text
stringlengths
8
6.88M
#pragma once #include<memory> template<typename T> class CommonSingleton { public: ~CommonSingleton() {} static T& Inst() { if(_instance.get() == nullptr) { _instance.reset(new T()); } return *_instance; } protected: CommonSingleton() {}; static std::auto_ptr<T> _instance; private: CommonSingleton(const CommonSingleton&) = delete; CommonSingleton& operator=(const CommonSingleton &) = delete; }; template <typename T> std::auto_ptr<T> CommonSingleton<T>::_instance;
#ifndef ENUMCONTROLLER_H_INCLUDED #define ENUMCONTROLLER_H_INCLUDED class GameWindow; extern GameWindow* globalWindowPtr; enum monthsEnum { JANUARY = 1, FEBRUARY = 2, MARCH = 3, APRIL = 4, MAY = 5, JUNE = 6, JULY = 7, AUGUST = 8, SEPTEMBER = 9, OCTOBER = 10, NOVERMBER = 11, DECEMBER = 12 }; enum webPages { WPNone = 0, WPHome = 1, WPBNN = 2, WPBlog = 3, WPBlogView = 4 }; enum ButtonType { BUTNone = 0, BUTAppMenu = 1, BUTSwitch = 2, BUTAppIcon = 3, BUTAppOptions = 4, ButAppUtilClose = 5, ButHomeLink = 6, ButArticle = 7, ButDialogueYes = 8, ButDialogueNo = 9, ButComments = 10, ButDialogueChoice = 11, ButDialogueSupport = 12, ButDialogueCriticize= 13, ButBlogPost = 14, ButNextDay = 15 }; enum AppType { APPCount = 3, APPNone = 0, APPBrowser = 1, APPEmail = 2 }; enum gameStates{ splash = 0, mainMenu = 1, settings = 2, computerLoading = 3, pauseMenu = 4, desktop = 5, webBrowser = 6, nextDayScreen = 7 }; enum CursorTypes{ CURNormal = 0, CURClick = 1 }; enum MainMenuOption { MMONone = 0, MMOPlay = 1, MMOSettings = 2, MMOExit = 3 }; enum webSites{ homePage = 0, news = 1, blog = 2}; enum buttonSoundEffects { sfx_browserClick = 0, sfx_count = 1 }; enum articles { a_articleZero = 0, a_ukEmbargo = 1, a_norBorders = 2, a_facebookAvatar = 3, a_prisonStrike = 4, a_usDemocrat = 5, a_ukraineWar = 6 }; enum dialogueBoxType { d_None = 0, d_YesNo = 1, d_ThreeOpts = 2, d_CritSup = 3 }; enum dialogueBoxReturns { dr_None = 0, dr_No = 1, dr_Yes = 2, dr_Criticize= 3, dr_Support = 4, dr_crit1 = 5, dr_crit2 = 6, dr_crit3 = 7 }; #endif // ENUMCONTROLLER_H_INCLUDED
#include<bits/stdc++.h> using namespace std; typedef long long ll; const long long INF=1e15; #define pii pair<ll,ll> vector<pii>adj[100001]; vector<ll>dist(100001,INF); void dijktra(int src) { priority_queue<pii,vector<pii>,greater<pii>>pq; pq.push({0,src}); dist[src]=0; while(!pq.empty()) { ll cur=pq.top().second; ll cur_d=pq.top().first; pq.pop(); if(cur_d!=dist[cur]) continue; for(auto edge:adj[cur]) { ll to=edge.first; ll len=edge.second; if(dist[cur]+len<dist[to]) { dist[to]=dist[cur]+len; pq.push({dist[to],to}); } } } } int main(){ int n,k,a; cin>>n>>k; vector<vector<int>>times; for(int i=0;i<1;i++) { vector<int>v; for(int j=0;j<3;j++) { cin>>a; v.push_back(a); } times.push_back(v); } for(int i=0;i<times.size();i++) { adj[times[i][0]].push_back({times[i][1],times[i][2]}); } for(int i=1;i<=4;i++) { cout<<i<<" - > "; for(int j=0;j<adj[i].size();j++) { cout<<adj[i][j].first<<" "<<adj[i][j].second<<" "; } cout<<"\n"; } dijktra(k); for(int i=1;i<=n;i++) cout<<dist[i]<<" "; }
class Solution { public: string getPermutation(int n, int k) { string temple; for (int i = 1; i<=n; i++) { temple+=i+48; } string result; int xulie = 1; for (int i = 1; i<n; i++) { xulie*=i; } k--; for(int templen = n-1;templen>0;templen--) { int j = k/xulie; result += temple[j]; temple.erase(temple.begin()+j); k=k%xulie; xulie = xulie/templen; } result +=temple; return result; } };
#include <iomanip> #include <iostream> int inumber,iwait,iconst,in = 2, gr[50],f,l; using namespace std; int proverka(int gr[], int f, int in, int inumber,int iconst) { if (inumber % in == 0) { gr[f] = in; f++; inumber = inumber / in; l = f; if (inumber % in == 0) { return proverka(gr, f, in, inumber, iconst); } } return inumber; } int main() { setlocale(LC_CTYPE, "Russian"); printf("Введите целое натуральное число: "); cin >> inumber; if (inumber <= 0) { printf("Число должно быть натуральным!\n"); return main(); } iwait = inumber; for (in; in <= iwait && inumber > 1 ; in++) { inumber = proverka(gr, f, in, inumber, iconst); f = l; } printf("Каноническое разложение числа: "); for (f; f != -1; f--) { if (gr[f] == 0) { } else { cout << gr[f] << " "; } } cout << " " << endl; system("pause"); }
#include "TimeStepper.hpp" ///TODO: implement Explicit Euler time integrator here void ForwardEuler::takeStep(ParticleSystem* particleSystem, float stepSize) { vector<Vector3f> f = particleSystem->evalF(particleSystem->getState()); vector<Vector3f> old = particleSystem->getState(); vector<Vector3f> newState; for (size_t i = 0; i < old.size(); i++) { Vector3f tmp = old.at(i) + stepSize * f.at(i); newState.push_back(tmp); } particleSystem->setState(newState); } ///TODO: implement Trapzoidal rule here void Trapzoidal::takeStep(ParticleSystem* particleSystem, float stepSize) { vector<Vector3f> old = particleSystem->getState(); vector<Vector3f> f0 = particleSystem->evalF(old); vector<Vector3f> tryState; for (size_t i = 0; i < old.size(); i++) { Vector3f tmp = old.at(i) + stepSize * f0.at(i); tryState.push_back(tmp); } //particleSystem->setState(newState); vector<Vector3f> f1 = particleSystem->evalF(tryState); vector<Vector3f> newState; for (size_t i = 0; i < old.size(); i++) { Vector3f tmp = old.at(i) + stepSize / 2 * (f0.at(i) + f1.at(i)); newState.push_back(tmp); } particleSystem->setState(newState); } void RK4::takeStep(ParticleSystem* particleSystem, float stepSize) { vector<Vector3f> old = particleSystem->getState(); vector<Vector3f> k1 = particleSystem->evalF(old); vector<Vector3f> k1State; for (size_t i = 0; i < old.size(); ++i) { k1State.push_back(old[i] + stepSize * 0.5f * k1[i]); } vector<Vector3f> k2 = particleSystem->evalF(k1State); vector<Vector3f> k2State; for (size_t i = 0; i < old.size(); ++i) { k2State.push_back(old[i] + stepSize * 0.5f * k2[i]); } vector<Vector3f> k3 = particleSystem->evalF(k2State); vector<Vector3f> k3State; for (size_t i = 0; i < old.size(); ++i) { k3State.push_back(old[i] + stepSize * 0.5f * k3[i]); } vector<Vector3f> k4 = particleSystem->evalF(k3State); vector<Vector3f> newState; for (size_t i = 0; i < old.size(); ++i) { Vector3f tmp=old[i] + (k1[i] + 2.0f * k2[i] + 2.0f * k3[i] + k4[i]) / 6.f * stepSize; newState.push_back(tmp); } particleSystem->setState(newState); }
#ifndef IMPVAL_H #define IMPVAL_H /// @file ImpVal.h /// @brief ImpVal のヘッダファイル /// @author Yusuke Matsunaga (松永 裕介) /// /// Copyright (C) 2005-2012 Yusuke Matsunaga /// All rights reserved. #include "YmNetworks/bdn.h" BEGIN_NAMESPACE_YM_NETWORKS class ImpNode; ////////////////////////////////////////////////////////////////////// /// @class ImpVal ImpVal.h "ImpVal.h" /// @brief ノード番号と値の組を表すクラス ////////////////////////////////////////////////////////////////////// class ImpVal { public: /// @brief 空のコンストラクタ ImpVal(); /// @brief コンストラクタ ImpVal(ymuint pval); /// @brief コンストラクタ /// @param[in] id ノード番号 /// @param[in] val 値 ImpVal(ymuint id, ymuint val); /// @brief デストラクタ ~ImpVal(); public: ////////////////////////////////////////////////////////////////////// // 値を設定する関数 ////////////////////////////////////////////////////////////////////// /// @brief 値を設定する. /// @param[in] id ノード番号 /// @param[in] val 値 void set(ymuint id, ymuint val); public: ////////////////////////////////////////////////////////////////////// // 値を取り出す関数 ////////////////////////////////////////////////////////////////////// /// @brief ノード番号を取り出す. ymuint id() const; /// @brief 値 ( 0 or 1 ) ymuint val() const; /// @brief 圧縮した値を返す. ymuint packed_val() const; /// @brief 等価比較演算子 bool operator==(const ImpVal& right) const; /// @brief 非等価比較演算子 bool operator!=(const ImpVal& right) const; /// @brief 大小比較演算子 bool operator<(const ImpVal& right) const; /// @brief 大小比較演算子 bool operator>(const ImpVal& right) const; /// @brief 大小比較演算子 bool operator<=(const ImpVal& right) const; /// @brief 大小比較演算子 bool operator>=(const ImpVal& right) const; /// @brief 内容を出力する. void print(ostream& s) const; private: ////////////////////////////////////////////////////////////////////// // データメンバ ////////////////////////////////////////////////////////////////////// // ノード番号 + 値 ymuint32 mVal; }; ////////////////////////////////////////////////////////////////////// // インライン関数の定義 ////////////////////////////////////////////////////////////////////// // @brief 空のコンストラクタ inline ImpVal::ImpVal() { mVal = 0U; } // @brief コンストラクタ inline ImpVal::ImpVal(ymuint pval) { mVal = pval; } // @brief コンストラクタ // @param[in] id ノード番号 // @param[in] val 値 inline ImpVal::ImpVal(ymuint id, ymuint val) { set(id, val); } // @brief デストラクタ inline ImpVal::~ImpVal() { } // @brief 値を設定する. // @param[in] id ノード番号 // @param[in] val 値 inline void ImpVal::set(ymuint id, ymuint val) { mVal = id * 2 + val; } // @brief ノード番号を取り出す. inline ymuint ImpVal::id() const { return mVal >> 1; } // @brief 値 ( 0 or 1 ) inline ymuint ImpVal::val() const { return mVal & 1U; } // @brief 圧縮した値を返す. inline ymuint ImpVal::packed_val() const { return mVal; } // @brief 等価比較演算子 inline bool ImpVal::operator==(const ImpVal& right) const { return mVal == right.mVal; } // @brief 非等価比較演算子 inline bool ImpVal::operator!=(const ImpVal& right) const { return !operator==(right); } // @brief 大小比較演算子 inline bool ImpVal::operator<(const ImpVal& right) const { return mVal < right.mVal; } // @brief 大小比較演算子 inline bool ImpVal::operator>(const ImpVal& right) const { return right.operator<(*this); } // @brief 大小比較演算子 inline bool ImpVal::operator<=(const ImpVal& right) const { return !right.operator<(*this); } // @brief 大小比較演算子 inline bool ImpVal::operator>=(const ImpVal& right) const { return !operator<(right); } // @brief 内容を出力する. inline void ImpVal::print(ostream& s) const { if ( val() == 0 ) { s << "~"; } s << id(); } END_NAMESPACE_YM_NETWORKS #endif // IMPVAL_H
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "Windows.Media.Editing.2.h" WINRT_EXPORT namespace winrt { namespace Windows::Media::Editing { struct WINRT_EBO BackgroundAudioTrack : Windows::Media::Editing::IBackgroundAudioTrack { BackgroundAudioTrack(std::nullptr_t) noexcept {} static Windows::Media::Editing::BackgroundAudioTrack CreateFromEmbeddedAudioTrack(const Windows::Media::Editing::EmbeddedAudioTrack & embeddedAudioTrack); static Windows::Foundation::IAsyncOperation<Windows::Media::Editing::BackgroundAudioTrack> CreateFromFileAsync(const Windows::Storage::IStorageFile & file); }; struct WINRT_EBO EmbeddedAudioTrack : Windows::Media::Editing::IEmbeddedAudioTrack { EmbeddedAudioTrack(std::nullptr_t) noexcept {} }; struct WINRT_EBO MediaClip : Windows::Media::Editing::IMediaClip { MediaClip(std::nullptr_t) noexcept {} static Windows::Media::Editing::MediaClip CreateFromColor(const Windows::UI::Color & color, const Windows::Foundation::TimeSpan & originalDuration); static Windows::Foundation::IAsyncOperation<Windows::Media::Editing::MediaClip> CreateFromFileAsync(const Windows::Storage::IStorageFile & file); static Windows::Foundation::IAsyncOperation<Windows::Media::Editing::MediaClip> CreateFromImageFileAsync(const Windows::Storage::IStorageFile & file, const Windows::Foundation::TimeSpan & originalDuration); static Windows::Media::Editing::MediaClip CreateFromSurface(const Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface & surface, const Windows::Foundation::TimeSpan & originalDuration); }; struct WINRT_EBO MediaComposition : Windows::Media::Editing::IMediaComposition, impl::require<MediaComposition, Windows::Media::Editing::IMediaComposition2> { MediaComposition(std::nullptr_t) noexcept {} MediaComposition(); static Windows::Foundation::IAsyncOperation<Windows::Media::Editing::MediaComposition> LoadAsync(const Windows::Storage::StorageFile & file); }; struct WINRT_EBO MediaOverlay : Windows::Media::Editing::IMediaOverlay { MediaOverlay(std::nullptr_t) noexcept {} MediaOverlay(const Windows::Media::Editing::MediaClip & clip); MediaOverlay(const Windows::Media::Editing::MediaClip & clip, const Windows::Foundation::Rect & position, double opacity); }; struct WINRT_EBO MediaOverlayLayer : Windows::Media::Editing::IMediaOverlayLayer { MediaOverlayLayer(std::nullptr_t) noexcept {} MediaOverlayLayer(); MediaOverlayLayer(const Windows::Media::Effects::IVideoCompositorDefinition & compositorDefinition); }; } }
#include "imageinfo.h" ImageInfo::ImageInfo() { this->dstSize = Size(537, 269); this->dstPtLeft[0] = Point(0, 0); this->dstPtLeft[1] = Point(0, 269); this->dstPtLeft[2] = Point(537, 269); this->dstPtLeft[3] = Point(537, 0); this->dstPtRight[0] = Point(0, 0); this->dstPtRight[1] = Point(0, 269); this->dstPtRight[2] = Point(537, 269); this->dstPtRight[3] = Point(537, 0); } ImageInfo::ImageInfo(string fileNames[]) { this->setCapture(fileNames); this->setup(true); this->dstSize = Size(537, 269); this->dstPtLeft[0] = Point(0, 0); this->dstPtLeft[1] = Point(0, 269); this->dstPtLeft[2] = Point(537, 269); this->dstPtLeft[3] = Point(537, 0); this->dstPtRight[0] = Point(0, 0); this->dstPtRight[1] = Point(0, 269); this->dstPtRight[2] = Point(537, 269); this->dstPtRight[3] = Point(537, 0); } ImageInfo::~ImageInfo() { } void ImageInfo::setSourceNumber(SourceNumber srcNum) { this->srcNumber = srcNum; } ImageInfo::SourceNumber ImageInfo::getSourceNumber() { return this->srcNumber; } void ImageInfo::setCapture(string fileNames[]) { this->capture[0] = VideoCapture(fileNames[0]); if(this->srcNumber == SourceNumber::Two) this->capture[1] = VideoCapture(fileNames[1]); } VideoCapture *ImageInfo::getCapture() { /*Validation*/ if(this->capture == NULL) { cout << "Captures are not set yet." << endl; return NULL; } return this->capture; } void ImageInfo::setCaptureNumber(double num) { this->capture[0].set(CAP_PROP_POS_FRAMES, num); if(this->srcNumber == ImageInfo::SourceNumber::Two) this->capture[1].set(CAP_PROP_POS_FRAMES, num); } double ImageInfo::getCaptureNumber() { return this->capture[0].get(CAP_PROP_FRAME_COUNT); } void ImageInfo::setTmpLeftImg(Mat img) { this->tmpLeftImg = img; } Mat ImageInfo::getTmpLeftImg() { return this->tmpLeftImg; } void ImageInfo::setTmpRightImg(Mat img) { this->tmpRightImg = img; } Mat ImageInfo::getTmpRightImg() { if(this->srcNumber == ImageInfo::SourceNumber::One) return this->tmpLeftImg; return this->tmpRightImg; } void ImageInfo::setTmpImg(Mat img) { this->tmpImg = img; } Mat ImageInfo::getTmpImg() { return this->tmpImg; } void ImageInfo::setDispImg(Mat img) { this->dispImg = img; } Mat ImageInfo::getDispImg() { return this->dispImg; } void ImageInfo::setSrcPtLeft(Point2f pt[]) { for(int i = 0; i < 4; i++) { this->srcPtLeft[i] = Point(pt[i].x, pt[i].y); } } Point2f *ImageInfo::getSrcPtLeft() { return this->srcPtLeft; } void ImageInfo::setSrcPtRight(Point2f pt[]) { if(this->srcNumber == ImageInfo::SourceNumber::One) return; for(int i = 0; i < 4; i++) { this->srcPtRight[i] = Point(pt[i].x, pt[i].y); } } Point2f *ImageInfo::getSrcPtRight() { if(this->srcNumber == ImageInfo::SourceNumber::One) return NULL; return this->srcPtRight; } void ImageInfo::setRoiRect(Rect roi) { this->roiRect = roi; } Rect ImageInfo::getRoiRect() { return this->roiRect; } void ImageInfo::setDstSize(Size size) { this->dstSize = size; } Size ImageInfo::getDstSize() { return this->dstSize; } void ImageInfo::setInitialized(bool isInitialized) { this->initialized = isInitialized; } bool ImageInfo::getInitialized() { return this->initialized; } void ImageInfo::setHomographyMtxLeft(Mat homographyMtx) { this->homographyMtxLeft = homographyMtx; } Mat ImageInfo::getHomographyMtxLeft() { return this->homographyMtxLeft; } void ImageInfo::setHomographyMtxRight(Mat homographyMtx) { if(this->srcNumber == ImageInfo::SourceNumber::One) return; this->homographyMtxRight = homographyMtx; } Mat ImageInfo::getHomographyMtxRight() { if(this->srcNumber == ImageInfo::SourceNumber::One) return Mat(); return this->homographyMtxRight; } void ImageInfo::setup(bool forInit) { this->next(); if(!forInit) { this->transHomography(); this->mergeImg(); } } void ImageInfo::paintCircle(Point2f pt) { circle(this->dispImg, pt, 2, Scalar(255, 0, 0)); } void ImageInfo::paintId(Point2f pt, int id) { putText(this->dispImg, to_string(id), pt, FONT_HERSHEY_SIMPLEX, 0.3, Scalar(0, 0, 255)); } void ImageInfo::setWarpPerspective() { this->homographyMtxLeft = getPerspectiveTransform(this->srcPtLeft, this->dstPtLeft); if(this->srcNumber == ImageInfo::SourceNumber::Two) this->homographyMtxRight = getPerspectiveTransform(this->srcPtRight, this->dstPtRight); } void ImageInfo::next() { this->capture[0] >> this->tmpLeftImg; if(this->srcNumber == ImageInfo::SourceNumber::Two) this->capture[1] >> this->tmpRightImg; } void ImageInfo::mergeImg() { if(this->srcNumber == ImageInfo::SourceNumber::One) { this->tmpImg= this->tmpLeftImg; return; } Size s = Size(this->tmpLeftImg.cols * 2, max(this->tmpLeftImg.rows, this->tmpRightImg.rows)); this->tmpImg = Mat::zeros(s, CV_8UC3); Rect roi = Rect(0, 0, this->tmpLeftImg.cols, this->tmpLeftImg.rows); this->tmpLeftImg.copyTo(this->tmpImg(roi)); roi = Rect(this->tmpLeftImg.cols, 0, this->tmpRightImg.cols, this->tmpRightImg.rows); this->tmpRightImg.copyTo(this->tmpImg(roi)); } void ImageInfo::transHomography() { warpPerspective(this->tmpLeftImg, this->tmpLeftImg, this->homographyMtxLeft, this->dstSize, INTER_LANCZOS4 + WARP_FILL_OUTLIERS); if(this->srcNumber == ImageInfo::SourceNumber::Two) warpPerspective(this->tmpRightImg, this->tmpRightImg, this->homographyMtxRight, this->dstSize, INTER_LANCZOS4 + WARP_FILL_OUTLIERS); } bool ImageInfo::validate() { if(this->srcNumber == ImageInfo::SourceNumber::One && !this->tmpLeftImg.empty()) return true; if(this->tmpLeftImg.empty() || this->tmpRightImg.empty()) return false; return true; }
#ifndef _Boids_Network_Adapter_internal_h_ #define _Boids_Network_Adapter_internal_h_ #include "base/NetworkInterface.h" #include "pvp.pb.h" #include "CCLuaEngine.h" class NetworkAdaperInternal : public cocos2d::NetworkInterface { public: bool tryReceive(); }; void extendNetworkAdapter(lua_State *L); #endif
#ifndef PAINTWIDGET_H #define PAINTWIDGET_H #include <QWidget> #include <qpainter.h> class PaintWidget : public QWidget { Q_OBJECT public: enum PaintType { Line, Rect, None }; explicit PaintWidget(QWidget *parent = 0); PaintWidget(QPen *pen, QBrush *brush, PaintType type, QWidget *parent = 0); void setPainterParams(QPen *pen, QBrush *brush, PaintType type); ~PaintWidget(); protected: void paintEvent(QPaintEvent *event); private: QPen *_pen; QBrush *_brush; PaintType _type; signals: public slots: }; #endif // PAINTWIDGET_H
#ifndef UIPROVIDER_H #define UIPROVIDER_H #include <QObject> class UiProvider : public QObject { Q_OBJECT public: explicit UiProvider(QObject *parent = 0); void setBackgroundColor(const QColor&); signals: public slots: }; #endif // UIPROVIDER_H
#include <mpi.h> #include "system/Plate.cpp" #include <stdio.h> #include "system/Components/Temperature.cpp" #include "system/Components/FirstConstrain.cpp" #include "system/Components/SecondConstrain.cpp" #include "parallels/paralel.h" #include <pthread.h> #include <string.h> #include <sys/time.h> #define REENTRANT #define C 1 #define WIDTH 10. #define HEIGHT 10. #define MaxToGnuPlot 101. double* test = new double[100 * 100]; typedef struct{ int id; Plate* localPlate; int width; double* localMatrix; double** cornerMatrix; void init(int p_num , Plate* p_localPlate , int p_width){ id = p_num; localPlate = p_localPlate; width = p_width; } } argThread; Plate* plate; double** voltage; int countThreads; int x; int y; double dx , dy; void printMat(double* mat , int yi , int xi){ for(int i = 0 ; i < yi ; i++){ for(int j = 0 ; j < xi ; j++) fprintf(stderr, "%3.3f ", mat[i * xi + j]); fprintf(stderr, "\n"); } } Plate* createPlate(int x , int y , double** voltage){ Plate* plate = new Plate(x * y + 1, voltage); for(int i = 1 , j; i < y - 1 ; i++){ plate -> addComponent(i * x + 1 , i * x + 2 , new Temperature(C * C , dy)); plate -> addComponent(i + 1 , i + 1 + x , new Temperature(C * C , dx)); plate -> addComponent(0 , i * x + 1 , new FirstConstrain(100)); plate -> addComponent(i * x + x - 1 , i * x + x , new SecondConstrain(dy ,-10)); for(j = 1 ; j < x - 1 ; j++){ plate -> addComponent(i * x + j + 1 , i * x + j + 2 , new Temperature(C * C , dy)); plate -> addComponent(i * x + j + 1 , i * x + j + 1 + x , new Temperature(C * C , dx)); } } plate -> addComponent(0 , 1 , new FirstConstrain(100)); plate -> addComponent(0 , x , new FirstConstrain(100)); plate -> addComponent(0 , x * y , new FirstConstrain(100)); plate -> addComponent(0 , x * (y - 1) + 1 , new FirstConstrain(100)); return plate; } void* action(void* v_arg){ argThread* arg = (argThread*)v_arg; int countNodes = arg -> localPlate -> getCountNodes() - 1; arg -> localMatrix = new double[countNodes * (countNodes + 1)]; arg -> cornerMatrix = new double*[countNodes - arg -> width]; double** localVolt = &arg -> localPlate -> getVoltage()[1]; int countCorner = plate -> getCountNodes() - 1 - arg -> width * countThreads; FILE* script = openFile("gnu.sh"); int* lengthPlates = new int[countThreads]; double* cornerVoltage = new double[countCorner + arg -> width]; arg -> localPlate->createStiffMatrix(arg -> localMatrix); for(int i = arg -> width , j = 0 ; i < countNodes ; i++ , j++){ memset(arg -> localMatrix + i * (countNodes + 1) + arg -> width, 0 , (countNodes + 1 - arg -> width) * sizeof(double)); arg -> cornerMatrix[j] = arg -> localMatrix + i * (countNodes + 1) + arg -> width; } for(int i = 0 ; i < arg -> width ; i++){ for(int j = i + 1 ; j < countNodes; j++){ double key = arg -> localMatrix[j * (countNodes + 1) + i] / arg -> localMatrix[i * (countNodes + 1) + i]; for(int k = i; k < countNodes + 1 ; k++) arg -> localMatrix[j * (countNodes + 1) + k] -= arg -> localMatrix[i * (countNodes + 1) + k] * key; } } MPI_Barrier(MPI_COMM_WORLD); MPI_Gather(&countNodes , 1 , MPI_INT , lengthPlates , 1 , MPI_INT , 0 , MPI_COMM_WORLD); if(arg->id) for(int i = 0 ; i < countNodes - arg -> width ; i++) MPI_Send(arg -> cornerMatrix[i] , countNodes - arg -> width + 1 , MPI_DOUBLE , 0 , i , MPI_COMM_WORLD); if(arg -> id == 0 && countThreads > 1){ int count = plate -> getCountNodes() - 1; double* matrix = new double[count * (count + 1)]; double** corner = new double*[countCorner]; MPI_Status status; memset(matrix , 0 , count * (count + 1) * sizeof(double)); plate -> createStiffMatrix(matrix); for(int i = 0 , it = arg -> width * countThreads ; i < countCorner ; i++ , it++) corner[i] = matrix + it * (count + 1) + arg -> width * countThreads; for(int i = 0 , delta = 0 ; i < countThreads ; i++){ int widthCorner = lengthPlates[i] - arg -> width; double* lineCorner; if(i > 0) lineCorner = new double[widthCorner + 1]; for(int j = 0 ; j < widthCorner ; j++){ if(i > 0) MPI_Recv(lineCorner , widthCorner + 1 , MPI_DOUBLE , i , j , MPI_COMM_WORLD , &status); else lineCorner = arg->cornerMatrix[j]; for(int k = 0 ; k < widthCorner ; k++) corner[j+ delta][k + delta] += lineCorner[k]; corner[j+ delta][countCorner] += lineCorner[widthCorner]; } delta += widthCorner - (countNodes - arg -> width); if(i > 0) delete lineCorner; } for(int i = 0 ; i < countCorner ; i++){ for(int j = i + 1 ; j < countCorner ; j++){ double key = corner[j][i] / corner[i][i]; for(int k = i; k <= countCorner; k++) corner[j][k] -= corner[i][k] * key; } } for(int i = countCorner - 1 , h = plate -> getCountNodes() - 1 ; i >= 0 ; i-- , h--){ for(int j = countCorner - 1 , row = plate -> getCountNodes() - 1 ; j > i ; j-- , row --) corner[i][countCorner] -= corner[i][j] * (*voltage[row]); cornerVoltage[arg -> width + i] = (*voltage[h]) = corner[i][countCorner] / corner[i][i]; } delete corner; delete matrix; } MPI_Barrier(MPI_COMM_WORLD); MPI_Bcast(cornerVoltage + arg -> width , plate->getCountNodes() - 1 - arg -> width * countThreads , MPI_DOUBLE , 0 , MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD); for(int i = arg -> width * countThreads , j = arg -> width ; i < plate->getCountNodes() - 1 ; i++ , j++){ (*voltage[i + 1]) = cornerVoltage[j]; } double* allVoltage; if(arg -> id == 0) allVoltage = new double[plate -> getCountNodes()]; for(int i = arg -> width - 1 ; i >= 0 ; i--){ for(int j = countNodes - 1 ; j > i; j--) arg->localMatrix[i * (countNodes + 1) + countNodes] -= arg->localMatrix[i * (countNodes + 1) + j] * (*localVolt[j]); cornerVoltage[i] = (*localVolt[i]) = arg->localMatrix[i * (countNodes + 1) + countNodes] / arg -> localMatrix[i * (countNodes + 1) + i]; } MPI_Barrier(MPI_COMM_WORLD); MPI_Gather(cornerVoltage , arg->width , MPI_DOUBLE , &allVoltage[1] , arg->width , MPI_DOUBLE , 0 , MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD); if(arg -> id == 0){ for(int i = 0 ; i < countCorner ; i++) allVoltage[arg -> width * countThreads + i + 1] = cornerVoltage[arg -> width + i]; writeToFile(script , allVoltage , plate -> getOrder() , y , x); } MPI_Barrier(MPI_COMM_WORLD); closeFile(script); delete lengthPlates; if(arg -> id == 0) delete allVoltage; delete arg -> cornerMatrix; delete arg -> localMatrix; } int main(int argc , char** argv){ x = atoi(argv[1]); y = atoi(argv[2]); dx = WIDTH / (x - 1); dy = HEIGHT / (y - 1); int countNodes = x * y , currentProc; voltage = new double*[countNodes + 1]; for(int i = 0 ; i < countNodes + 1 ; i++) voltage[i] = new double[1]; plate = createPlate(x , y , voltage); argThread* args = new argThread(); struct timeval begin; struct timeval end; struct timezone zone; gettimeofday(&begin, &zone); MPI_Init (&argc, &argv); MPI_Comm_size (MPI_COMM_WORLD, &countThreads); MPI_Comm_rank (MPI_COMM_WORLD, &currentProc); MPI_Barrier(MPI_COMM_WORLD); int** intervals = createBlockOrder(&plate -> getOrder()[1] , y , x , countThreads); if(countThreads > 1){ Plate* plates; if(currentProc == 0) plates = new Plate(&plate -> getNodes()[intervals[0][0]] , intervals[1][1] - intervals[0][0]); else if(currentProc == countThreads - 1) plates = new Plate(&plate -> getNodes()[intervals[2 * currentProc - 1][0]] , intervals[2 * currentProc][1] - intervals[2 * currentProc - 1][0]); else plates = new Plate(&plate -> getNodes()[intervals[2 * currentProc - 1][0]] , intervals[2 * currentProc + 1][1] - intervals[2 * currentProc - 1][0]); args -> init(currentProc , plates , intervals[2 * currentProc][1] - intervals[2 * currentProc][0]); } else args -> init(0 , plate , intervals[0][1] - intervals[0][0]); MPI_Barrier(MPI_COMM_WORLD); action((void*)(args)); gettimeofday(&end, &zone); fprintf(stderr , "Time executing :: %lu on number of process %d\n" , end.tv_sec * 1000000 + end.tv_usec - begin.tv_usec - begin.tv_sec * 1000000 , countThreads); createScript(x , y , MaxToGnuPlot); MPI_Finalize(); delete args; delete plate; delete voltage; delete test; return 0; }
//************************************************************************** //** //** See jlquake.txt for copyright info. //** //** This program is free software; you can redistribute it and/or //** modify it under the terms of the GNU General Public License //** as published by the Free Software Foundation; either version 3 //** of the License, or (at your option) any later version. //** //** This program is distributed in the hope that it will be useful, //** but WITHOUT ANY WARRANTY; without even the implied warranty of //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //** included (gnu.txt) GNU General Public License for more details. //** //************************************************************************** //** //** Memory allocation //** //** Mostly based on memory allocator of Doom 3. //** //************************************************************************** // HEADER FILES ------------------------------------------------------------ #include "qcommon.h" #include "Common.h" // MACROS ------------------------------------------------------------------ #define SMALLID 0x22 #define LARGEID 0x33 // TYPES ------------------------------------------------------------------- enum { ALIGN = 4 }; #define ALIGN_SIZE( bytes ) ( ( ( bytes ) + ALIGN - 1 ) & ~( ALIGN - 1 ) ) #define SMALL_HEADER_SIZE ALIGN_SIZE( sizeof ( byte ) + sizeof ( byte ) ) #define LARGE_HEADER_SIZE ALIGN_SIZE( sizeof ( void* ) + sizeof ( byte ) ) #define SMALL_ALIGN( bytes ) ( ALIGN_SIZE( ( bytes ) + SMALL_HEADER_SIZE ) - SMALL_HEADER_SIZE ) struct MemDebug_t { const char* FileName; int LineNumber; int Size; MemDebug_t* Prev; MemDebug_t* Next; }; class QMemHeap { public: QMemHeap(); void* Alloc( size_t Bytes ); void Free( void* Ptr ); private: struct QPage { void* Data; size_t Size; QPage* Prev; QPage* Next; }; size_t PageSize; void* SmallFirstFree[ 256 / ALIGN + 1 ]; QPage* SmallPage; size_t SmallOffset; QPage* SmallUsedPages; QPage* LargeFirstUsedPage; QPage* AllocPage( size_t Bytes ); void FreePage( QPage* Page ); void* SmallAlloc( size_t Bytes ); void SmallFree( void* Ptr ); void* LargeAlloc( size_t Bytes ); void LargeFree( void* Ptr ); }; // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- #ifdef MEM_DEBUG static void Mem_MemDebugDump(); #endif // EXTERNAL DATA DECLARATIONS ---------------------------------------------- // PUBLIC DATA DEFINITIONS ------------------------------------------------- // PRIVATE DATA DEFINITIONS ------------------------------------------------ static QMemHeap MainHeap; #ifdef MEM_DEBUG static MemDebug_t* MemDebug; #endif // CODE -------------------------------------------------------------------- //========================================================================== // // QMemHeap::Init // //========================================================================== QMemHeap::QMemHeap() : PageSize( 0 ), SmallPage( NULL ), SmallOffset( 0 ), SmallUsedPages( NULL ), LargeFirstUsedPage( NULL ) { } //========================================================================== // // QMemHeap::Alloc // //========================================================================== void* QMemHeap::Alloc( size_t Bytes ) { if ( Bytes < 256 ) { return SmallAlloc( Bytes ); } return LargeAlloc( Bytes ); } //========================================================================== // // QMemHeap::Free // //========================================================================== void QMemHeap::Free( void* Ptr ) { switch ( ( ( byte* )Ptr )[ -1 ] ) { case SMALLID: SmallFree( Ptr ); break; case LARGEID: LargeFree( Ptr ); break; default: common->FatalError( "Invalid memory block" ); } } //========================================================================== // // QMemHeap::AllocPage // //========================================================================== QMemHeap::QPage* QMemHeap::AllocPage( size_t Bytes ) { size_t Size = Bytes + sizeof ( QPage ); QPage* P = ( QPage* )::malloc( Size ); if ( !P ) { //common->FatalError("Failed to allocate %d bytes", Bytes); common->FatalError( "Failed to allocate page" ); } P->Data = P + 1; P->Size = Bytes; P->Prev = NULL; P->Next = NULL; return P; } //========================================================================== // // QMemHeap::FreePage // //========================================================================== void QMemHeap::FreePage( QMemHeap::QPage* Page ) { if ( !Page ) { common->FatalError( "Tried to free NULL page" ); } ::free( Page ); } //========================================================================== // // QMemHeap::SmallAlloc // //========================================================================== void* QMemHeap::SmallAlloc( size_t Bytes ) { // We need enough memory for the free list. if ( Bytes < sizeof ( void* ) ) { Bytes = sizeof ( void* ); } if ( !PageSize ) { PageSize = 65536 - sizeof ( QPage ); Com_Memset( SmallFirstFree, 0, sizeof ( SmallFirstFree ) ); SmallPage = AllocPage( PageSize ); SmallOffset = 0; SmallUsedPages = NULL; } // Align the size. Bytes = SMALL_ALIGN( Bytes ); byte* SmallBlock = ( byte* )SmallFirstFree[ Bytes / ALIGN ]; if ( SmallBlock ) { byte* Ptr = SmallBlock + SMALL_HEADER_SIZE; SmallFirstFree[ Bytes / ALIGN ] = *( void** )Ptr; Ptr[ -1 ] = SMALLID; return Ptr; } size_t BytesLeft = PageSize - SmallOffset; if ( BytesLeft < Bytes + SMALL_HEADER_SIZE ) { // Add current page to the used ones. SmallPage->Next = SmallUsedPages; SmallUsedPages = SmallPage; SmallPage = AllocPage( PageSize ); SmallOffset = 0; } SmallBlock = ( byte* )SmallPage->Data + SmallOffset; byte* Ptr = SmallBlock + SMALL_HEADER_SIZE; SmallBlock[ 0 ] = ( byte )( Bytes / ALIGN ); Ptr[ -1 ] = SMALLID; SmallOffset += Bytes + SMALL_HEADER_SIZE; return Ptr; } //========================================================================== // // QMemHeap::SmallFree // //========================================================================== void QMemHeap::SmallFree( void* Ptr ) { ( ( byte* )Ptr )[ -1 ] = 0; byte* Block = ( byte* )Ptr - SMALL_HEADER_SIZE; size_t Idx = *Block; if ( Idx > 256 / ALIGN ) { common->FatalError( "Invalid small memory block size" ); } *( ( void** )Ptr ) = SmallFirstFree[ Idx ]; SmallFirstFree[ Idx ] = Block; } //========================================================================== // // QMemHeap::LargeAlloc // //========================================================================== void* QMemHeap::LargeAlloc( size_t Bytes ) { QPage* P = AllocPage( Bytes + LARGE_HEADER_SIZE ); byte* Ptr = ( byte* )P->Data + LARGE_HEADER_SIZE; *( void** )P->Data = P; Ptr[ -1 ] = LARGEID; // Link to 'large used page list' P->Prev = NULL; P->Next = LargeFirstUsedPage; if ( P->Next ) { P->Next->Prev = P; } LargeFirstUsedPage = P; return Ptr; } //========================================================================== // // QMemHeap::LargeFree // //========================================================================== void QMemHeap::LargeFree( void* Ptr ) { ( ( byte* )Ptr )[ -1 ] = 0; // Get page pointer QPage* P = ( QPage* )( *( ( void** )( ( ( byte* )Ptr ) - LARGE_HEADER_SIZE ) ) ); // Unlink from doubly linked list if ( P->Prev ) { P->Prev->Next = P->Next; } if ( P->Next ) { P->Next->Prev = P->Prev; } if ( P == LargeFirstUsedPage ) { LargeFirstUsedPage = P->Next; } P->Next = P->Prev = NULL; FreePage( P ); } //========================================================================== // // Mem_Shutdown // //========================================================================== void Mem_Shutdown() { #ifdef MEM_DEBUG Mem_MemDebugDump(); #endif } #ifdef MEM_DEBUG #undef Mem_Alloc #undef Mem_ClearedAlloc #undef Mem_Free //========================================================================== // // Mem_Alloc // //========================================================================== void* Mem_Alloc( int size, const char* FileName, int LineNumber ) { if ( !size ) { return NULL; } void* ptr = MainHeap.Alloc( size + sizeof ( MemDebug_t ) ); if ( !ptr ) { // It should always return valid pointer. common->FatalError( "MainHeap.Alloc failed" ); } MemDebug_t* m = ( MemDebug_t* )ptr; m->FileName = FileName; m->LineNumber = LineNumber; m->Size = size; m->Next = MemDebug; if ( MemDebug ) { MemDebug->Prev = m; } MemDebug = m; return ( byte* )ptr + sizeof ( MemDebug_t ); } //========================================================================== // // Mem_ClearedAlloc // //========================================================================== void* Mem_ClearedAlloc( int size, const char* FileName, int LineNumber ) { void* P = Mem_Alloc( size, FileName, LineNumber ); Com_Memset( P, 0, size ); return P; } //========================================================================== // // Mem_Free // //========================================================================== void Mem_Free( void* ptr, const char* FileName, int LineNumber ) { if ( !ptr ) { return; } // Unlink debug info. MemDebug_t* m = ( MemDebug_t* )( ( char* )ptr - sizeof ( MemDebug_t ) ); if ( m->Next ) { m->Next->Prev = m->Prev; } if ( m == MemDebug ) { MemDebug = m->Next; } else { m->Prev->Next = m->Next; } MainHeap.Free( ( char* )ptr - sizeof ( MemDebug_t ) ); } //========================================================================== // // Mem_MemDebugDump // //========================================================================== static void Mem_MemDebugDump() { int NumBlocks = 0; for ( MemDebug_t* m = MemDebug; m; m = m->Next ) { common->Printf( "block %p size %8d at %s:%d\n", m + 1, m->Size, m->FileName, m->LineNumber ); NumBlocks++; } common->Printf( "%d blocks allocated\n", NumBlocks ); } #else //========================================================================== // // Mem_Alloc // //========================================================================== void* Mem_Alloc( int size ) { if ( !size ) { return NULL; } void* ptr = MainHeap.Alloc( size ); if ( !ptr ) { // It should always return valid pointer. common->FatalError( "MainHeap.Alloc failed" ); } return ptr; } //========================================================================== // // Mem_ClearedAlloc // //========================================================================== void* Mem_ClearedAlloc( int size ) { void* P = Mem_Alloc( size ); Com_Memset( P, 0, size ); return P; } //========================================================================== // // Mem_Free // //========================================================================== void Mem_Free( void* ptr ) { if ( !ptr ) { return; } MainHeap.Free( ptr ); } #endif
// @copyright 2017 - 2018 Shaun Ostoic // Distributed under the MIT License. // (See accompanying file LICENSE.md or copy at https://opensource.org/licenses/MIT) #pragma once #include <distant/config.hpp> #include <distant/agents/process.hpp> #include <distant/support/winapi/psapi.hpp> namespace distant { namespace agents { /// @brief A class containing memory information about a process. class memory_status { public: static constexpr auto required_status_access = process_rights::vm_read | process_rights::query_limited_information; /// @brief Construct a status object for the given process. /// @remark The given process must have at least vm_read and query_limited_information access rights. explicit memory_status(const process<required_status_access>& process); /// Total amount of memory (kb) committed for the process /// @return the amount of memory in kilobytes. std::size_t private_usage() const noexcept; /// Largest private usage (kb) over the course its execution /// @return the amount of memory in kilobytes. std::size_t peak_private_usage() const noexcept; /// The size of memory (kb) occupied by the process in RAM. /// See: https://en.wikipedia.org/wiki/Resident_set_size /// @return the amount of memory in kilobytes. std::size_t working_set() const noexcept; /// Largest working set over the course its execution /// @return the amount of memory in kilobytes. std::size_t peak_working_set() const noexcept; /// Number of page fault errors that have occurred over the course of its execution /// @return the number of page faults. std::size_t page_fault_count() const noexcept; private: static constexpr std::size_t kb = 1024; boost::winapi::PROCESS_MEMORY_COUNTERS_ memory_counters_; }; /// @brief Create a status object for the given process. template <access_rights::process T, typename = std::enable_if_t<(T >= memory_status::required_status_access)>> [[nodiscard]] auto get_memory_status(const process<T>& p) { return memory_status(p); } } // namespace agents using agents::get_memory_status; } // namespace distant // Implementation: #include "impl/memory_status.hxx"
/**************************************** * * INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE * Copyright (C) 2019 Victor Tran * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * *************************************/ #include "keyboardlayoutsdatabase.h" QMap<QString, KeyboardLayout> KeyboardLayoutsDatabase::layouts = KeyboardLayoutsDatabase::setupLayouts(); KeyboardLayoutsDatabase::KeyboardLayoutsDatabase() { } QMap<QString, KeyboardLayout> KeyboardLayoutsDatabase::setupLayouts() { //Set up keyboard layouts QList<KeyboardLayout> layouts; { KeyboardLayout usLayout; usLayout.name = "en-US"; usLayout.displayName = tr("English (US)"); usLayout.keys = { {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', KeyboardKey::Backspace}, {'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '\''}, {'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', '/', KeyboardKey::Ok}, {KeyboardKey::Shift, 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', KeyboardKey::Shift}, {KeyboardKey::SetNumeric, KeyboardKey::Space, KeyboardKey::SetLayout} }; layouts.append(usLayout); } { KeyboardLayout vnLayout; vnLayout.name = "vi-VN"; vnLayout.displayName = tr("Vietnamese (VN)"); vnLayout.keys = { {QChar(0x103), QChar(0xE2), QChar(0xEA), QChar(0xF4), QChar(0x300), QChar(0x309), QChar(0x303), QChar(0x301), QChar(0x323), QChar(0x111), KeyboardKey::Backspace}, {'q', QChar(0x1B0), 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', QChar(0x1A1)}, {'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', '/', KeyboardKey::Ok}, {KeyboardKey::Shift, 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', KeyboardKey::Shift}, {KeyboardKey::SetNumeric, KeyboardKey::Space, KeyboardKey::SetLayout} }; layouts.append(vnLayout); } { KeyboardLayout numLayout; numLayout.name = "numOnly"; numLayout.honourShift = false; numLayout.keys = { {'1', '2', '3', KeyboardKey::Backspace}, {'4', '5', '6', KeyboardKey::Ok}, {'7', '8', '9', KeyboardKey::Dummy}, {KeyboardKey::Dummy, '0', KeyboardKey::Dummy, KeyboardKey::Dummy} }; layouts.append(numLayout); } { KeyboardLayout symLayout; symLayout.name = "sym"; symLayout.honourShift = false; symLayout.keys = { {'1', '2', '3', '!', '@', '#', '(', ')', ':', ';', KeyboardKey::Backspace}, {'4', '5', '6', '$', '%', '^', '[', ']', '\'', '"', '|'}, {'7', '8', '9', '&', '*', '=', '{', '}', '/', '\\', KeyboardKey::Ok}, {'.', '0', '?', '+', '-', '_', '<', '>', ',', '`', '~'}, {KeyboardKey::SetNumeric, KeyboardKey::Space, KeyboardKey::SetLayout} }; layouts.append(symLayout); } QMap<QString, KeyboardLayout> layoutsMap; for (KeyboardLayout layout : layouts) { layoutsMap.insert(layout.name, layout); } return layoutsMap; } KeyboardLayout KeyboardLayoutsDatabase::layoutForName(QString name) { return layouts.value(name); } QMap<QString, KeyboardLayout> KeyboardLayoutsDatabase::displayLayouts() { QMap<QString, KeyboardLayout> layouts = KeyboardLayoutsDatabase::layouts; layouts.remove("numOnly"); layouts.remove("sym"); return layouts; }
#pragma once #include "TitleScene.h" #include <2D-Game-Engine/Game.h> class MainGame : public Engine::EngineGame { public: void initGame() override; void updateGame(float dt) override; void destroyGame() override; };
#ifndef PERMUTATIONSTREAM_H #define PERMUTATIONSTREAM_H #include <vector> #include <stack> #include <iostream> struct PermutationState { int targetSize; std::vector<char> current; std::vector<bool> used; bool isComplete() const { return current.size() == targetSize; } void print() const { for (auto s : current) { std::cout << s << " "; } std::cout << std::endl; } }; class PermutationStream { public: PermutationStream(std::vector<char> symbols, int variationSize); bool hasNext() const; void generateAll(); std::vector<char> next(); protected: private: std::vector<char> symbols; std::stack<PermutationState> state; int variationSize; void unwind(); }; #endif // PERMUTATIONSTREAM_H
#include "List.h" #include <string> #include <iostream> using namespace std; int main() { string str = "0"; List list; list.pushBack(str); list.pushBack("1"); list.pushBack("2"); list.pushBack("3"); list.insert(0, "4"); list.insert(3, "5"); list.remove(0); list.remove(1); list.remove(2); List list2(list); /*list.insert(0, "4"); list.insert(1, "5"); list.insert(2, "6"); list.insert(4, "7"); list.insert(6, "8"); list.insert(8, "9");*/ list.printAll(); cout << endl; list2.printAll(); cout << endl; cout << list.getSize() << endl;; //list.~List(); system("pause"); }
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: TreeNode * flattenHelp(TreeNode * root) { if(root == nullptr) return root; TreeNode * left_sub = flattenHelp(root -> left); TreeNode * right_sub = flattenHelp(root -> right); root -> left = nullptr; root -> right = nullptr; if(left_sub != nullptr) { root -> right = left_sub; while(left_sub -> right != nullptr) { left_sub = left_sub -> right; } left_sub -> right = right_sub; } else { root -> right = right_sub; } return root; } void flatten(TreeNode* root) { if(root == nullptr) return ; root = flattenHelp(root); } };
#include <iostream> using namespace std; template <class T> class Number { private: T _x; public: Number(const T& x) : _x(x) {} bool operator< (const Number& rhs) { return this->_x < rhs._x; } bool operator== (const Number& rhs) { return this->_x == rhs._x; } void operator= (const Number& rhs) { this->_x = rhs._x; } // prefix increment Number & operator++() { _x += T(1); return *this; } Number operator++(int) { Number tmp(_x); ++_x; return tmp; } friend ostream& operator<<(ostream& os, const Number& n) { os << n._x; return os; } }; template <class T, int SIZE> class Array { private: T _data[SIZE]; public: Array(T (&x)[SIZE]) { copy(begin(x), end(x), begin(_data)); } T* data() { return _data; } Array operator+(const T& x) { T newData[SIZE]; for (int i = 0; i < SIZE; ++i) { newData[i] = _data[i] + x; } return Array(newData); } Array operator*(const T& x) { T newData[SIZE]; for (int i = 0; i < SIZE; ++i) { newData[i] = _data[i] * x; } return Array(newData); } T& operator[] (int idx) { return _data[idx]; } }; int main() { double data[] = {1,2,3,4,5}; Array<double, 5> a(data); Array<double, 5> b = a + 1.0; Array<double, 5> c = a * 2.0; for (int i = 0; i < 5; ++i) { cout << "(a, b, c) = (" << a[i] << ", " << b[i] << ", " << c[i] << ")" << endl; } }
#ifndef LIBNDGPP_UTILITY_HPP #define LIBNDGPP_UTILITY_HPP #include <tuple> namespace ndgpp { /// Causes a compiler error upon instantiation so the type can be examined template <class T> class print_type_t; /// Helper function to generate a print_type_t compilation error template <class T> inline decltype(auto) print_type(T&& t) { return print_type_t<T>{}; } /// Helper function to generate a print_type_t compilation error template <class ... Ts> inline decltype(auto) print_types(Ts&& ... ts) { return std::make_tuple(print_type_t<Ts>{}...); } } #endif
#include <bits/stdc++.h> using namespace std; #define ll long long void print(vector<int> t) { for (int a : t) cout << a << " "; cout << endl; } int main() { // freopen("huffman.in", "r", stdin); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) a[i] = i + 1; for (int i = 1; i < n; ++i) swap(a[i], a[i / 2]); print(a); return 0; }
// $Id: AAP_var.hpp,v 1.2 2003/12/03 01:52:30 magh Exp $ /* ------------------------------------------------------------------------ Author: Matthew Galati (magh@lehigh.edu) (c) Copyright 2003 Lehigh University. All Rights Reserved. This software is licensed under the Common Public License. Please see accompanying file for terms. ---------------------------------------------------------------------------*/ #ifndef AT_VAR_H #define AT_VAR_H #include "BCP_var.hpp" #include "BCP_buffer.hpp" #include "AT_GRASP.h" #include "CoinHelperFunctions.hpp" #include <iostream> #include <vector> #include <algorithm> #include<stdlib.h> #include<stdio.h> using std::make_pair; using namespace std; /*--------------------------------------------------------------------------*/ /* Class for an AAP algorithmic variable (derived from a BCP_var_algo). A variable in this context is an point that satisfies the assignment constraints over J x K. */ class AT_var : public BCP_var_algo{ public: int i; int lambda_id; vector< pair<int,int> > L_S; public: AT_var() : BCP_var_algo(BCP_IntegerVar, 0.0, 0.0, DBL_MAX){ cout<<"construct AT_var"<<endl; i=0; lambda_id=0; L_S.clear(); } AT_var(int i_input,int lambda_id_input,const vector< pair<int,int> > & LS_input):BCP_var_algo(BCP_IntegerVar,0.0,0.0,DBL_MAX){ i=i_input; lambda_id=lambda_id_input; L_S.resize((int)LS_input.size()); copy(LS_input.begin(),LS_input.end(),L_S.begin()); } AT_var(const AT_var & x) : BCP_var_algo(BCP_IntegerVar,0.0, 0.0, DBL_MAX), i(x.i), lambda_id(x.lambda_id), L_S(x.L_S) {} AT_var(BCP_buffer & buf):BCP_var_algo(BCP_IntegerVar, 0.0, 0.0, DBL_MAX){ i=0; lambda_id=0; //Constructor given a buffer stream - unpacks the buffer stream //into this's data members unpack(buf); } ~AT_var() { i=0; lambda_id=0; L_S.clear(); }; public: void pack(BCP_buffer & buf) const { //Pack the variable buf.pack(i); buf.pack(lambda_id); buf.pack(L_S); } void unpack(BCP_buffer & buf){ //Unpack the variable buf.unpack(i); buf.unpack(lambda_id); buf.unpack(L_S); } void print(ostream * os = &cout) const { (*os)<<"i="<<i<<",lambda_id="<<lambda_id<<endl; vector< pair<int,int> >::const_iterator pLS=L_S.begin(); while(pLS!=L_S.end()){ (*os)<<"l="<<(*pLS).first<<",s="<<(*pLS).second<<endl; pLS++; } } }; #endif
#ifndef ___ApplicationProxy_H #define ___ApplicationProxy_H #include <string> #include "ProxyArray.h" #include "PrimitiveArray.h" #include "JStringHelper.h" #include "JStringHelperArray.h" using namespace de::freegroup::jnipp; class I18NProxy { private: static std::string className; static jclass objectClass; // jobject peerObject; static jclass _getObjectClass(); protected: // virtual jobject getPeerObject(){ return peerObject;}; public: // virtual jclass getObjectClass(); // operator jobject(); // constructors // I18NProxy(jobject obj); // I18NProxy(); /* * static String get(String); */ static CString get(CString p0); }; #endif
#include "linear_assignment.h" #include <map> linear_assignment *linear_assignment::instance = NULL; linear_assignment::linear_assignment() { } linear_assignment::~linear_assignment() { if(instance != NULL) delete instance; } linear_assignment *linear_assignment::getInstance() { if(instance == NULL) instance = new linear_assignment(); return instance; } // 级联匹配需要从刚刚匹配成功的trk循环遍历到最多已经有10次(即cascade_depth或max_age)没有匹配的trk,以对更加频繁出现的目标赋予优先权 // 所以这里的状态为confirmed但却已经好多帧没有匹配到检测结果的trk TRACHER_MATCHD linear_assignment::matching_cascade( tracker *tracker_ptr, tracker::GATED_METRIC_FUNC distance_metric_func, float max_distance, int cascade_depth, std::vector<Track> &tracks, const DETECTIONS &detections, std::vector<int>& track_indices, std::vector<int> detection_indices) { // 首先分配track-indices和detection-indices TRACHER_MATCHD res; for(size_t i = 0; i < detections.size(); i++) { detection_indices.push_back(int(i)); } std::vector<int> unmatched_detections; unmatched_detections.assign(detection_indices.begin(), detection_indices.end()); res.matches.clear(); std::vector<int> track_indices_l; // 遍历(合并匹配结果) // (1). 计算当前帧每个检测结果的深度特征与这一level中每个trk中已保留的特征集之间的余弦距离矩阵cost_matric,取最小值作为该trk与检测结果之间的计算值; // (2). 在cost_matric中,进行运动信息约束。对于每个trk,计算其kf预测结果和检测结果之间的马氏距离,并存放于cost_matric中,当trk的马氏距离大于阈值(gating_threshold)的值设为无穷大; // (3). 将经由max_distance处理之后的cost_matric作为匈牙利算法的输入,得到线性匹配结果,并去除差距较大的匹配 std::map<int, int> matches_trackid; for(int level = 0; level < cascade_depth; level++) { if(unmatched_detections.size() == 0) break; //No detections left; track_indices_l.clear(); for(int k:track_indices) { if(tracks[k].time_since_update() == 1+level) track_indices_l.push_back(k); } if(track_indices_l.size() == 0) continue; //Nothing to match at this level. // 计算cost_matric TRACHER_MATCHD tmp = min_cost_matching( tracker_ptr, distance_metric_func, max_distance, tracks, detections, track_indices_l, unmatched_detections); unmatched_detections.assign(tmp.unmatched_detections.begin(), tmp.unmatched_detections.end()); for(size_t i = 0; i < tmp.matches.size(); i++) { MATCH_DATA pa = tmp.matches[i]; res.matches.push_back(pa); matches_trackid.insert(pa); } } res.unmatched_detections.assign(unmatched_detections.begin(), unmatched_detections.end()); for(size_t i = 0; i < track_indices.size(); i++) { int tid = track_indices[i]; if(matches_trackid.find(tid) == matches_trackid.end()) res.unmatched_tracks.push_back(tid); } return res; // 经过上述处理之后,得到当前最终级联匹配结果 } TRACHER_MATCHD linear_assignment::min_cost_matching(tracker *tracker_ptr, tracker::GATED_METRIC_FUNC distance_metric_func, float max_distance, std::vector<Track> &tracks, const DETECTIONS &detections, std::vector<int> &track_indices, std::vector<int> &detection_indices) { TRACHER_MATCHD res; if((detection_indices.size() == 0) || (track_indices.size() == 0)) { res.matches.clear(); res.unmatched_tracks.assign(track_indices.begin(), track_indices.end()); res.unmatched_detections.assign(detection_indices.begin(), detection_indices.end()); return res; } // 执行级联匹配遍历步骤中的(1)和(2) // https://blog.csdn.net/qq_33154343/article/details/84141832#%5B1%5D%C2%A0%20%E6%88%90%E5%91%98%E6%8C%87%E9%92%88%E8%AE%BF%E9%97%AE%E8%BF%90%E7%AE%97%E7%AC%A6%20.* DYNAMICM cost_matrix = (tracker_ptr->*(distance_metric_func))(tracks, detections, track_indices, detection_indices); // 执行级联匹配遍历步骤中的(3) // a. 把经过马氏距离处理的矩阵cost_matric继续经由max_distance(max_cosine_distance=0.9, max_iou_distance = 0.9)处理, 把cost大于阈值的,都设置成阈值+0.00001. for(int i = 0; i < cost_matrix.rows(); i++) { for(int j = 0; j < cost_matrix.cols(); j++) { float tmp = cost_matrix(i,j); if(tmp > max_distance) cost_matrix(i,j) = max_distance + 1e-5; } } //Eigen::Matrix<float, -1, 2, Eigen::RowMajor> indices = HungarianOper::Solve(cost_matrix); // cout << "detection size : " << detections.size() << endl; // for (int i = 0; i < detections.size(); i++) // { // cout << "detections : " << detections[i].tlwh << endl; // } //cout << "tracks size : " << tracks.size() << endl; // for (int i = 0; i < tracks.size(); i++) // { // cout << "tracks : " << tracks[i].track_id << " position : "<< tracks[i].to_tlwh() << endl; // } //cout << "cost_matrix : " << cost_matrix << endl; // b. 把经由max_distance处理之后的cost_matric作为匈牙利算法的输入,得到线性匹配结果 Eigen::Matrix<float, -1, 2, Eigen::RowMajor> indices = hungarian.solve(cost_matrix); //cout << "indices : " << indices << endl ; // c. 对于匹配结果进行筛选,删去两者差别(即cosine distance)太大的,得到当前level的匹配结果 res.matches.clear(); res.unmatched_tracks.clear(); res.unmatched_detections.clear(); for(size_t col = 0; col < detection_indices.size(); col++) { bool flag = false; for(int i = 0; i < indices.rows(); i++) if(indices(i, 1) == col) { flag = true; break;} if(flag == false)res.unmatched_detections.push_back(detection_indices[col]); } for(size_t row = 0; row < track_indices.size(); row++) { bool flag = false; for(int i = 0; i < indices.rows(); i++) if(indices(i, 0) == row) { flag = true; break; } if(flag == false) res.unmatched_tracks.push_back(track_indices[row]); } for(int i = 0; i < indices.rows(); i++) { int row = indices(i, 0); int col = indices(i, 1); int track_idx = track_indices[row]; int detection_idx = detection_indices[col]; // cout << "row : " << row << " col : " << col << "track id : " << track_idx << " detection id : " << detection_idx << // " cost_matrix : " << cost_matrix(row, col) <<endl; if(cost_matrix(row, col) > max_distance) { // 如果某个组合的cost值大于阈值, 这样的组合还是认为不match的,相应的,还要把组合中的检测框和跟踪框都踢到各自的unmatched列表中。 res.unmatched_tracks.push_back(track_idx); res.unmatched_detections.push_back(detection_idx); } else { res.matches.push_back(std::make_pair(track_idx, detection_idx)); } } return res; // 经过上述处理之后,得到当前初步matches、unmatche-tracks、unmat-detections } // DYNAMICM void linear_assignment::gate_cost_matrix( DYNAMICM &cost_matrix, std::vector<Track> &tracks, const DETECTIONS &detections, const std::vector<int> &track_indices, const std::vector<int> &detection_indices, float gated_cost, bool only_position) { // 运动信息约束 int gating_dim = (only_position == true?2:4); double gating_threshold = KalmanFilterToolBox::chi2inv95[gating_dim]; std::vector<DETECTBOX> measurements; // 将各检测结果由[x,y,w,h]转换为[center_x,center_y,aspect_ratio,height] for(int i:detection_indices) { DETECTION_ROW t = detections[i]; measurements.push_back(t.to_xyah()); } // 对于每个trk,计算其kf预测位置和检测结果bbox间的马氏距离,并放在cost_matric中,针对马氏距离大于阈值(gating_threshold)的值设置为100000(gated_cost,相当于无穷大) for(size_t i = 0; i < track_indices.size(); i++) { Track& track = tracks[track_indices[i]]; Eigen::Matrix<float, 1, -1> gating_distance = track.kf->mahalanobis_distance(measurements, only_position); for (int j = 0; j < gating_distance.cols(); j++) { if (gating_distance(0, j) > gating_threshold) cost_matrix(i, j) = gated_cost; } } // return cost_matrix; }
//************************************************************************** //** //** See jlquake.txt for copyright info. //** //** This program is free software; you can redistribute it and/or //** modify it under the terms of the GNU General Public License //** as published by the Free Software Foundation; either version 3 //** of the License, or (at your option) any later version. //** //** This program is distributed in the hope that it will be useful, //** but WITHOUT ANY WARRANTY; without even the implied warranty of //** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //** included (gnu.txt) GNU General Public License for more details. //** //************************************************************************** #ifndef __Bsp29SurfacesLoader__ #define __Bsp29SurfacesLoader__ #include "BspSurfaceBuilder.h" #include "models/RenderModel.h" class idBsp29LoadHelper : public idBspSurfaceBuilder { public: int numplanes; cplane_t* planes; byte* lightdata; int numtextures; mbrush29_texture_t** textures; int numtexinfo; mbrush29_texinfo_t* texinfo; idTextureInfo* textureInfos; int numsurfaces; idSurfaceFaceQ1* surfaces; int numsubmodels; mbrush29_submodel_t* submodels; idBsp29LoadHelper( const idStr& name, byte* fileBase ); ~idBsp29LoadHelper(); void LoadPlanes( bsp_lump_t* l ); void LoadLighting( bsp_lump_t* l ); void LoadTextures( bsp_lump_t* l ); void LoadTexinfo( bsp_lump_t* l ); void LoadFaces( bsp_lump_t* l ); void LoadSubmodelsQ1( bsp_lump_t* l ); void LoadSubmodelsH2( bsp_lump_t* l ); }; #endif
#ifndef H_SPIDER_WINDOW_ELEMENT #define H_SPIDER_WINDOW_ELEMENT #include "VBoxElement.h" #include "ImageLibrary.h" #include "GraphicsContext.h" namespace spider { class WindowElement : public VBoxElement { protected: GraphicsContext * gc; // ImageLibrary *mImages; public: /* ImageLibrary *images() { return this->mImages; }*/ void draw(); void pack(); WindowElement(GraphicsContext *gc); virtual void invalidateRegion(rectangle rect) {} virtual string getType() { return "window"; } virtual void scrollTo(int x, int y) {} virtual void scroll(int x, int y) {} void SampleLayout(); }; }; #endif
#pragma once #include<iostream> using namespace std; struct node { int data; node* left; node* right; }; class BST { protected: node* root; private: int max(node* current) { node* current2 = current; if (current == nullptr) { return 0; } else { current = current->left; int L = max(current); current2 = current2->right; int R = max(current2); if (L > R) { L++; return L; } else { R++; return R; } } } public: BST() { root = nullptr; } void insert(int data) { node* newnode = new node(); newnode->left = nullptr; newnode->right = nullptr; newnode->data = data; if (root == nullptr) { root = newnode; } else { node* temp1 = root; while (true) { if (data < temp1->data) { if (temp1->left == nullptr) { if (data < temp1->data) { temp1->left = newnode; break; } } temp1 = temp1->left; } else { if (temp1->right == nullptr) { if (data > temp1->data) { temp1->right = newnode; break; } } temp1 = temp1->right; } } } } int height() { node* current = root; int h = max(current); return h + 1; } };
using namespace std; #include <iostream> class Time { int myhours; int myminutes; int myseconds; public: Time() { myhours = myminutes = myseconds = 0; } Time(int hours, int minutes, int seconds) { myhours = hours; myminutes = minutes; myseconds = seconds; if (myseconds >= 60) { myminutes += myseconds / 60; myseconds = myseconds % 60; } else if (myminutes >= 60) { myhours += myminutes / 60; myminutes = myminutes % 60; } } void show_time()const { cout << "Time is " << myhours << ":" << myminutes << ":" << myseconds << endl; } Time time_sum(Time &t1, Time &t2) { long totalsecs = (t1.myhours * 3600) + (t1.myminutes * 60) + t1.myseconds + (t2.myhours * 3600) + (t2.myminutes * 60) + t2.myseconds; myhours = totalsecs / 3600; myminutes = totalsecs % (3600) / 60; myseconds = totalsecs % (3600) % 60; Time summary = Time(myhours, myminutes, myseconds); return summary; } }; int main() { Time time1 = Time(); time1.show_time(); Time time2 = Time(1, 14, 72); time2.show_time(); Time time3 = Time(3, 83, 54); time3.show_time(); time1.time_sum(time2, time3); time1.show_time(); }
//int SER_Pin = 5; //pin 14 on the 75HC595 //int RCLK_Pin = 4; //pin 12 on the 75HC595 //nt SRCLK_Pin = 0; //pin 11 on the 75HC595 /* ShiftRegister74HC595.h - Library for easy control of the 74HC595 shift register. Created by Timo Denk (www.simsso.de), Nov 2014. Additional information are available on http://shiftregister.simsso.de/ Released into the public domain. */ #include "ShiftRegister74HC595.h" // create shift register object (number of shift registers, data pin, clock pin, latch pin) ShiftRegister74HC595 sr (3, 5, 4, 0); void setup() { } void loop() { //sr.setAllHigh(); // set all pins HIGH //delay(500); sr.setAllLow(); // set all pins LOW delay(500); //sr.set(5,HIGH); //delay(1000); for (int i = 0; i < 24; i++) { sr.set(i, HIGH); // set single pin HIGH delay(1250); } for (int i = 0; i < 24; i++) { sr.set(i,LOW); // set single pin HIGH delay(1250); } // set all pins at once //uint8_t pinValues[] = { B10101010 }; //sr.setAll(pinValues); //delay(1000); // read pin (zero based) //uint8_t stateOfPin5 = sr.get(5); }
#include <jni.h> #include <string> #include "test_fixed_float.h" extern "C" JNIEXPORT jstring JNICALL Java_com_physics_demo_MainActivity_stringFromJNI( JNIEnv *env, jobject /* this */) { std::string hello = "Hello from C++"; return env->NewStringUTF(hello.c_str()); } extern "C" JNIEXPORT jstring JNICALL Java_com_physics_demo_MainActivity_testFixedFloat( JNIEnv *env, jobject) { TestFixedFloat::doTest(); TestFixedFloat::doTestSpeed(); return env->NewStringUTF("Test complete, plz check log with adb logcat!!!"); }
#include <iostream> using namespace std; int Fibonaci(int n) { // Mảng lưu kết quả các bài toán con int *fibo = new int[n + 1]; int i; fibo[0] = 0; fibo[1] = 1; for (i = 2; i <= n; i++) { fibo[i] = fibo[i - 1] + fibo[i - 2]; } return fibo[n]; } int main() { int n; cin >> n; // Dynamic Programming cout << "Fibonaci number " << n << " is " << Fibonaci(n); return 0; }
#pragma once #include "../Shader/Shader.h" /*! * \brief Base class for lights * */ class Light { protected: /*! * Uniforms to update for a particular light and shader. Has to be overwritten. * * \param shader shader to be updated. * \param index index index of the light among lights of the same type (used in shader to index light) */ virtual void setUniform(std::shared_ptr<Shader>& shader, int index); public: Light(); virtual ~Light(); /*! * Updates all light related uniform for all shaders in shaders-vector for this light. * Internally calls void setUniform(std::shared_ptr<Shader>& shadeer, int index); * * \param shaders Vectors of all shaders to be uodated. * \param index index of the light among lights of the same type (used in shader to index light) */ virtual void setUniforms(const std::vector<std::shared_ptr<Shader>>& shaders, int index) final; };
#include "THEDEVASTATOR.h" DEVASTATOR::DEVASTATOR() { DevastatorT.loadFromFile("THEDEVASTATOR.png"); Devastator.setTexture(&DevastatorT); Devastator.setSize(sf::Vector2f(1500, 1300)); Devastator.setOrigin(1500 / 2, 1300 / 2); Devastator.setPosition(900, 0); AssaultArm.setSize(sf::Vector2f(10, 1000)); AssaultArm.setOrigin(10/ 2,1000/2 ); AssaultArm.setPosition(1900, 500); AssaultArm.setFillColor(sf::Color::Red); AssaultArm.setOutlineColor(sf::Color::White); LeftArm.setSize(sf::Vector2f(RightArm1, RightArm2)); LeftArm.setOrigin(RightArm1 / 2, RightArm2 / 2); LeftArm.setPosition(600, 0); RightArm.setSize(sf::Vector2f(LeftArm1, LeftArm2)); RightArm.setOrigin(LeftArm1 / 2, LeftArm2 / 2); RightArm.setPosition(1200, 0); Head.setSize(sf::Vector2f(Headoro, Headoro)); Head.setOrigin(Headoro / 2, Headoro / 2); Head.setPosition(900, 0); } void DEVASTATOR::devastatorSmash(float deltatime) { if (SmashWhere == 1 && AssaultArm.getPosition().x > 0) { AssaultArm.move(-150.5f * deltatime, 0); } if (SmashWhere == -1 && AssaultArm.getPosition().x < 1900) { AssaultArm.move(150.5f * deltatime, 0); } } void DEVASTATOR::ShowDown(float deltatime) { if (Devastator.getPosition().y <= 500) { Devastator.move(0, 80.f * deltatime); LeftArm.move(0, 80.f * deltatime); RightArm.move(0, 80.f * deltatime); Head.move(0, 80.f * deltatime); } }
#include "IScriptable.h" IScriptable::IScriptable() { m_wzName[0] = 0; }
#ifndef __WHISKEY_AST_FieldReal_HPP #define __WHISKEY_AST_FieldReal_HPP #include <whiskey/AST/Field.hpp> namespace whiskey { class FieldReal : public Field { private: Real value; protected: std::unique_ptr<Field> onClone() const; void onPrintAsLiteral(std::ostream &os) const; bool onCompare(const Field &other) const; void onPrint(std::ostream &os, int indent) const; public: FieldReal(Real value); Real &getValue(); const Real &getValue() const; void setValue(Real value); }; } #endif
#pragma once #include "newuser.h" #include "gameform1.h" #include "newgame.h" #include "rules.h" #include"compare.h" #include"ranklist.h" #include<stdlib.h> #include<fstream> #include<iostream> #include<string.h> using namespace std; namespace miniprojectfirstassignment { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::Runtime::InteropServices; /// <summary> /// Summary for Form1 /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); pictureBox1->Image = Image::FromFile("poker1.jpg");//Background picture. pictureBox1->Visible=true; pictureBox2->Image = Image::FromFile("456.png"); pictureBox2->Visible=true; // int score=0;//TODO: Add the constructor code here // } protected: char *p;//get the username from the textbox1. char *q;//get the password from the textbox2. private: System::Windows::Forms::PictureBox^ pictureBox2; protected: int score; /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::TextBox^ textBox1; protected: private: System::Windows::Forms::TextBox^ textBox2; private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::Label^ label2; private: System::Windows::Forms::PictureBox^ pictureBox1; private: System::Windows::Forms::Button^ button2; private: System::Windows::Forms::Button^ button3; private: System::Windows::Forms::Button^ button4; private: System::Windows::Forms::Button^ button5; private: System::Windows::Forms::Button^ button6; private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid)); this->textBox1 = (gcnew System::Windows::Forms::TextBox()); this->textBox2 = (gcnew System::Windows::Forms::TextBox()); this->label1 = (gcnew System::Windows::Forms::Label()); this->label2 = (gcnew System::Windows::Forms::Label()); this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox()); this->button2 = (gcnew System::Windows::Forms::Button()); this->button3 = (gcnew System::Windows::Forms::Button()); this->button4 = (gcnew System::Windows::Forms::Button()); this->button5 = (gcnew System::Windows::Forms::Button()); this->button6 = (gcnew System::Windows::Forms::Button()); this->pictureBox2 = (gcnew System::Windows::Forms::PictureBox()); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox2))->BeginInit(); this->SuspendLayout(); // // textBox1 // this->textBox1->Location = System::Drawing::Point(230, 195); this->textBox1->Name = L"textBox1"; this->textBox1->Size = System::Drawing::Size(169, 22); this->textBox1->TabIndex = 0; // // textBox2 // this->textBox2->ForeColor = System::Drawing::SystemColors::ActiveBorder; this->textBox2->Location = System::Drawing::Point(230, 261); this->textBox2->Name = L"textBox2"; this->textBox2->Size = System::Drawing::Size(169, 22); this->textBox2->TabIndex = 1; // // label1 // this->label1->AutoSize = true; this->label1->Font = (gcnew System::Drawing::Font(L"PMingLiU", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(136))); this->label1->ForeColor = System::Drawing::Color::Transparent; this->label1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"label1.Image"))); this->label1->Location = System::Drawing::Point(125, 202); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(85, 15); this->label1->TabIndex = 2; this->label1->Text = L"USERNAME"; this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click); // // label2 // this->label2->AutoSize = true; this->label2->Font = (gcnew System::Drawing::Font(L"PMingLiU", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(136))); this->label2->ForeColor = System::Drawing::Color::Transparent; this->label2->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"label2.Image"))); this->label2->Location = System::Drawing::Point(125, 264); this->label2->Name = L"label2"; this->label2->Size = System::Drawing::Size(83, 15); this->label2->TabIndex = 3; this->label2->Text = L"PASSWORD"; // // pictureBox1 // this->pictureBox1->InitialImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox1.InitialImage"))); this->pictureBox1->Location = System::Drawing::Point(572, 23); this->pictureBox1->Name = L"pictureBox1"; this->pictureBox1->Size = System::Drawing::Size(391, 292); this->pictureBox1->TabIndex = 5; this->pictureBox1->TabStop = false; this->pictureBox1->Click += gcnew System::EventHandler(this, &Form1::pictureBox1_Click); // // button2 // this->button2->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"button2.BackgroundImage"))); this->button2->Font = (gcnew System::Drawing::Font(L"PMingLiU", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(136))); this->button2->ForeColor = System::Drawing::Color::Cornsilk; this->button2->Location = System::Drawing::Point(489, 337); this->button2->Name = L"button2"; this->button2->Size = System::Drawing::Size(130, 45); this->button2->TabIndex = 6; this->button2->Text = L"The Rules"; this->button2->UseVisualStyleBackColor = true; this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click); // // button3 // this->button3->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"button3.BackgroundImage"))); this->button3->Font = (gcnew System::Drawing::Font(L"PMingLiU", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(136))); this->button3->ForeColor = System::Drawing::Color::Cornsilk; this->button3->Location = System::Drawing::Point(293, 337); this->button3->Name = L"button3"; this->button3->Size = System::Drawing::Size(130, 45); this->button3->TabIndex = 7; this->button3->Text = L"New User"; this->button3->UseVisualStyleBackColor = true; this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click); // // button4 // this->button4->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"button4.BackgroundImage"))); this->button4->Font = (gcnew System::Drawing::Font(L"PMingLiU", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(136))); this->button4->ForeColor = System::Drawing::Color::Cornsilk; this->button4->Location = System::Drawing::Point(687, 337); this->button4->Name = L"button4"; this->button4->Size = System::Drawing::Size(130, 45); this->button4->TabIndex = 8; this->button4->Text = L"Start"; this->button4->UseVisualStyleBackColor = true; this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click); // // button5 // this->button5->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"button5.BackgroundImage"))); this->button5->DialogResult = System::Windows::Forms::DialogResult::OK; this->button5->Font = (gcnew System::Drawing::Font(L"PMingLiU", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(136))); this->button5->ForeColor = System::Drawing::Color::Cornsilk; this->button5->Location = System::Drawing::Point(890, 337); this->button5->Name = L"button5"; this->button5->Size = System::Drawing::Size(130, 45); this->button5->TabIndex = 9; this->button5->Text = L"Quit"; this->button5->UseVisualStyleBackColor = true; this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click); // // button6 // this->button6->Font = (gcnew System::Drawing::Font(L"PMingLiU", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(136))); this->button6->ForeColor = System::Drawing::Color::White; this->button6->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"button6.Image"))); this->button6->Location = System::Drawing::Point(110, 337); this->button6->Name = L"button6"; this->button6->Size = System::Drawing::Size(130, 45); this->button6->TabIndex = 10; this->button6->Text = L"Rank"; this->button6->UseVisualStyleBackColor = true; this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click); // // pictureBox2 // this->pictureBox2->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox2.BackgroundImage"))); this->pictureBox2->Location = System::Drawing::Point(27, 12); this->pictureBox2->Name = L"pictureBox2"; this->pictureBox2->Size = System::Drawing::Size(517, 158); this->pictureBox2->TabIndex = 12; this->pictureBox2->TabStop = false; // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage"))); this->ClientSize = System::Drawing::Size(1084, 411); this->Controls->Add(this->pictureBox2); this->Controls->Add(this->button6); this->Controls->Add(this->button5); this->Controls->Add(this->button4); this->Controls->Add(this->button3); this->Controls->Add(this->button2); this->Controls->Add(this->pictureBox1); this->Controls->Add(this->label2); this->Controls->Add(this->label1); this->Controls->Add(this->textBox2); this->Controls->Add(this->textBox1); this->Name = L"Form1"; this->Text = L"Form1"; this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit(); (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox2))->EndInit(); this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void label3_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void pictureBox1_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) { newuser ^ a = gcnew newuser; a ->ShowDialog();//jump to the newuser form. } private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { } private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { rules ^ b = gcnew rules; b ->ShowDialog();//show the rules to the player. } private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) { String ^ username2=textBox1->Text; String ^ password2=textBox2->Text; p=(char*)Marshal::StringToHGlobalAnsi(username2).ToPointer(); q=(char*)Marshal::StringToHGlobalAnsi(password2).ToPointer(); namepassword b(p,q); //get the username and password to the pointer *p,*q. if(b.compare(p,q)==0)//compare the password {score=b.getscore();//get the score from the file. //char nn[6]={'-1','-1','-1','-1','-1','-1'}; // for(int i=0;i<6;i++) //{nn[i]= testing[i]; // } /* char n0[1],n1[1],n2[1],n3[1],n4[1],n5[1]; n0[0]=testing[0]; if(n0=="") {score=100;} else{ n1[0]=testing[1]; if(n1=="") {score=atoi(n0);} else{n2[0]=testing[2]; if(n2==""){strcat(n0,n1); score=atoi(n0);} else{ n3[0]=testing[3];int testing=stoi(n3); if(n3==""){strcat(n0,n1);strcat(n0,n2); score=atoi(n0);} else{ n4[0]=testing[4]; if(n4==""){strcat(n0,n1);strcat(n0,n2);strcat(n0,n3);score=stoi(n0);} else{ n5[0]=testing[5]; if(n5==""){strcat(n0,n1);strcat(n0,n1);strcat(n0,n3);strcat(n0,n4);score=atoi(n0);} }}}}}*/ /* int m0; int m1; int m2; int m3; int m4; int m5; m0=int(nn[0])-int("0"); m1=int(nn[1])-int("0"); m2=int(nn[2])-int("0"); m3=int(nn[3])-int("0"); m4=int(nn[4])-int("0"); m5=int(nn[5])-int("0"); */ gameform1 ^ c = gcnew gameform1(p,score);//transfer the usernmae and the score to the gameform1. c ->ShowDialog(); } else {String ^title="warning"; String ^ message="wrong!"; MessageBox::Show(message,title,MessageBoxButtons::OK);//If the player enter wrong information, it will this window. } } private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) { this->Close(); } private: System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) { ranklist ^ rank = gcnew ranklist;//show the history score list of the game rank ->ShowDialog(); } }; }
//------------------------------ Problem 2 #include <iostream> using namespace std; int main(){ int x,y, temp; cout << "Enter value of of x: "; cin >> x; cout << "Enter value of of y: "; cin >> y; //swapping temp=x; x=y; y=temp; cout << "value of x is : " << x << endl; cout << "value of y is : " << y; return 0; }
#include "widget.h" #include "rotatedlabel.h" #include <QtGui> Widget::Widget(QWidget *parent) : QWidget(parent) { label = new RotatedLabel(this); spinBox = new QSpinBox; spinBox->setRange(-360, 360); spinBox->setValue(0); lineEdit = new QLineEdit("<h1>Text<sup>123</sup>&Psi;</h1>"); QLabel *angleLabel = new QLabel("angle"); QHBoxLayout *angleLayout = new QHBoxLayout; angleLayout->addStretch(); angleLayout->addWidget(angleLabel); angleLayout->addWidget(spinBox); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(label); mainLayout->addWidget(lineEdit); mainLayout->addLayout(angleLayout); setLayout(mainLayout); connect(lineEdit, SIGNAL(textChanged(QString)), this, SLOT(textChange(QString))); connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(angleChange(int))); } Widget::~Widget() { } void Widget::textChange(const QString &text) { label->setText(text); } void Widget::angleChange(int angle) { label->setAngle(qreal(angle)); }
#ifndef POP_HPP_INCLUDED #define POP_HPP_INCLUDED #include "email.hpp" #include <iostream> #include <sstream> #include <queue> #include <boost/asio.hpp> #include <boost/bind.hpp> #include <boost/function.hpp> #include <boost/smart_ptr.hpp> #include <boost/date_time/posix_time/posix_time.hpp> typedef boost::function<void()> ok_handler; typedef boost::function<void()> task; /** Pop3-based mailbox reciever client. **/ class MailboxService : public boost::noncopyable { public: MailboxService(boost::asio::io_service& iosev) :username(""), password(""), pop_serv(""), iosev(iosev), socket(new boost::asio::ip::tcp::socket(this->iosev)), todos(), stat() {}; void start(std::string mailbox, std::string password, std::string pop_serv) { this->username = mailbox; this->password = password; this->pop_serv = pop_serv; this->do_all(); }; void get_mail_nr(unsigned int *dest, ok_handler on_ok); void get_all_email(std::vector<EMail*> *dest_emails, ok_handler on_ok, int stage = 0); void get_email(int index, EMail *to_fill, ok_handler on_ok) { this->todos.push( bind(&MailboxService::r_get_email, this, index, to_fill, on_ok)); } private: void do_all(); void login(ok_handler on_ok); void login_start(ok_handler on_ok, const boost::system::error_code& ec); void vs_login(ok_handler on_ok, int stage, const boost::system::error_code& ec); void down(); void get_mail_nr_ok(unsigned int *dest, ok_handler on_ok); void get_stat(ok_handler on_ok) { this->todos.push(bind(&MailboxService::r_get_stat, this, on_ok)); } void r_get_stat(ok_handler on_ok); void read_stat(ok_handler on_ok, const boost::system::error_code& ec); void fill_stat(boost::shared_ptr<boost::asio::streambuf> data_got, ok_handler on_ok, const boost::system::error_code& ec); void get_all_email_single_ok(boost::shared_ptr<unsigned int> ok_nr, ok_handler on_ok); void r_get_email(int index, EMail *to_fill, ok_handler on_ok); void read_email(EMail *to_fill, ok_handler on_ok, const boost::system::error_code& ec); void fill_email(EMail *to_fill, ok_handler on_ok, boost::shared_ptr<boost::asio::streambuf> data_got, const boost::system::error_code& ec); std::string username, password, pop_serv; boost::asio::io_service& iosev; boost::asio::ip::tcp::socket* socket; std::queue<task> todos; Mailbox_STAT stat; }; #endif // POP_HPP_INCLUDED
/* Packet for sending and receiving pings Copyright (C) 2016 Alex Craig, Michael Wallace, Mario Garcia. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (At your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __PING_PACKET_H #define __PING_PACKET_H #include <CommProto/abstractpacket.h> #include <string> namespace comnet { namespace ping { /** Packet to be sent and received to ping and pong. */ class PingPacket : INHERITS_ABSPACKET { public: /** Creates a new instance of {@link PingPacket}. @return A new {@link PingPacket}. */ PingPacket(); /** Serializes {@link #ping} to the stream. @param objOut The stream to serialize the data to. */ void Pack(REF_OBJECTSTREAM objOut) override; /** Parses {@link #ping} from the stream. @param objIn The stream to parse data from. */ void Unpack(REF_OBJECTSTREAM objIn) override; /** Creates a new instance of {@link PingPacket}. @return New instance of {@link PingPacket}. */ AbstractPacket* Create() override { return new PingPacket(); } /** Accessor for {@link #ping}. @return {@code true} when is a ping, {@code false} when a pong. */ bool isPing() { return ping; } /** Modifier for the {@link #ping} field. @param mode Value to set {@link #ping} to. */ void setPing(bool mode) { ping = mode; } /** Default destructor. */ ~PingPacket(); private: /** When {@code true}, {@code this} represents a ping. When {@code false}, {@code this} represents a pong. */ bool ping; }; } //namespace ping } //namespace comnet #endif //__PING_PACKET_H
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "../base.h" #include "Windows.Media.Playback.0.h" #include "Windows.Devices.Enumeration.0.h" #include "Windows.Foundation.0.h" #include "Windows.Foundation.Collections.0.h" #include "Windows.Graphics.DirectX.Direct3D11.0.h" #include "Windows.Media.0.h" #include "Windows.Media.Casting.0.h" #include "Windows.Media.Core.0.h" #include "Windows.Media.MediaProperties.0.h" #include "Windows.Media.Protection.0.h" #include "Windows.Storage.0.h" #include "Windows.Storage.Streams.0.h" #include "Windows.UI.Composition.0.h" #include "Windows.Foundation.Collections.1.h" #include "Windows.Foundation.1.h" #include "Windows.Media.1.h" #include "Windows.Media.Core.1.h" WINRT_EXPORT namespace winrt { namespace ABI::Windows::Media::Playback { struct __declspec(uuid("856ddbc1-55f7-471f-a0f2-68ac4c904592")) __declspec(novtable) IBackgroundMediaPlayerStatics : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Current(Windows::Media::Playback::IMediaPlayer ** player) = 0; virtual HRESULT __stdcall add_MessageReceivedFromBackground(Windows::Foundation::EventHandler<Windows::Media::Playback::MediaPlayerDataReceivedEventArgs> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_MessageReceivedFromBackground(event_token token) = 0; virtual HRESULT __stdcall add_MessageReceivedFromForeground(Windows::Foundation::EventHandler<Windows::Media::Playback::MediaPlayerDataReceivedEventArgs> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_MessageReceivedFromForeground(event_token token) = 0; virtual HRESULT __stdcall abi_SendMessageToBackground(Windows::Foundation::Collections::IPropertySet * value) = 0; virtual HRESULT __stdcall abi_SendMessageToForeground(Windows::Foundation::Collections::IPropertySet * value) = 0; virtual HRESULT __stdcall abi_IsMediaPlaying(bool * isMediaPlaying) = 0; virtual HRESULT __stdcall abi_Shutdown() = 0; }; struct __declspec(uuid("1743a892-5c43-4a15-967a-572d2d0f26c6")) __declspec(novtable) ICurrentMediaPlaybackItemChangedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_NewItem(Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; virtual HRESULT __stdcall get_OldItem(Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; }; struct __declspec(uuid("1d80a51e-996e-40a9-be48-e66ec90b2b7d")) __declspec(novtable) ICurrentMediaPlaybackItemChangedEventArgs2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Reason(winrt::Windows::Media::Playback::MediaPlaybackItemChangedReason * value) = 0; }; struct __declspec(uuid("714be270-0def-4ebc-a489-6b34930e1558")) __declspec(novtable) IMediaBreak : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_PlaybackList(Windows::Media::Playback::IMediaPlaybackList ** value) = 0; virtual HRESULT __stdcall get_PresentationPosition(Windows::Foundation::IReference<Windows::Foundation::TimeSpan> ** value) = 0; virtual HRESULT __stdcall get_InsertionMethod(winrt::Windows::Media::Playback::MediaBreakInsertionMethod * value) = 0; virtual HRESULT __stdcall get_CustomProperties(Windows::Foundation::Collections::IPropertySet ** value) = 0; virtual HRESULT __stdcall get_CanStart(bool * value) = 0; virtual HRESULT __stdcall put_CanStart(bool value) = 0; }; struct __declspec(uuid("32b93276-1c5d-4fee-8732-236dc3a88580")) __declspec(novtable) IMediaBreakEndedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_MediaBreak(Windows::Media::Playback::IMediaBreak ** value) = 0; }; struct __declspec(uuid("4516e002-18e0-4079-8b5f-d33495c15d2e")) __declspec(novtable) IMediaBreakFactory : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_Create(winrt::Windows::Media::Playback::MediaBreakInsertionMethod insertionMethod, Windows::Media::Playback::IMediaBreak ** result) = 0; virtual HRESULT __stdcall abi_CreateWithPresentationPosition(winrt::Windows::Media::Playback::MediaBreakInsertionMethod insertionMethod, Windows::Foundation::TimeSpan presentationPosition, Windows::Media::Playback::IMediaBreak ** result) = 0; }; struct __declspec(uuid("a854ddb1-feb4-4d9b-9d97-0fdbe58e5e39")) __declspec(novtable) IMediaBreakManager : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_BreaksSeekedOver(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakSeekedOverEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_BreaksSeekedOver(event_token token) = 0; virtual HRESULT __stdcall add_BreakStarted(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakStartedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_BreakStarted(event_token token) = 0; virtual HRESULT __stdcall add_BreakEnded(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakEndedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_BreakEnded(event_token token) = 0; virtual HRESULT __stdcall add_BreakSkipped(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakSkippedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_BreakSkipped(event_token token) = 0; virtual HRESULT __stdcall get_CurrentBreak(Windows::Media::Playback::IMediaBreak ** value) = 0; virtual HRESULT __stdcall get_PlaybackSession(Windows::Media::Playback::IMediaPlaybackSession ** value) = 0; virtual HRESULT __stdcall abi_PlayBreak(Windows::Media::Playback::IMediaBreak * value) = 0; virtual HRESULT __stdcall abi_SkipCurrentBreak() = 0; }; struct __declspec(uuid("a19a5813-98b6-41d8-83da-f971d22b7bba")) __declspec(novtable) IMediaBreakSchedule : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_ScheduleChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakSchedule, Windows::Foundation::IInspectable> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_ScheduleChanged(event_token token) = 0; virtual HRESULT __stdcall abi_InsertMidrollBreak(Windows::Media::Playback::IMediaBreak * mediaBreak) = 0; virtual HRESULT __stdcall abi_RemoveMidrollBreak(Windows::Media::Playback::IMediaBreak * mediaBreak) = 0; virtual HRESULT __stdcall get_MidrollBreaks(Windows::Foundation::Collections::IVectorView<Windows::Media::Playback::MediaBreak> ** value) = 0; virtual HRESULT __stdcall put_PrerollBreak(Windows::Media::Playback::IMediaBreak * value) = 0; virtual HRESULT __stdcall get_PrerollBreak(Windows::Media::Playback::IMediaBreak ** value) = 0; virtual HRESULT __stdcall put_PostrollBreak(Windows::Media::Playback::IMediaBreak * value) = 0; virtual HRESULT __stdcall get_PostrollBreak(Windows::Media::Playback::IMediaBreak ** value) = 0; virtual HRESULT __stdcall get_PlaybackItem(Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; }; struct __declspec(uuid("e5aa6746-0606-4492-b9d3-c3c8fde0a4ea")) __declspec(novtable) IMediaBreakSeekedOverEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_SeekedOverBreaks(Windows::Foundation::Collections::IVectorView<Windows::Media::Playback::MediaBreak> ** value) = 0; virtual HRESULT __stdcall get_OldPosition(Windows::Foundation::TimeSpan * value) = 0; virtual HRESULT __stdcall get_NewPosition(Windows::Foundation::TimeSpan * value) = 0; }; struct __declspec(uuid("6ee94c05-2f54-4a3e-a3ab-24c3b270b4a3")) __declspec(novtable) IMediaBreakSkippedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_MediaBreak(Windows::Media::Playback::IMediaBreak ** value) = 0; }; struct __declspec(uuid("a87efe71-dfd4-454a-956e-0a4a648395f8")) __declspec(novtable) IMediaBreakStartedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_MediaBreak(Windows::Media::Playback::IMediaBreak ** value) = 0; }; struct __declspec(uuid("5c1d0ba7-3856-48b9-8dc6-244bf107bf8c")) __declspec(novtable) IMediaEnginePlaybackSource : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_CurrentItem(Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; virtual HRESULT __stdcall abi_SetPlaybackSource(Windows::Media::Playback::IMediaPlaybackSource * source) = 0; }; struct __declspec(uuid("1e3c1b48-7097-4384-a217-c1291dfa8c16")) __declspec(novtable) IMediaItemDisplayProperties : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Type(winrt::Windows::Media::MediaPlaybackType * value) = 0; virtual HRESULT __stdcall put_Type(winrt::Windows::Media::MediaPlaybackType value) = 0; virtual HRESULT __stdcall get_MusicProperties(Windows::Media::IMusicDisplayProperties ** value) = 0; virtual HRESULT __stdcall get_VideoProperties(Windows::Media::IVideoDisplayProperties ** value) = 0; virtual HRESULT __stdcall get_Thumbnail(Windows::Storage::Streams::IRandomAccessStreamReference ** value) = 0; virtual HRESULT __stdcall put_Thumbnail(Windows::Storage::Streams::IRandomAccessStreamReference * value) = 0; virtual HRESULT __stdcall abi_ClearAll() = 0; }; struct __declspec(uuid("5acee5a6-5cb6-4a5a-8521-cc86b1c1ed37")) __declspec(novtable) IMediaPlaybackCommandManager : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_IsEnabled(bool * value) = 0; virtual HRESULT __stdcall put_IsEnabled(bool value) = 0; virtual HRESULT __stdcall get_MediaPlayer(Windows::Media::Playback::IMediaPlayer ** value) = 0; virtual HRESULT __stdcall get_PlayBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall get_PauseBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall get_NextBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall get_PreviousBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall get_FastForwardBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall get_RewindBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall get_ShuffleBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall get_AutoRepeatModeBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall get_PositionBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall get_RateBehavior(Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior ** value) = 0; virtual HRESULT __stdcall add_PlayReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPlayReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_PlayReceived(event_token token) = 0; virtual HRESULT __stdcall add_PauseReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPauseReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_PauseReceived(event_token token) = 0; virtual HRESULT __stdcall add_NextReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerNextReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_NextReceived(event_token token) = 0; virtual HRESULT __stdcall add_PreviousReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPreviousReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_PreviousReceived(event_token token) = 0; virtual HRESULT __stdcall add_FastForwardReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerFastForwardReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_FastForwardReceived(event_token token) = 0; virtual HRESULT __stdcall add_RewindReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerRewindReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_RewindReceived(event_token token) = 0; virtual HRESULT __stdcall add_ShuffleReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerShuffleReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_ShuffleReceived(event_token token) = 0; virtual HRESULT __stdcall add_AutoRepeatModeReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_AutoRepeatModeReceived(event_token token) = 0; virtual HRESULT __stdcall add_PositionReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPositionReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_PositionReceived(event_token token) = 0; virtual HRESULT __stdcall add_RateReceived(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerRateReceivedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_RateReceived(event_token token) = 0; }; struct __declspec(uuid("3d6f4f23-5230-4411-a0e9-bad94c2a045c")) __declspec(novtable) IMediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall get_AutoRepeatMode(winrt::Windows::Media::MediaPlaybackAutoRepeatMode * value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("786c1e78-ce78-4a10-afd6-843fcbb90c2e")) __declspec(novtable) IMediaPlaybackCommandManagerCommandBehavior : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_CommandManager(Windows::Media::Playback::IMediaPlaybackCommandManager ** value) = 0; virtual HRESULT __stdcall get_IsEnabled(bool * value) = 0; virtual HRESULT __stdcall get_EnablingRule(winrt::Windows::Media::Playback::MediaCommandEnablingRule * value) = 0; virtual HRESULT __stdcall put_EnablingRule(winrt::Windows::Media::Playback::MediaCommandEnablingRule value) = 0; virtual HRESULT __stdcall add_IsEnabledChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior, Windows::Foundation::IInspectable> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_IsEnabledChanged(event_token token) = 0; }; struct __declspec(uuid("30f064d9-b491-4d0a-bc21-3098bd1332e9")) __declspec(novtable) IMediaPlaybackCommandManagerFastForwardReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("e1504433-a2b0-45d4-b9de-5f42ac14a839")) __declspec(novtable) IMediaPlaybackCommandManagerNextReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("5ceccd1c-c25c-4221-b16c-c3c98ce012d6")) __declspec(novtable) IMediaPlaybackCommandManagerPauseReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("9af0004e-578b-4c56-a006-16159d888a48")) __declspec(novtable) IMediaPlaybackCommandManagerPlayReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("5591a754-d627-4bdd-a90d-86a015b24902")) __declspec(novtable) IMediaPlaybackCommandManagerPositionReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall get_Position(Windows::Foundation::TimeSpan * value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("525e3081-4632-4f76-99b1-d771623f6287")) __declspec(novtable) IMediaPlaybackCommandManagerPreviousReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("18ea3939-4a16-4169-8b05-3eb9f5ff78eb")) __declspec(novtable) IMediaPlaybackCommandManagerRateReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall get_PlaybackRate(double * value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("9f085947-a3c0-425d-aaef-97ba7898b141")) __declspec(novtable) IMediaPlaybackCommandManagerRewindReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("50a05cef-63ee-4a96-b7b5-fee08b9ff90c")) __declspec(novtable) IMediaPlaybackCommandManagerShuffleReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Handled(bool * value) = 0; virtual HRESULT __stdcall put_Handled(bool value) = 0; virtual HRESULT __stdcall get_IsShuffleRequested(bool * value) = 0; virtual HRESULT __stdcall abi_GetDeferral(Windows::Foundation::IDeferral ** value) = 0; }; struct __declspec(uuid("047097d2-e4af-48ab-b283-6929e674ece2")) __declspec(novtable) IMediaPlaybackItem : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_AudioTracksChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackItem, Windows::Foundation::Collections::IVectorChangedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_AudioTracksChanged(event_token token) = 0; virtual HRESULT __stdcall add_VideoTracksChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackItem, Windows::Foundation::Collections::IVectorChangedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_VideoTracksChanged(event_token token) = 0; virtual HRESULT __stdcall add_TimedMetadataTracksChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackItem, Windows::Foundation::Collections::IVectorChangedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_TimedMetadataTracksChanged(event_token token) = 0; virtual HRESULT __stdcall get_Source(Windows::Media::Core::IMediaSource2 ** value) = 0; virtual HRESULT __stdcall get_AudioTracks(Windows::Foundation::Collections::IVectorView<Windows::Media::Core::AudioTrack> ** value) = 0; virtual HRESULT __stdcall get_VideoTracks(Windows::Foundation::Collections::IVectorView<Windows::Media::Core::VideoTrack> ** value) = 0; virtual HRESULT __stdcall get_TimedMetadataTracks(Windows::Foundation::Collections::IVectorView<Windows::Media::Core::TimedMetadataTrack> ** value) = 0; }; struct __declspec(uuid("d859d171-d7ef-4b81-ac1f-f40493cbb091")) __declspec(novtable) IMediaPlaybackItem2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_BreakSchedule(Windows::Media::Playback::IMediaBreakSchedule ** value) = 0; virtual HRESULT __stdcall get_StartTime(Windows::Foundation::TimeSpan * value) = 0; virtual HRESULT __stdcall get_DurationLimit(Windows::Foundation::IReference<Windows::Foundation::TimeSpan> ** value) = 0; virtual HRESULT __stdcall get_CanSkip(bool * value) = 0; virtual HRESULT __stdcall put_CanSkip(bool value) = 0; virtual HRESULT __stdcall abi_GetDisplayProperties(Windows::Media::Playback::IMediaItemDisplayProperties ** value) = 0; virtual HRESULT __stdcall abi_ApplyDisplayProperties(Windows::Media::Playback::IMediaItemDisplayProperties * value) = 0; }; struct __declspec(uuid("0d328220-b80a-4d09-9ff8-f87094a1c831")) __declspec(novtable) IMediaPlaybackItem3 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_IsDisabledInPlaybackList(bool * value) = 0; virtual HRESULT __stdcall put_IsDisabledInPlaybackList(bool value) = 0; virtual HRESULT __stdcall get_TotalDownloadProgress(double * value) = 0; virtual HRESULT __stdcall get_AutoLoadedDisplayProperties(winrt::Windows::Media::Playback::AutoLoadedDisplayPropertyKind * value) = 0; virtual HRESULT __stdcall put_AutoLoadedDisplayProperties(winrt::Windows::Media::Playback::AutoLoadedDisplayPropertyKind value) = 0; }; struct __declspec(uuid("69fbef2b-dcd6-4df9-a450-dbf4c6f1c2c2")) __declspec(novtable) IMediaPlaybackItemError : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_ErrorCode(winrt::Windows::Media::Playback::MediaPlaybackItemErrorCode * value) = 0; virtual HRESULT __stdcall get_ExtendedError(HRESULT * value) = 0; }; struct __declspec(uuid("7133fce1-1769-4ff9-a7c1-38d2c4d42360")) __declspec(novtable) IMediaPlaybackItemFactory : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_Create(Windows::Media::Core::IMediaSource2 * source, Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; }; struct __declspec(uuid("d77cdf3a-b947-4972-b35d-adfb931a71e6")) __declspec(novtable) IMediaPlaybackItemFactory2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_CreateWithStartTime(Windows::Media::Core::IMediaSource2 * source, Windows::Foundation::TimeSpan startTime, Windows::Media::Playback::IMediaPlaybackItem ** result) = 0; virtual HRESULT __stdcall abi_CreateWithStartTimeAndDurationLimit(Windows::Media::Core::IMediaSource2 * source, Windows::Foundation::TimeSpan startTime, Windows::Foundation::TimeSpan durationLimit, Windows::Media::Playback::IMediaPlaybackItem ** result) = 0; }; struct __declspec(uuid("7703134a-e9a7-47c3-862c-c656d30683d4")) __declspec(novtable) IMediaPlaybackItemFailedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Item(Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; virtual HRESULT __stdcall get_Error(Windows::Media::Playback::IMediaPlaybackItemError ** value) = 0; }; struct __declspec(uuid("cbd9bd82-3037-4fbe-ae8f-39fc39edf4ef")) __declspec(novtable) IMediaPlaybackItemOpenedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Item(Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; }; struct __declspec(uuid("4b1be7f4-4345-403c-8a67-f5de91df4c86")) __declspec(novtable) IMediaPlaybackItemStatics : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_FindFromMediaSource(Windows::Media::Core::IMediaSource2 * source, Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; }; struct __declspec(uuid("7f77ee9c-dc42-4e26-a98d-7850df8ec925")) __declspec(novtable) IMediaPlaybackList : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_ItemFailed(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackList, Windows::Media::Playback::MediaPlaybackItemFailedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_ItemFailed(event_token token) = 0; virtual HRESULT __stdcall add_CurrentItemChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackList, Windows::Media::Playback::CurrentMediaPlaybackItemChangedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_CurrentItemChanged(event_token token) = 0; virtual HRESULT __stdcall add_ItemOpened(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackList, Windows::Media::Playback::MediaPlaybackItemOpenedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_ItemOpened(event_token token) = 0; virtual HRESULT __stdcall get_Items(Windows::Foundation::Collections::IObservableVector<Windows::Media::Playback::MediaPlaybackItem> ** value) = 0; virtual HRESULT __stdcall get_AutoRepeatEnabled(bool * value) = 0; virtual HRESULT __stdcall put_AutoRepeatEnabled(bool value) = 0; virtual HRESULT __stdcall get_ShuffleEnabled(bool * value) = 0; virtual HRESULT __stdcall put_ShuffleEnabled(bool value) = 0; virtual HRESULT __stdcall get_CurrentItem(Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; virtual HRESULT __stdcall get_CurrentItemIndex(uint32_t * value) = 0; virtual HRESULT __stdcall abi_MoveNext(Windows::Media::Playback::IMediaPlaybackItem ** item) = 0; virtual HRESULT __stdcall abi_MovePrevious(Windows::Media::Playback::IMediaPlaybackItem ** item) = 0; virtual HRESULT __stdcall abi_MoveTo(uint32_t itemIndex, Windows::Media::Playback::IMediaPlaybackItem ** item) = 0; }; struct __declspec(uuid("0e09b478-600a-4274-a14b-0b6723d0f48b")) __declspec(novtable) IMediaPlaybackList2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_MaxPrefetchTime(Windows::Foundation::IReference<Windows::Foundation::TimeSpan> ** value) = 0; virtual HRESULT __stdcall put_MaxPrefetchTime(Windows::Foundation::IReference<Windows::Foundation::TimeSpan> * value) = 0; virtual HRESULT __stdcall get_StartingItem(Windows::Media::Playback::IMediaPlaybackItem ** value) = 0; virtual HRESULT __stdcall put_StartingItem(Windows::Media::Playback::IMediaPlaybackItem * value) = 0; virtual HRESULT __stdcall get_ShuffledItems(Windows::Foundation::Collections::IVectorView<Windows::Media::Playback::MediaPlaybackItem> ** value) = 0; virtual HRESULT __stdcall abi_SetShuffledItems(Windows::Foundation::Collections::IIterable<Windows::Media::Playback::MediaPlaybackItem> * value) = 0; }; struct __declspec(uuid("dd24bba9-bc47-4463-aa90-c18b7e5ffde1")) __declspec(novtable) IMediaPlaybackList3 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_MaxPlayedItemsToKeepOpen(Windows::Foundation::IReference<uint32_t> ** value) = 0; virtual HRESULT __stdcall put_MaxPlayedItemsToKeepOpen(Windows::Foundation::IReference<uint32_t> * value) = 0; }; struct __declspec(uuid("c32b683d-0407-41ba-8946-8b345a5a5435")) __declspec(novtable) IMediaPlaybackSession : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_PlaybackStateChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_PlaybackStateChanged(event_token token) = 0; virtual HRESULT __stdcall add_PlaybackRateChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_PlaybackRateChanged(event_token token) = 0; virtual HRESULT __stdcall add_SeekCompleted(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_SeekCompleted(event_token token) = 0; virtual HRESULT __stdcall add_BufferingStarted(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_BufferingStarted(event_token token) = 0; virtual HRESULT __stdcall add_BufferingEnded(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_BufferingEnded(event_token token) = 0; virtual HRESULT __stdcall add_BufferingProgressChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_BufferingProgressChanged(event_token token) = 0; virtual HRESULT __stdcall add_DownloadProgressChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_DownloadProgressChanged(event_token token) = 0; virtual HRESULT __stdcall add_NaturalDurationChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_NaturalDurationChanged(event_token token) = 0; virtual HRESULT __stdcall add_PositionChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_PositionChanged(event_token token) = 0; virtual HRESULT __stdcall add_NaturalVideoSizeChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_NaturalVideoSizeChanged(event_token token) = 0; virtual HRESULT __stdcall get_MediaPlayer(Windows::Media::Playback::IMediaPlayer ** value) = 0; virtual HRESULT __stdcall get_NaturalDuration(Windows::Foundation::TimeSpan * value) = 0; virtual HRESULT __stdcall get_Position(Windows::Foundation::TimeSpan * value) = 0; virtual HRESULT __stdcall put_Position(Windows::Foundation::TimeSpan value) = 0; virtual HRESULT __stdcall get_PlaybackState(winrt::Windows::Media::Playback::MediaPlaybackState * value) = 0; virtual HRESULT __stdcall get_CanSeek(bool * value) = 0; virtual HRESULT __stdcall get_CanPause(bool * value) = 0; virtual HRESULT __stdcall get_IsProtected(bool * value) = 0; virtual HRESULT __stdcall get_PlaybackRate(double * value) = 0; virtual HRESULT __stdcall put_PlaybackRate(double value) = 0; virtual HRESULT __stdcall get_BufferingProgress(double * value) = 0; virtual HRESULT __stdcall get_DownloadProgress(double * value) = 0; virtual HRESULT __stdcall get_NaturalVideoHeight(uint32_t * value) = 0; virtual HRESULT __stdcall get_NaturalVideoWidth(uint32_t * value) = 0; virtual HRESULT __stdcall get_NormalizedSourceRect(Windows::Foundation::Rect * value) = 0; virtual HRESULT __stdcall put_NormalizedSourceRect(Windows::Foundation::Rect value) = 0; virtual HRESULT __stdcall get_StereoscopicVideoPackingMode(winrt::Windows::Media::MediaProperties::StereoscopicVideoPackingMode * value) = 0; virtual HRESULT __stdcall put_StereoscopicVideoPackingMode(winrt::Windows::Media::MediaProperties::StereoscopicVideoPackingMode value) = 0; }; struct __declspec(uuid("f8ba7c79-1fc8-4097-ad70-c0fa18cc0050")) __declspec(novtable) IMediaPlaybackSession2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_BufferedRangesChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_BufferedRangesChanged(event_token token) = 0; virtual HRESULT __stdcall add_PlayedRangesChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_PlayedRangesChanged(event_token token) = 0; virtual HRESULT __stdcall add_SeekableRangesChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_SeekableRangesChanged(event_token token) = 0; virtual HRESULT __stdcall add_SupportedPlaybackRatesChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_SupportedPlaybackRatesChanged(event_token token) = 0; virtual HRESULT __stdcall get_SphericalVideoProjection(Windows::Media::Playback::IMediaPlaybackSphericalVideoProjection ** value) = 0; virtual HRESULT __stdcall get_IsMirroring(bool * value) = 0; virtual HRESULT __stdcall put_IsMirroring(bool value) = 0; virtual HRESULT __stdcall abi_GetBufferedRanges(Windows::Foundation::Collections::IVectorView<Windows::Media::MediaTimeRange> ** value) = 0; virtual HRESULT __stdcall abi_GetPlayedRanges(Windows::Foundation::Collections::IVectorView<Windows::Media::MediaTimeRange> ** value) = 0; virtual HRESULT __stdcall abi_GetSeekableRanges(Windows::Foundation::Collections::IVectorView<Windows::Media::MediaTimeRange> ** value) = 0; virtual HRESULT __stdcall abi_IsSupportedPlaybackRateRange(double rate1, double rate2, bool * value) = 0; }; struct __declspec(uuid("ef9dc2bc-9317-4696-b051-2bad643177b5")) __declspec(novtable) IMediaPlaybackSource : Windows::Foundation::IInspectable { }; struct __declspec(uuid("d405b37c-6f0e-4661-b8ee-d487ba9752d5")) __declspec(novtable) IMediaPlaybackSphericalVideoProjection : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_IsEnabled(bool * value) = 0; virtual HRESULT __stdcall put_IsEnabled(bool value) = 0; virtual HRESULT __stdcall get_FrameFormat(winrt::Windows::Media::MediaProperties::SphericalVideoFrameFormat * value) = 0; virtual HRESULT __stdcall put_FrameFormat(winrt::Windows::Media::MediaProperties::SphericalVideoFrameFormat value) = 0; virtual HRESULT __stdcall get_HorizontalFieldOfViewInDegrees(double * value) = 0; virtual HRESULT __stdcall put_HorizontalFieldOfViewInDegrees(double value) = 0; virtual HRESULT __stdcall get_ViewOrientation(Windows::Foundation::Numerics::quaternion * value) = 0; virtual HRESULT __stdcall put_ViewOrientation(Windows::Foundation::Numerics::quaternion value) = 0; virtual HRESULT __stdcall get_ProjectionMode(winrt::Windows::Media::Playback::SphericalVideoProjectionMode * value) = 0; virtual HRESULT __stdcall put_ProjectionMode(winrt::Windows::Media::Playback::SphericalVideoProjectionMode value) = 0; }; struct __declspec(uuid("72b41319-bbfb-46a3-9372-9c9c744b9438")) __declspec(novtable) IMediaPlaybackTimedMetadataTrackList : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_PresentationModeChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackTimedMetadataTrackList, Windows::Media::Playback::TimedMetadataPresentationModeChangedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_PresentationModeChanged(event_token token) = 0; virtual HRESULT __stdcall abi_GetPresentationMode(uint32_t index, winrt::Windows::Media::Playback::TimedMetadataTrackPresentationMode * value) = 0; virtual HRESULT __stdcall abi_SetPresentationMode(uint32_t index, winrt::Windows::Media::Playback::TimedMetadataTrackPresentationMode value) = 0; }; struct __declspec(uuid("381a83cb-6fff-499b-8d64-2885dfc1249e")) __declspec(novtable) IMediaPlayer : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_AutoPlay(bool * value) = 0; virtual HRESULT __stdcall put_AutoPlay(bool value) = 0; virtual HRESULT __stdcall get_NaturalDuration(Windows::Foundation::TimeSpan * value) = 0; virtual HRESULT __stdcall get_Position(Windows::Foundation::TimeSpan * value) = 0; virtual HRESULT __stdcall put_Position(Windows::Foundation::TimeSpan value) = 0; virtual HRESULT __stdcall get_BufferingProgress(double * value) = 0; virtual HRESULT __stdcall get_CurrentState(winrt::Windows::Media::Playback::MediaPlayerState * value) = 0; virtual HRESULT __stdcall get_CanSeek(bool * value) = 0; virtual HRESULT __stdcall get_CanPause(bool * value) = 0; virtual HRESULT __stdcall get_IsLoopingEnabled(bool * value) = 0; virtual HRESULT __stdcall put_IsLoopingEnabled(bool value) = 0; virtual HRESULT __stdcall get_IsProtected(bool * value) = 0; virtual HRESULT __stdcall get_IsMuted(bool * value) = 0; virtual HRESULT __stdcall put_IsMuted(bool value) = 0; virtual HRESULT __stdcall get_PlaybackRate(double * value) = 0; virtual HRESULT __stdcall put_PlaybackRate(double value) = 0; virtual HRESULT __stdcall get_Volume(double * value) = 0; virtual HRESULT __stdcall put_Volume(double value) = 0; virtual HRESULT __stdcall get_PlaybackMediaMarkers(Windows::Media::Playback::IPlaybackMediaMarkerSequence ** value) = 0; virtual HRESULT __stdcall add_MediaOpened(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_MediaOpened(event_token token) = 0; virtual HRESULT __stdcall add_MediaEnded(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_MediaEnded(event_token token) = 0; virtual HRESULT __stdcall add_MediaFailed(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Media::Playback::MediaPlayerFailedEventArgs> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_MediaFailed(event_token token) = 0; virtual HRESULT __stdcall add_CurrentStateChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_CurrentStateChanged(event_token token) = 0; virtual HRESULT __stdcall add_PlaybackMediaMarkerReached(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Media::Playback::PlaybackMediaMarkerReachedEventArgs> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_PlaybackMediaMarkerReached(event_token token) = 0; virtual HRESULT __stdcall add_MediaPlayerRateChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Media::Playback::MediaPlayerRateChangedEventArgs> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_MediaPlayerRateChanged(event_token token) = 0; virtual HRESULT __stdcall add_VolumeChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_VolumeChanged(event_token token) = 0; virtual HRESULT __stdcall add_SeekCompleted(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_SeekCompleted(event_token token) = 0; virtual HRESULT __stdcall add_BufferingStarted(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_BufferingStarted(event_token token) = 0; virtual HRESULT __stdcall add_BufferingEnded(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_BufferingEnded(event_token token) = 0; virtual HRESULT __stdcall abi_Play() = 0; virtual HRESULT __stdcall abi_Pause() = 0; virtual HRESULT __stdcall abi_SetUriSource(Windows::Foundation::IUriRuntimeClass * value) = 0; }; struct __declspec(uuid("3c841218-2123-4fc5-9082-2f883f77bdf5")) __declspec(novtable) IMediaPlayer2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_SystemMediaTransportControls(Windows::Media::ISystemMediaTransportControls ** value) = 0; virtual HRESULT __stdcall get_AudioCategory(winrt::Windows::Media::Playback::MediaPlayerAudioCategory * value) = 0; virtual HRESULT __stdcall put_AudioCategory(winrt::Windows::Media::Playback::MediaPlayerAudioCategory value) = 0; virtual HRESULT __stdcall get_AudioDeviceType(winrt::Windows::Media::Playback::MediaPlayerAudioDeviceType * value) = 0; virtual HRESULT __stdcall put_AudioDeviceType(winrt::Windows::Media::Playback::MediaPlayerAudioDeviceType value) = 0; }; struct __declspec(uuid("ee0660da-031b-4feb-bd9b-92e0a0a8d299")) __declspec(novtable) IMediaPlayer3 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_IsMutedChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_IsMutedChanged(event_token token) = 0; virtual HRESULT __stdcall add_SourceChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_SourceChanged(event_token token) = 0; virtual HRESULT __stdcall get_AudioBalance(double * value) = 0; virtual HRESULT __stdcall put_AudioBalance(double value) = 0; virtual HRESULT __stdcall get_RealTimePlayback(bool * value) = 0; virtual HRESULT __stdcall put_RealTimePlayback(bool value) = 0; virtual HRESULT __stdcall get_StereoscopicVideoRenderMode(winrt::Windows::Media::Playback::StereoscopicVideoRenderMode * value) = 0; virtual HRESULT __stdcall put_StereoscopicVideoRenderMode(winrt::Windows::Media::Playback::StereoscopicVideoRenderMode value) = 0; virtual HRESULT __stdcall get_BreakManager(Windows::Media::Playback::IMediaBreakManager ** value) = 0; virtual HRESULT __stdcall get_CommandManager(Windows::Media::Playback::IMediaPlaybackCommandManager ** value) = 0; virtual HRESULT __stdcall get_AudioDevice(Windows::Devices::Enumeration::IDeviceInformation ** value) = 0; virtual HRESULT __stdcall put_AudioDevice(Windows::Devices::Enumeration::IDeviceInformation * value) = 0; virtual HRESULT __stdcall get_TimelineController(Windows::Media::IMediaTimelineController ** value) = 0; virtual HRESULT __stdcall put_TimelineController(Windows::Media::IMediaTimelineController * value) = 0; virtual HRESULT __stdcall get_TimelineControllerPositionOffset(Windows::Foundation::TimeSpan * value) = 0; virtual HRESULT __stdcall put_TimelineControllerPositionOffset(Windows::Foundation::TimeSpan value) = 0; virtual HRESULT __stdcall get_PlaybackSession(Windows::Media::Playback::IMediaPlaybackSession ** value) = 0; virtual HRESULT __stdcall abi_StepForwardOneFrame() = 0; virtual HRESULT __stdcall abi_StepBackwardOneFrame() = 0; virtual HRESULT __stdcall abi_GetAsCastingSource(Windows::Media::Casting::ICastingSource ** returnValue) = 0; }; struct __declspec(uuid("80035db0-7448-4770-afcf-2a57450914c5")) __declspec(novtable) IMediaPlayer4 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_SetSurfaceSize(Windows::Foundation::Size size) = 0; virtual HRESULT __stdcall abi_GetSurface(Windows::UI::Composition::ICompositor * compositor, Windows::Media::Playback::IMediaPlayerSurface ** result) = 0; }; struct __declspec(uuid("cfe537fd-f86a-4446-bf4d-c8e792b7b4b3")) __declspec(novtable) IMediaPlayer5 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_VideoFrameAvailable(Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> * value, event_token * token) = 0; virtual HRESULT __stdcall remove_VideoFrameAvailable(event_token token) = 0; virtual HRESULT __stdcall get_IsVideoFrameServerEnabled(bool * value) = 0; virtual HRESULT __stdcall put_IsVideoFrameServerEnabled(bool value) = 0; virtual HRESULT __stdcall abi_CopyFrameToVideoSurface(Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface * destination) = 0; virtual HRESULT __stdcall abi_CopyFrameToVideoSurfaceWithTargetRectangle(Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface * destination, Windows::Foundation::Rect targetRectangle) = 0; virtual HRESULT __stdcall abi_CopyFrameToStereoscopicVideoSurfaces(Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface * destinationLeftEye, Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface * destinationRightEye) = 0; }; struct __declspec(uuid("c75a9405-c801-412a-835b-83fc0e622a8e")) __declspec(novtable) IMediaPlayerDataReceivedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Data(Windows::Foundation::Collections::IPropertySet ** value) = 0; }; struct __declspec(uuid("85a1deda-cab6-4cc0-8be3-6035f4de2591")) __declspec(novtable) IMediaPlayerEffects : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_AddAudioEffect(hstring activatableClassId, bool effectOptional, Windows::Foundation::Collections::IPropertySet * configuration) = 0; virtual HRESULT __stdcall abi_RemoveAllEffects() = 0; }; struct __declspec(uuid("fa419a79-1bbe-46c5-ae1f-8ee69fb3c2c7")) __declspec(novtable) IMediaPlayerEffects2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_AddVideoEffect(hstring activatableClassId, bool effectOptional, Windows::Foundation::Collections::IPropertySet * effectConfiguration) = 0; }; struct __declspec(uuid("2744e9b9-a7e3-4f16-bac4-7914ebc08301")) __declspec(novtable) IMediaPlayerFailedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Error(winrt::Windows::Media::Playback::MediaPlayerError * value) = 0; virtual HRESULT __stdcall get_ExtendedErrorCode(HRESULT * value) = 0; virtual HRESULT __stdcall get_ErrorMessage(hstring * value) = 0; }; struct __declspec(uuid("40600d58-3b61-4bb2-989f-fc65608b6cab")) __declspec(novtable) IMediaPlayerRateChangedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_NewRate(double * value) = 0; }; struct __declspec(uuid("bd4f8897-1423-4c3e-82c5-0fb1af94f715")) __declspec(novtable) IMediaPlayerSource : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_ProtectionManager(Windows::Media::Protection::IMediaProtectionManager ** value) = 0; virtual HRESULT __stdcall put_ProtectionManager(Windows::Media::Protection::IMediaProtectionManager * value) = 0; virtual HRESULT __stdcall abi_SetFileSource(Windows::Storage::IStorageFile * file) = 0; virtual HRESULT __stdcall abi_SetStreamSource(Windows::Storage::Streams::IRandomAccessStream * stream) = 0; virtual HRESULT __stdcall abi_SetMediaSource(Windows::Media::Core::IMediaSource * source) = 0; }; struct __declspec(uuid("82449b9f-7322-4c0b-b03b-3e69a48260c5")) __declspec(novtable) IMediaPlayerSource2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Source(Windows::Media::Playback::IMediaPlaybackSource ** value) = 0; virtual HRESULT __stdcall put_Source(Windows::Media::Playback::IMediaPlaybackSource * value) = 0; }; struct __declspec(uuid("0ed653bc-b736-49c3-830b-764a3845313a")) __declspec(novtable) IMediaPlayerSurface : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_CompositionSurface(Windows::UI::Composition::ICompositionSurface ** value) = 0; virtual HRESULT __stdcall get_Compositor(Windows::UI::Composition::ICompositor ** value) = 0; virtual HRESULT __stdcall get_MediaPlayer(Windows::Media::Playback::IMediaPlayer ** value) = 0; }; struct __declspec(uuid("c4d22f5c-3c1c-4444-b6b9-778b0422d41a")) __declspec(novtable) IPlaybackMediaMarker : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Time(Windows::Foundation::TimeSpan * value) = 0; virtual HRESULT __stdcall get_MediaMarkerType(hstring * value) = 0; virtual HRESULT __stdcall get_Text(hstring * value) = 0; }; struct __declspec(uuid("8c530a78-e0ae-4e1a-a8c8-e23f982a937b")) __declspec(novtable) IPlaybackMediaMarkerFactory : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_CreateFromTime(Windows::Foundation::TimeSpan value, Windows::Media::Playback::IPlaybackMediaMarker ** marker) = 0; virtual HRESULT __stdcall abi_Create(Windows::Foundation::TimeSpan value, hstring mediaMarketType, hstring text, Windows::Media::Playback::IPlaybackMediaMarker ** marker) = 0; }; struct __declspec(uuid("578cd1b9-90e2-4e60-abc4-8740b01f6196")) __declspec(novtable) IPlaybackMediaMarkerReachedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_PlaybackMediaMarker(Windows::Media::Playback::IPlaybackMediaMarker ** value) = 0; }; struct __declspec(uuid("f2810cee-638b-46cf-8817-1d111fe9d8c4")) __declspec(novtable) IPlaybackMediaMarkerSequence : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Size(uint32_t * value) = 0; virtual HRESULT __stdcall abi_Insert(Windows::Media::Playback::IPlaybackMediaMarker * value) = 0; virtual HRESULT __stdcall abi_Clear() = 0; }; struct __declspec(uuid("d1636099-65df-45ae-8cef-dc0b53fdc2bb")) __declspec(novtable) ITimedMetadataPresentationModeChangedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Track(Windows::Media::Core::ITimedMetadataTrack ** value) = 0; virtual HRESULT __stdcall get_OldPresentationMode(winrt::Windows::Media::Playback::TimedMetadataTrackPresentationMode * value) = 0; virtual HRESULT __stdcall get_NewPresentationMode(winrt::Windows::Media::Playback::TimedMetadataTrackPresentationMode * value) = 0; }; } namespace ABI { template <> struct traits<Windows::Media::Playback::CurrentMediaPlaybackItemChangedEventArgs> { using default_interface = Windows::Media::Playback::ICurrentMediaPlaybackItemChangedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaBreak> { using default_interface = Windows::Media::Playback::IMediaBreak; }; template <> struct traits<Windows::Media::Playback::MediaBreakEndedEventArgs> { using default_interface = Windows::Media::Playback::IMediaBreakEndedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaBreakManager> { using default_interface = Windows::Media::Playback::IMediaBreakManager; }; template <> struct traits<Windows::Media::Playback::MediaBreakSchedule> { using default_interface = Windows::Media::Playback::IMediaBreakSchedule; }; template <> struct traits<Windows::Media::Playback::MediaBreakSeekedOverEventArgs> { using default_interface = Windows::Media::Playback::IMediaBreakSeekedOverEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaBreakSkippedEventArgs> { using default_interface = Windows::Media::Playback::IMediaBreakSkippedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaBreakStartedEventArgs> { using default_interface = Windows::Media::Playback::IMediaBreakStartedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaItemDisplayProperties> { using default_interface = Windows::Media::Playback::IMediaItemDisplayProperties; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackAudioTrackList> { using default_interface = Windows::Foundation::Collections::IVectorView<Windows::Media::Core::AudioTrack>; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManager> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManager; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerFastForwardReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerFastForwardReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerNextReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerNextReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerPauseReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerPauseReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerPlayReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerPlayReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerPositionReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerPositionReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerPreviousReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerPreviousReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerRateReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerRateReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerRewindReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerRewindReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerShuffleReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackCommandManagerShuffleReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackItem> { using default_interface = Windows::Media::Playback::IMediaPlaybackItem; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackItemError> { using default_interface = Windows::Media::Playback::IMediaPlaybackItemError; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackItemFailedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackItemFailedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackItemOpenedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlaybackItemOpenedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackList> { using default_interface = Windows::Media::Playback::IMediaPlaybackList; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackSession> { using default_interface = Windows::Media::Playback::IMediaPlaybackSession; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackSphericalVideoProjection> { using default_interface = Windows::Media::Playback::IMediaPlaybackSphericalVideoProjection; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackTimedMetadataTrackList> { using default_interface = Windows::Foundation::Collections::IVectorView<Windows::Media::Core::TimedMetadataTrack>; }; template <> struct traits<Windows::Media::Playback::MediaPlaybackVideoTrackList> { using default_interface = Windows::Foundation::Collections::IVectorView<Windows::Media::Core::VideoTrack>; }; template <> struct traits<Windows::Media::Playback::MediaPlayer> { using default_interface = Windows::Media::Playback::IMediaPlayer; }; template <> struct traits<Windows::Media::Playback::MediaPlayerDataReceivedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlayerDataReceivedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlayerFailedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlayerFailedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlayerRateChangedEventArgs> { using default_interface = Windows::Media::Playback::IMediaPlayerRateChangedEventArgs; }; template <> struct traits<Windows::Media::Playback::MediaPlayerSurface> { using default_interface = Windows::Media::Playback::IMediaPlayerSurface; }; template <> struct traits<Windows::Media::Playback::PlaybackMediaMarker> { using default_interface = Windows::Media::Playback::IPlaybackMediaMarker; }; template <> struct traits<Windows::Media::Playback::PlaybackMediaMarkerReachedEventArgs> { using default_interface = Windows::Media::Playback::IPlaybackMediaMarkerReachedEventArgs; }; template <> struct traits<Windows::Media::Playback::PlaybackMediaMarkerSequence> { using default_interface = Windows::Media::Playback::IPlaybackMediaMarkerSequence; }; template <> struct traits<Windows::Media::Playback::TimedMetadataPresentationModeChangedEventArgs> { using default_interface = Windows::Media::Playback::ITimedMetadataPresentationModeChangedEventArgs; }; } namespace Windows::Media::Playback { template <typename D> struct WINRT_EBO impl_IBackgroundMediaPlayerStatics { [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] Windows::Media::Playback::MediaPlayer Current() const; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] event_token MessageReceivedFromBackground(const Windows::Foundation::EventHandler<Windows::Media::Playback::MediaPlayerDataReceivedEventArgs> & value) const; using MessageReceivedFromBackground_revoker = event_revoker<IBackgroundMediaPlayerStatics>; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] MessageReceivedFromBackground_revoker MessageReceivedFromBackground(auto_revoke_t, const Windows::Foundation::EventHandler<Windows::Media::Playback::MediaPlayerDataReceivedEventArgs> & value) const; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] void MessageReceivedFromBackground(event_token token) const; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] event_token MessageReceivedFromForeground(const Windows::Foundation::EventHandler<Windows::Media::Playback::MediaPlayerDataReceivedEventArgs> & value) const; using MessageReceivedFromForeground_revoker = event_revoker<IBackgroundMediaPlayerStatics>; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] MessageReceivedFromForeground_revoker MessageReceivedFromForeground(auto_revoke_t, const Windows::Foundation::EventHandler<Windows::Media::Playback::MediaPlayerDataReceivedEventArgs> & value) const; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] void MessageReceivedFromForeground(event_token token) const; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] void SendMessageToBackground(const Windows::Foundation::Collections::ValueSet & value) const; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] void SendMessageToForeground(const Windows::Foundation::Collections::ValueSet & value) const; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] bool IsMediaPlaying() const; [[deprecated("Use MediaPlayer instead of BackgroundMediaPlayer. For more info, see MSDN.")]] void Shutdown() const; }; template <typename D> struct WINRT_EBO impl_ICurrentMediaPlaybackItemChangedEventArgs { Windows::Media::Playback::MediaPlaybackItem NewItem() const; Windows::Media::Playback::MediaPlaybackItem OldItem() const; }; template <typename D> struct WINRT_EBO impl_ICurrentMediaPlaybackItemChangedEventArgs2 { Windows::Media::Playback::MediaPlaybackItemChangedReason Reason() const; }; template <typename D> struct WINRT_EBO impl_IMediaBreak { Windows::Media::Playback::MediaPlaybackList PlaybackList() const; Windows::Foundation::IReference<Windows::Foundation::TimeSpan> PresentationPosition() const; Windows::Media::Playback::MediaBreakInsertionMethod InsertionMethod() const; Windows::Foundation::Collections::ValueSet CustomProperties() const; bool CanStart() const; void CanStart(bool value) const; }; template <typename D> struct WINRT_EBO impl_IMediaBreakEndedEventArgs { Windows::Media::Playback::MediaBreak MediaBreak() const; }; template <typename D> struct WINRT_EBO impl_IMediaBreakFactory { Windows::Media::Playback::MediaBreak Create(Windows::Media::Playback::MediaBreakInsertionMethod insertionMethod) const; Windows::Media::Playback::MediaBreak CreateWithPresentationPosition(Windows::Media::Playback::MediaBreakInsertionMethod insertionMethod, const Windows::Foundation::TimeSpan & presentationPosition) const; }; template <typename D> struct WINRT_EBO impl_IMediaBreakManager { event_token BreaksSeekedOver(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakSeekedOverEventArgs> & handler) const; using BreaksSeekedOver_revoker = event_revoker<IMediaBreakManager>; BreaksSeekedOver_revoker BreaksSeekedOver(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakSeekedOverEventArgs> & handler) const; void BreaksSeekedOver(event_token token) const; event_token BreakStarted(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakStartedEventArgs> & handler) const; using BreakStarted_revoker = event_revoker<IMediaBreakManager>; BreakStarted_revoker BreakStarted(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakStartedEventArgs> & handler) const; void BreakStarted(event_token token) const; event_token BreakEnded(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakEndedEventArgs> & handler) const; using BreakEnded_revoker = event_revoker<IMediaBreakManager>; BreakEnded_revoker BreakEnded(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakEndedEventArgs> & handler) const; void BreakEnded(event_token token) const; event_token BreakSkipped(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakSkippedEventArgs> & handler) const; using BreakSkipped_revoker = event_revoker<IMediaBreakManager>; BreakSkipped_revoker BreakSkipped(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakManager, Windows::Media::Playback::MediaBreakSkippedEventArgs> & handler) const; void BreakSkipped(event_token token) const; Windows::Media::Playback::MediaBreak CurrentBreak() const; Windows::Media::Playback::MediaPlaybackSession PlaybackSession() const; void PlayBreak(const Windows::Media::Playback::MediaBreak & value) const; void SkipCurrentBreak() const; }; template <typename D> struct WINRT_EBO impl_IMediaBreakSchedule { event_token ScheduleChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakSchedule, Windows::Foundation::IInspectable> & handler) const; using ScheduleChanged_revoker = event_revoker<IMediaBreakSchedule>; ScheduleChanged_revoker ScheduleChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaBreakSchedule, Windows::Foundation::IInspectable> & handler) const; void ScheduleChanged(event_token token) const; void InsertMidrollBreak(const Windows::Media::Playback::MediaBreak & mediaBreak) const; void RemoveMidrollBreak(const Windows::Media::Playback::MediaBreak & mediaBreak) const; Windows::Foundation::Collections::IVectorView<Windows::Media::Playback::MediaBreak> MidrollBreaks() const; void PrerollBreak(const Windows::Media::Playback::MediaBreak & value) const; Windows::Media::Playback::MediaBreak PrerollBreak() const; void PostrollBreak(const Windows::Media::Playback::MediaBreak & value) const; Windows::Media::Playback::MediaBreak PostrollBreak() const; Windows::Media::Playback::MediaPlaybackItem PlaybackItem() const; }; template <typename D> struct WINRT_EBO impl_IMediaBreakSeekedOverEventArgs { Windows::Foundation::Collections::IVectorView<Windows::Media::Playback::MediaBreak> SeekedOverBreaks() const; Windows::Foundation::TimeSpan OldPosition() const; Windows::Foundation::TimeSpan NewPosition() const; }; template <typename D> struct WINRT_EBO impl_IMediaBreakSkippedEventArgs { Windows::Media::Playback::MediaBreak MediaBreak() const; }; template <typename D> struct WINRT_EBO impl_IMediaBreakStartedEventArgs { Windows::Media::Playback::MediaBreak MediaBreak() const; }; template <typename D> struct WINRT_EBO impl_IMediaEnginePlaybackSource { [[deprecated("Use MediaPlayer instead of MediaEngine. For more info, see MSDN.")]] Windows::Media::Playback::MediaPlaybackItem CurrentItem() const; [[deprecated("Use MediaPlayer instead of MediaEngine. For more info, see MSDN.")]] void SetPlaybackSource(const Windows::Media::Playback::IMediaPlaybackSource & source) const; }; template <typename D> struct WINRT_EBO impl_IMediaItemDisplayProperties { Windows::Media::MediaPlaybackType Type() const; void Type(Windows::Media::MediaPlaybackType value) const; Windows::Media::MusicDisplayProperties MusicProperties() const; Windows::Media::VideoDisplayProperties VideoProperties() const; Windows::Storage::Streams::RandomAccessStreamReference Thumbnail() const; void Thumbnail(const Windows::Storage::Streams::RandomAccessStreamReference & value) const; void ClearAll() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManager { bool IsEnabled() const; void IsEnabled(bool value) const; Windows::Media::Playback::MediaPlayer MediaPlayer() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior PlayBehavior() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior PauseBehavior() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior NextBehavior() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior PreviousBehavior() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior FastForwardBehavior() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior RewindBehavior() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior ShuffleBehavior() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior AutoRepeatModeBehavior() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior PositionBehavior() const; Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior RateBehavior() const; event_token PlayReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPlayReceivedEventArgs> & handler) const; using PlayReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; PlayReceived_revoker PlayReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPlayReceivedEventArgs> & handler) const; void PlayReceived(event_token token) const; event_token PauseReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPauseReceivedEventArgs> & handler) const; using PauseReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; PauseReceived_revoker PauseReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPauseReceivedEventArgs> & handler) const; void PauseReceived(event_token token) const; event_token NextReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerNextReceivedEventArgs> & handler) const; using NextReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; NextReceived_revoker NextReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerNextReceivedEventArgs> & handler) const; void NextReceived(event_token token) const; event_token PreviousReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPreviousReceivedEventArgs> & handler) const; using PreviousReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; PreviousReceived_revoker PreviousReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPreviousReceivedEventArgs> & handler) const; void PreviousReceived(event_token token) const; event_token FastForwardReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerFastForwardReceivedEventArgs> & handler) const; using FastForwardReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; FastForwardReceived_revoker FastForwardReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerFastForwardReceivedEventArgs> & handler) const; void FastForwardReceived(event_token token) const; event_token RewindReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerRewindReceivedEventArgs> & handler) const; using RewindReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; RewindReceived_revoker RewindReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerRewindReceivedEventArgs> & handler) const; void RewindReceived(event_token token) const; event_token ShuffleReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerShuffleReceivedEventArgs> & handler) const; using ShuffleReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; ShuffleReceived_revoker ShuffleReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerShuffleReceivedEventArgs> & handler) const; void ShuffleReceived(event_token token) const; event_token AutoRepeatModeReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs> & handler) const; using AutoRepeatModeReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; AutoRepeatModeReceived_revoker AutoRepeatModeReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs> & handler) const; void AutoRepeatModeReceived(event_token token) const; event_token PositionReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPositionReceivedEventArgs> & handler) const; using PositionReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; PositionReceived_revoker PositionReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerPositionReceivedEventArgs> & handler) const; void PositionReceived(event_token token) const; event_token RateReceived(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerRateReceivedEventArgs> & handler) const; using RateReceived_revoker = event_revoker<IMediaPlaybackCommandManager>; RateReceived_revoker RateReceived(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManager, Windows::Media::Playback::MediaPlaybackCommandManagerRateReceivedEventArgs> & handler) const; void RateReceived(event_token token) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs { bool Handled() const; void Handled(bool value) const; Windows::Media::MediaPlaybackAutoRepeatMode AutoRepeatMode() const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerCommandBehavior { Windows::Media::Playback::MediaPlaybackCommandManager CommandManager() const; bool IsEnabled() const; Windows::Media::Playback::MediaCommandEnablingRule EnablingRule() const; void EnablingRule(Windows::Media::Playback::MediaCommandEnablingRule value) const; event_token IsEnabledChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior, Windows::Foundation::IInspectable> & handler) const; using IsEnabledChanged_revoker = event_revoker<IMediaPlaybackCommandManagerCommandBehavior>; IsEnabledChanged_revoker IsEnabledChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior, Windows::Foundation::IInspectable> & handler) const; void IsEnabledChanged(event_token token) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerFastForwardReceivedEventArgs { bool Handled() const; void Handled(bool value) const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerNextReceivedEventArgs { bool Handled() const; void Handled(bool value) const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerPauseReceivedEventArgs { bool Handled() const; void Handled(bool value) const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerPlayReceivedEventArgs { bool Handled() const; void Handled(bool value) const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerPositionReceivedEventArgs { bool Handled() const; void Handled(bool value) const; Windows::Foundation::TimeSpan Position() const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerPreviousReceivedEventArgs { bool Handled() const; void Handled(bool value) const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerRateReceivedEventArgs { bool Handled() const; void Handled(bool value) const; double PlaybackRate() const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerRewindReceivedEventArgs { bool Handled() const; void Handled(bool value) const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackCommandManagerShuffleReceivedEventArgs { bool Handled() const; void Handled(bool value) const; bool IsShuffleRequested() const; Windows::Foundation::Deferral GetDeferral() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackItem { event_token AudioTracksChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackItem, Windows::Foundation::Collections::IVectorChangedEventArgs> & handler) const; using AudioTracksChanged_revoker = event_revoker<IMediaPlaybackItem>; AudioTracksChanged_revoker AudioTracksChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackItem, Windows::Foundation::Collections::IVectorChangedEventArgs> & handler) const; void AudioTracksChanged(event_token token) const; event_token VideoTracksChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackItem, Windows::Foundation::Collections::IVectorChangedEventArgs> & handler) const; using VideoTracksChanged_revoker = event_revoker<IMediaPlaybackItem>; VideoTracksChanged_revoker VideoTracksChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackItem, Windows::Foundation::Collections::IVectorChangedEventArgs> & handler) const; void VideoTracksChanged(event_token token) const; event_token TimedMetadataTracksChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackItem, Windows::Foundation::Collections::IVectorChangedEventArgs> & handler) const; using TimedMetadataTracksChanged_revoker = event_revoker<IMediaPlaybackItem>; TimedMetadataTracksChanged_revoker TimedMetadataTracksChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackItem, Windows::Foundation::Collections::IVectorChangedEventArgs> & handler) const; void TimedMetadataTracksChanged(event_token token) const; Windows::Media::Core::MediaSource Source() const; Windows::Media::Playback::MediaPlaybackAudioTrackList AudioTracks() const; Windows::Media::Playback::MediaPlaybackVideoTrackList VideoTracks() const; Windows::Media::Playback::MediaPlaybackTimedMetadataTrackList TimedMetadataTracks() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackItem2 { Windows::Media::Playback::MediaBreakSchedule BreakSchedule() const; Windows::Foundation::TimeSpan StartTime() const; Windows::Foundation::IReference<Windows::Foundation::TimeSpan> DurationLimit() const; bool CanSkip() const; void CanSkip(bool value) const; Windows::Media::Playback::MediaItemDisplayProperties GetDisplayProperties() const; void ApplyDisplayProperties(const Windows::Media::Playback::MediaItemDisplayProperties & value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackItem3 { bool IsDisabledInPlaybackList() const; void IsDisabledInPlaybackList(bool value) const; double TotalDownloadProgress() const; Windows::Media::Playback::AutoLoadedDisplayPropertyKind AutoLoadedDisplayProperties() const; void AutoLoadedDisplayProperties(Windows::Media::Playback::AutoLoadedDisplayPropertyKind value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackItemError { Windows::Media::Playback::MediaPlaybackItemErrorCode ErrorCode() const; HRESULT ExtendedError() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackItemFactory { Windows::Media::Playback::MediaPlaybackItem Create(const Windows::Media::Core::MediaSource & source) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackItemFactory2 { Windows::Media::Playback::MediaPlaybackItem CreateWithStartTime(const Windows::Media::Core::MediaSource & source, const Windows::Foundation::TimeSpan & startTime) const; Windows::Media::Playback::MediaPlaybackItem CreateWithStartTimeAndDurationLimit(const Windows::Media::Core::MediaSource & source, const Windows::Foundation::TimeSpan & startTime, const Windows::Foundation::TimeSpan & durationLimit) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackItemFailedEventArgs { Windows::Media::Playback::MediaPlaybackItem Item() const; Windows::Media::Playback::MediaPlaybackItemError Error() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackItemOpenedEventArgs { Windows::Media::Playback::MediaPlaybackItem Item() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackItemStatics { Windows::Media::Playback::MediaPlaybackItem FindFromMediaSource(const Windows::Media::Core::MediaSource & source) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackList { event_token ItemFailed(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackList, Windows::Media::Playback::MediaPlaybackItemFailedEventArgs> & handler) const; using ItemFailed_revoker = event_revoker<IMediaPlaybackList>; ItemFailed_revoker ItemFailed(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackList, Windows::Media::Playback::MediaPlaybackItemFailedEventArgs> & handler) const; void ItemFailed(event_token token) const; event_token CurrentItemChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackList, Windows::Media::Playback::CurrentMediaPlaybackItemChangedEventArgs> & handler) const; using CurrentItemChanged_revoker = event_revoker<IMediaPlaybackList>; CurrentItemChanged_revoker CurrentItemChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackList, Windows::Media::Playback::CurrentMediaPlaybackItemChangedEventArgs> & handler) const; void CurrentItemChanged(event_token token) const; event_token ItemOpened(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackList, Windows::Media::Playback::MediaPlaybackItemOpenedEventArgs> & handler) const; using ItemOpened_revoker = event_revoker<IMediaPlaybackList>; ItemOpened_revoker ItemOpened(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackList, Windows::Media::Playback::MediaPlaybackItemOpenedEventArgs> & handler) const; void ItemOpened(event_token token) const; Windows::Foundation::Collections::IObservableVector<Windows::Media::Playback::MediaPlaybackItem> Items() const; bool AutoRepeatEnabled() const; void AutoRepeatEnabled(bool value) const; bool ShuffleEnabled() const; void ShuffleEnabled(bool value) const; Windows::Media::Playback::MediaPlaybackItem CurrentItem() const; uint32_t CurrentItemIndex() const; Windows::Media::Playback::MediaPlaybackItem MoveNext() const; Windows::Media::Playback::MediaPlaybackItem MovePrevious() const; Windows::Media::Playback::MediaPlaybackItem MoveTo(uint32_t itemIndex) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackList2 { Windows::Foundation::IReference<Windows::Foundation::TimeSpan> MaxPrefetchTime() const; void MaxPrefetchTime(const optional<Windows::Foundation::TimeSpan> & value) const; Windows::Media::Playback::MediaPlaybackItem StartingItem() const; void StartingItem(const Windows::Media::Playback::MediaPlaybackItem & value) const; Windows::Foundation::Collections::IVectorView<Windows::Media::Playback::MediaPlaybackItem> ShuffledItems() const; void SetShuffledItems(iterable<Windows::Media::Playback::MediaPlaybackItem> value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackList3 { Windows::Foundation::IReference<uint32_t> MaxPlayedItemsToKeepOpen() const; void MaxPlayedItemsToKeepOpen(const optional<uint32_t> & value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackSession { event_token PlaybackStateChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using PlaybackStateChanged_revoker = event_revoker<IMediaPlaybackSession>; PlaybackStateChanged_revoker PlaybackStateChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void PlaybackStateChanged(event_token token) const; event_token PlaybackRateChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using PlaybackRateChanged_revoker = event_revoker<IMediaPlaybackSession>; PlaybackRateChanged_revoker PlaybackRateChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void PlaybackRateChanged(event_token token) const; event_token SeekCompleted(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using SeekCompleted_revoker = event_revoker<IMediaPlaybackSession>; SeekCompleted_revoker SeekCompleted(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void SeekCompleted(event_token token) const; event_token BufferingStarted(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using BufferingStarted_revoker = event_revoker<IMediaPlaybackSession>; BufferingStarted_revoker BufferingStarted(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void BufferingStarted(event_token token) const; event_token BufferingEnded(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using BufferingEnded_revoker = event_revoker<IMediaPlaybackSession>; BufferingEnded_revoker BufferingEnded(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void BufferingEnded(event_token token) const; event_token BufferingProgressChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using BufferingProgressChanged_revoker = event_revoker<IMediaPlaybackSession>; BufferingProgressChanged_revoker BufferingProgressChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void BufferingProgressChanged(event_token token) const; event_token DownloadProgressChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using DownloadProgressChanged_revoker = event_revoker<IMediaPlaybackSession>; DownloadProgressChanged_revoker DownloadProgressChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void DownloadProgressChanged(event_token token) const; event_token NaturalDurationChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using NaturalDurationChanged_revoker = event_revoker<IMediaPlaybackSession>; NaturalDurationChanged_revoker NaturalDurationChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void NaturalDurationChanged(event_token token) const; event_token PositionChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using PositionChanged_revoker = event_revoker<IMediaPlaybackSession>; PositionChanged_revoker PositionChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void PositionChanged(event_token token) const; event_token NaturalVideoSizeChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using NaturalVideoSizeChanged_revoker = event_revoker<IMediaPlaybackSession>; NaturalVideoSizeChanged_revoker NaturalVideoSizeChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void NaturalVideoSizeChanged(event_token token) const; Windows::Media::Playback::MediaPlayer MediaPlayer() const; Windows::Foundation::TimeSpan NaturalDuration() const; Windows::Foundation::TimeSpan Position() const; void Position(const Windows::Foundation::TimeSpan & value) const; Windows::Media::Playback::MediaPlaybackState PlaybackState() const; bool CanSeek() const; bool CanPause() const; bool IsProtected() const; double PlaybackRate() const; void PlaybackRate(double value) const; double BufferingProgress() const; double DownloadProgress() const; uint32_t NaturalVideoHeight() const; uint32_t NaturalVideoWidth() const; Windows::Foundation::Rect NormalizedSourceRect() const; void NormalizedSourceRect(const Windows::Foundation::Rect & value) const; Windows::Media::MediaProperties::StereoscopicVideoPackingMode StereoscopicVideoPackingMode() const; void StereoscopicVideoPackingMode(Windows::Media::MediaProperties::StereoscopicVideoPackingMode value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackSession2 { event_token BufferedRangesChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using BufferedRangesChanged_revoker = event_revoker<IMediaPlaybackSession2>; BufferedRangesChanged_revoker BufferedRangesChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void BufferedRangesChanged(event_token token) const; event_token PlayedRangesChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using PlayedRangesChanged_revoker = event_revoker<IMediaPlaybackSession2>; PlayedRangesChanged_revoker PlayedRangesChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void PlayedRangesChanged(event_token token) const; event_token SeekableRangesChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using SeekableRangesChanged_revoker = event_revoker<IMediaPlaybackSession2>; SeekableRangesChanged_revoker SeekableRangesChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void SeekableRangesChanged(event_token token) const; event_token SupportedPlaybackRatesChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; using SupportedPlaybackRatesChanged_revoker = event_revoker<IMediaPlaybackSession2>; SupportedPlaybackRatesChanged_revoker SupportedPlaybackRatesChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackSession, Windows::Foundation::IInspectable> & value) const; void SupportedPlaybackRatesChanged(event_token token) const; Windows::Media::Playback::MediaPlaybackSphericalVideoProjection SphericalVideoProjection() const; bool IsMirroring() const; void IsMirroring(bool value) const; Windows::Foundation::Collections::IVectorView<Windows::Media::MediaTimeRange> GetBufferedRanges() const; Windows::Foundation::Collections::IVectorView<Windows::Media::MediaTimeRange> GetPlayedRanges() const; Windows::Foundation::Collections::IVectorView<Windows::Media::MediaTimeRange> GetSeekableRanges() const; bool IsSupportedPlaybackRateRange(double rate1, double rate2) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackSource { }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackSphericalVideoProjection { bool IsEnabled() const; void IsEnabled(bool value) const; Windows::Media::MediaProperties::SphericalVideoFrameFormat FrameFormat() const; void FrameFormat(Windows::Media::MediaProperties::SphericalVideoFrameFormat value) const; double HorizontalFieldOfViewInDegrees() const; void HorizontalFieldOfViewInDegrees(double value) const; Windows::Foundation::Numerics::quaternion ViewOrientation() const; void ViewOrientation(const Windows::Foundation::Numerics::quaternion & value) const; Windows::Media::Playback::SphericalVideoProjectionMode ProjectionMode() const; void ProjectionMode(Windows::Media::Playback::SphericalVideoProjectionMode value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlaybackTimedMetadataTrackList { event_token PresentationModeChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackTimedMetadataTrackList, Windows::Media::Playback::TimedMetadataPresentationModeChangedEventArgs> & handler) const; using PresentationModeChanged_revoker = event_revoker<IMediaPlaybackTimedMetadataTrackList>; PresentationModeChanged_revoker PresentationModeChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlaybackTimedMetadataTrackList, Windows::Media::Playback::TimedMetadataPresentationModeChangedEventArgs> & handler) const; void PresentationModeChanged(event_token token) const; Windows::Media::Playback::TimedMetadataTrackPresentationMode GetPresentationMode(uint32_t index) const; void SetPresentationMode(uint32_t index, Windows::Media::Playback::TimedMetadataTrackPresentationMode value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayer { bool AutoPlay() const; void AutoPlay(bool value) const; [[deprecated("Use PlaybackSession.NaturalDuration instead of NaturalDuration. For more info, see MSDN.")]] Windows::Foundation::TimeSpan NaturalDuration() const; [[deprecated("Use PlaybackSession.Position instead of Position. For more info, see MSDN.")]] Windows::Foundation::TimeSpan Position() const; [[deprecated("Use PlaybackSession.Position instead of Position. For more info, see MSDN.")]] void Position(const Windows::Foundation::TimeSpan & value) const; [[deprecated("Use PlaybackSession.BufferingProgress instead of BufferingProgress. For more info, see MSDN.")]] double BufferingProgress() const; [[deprecated("Use PlaybackSession.State instead of CurrentState. For more info, see MSDN.")]] Windows::Media::Playback::MediaPlayerState CurrentState() const; [[deprecated("Use PlaybackSession.CanSeek instead of CanSeek. For more info, see MSDN.")]] bool CanSeek() const; [[deprecated("Use PlaybackSession.CanPause instead of CanPause. For more info, see MSDN.")]] bool CanPause() const; bool IsLoopingEnabled() const; void IsLoopingEnabled(bool value) const; [[deprecated("Use PlaybackSession.IsProtected instead of IsProtected. For more info, see MSDN.")]] bool IsProtected() const; bool IsMuted() const; void IsMuted(bool value) const; [[deprecated("Use PlaybackSession.PlaybackRate instead of PlaybackRate. For more info, see MSDN.")]] double PlaybackRate() const; [[deprecated("Use PlaybackSession.PlaybackRate instead of PlaybackRate. For more info, see MSDN.")]] void PlaybackRate(double value) const; double Volume() const; void Volume(double value) const; [[deprecated("Use media tracks on MediaPlaybackItem instead of PlaybackMediaMarkers. For more info, see MSDN.")]] Windows::Media::Playback::PlaybackMediaMarkerSequence PlaybackMediaMarkers() const; event_token MediaOpened(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using MediaOpened_revoker = event_revoker<IMediaPlayer>; MediaOpened_revoker MediaOpened(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; void MediaOpened(event_token token) const; event_token MediaEnded(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using MediaEnded_revoker = event_revoker<IMediaPlayer>; MediaEnded_revoker MediaEnded(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; void MediaEnded(event_token token) const; event_token MediaFailed(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Media::Playback::MediaPlayerFailedEventArgs> & value) const; using MediaFailed_revoker = event_revoker<IMediaPlayer>; MediaFailed_revoker MediaFailed(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Media::Playback::MediaPlayerFailedEventArgs> & value) const; void MediaFailed(event_token token) const; [[deprecated("Use PlaybackSession.PlaybackStateChanged instead of CurrentStateChanged. For more info, see MSDN.")]] event_token CurrentStateChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using CurrentStateChanged_revoker = event_revoker<IMediaPlayer>; [[deprecated("Use PlaybackSession.PlaybackStateChanged instead of CurrentStateChanged. For more info, see MSDN.")]] CurrentStateChanged_revoker CurrentStateChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; [[deprecated("Use PlaybackSession.PlaybackStateChanged instead of CurrentStateChanged. For more info, see MSDN.")]] void CurrentStateChanged(event_token token) const; [[deprecated("Use media tracks on MediaPlaybackItem instead of PlaybackMediaMarkers. For more info, see MSDN.")]] event_token PlaybackMediaMarkerReached(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Media::Playback::PlaybackMediaMarkerReachedEventArgs> & value) const; using PlaybackMediaMarkerReached_revoker = event_revoker<IMediaPlayer>; [[deprecated("Use media tracks on MediaPlaybackItem instead of PlaybackMediaMarkers. For more info, see MSDN.")]] PlaybackMediaMarkerReached_revoker PlaybackMediaMarkerReached(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Media::Playback::PlaybackMediaMarkerReachedEventArgs> & value) const; [[deprecated("Use media tracks on MediaPlaybackItem instead of PlaybackMediaMarkers. For more info, see MSDN.")]] void PlaybackMediaMarkerReached(event_token token) const; [[deprecated("Use PlaybackSession.PlaybackRateChanged instead of MediaPlayerRateChanged. For more info, see MSDN.")]] event_token MediaPlayerRateChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Media::Playback::MediaPlayerRateChangedEventArgs> & value) const; using MediaPlayerRateChanged_revoker = event_revoker<IMediaPlayer>; [[deprecated("Use PlaybackSession.PlaybackRateChanged instead of MediaPlayerRateChanged. For more info, see MSDN.")]] MediaPlayerRateChanged_revoker MediaPlayerRateChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Media::Playback::MediaPlayerRateChangedEventArgs> & value) const; [[deprecated("Use PlaybackSession.PlaybackRateChanged instead of MediaPlayerRateChanged. For more info, see MSDN.")]] void MediaPlayerRateChanged(event_token token) const; event_token VolumeChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using VolumeChanged_revoker = event_revoker<IMediaPlayer>; VolumeChanged_revoker VolumeChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; void VolumeChanged(event_token token) const; [[deprecated("Use PlaybackSession.SeekCompleted instead of SeekCompleted. For more info, see MSDN.")]] event_token SeekCompleted(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using SeekCompleted_revoker = event_revoker<IMediaPlayer>; [[deprecated("Use PlaybackSession.SeekCompleted instead of SeekCompleted. For more info, see MSDN.")]] SeekCompleted_revoker SeekCompleted(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; [[deprecated("Use PlaybackSession.SeekCompleted instead of SeekCompleted. For more info, see MSDN.")]] void SeekCompleted(event_token token) const; [[deprecated("Use PlaybackSession.BufferingStarted instead of BufferingStarted. For more info, see MSDN.")]] event_token BufferingStarted(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using BufferingStarted_revoker = event_revoker<IMediaPlayer>; [[deprecated("Use PlaybackSession.BufferingStarted instead of BufferingStarted. For more info, see MSDN.")]] BufferingStarted_revoker BufferingStarted(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; [[deprecated("Use PlaybackSession.BufferingStarted instead of BufferingStarted. For more info, see MSDN.")]] void BufferingStarted(event_token token) const; [[deprecated("Use PlaybackSession.BufferingEnded instead of BufferingEnded. For more info, see MSDN.")]] event_token BufferingEnded(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using BufferingEnded_revoker = event_revoker<IMediaPlayer>; [[deprecated("Use PlaybackSession.BufferingEnded instead of BufferingEnded. For more info, see MSDN.")]] BufferingEnded_revoker BufferingEnded(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; [[deprecated("Use PlaybackSession.BufferingEnded instead of BufferingEnded. For more info, see MSDN.")]] void BufferingEnded(event_token token) const; void Play() const; void Pause() const; [[deprecated("Use Source instead of SetUriSource. For more info, see MSDN.")]] void SetUriSource(const Windows::Foundation::Uri & value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayer2 { Windows::Media::SystemMediaTransportControls SystemMediaTransportControls() const; Windows::Media::Playback::MediaPlayerAudioCategory AudioCategory() const; void AudioCategory(Windows::Media::Playback::MediaPlayerAudioCategory value) const; Windows::Media::Playback::MediaPlayerAudioDeviceType AudioDeviceType() const; void AudioDeviceType(Windows::Media::Playback::MediaPlayerAudioDeviceType value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayer3 { event_token IsMutedChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using IsMutedChanged_revoker = event_revoker<IMediaPlayer3>; IsMutedChanged_revoker IsMutedChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; void IsMutedChanged(event_token token) const; event_token SourceChanged(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using SourceChanged_revoker = event_revoker<IMediaPlayer3>; SourceChanged_revoker SourceChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; void SourceChanged(event_token token) const; double AudioBalance() const; void AudioBalance(double value) const; bool RealTimePlayback() const; void RealTimePlayback(bool value) const; Windows::Media::Playback::StereoscopicVideoRenderMode StereoscopicVideoRenderMode() const; void StereoscopicVideoRenderMode(Windows::Media::Playback::StereoscopicVideoRenderMode value) const; Windows::Media::Playback::MediaBreakManager BreakManager() const; Windows::Media::Playback::MediaPlaybackCommandManager CommandManager() const; Windows::Devices::Enumeration::DeviceInformation AudioDevice() const; void AudioDevice(const Windows::Devices::Enumeration::DeviceInformation & value) const; Windows::Media::MediaTimelineController TimelineController() const; void TimelineController(const Windows::Media::MediaTimelineController & value) const; Windows::Foundation::TimeSpan TimelineControllerPositionOffset() const; void TimelineControllerPositionOffset(const Windows::Foundation::TimeSpan & value) const; Windows::Media::Playback::MediaPlaybackSession PlaybackSession() const; void StepForwardOneFrame() const; void StepBackwardOneFrame() const; Windows::Media::Casting::CastingSource GetAsCastingSource() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayer4 { void SetSurfaceSize(const Windows::Foundation::Size & size) const; Windows::Media::Playback::MediaPlayerSurface GetSurface(const Windows::UI::Composition::Compositor & compositor) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayer5 { event_token VideoFrameAvailable(const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; using VideoFrameAvailable_revoker = event_revoker<IMediaPlayer5>; VideoFrameAvailable_revoker VideoFrameAvailable(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::Media::Playback::MediaPlayer, Windows::Foundation::IInspectable> & value) const; void VideoFrameAvailable(event_token token) const; bool IsVideoFrameServerEnabled() const; void IsVideoFrameServerEnabled(bool value) const; void CopyFrameToVideoSurface(const Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface & destination) const; void CopyFrameToVideoSurface(const Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface & destination, const Windows::Foundation::Rect & targetRectangle) const; void CopyFrameToStereoscopicVideoSurfaces(const Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface & destinationLeftEye, const Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface & destinationRightEye) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayerDataReceivedEventArgs { Windows::Foundation::Collections::ValueSet Data() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayerEffects { void AddAudioEffect(hstring_view activatableClassId, bool effectOptional, const Windows::Foundation::Collections::IPropertySet & configuration) const; void RemoveAllEffects() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayerEffects2 { void AddVideoEffect(hstring_view activatableClassId, bool effectOptional, const Windows::Foundation::Collections::IPropertySet & effectConfiguration) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayerFailedEventArgs { Windows::Media::Playback::MediaPlayerError Error() const; HRESULT ExtendedErrorCode() const; hstring ErrorMessage() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayerRateChangedEventArgs { double NewRate() const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayerSource { Windows::Media::Protection::MediaProtectionManager ProtectionManager() const; void ProtectionManager(const Windows::Media::Protection::MediaProtectionManager & value) const; [[deprecated("Use Source instead of SetFileSource. For more info, see MSDN.")]] void SetFileSource(const Windows::Storage::IStorageFile & file) const; [[deprecated("Use Source instead of SetStreamSource. For more info, see MSDN.")]] void SetStreamSource(const Windows::Storage::Streams::IRandomAccessStream & stream) const; [[deprecated("Use Source instead of SetMediaSource. For more info, see MSDN.")]] void SetMediaSource(const Windows::Media::Core::IMediaSource & source) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayerSource2 { Windows::Media::Playback::IMediaPlaybackSource Source() const; void Source(const Windows::Media::Playback::IMediaPlaybackSource & value) const; }; template <typename D> struct WINRT_EBO impl_IMediaPlayerSurface { Windows::UI::Composition::ICompositionSurface CompositionSurface() const; Windows::UI::Composition::Compositor Compositor() const; Windows::Media::Playback::MediaPlayer MediaPlayer() const; }; template <typename D> struct WINRT_EBO impl_IPlaybackMediaMarker { Windows::Foundation::TimeSpan Time() const; hstring MediaMarkerType() const; hstring Text() const; }; template <typename D> struct WINRT_EBO impl_IPlaybackMediaMarkerFactory { Windows::Media::Playback::PlaybackMediaMarker CreateFromTime(const Windows::Foundation::TimeSpan & value) const; Windows::Media::Playback::PlaybackMediaMarker Create(const Windows::Foundation::TimeSpan & value, hstring_view mediaMarketType, hstring_view text) const; }; template <typename D> struct WINRT_EBO impl_IPlaybackMediaMarkerReachedEventArgs { Windows::Media::Playback::PlaybackMediaMarker PlaybackMediaMarker() const; }; template <typename D> struct WINRT_EBO impl_IPlaybackMediaMarkerSequence { uint32_t Size() const; void Insert(const Windows::Media::Playback::PlaybackMediaMarker & value) const; void Clear() const; }; template <typename D> struct WINRT_EBO impl_ITimedMetadataPresentationModeChangedEventArgs { Windows::Media::Core::TimedMetadataTrack Track() const; Windows::Media::Playback::TimedMetadataTrackPresentationMode OldPresentationMode() const; Windows::Media::Playback::TimedMetadataTrackPresentationMode NewPresentationMode() const; }; } namespace impl { template <> struct traits<Windows::Media::Playback::IBackgroundMediaPlayerStatics> { using abi = ABI::Windows::Media::Playback::IBackgroundMediaPlayerStatics; template <typename D> using consume = Windows::Media::Playback::impl_IBackgroundMediaPlayerStatics<D>; }; template <> struct traits<Windows::Media::Playback::ICurrentMediaPlaybackItemChangedEventArgs> { using abi = ABI::Windows::Media::Playback::ICurrentMediaPlaybackItemChangedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_ICurrentMediaPlaybackItemChangedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::ICurrentMediaPlaybackItemChangedEventArgs2> { using abi = ABI::Windows::Media::Playback::ICurrentMediaPlaybackItemChangedEventArgs2; template <typename D> using consume = Windows::Media::Playback::impl_ICurrentMediaPlaybackItemChangedEventArgs2<D>; }; template <> struct traits<Windows::Media::Playback::IMediaBreak> { using abi = ABI::Windows::Media::Playback::IMediaBreak; template <typename D> using consume = Windows::Media::Playback::impl_IMediaBreak<D>; }; template <> struct traits<Windows::Media::Playback::IMediaBreakEndedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaBreakEndedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaBreakEndedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaBreakFactory> { using abi = ABI::Windows::Media::Playback::IMediaBreakFactory; template <typename D> using consume = Windows::Media::Playback::impl_IMediaBreakFactory<D>; }; template <> struct traits<Windows::Media::Playback::IMediaBreakManager> { using abi = ABI::Windows::Media::Playback::IMediaBreakManager; template <typename D> using consume = Windows::Media::Playback::impl_IMediaBreakManager<D>; }; template <> struct traits<Windows::Media::Playback::IMediaBreakSchedule> { using abi = ABI::Windows::Media::Playback::IMediaBreakSchedule; template <typename D> using consume = Windows::Media::Playback::impl_IMediaBreakSchedule<D>; }; template <> struct traits<Windows::Media::Playback::IMediaBreakSeekedOverEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaBreakSeekedOverEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaBreakSeekedOverEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaBreakSkippedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaBreakSkippedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaBreakSkippedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaBreakStartedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaBreakStartedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaBreakStartedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaEnginePlaybackSource> { using abi = ABI::Windows::Media::Playback::IMediaEnginePlaybackSource; template <typename D> using consume = Windows::Media::Playback::impl_IMediaEnginePlaybackSource<D>; }; template <> struct traits<Windows::Media::Playback::IMediaItemDisplayProperties> { using abi = ABI::Windows::Media::Playback::IMediaItemDisplayProperties; template <typename D> using consume = Windows::Media::Playback::impl_IMediaItemDisplayProperties<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManager> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManager; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManager<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerCommandBehavior; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerCommandBehavior<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerFastForwardReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerFastForwardReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerFastForwardReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerNextReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerNextReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerNextReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerPauseReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerPauseReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerPauseReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerPlayReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerPlayReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerPlayReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerPositionReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerPositionReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerPositionReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerPreviousReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerPreviousReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerPreviousReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerRateReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerRateReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerRateReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerRewindReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerRewindReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerRewindReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackCommandManagerShuffleReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackCommandManagerShuffleReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackCommandManagerShuffleReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackItem> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackItem; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackItem<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackItem2> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackItem2; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackItem2<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackItem3> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackItem3; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackItem3<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackItemError> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackItemError; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackItemError<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackItemFactory> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackItemFactory; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackItemFactory<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackItemFactory2> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackItemFactory2; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackItemFactory2<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackItemFailedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackItemFailedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackItemFailedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackItemOpenedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackItemOpenedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackItemOpenedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackItemStatics> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackItemStatics; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackItemStatics<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackList> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackList; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackList<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackList2> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackList2; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackList2<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackList3> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackList3; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackList3<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackSession> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackSession; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackSession<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackSession2> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackSession2; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackSession2<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackSource> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackSource; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackSource<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackSphericalVideoProjection> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackSphericalVideoProjection; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackSphericalVideoProjection<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlaybackTimedMetadataTrackList> { using abi = ABI::Windows::Media::Playback::IMediaPlaybackTimedMetadataTrackList; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlaybackTimedMetadataTrackList<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayer> { using abi = ABI::Windows::Media::Playback::IMediaPlayer; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayer<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayer2> { using abi = ABI::Windows::Media::Playback::IMediaPlayer2; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayer2<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayer3> { using abi = ABI::Windows::Media::Playback::IMediaPlayer3; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayer3<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayer4> { using abi = ABI::Windows::Media::Playback::IMediaPlayer4; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayer4<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayer5> { using abi = ABI::Windows::Media::Playback::IMediaPlayer5; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayer5<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayerDataReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlayerDataReceivedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayerDataReceivedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayerEffects> { using abi = ABI::Windows::Media::Playback::IMediaPlayerEffects; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayerEffects<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayerEffects2> { using abi = ABI::Windows::Media::Playback::IMediaPlayerEffects2; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayerEffects2<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayerFailedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlayerFailedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayerFailedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayerRateChangedEventArgs> { using abi = ABI::Windows::Media::Playback::IMediaPlayerRateChangedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayerRateChangedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayerSource> { using abi = ABI::Windows::Media::Playback::IMediaPlayerSource; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayerSource<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayerSource2> { using abi = ABI::Windows::Media::Playback::IMediaPlayerSource2; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayerSource2<D>; }; template <> struct traits<Windows::Media::Playback::IMediaPlayerSurface> { using abi = ABI::Windows::Media::Playback::IMediaPlayerSurface; template <typename D> using consume = Windows::Media::Playback::impl_IMediaPlayerSurface<D>; }; template <> struct traits<Windows::Media::Playback::IPlaybackMediaMarker> { using abi = ABI::Windows::Media::Playback::IPlaybackMediaMarker; template <typename D> using consume = Windows::Media::Playback::impl_IPlaybackMediaMarker<D>; }; template <> struct traits<Windows::Media::Playback::IPlaybackMediaMarkerFactory> { using abi = ABI::Windows::Media::Playback::IPlaybackMediaMarkerFactory; template <typename D> using consume = Windows::Media::Playback::impl_IPlaybackMediaMarkerFactory<D>; }; template <> struct traits<Windows::Media::Playback::IPlaybackMediaMarkerReachedEventArgs> { using abi = ABI::Windows::Media::Playback::IPlaybackMediaMarkerReachedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_IPlaybackMediaMarkerReachedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::IPlaybackMediaMarkerSequence> { using abi = ABI::Windows::Media::Playback::IPlaybackMediaMarkerSequence; template <typename D> using consume = Windows::Media::Playback::impl_IPlaybackMediaMarkerSequence<D>; }; template <> struct traits<Windows::Media::Playback::ITimedMetadataPresentationModeChangedEventArgs> { using abi = ABI::Windows::Media::Playback::ITimedMetadataPresentationModeChangedEventArgs; template <typename D> using consume = Windows::Media::Playback::impl_ITimedMetadataPresentationModeChangedEventArgs<D>; }; template <> struct traits<Windows::Media::Playback::BackgroundMediaPlayer> { static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.BackgroundMediaPlayer"; } }; template <> struct traits<Windows::Media::Playback::CurrentMediaPlaybackItemChangedEventArgs> { using abi = ABI::Windows::Media::Playback::CurrentMediaPlaybackItemChangedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.CurrentMediaPlaybackItemChangedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaBreak> { using abi = ABI::Windows::Media::Playback::MediaBreak; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaBreak"; } }; template <> struct traits<Windows::Media::Playback::MediaBreakEndedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaBreakEndedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaBreakEndedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaBreakManager> { using abi = ABI::Windows::Media::Playback::MediaBreakManager; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaBreakManager"; } }; template <> struct traits<Windows::Media::Playback::MediaBreakSchedule> { using abi = ABI::Windows::Media::Playback::MediaBreakSchedule; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaBreakSchedule"; } }; template <> struct traits<Windows::Media::Playback::MediaBreakSeekedOverEventArgs> { using abi = ABI::Windows::Media::Playback::MediaBreakSeekedOverEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaBreakSeekedOverEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaBreakSkippedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaBreakSkippedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaBreakSkippedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaBreakStartedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaBreakStartedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaBreakStartedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaItemDisplayProperties> { using abi = ABI::Windows::Media::Playback::MediaItemDisplayProperties; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaItemDisplayProperties"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackAudioTrackList> { using abi = ABI::Windows::Media::Playback::MediaPlaybackAudioTrackList; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackAudioTrackList"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManager> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManager; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManager"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerAutoRepeatModeReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerCommandBehavior; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerCommandBehavior"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerFastForwardReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerFastForwardReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerFastForwardReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerNextReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerNextReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerNextReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerPauseReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerPauseReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerPauseReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerPlayReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerPlayReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerPlayReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerPositionReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerPositionReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerPositionReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerPreviousReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerPreviousReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerPreviousReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerRateReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerRateReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerRateReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerRewindReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerRewindReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerRewindReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackCommandManagerShuffleReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackCommandManagerShuffleReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackCommandManagerShuffleReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackItem> { using abi = ABI::Windows::Media::Playback::MediaPlaybackItem; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackItem"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackItemError> { using abi = ABI::Windows::Media::Playback::MediaPlaybackItemError; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackItemError"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackItemFailedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackItemFailedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackItemFailedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackItemOpenedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlaybackItemOpenedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackItemOpenedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackList> { using abi = ABI::Windows::Media::Playback::MediaPlaybackList; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackList"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackSession> { using abi = ABI::Windows::Media::Playback::MediaPlaybackSession; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackSession"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackSphericalVideoProjection> { using abi = ABI::Windows::Media::Playback::MediaPlaybackSphericalVideoProjection; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackSphericalVideoProjection"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackTimedMetadataTrackList> { using abi = ABI::Windows::Media::Playback::MediaPlaybackTimedMetadataTrackList; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackTimedMetadataTrackList"; } }; template <> struct traits<Windows::Media::Playback::MediaPlaybackVideoTrackList> { using abi = ABI::Windows::Media::Playback::MediaPlaybackVideoTrackList; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlaybackVideoTrackList"; } }; template <> struct traits<Windows::Media::Playback::MediaPlayer> { using abi = ABI::Windows::Media::Playback::MediaPlayer; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlayer"; } }; template <> struct traits<Windows::Media::Playback::MediaPlayerDataReceivedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlayerDataReceivedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlayerDataReceivedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlayerFailedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlayerFailedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlayerFailedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlayerRateChangedEventArgs> { using abi = ABI::Windows::Media::Playback::MediaPlayerRateChangedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlayerRateChangedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::MediaPlayerSurface> { using abi = ABI::Windows::Media::Playback::MediaPlayerSurface; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.MediaPlayerSurface"; } }; template <> struct traits<Windows::Media::Playback::PlaybackMediaMarker> { using abi = ABI::Windows::Media::Playback::PlaybackMediaMarker; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.PlaybackMediaMarker"; } }; template <> struct traits<Windows::Media::Playback::PlaybackMediaMarkerReachedEventArgs> { using abi = ABI::Windows::Media::Playback::PlaybackMediaMarkerReachedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.PlaybackMediaMarkerReachedEventArgs"; } }; template <> struct traits<Windows::Media::Playback::PlaybackMediaMarkerSequence> { using abi = ABI::Windows::Media::Playback::PlaybackMediaMarkerSequence; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.PlaybackMediaMarkerSequence"; } }; template <> struct traits<Windows::Media::Playback::TimedMetadataPresentationModeChangedEventArgs> { using abi = ABI::Windows::Media::Playback::TimedMetadataPresentationModeChangedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.Media.Playback.TimedMetadataPresentationModeChangedEventArgs"; } }; } }
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "instruction_set_features_arm64.h" #include <gtest/gtest.h> namespace art { TEST(Arm64InstructionSetFeaturesTest, Arm64Features) { // Build features for an ARM64 processor. std::string error_msg; std::unique_ptr<const InstructionSetFeatures> arm64_default_features( InstructionSetFeatures::FromVariant(kArm64, "default", &error_msg)); ASSERT_TRUE(arm64_default_features.get() != nullptr) << error_msg; EXPECT_EQ(arm64_default_features->GetInstructionSet(), kArm64); EXPECT_TRUE(arm64_default_features->Equals(arm64_features.get())); EXPECT_STREQ("a53", arm64_default_features->GetFeatureString().c_str()); EXPECT_STREQ("a53,-crc", arm64_default_features->GetFeatureString().c_str()); EXPECT_EQ(arm64_default_features->AsBitmap(), 1U); std::unique_ptr<const InstructionSetFeatures> cortex_a57_features( InstructionSetFeatures::FromVariant(kArm64, "cortex-a57", &error_msg)); ASSERT_TRUE(cortex_a57_features.get() != nullptr) << error_msg; EXPECT_EQ(cortex_a57_features->GetInstructionSet(), kArm64); EXPECT_TRUE(cortex_a57_features->Equals(cortex_a57_features.get())); EXPECT_FALSE(cortex_a57_features->AsArm64InstructionSetFeatures()->HasCRC32Instruction()); EXPECT_STREQ("a53,-crc", cortex_a57_features->GetFeatureString().c_str()); EXPECT_EQ(cortex_a57_features->AsBitmap(), 1U); std::unique_ptr<const Arm64InstructionSetFeatures> cortex_a57_crc_features( Arm64InstructionSetFeatures::FromVariant("cortex-a57", "armv8.1-a", &error_msg)); ASSERT_TRUE(cortex_a57_crc_features.get() != nullptr) << error_msg; EXPECT_EQ(cortex_a57_crc_features->GetInstructionSet(), InstructionSet::kArm64); EXPECT_TRUE(cortex_a57_crc_features->Equals(cortex_a57_crc_features.get())); EXPECT_TRUE(cortex_a57_crc_features->AsArm64InstructionSetFeatures()->HasCRC32Instruction()); EXPECT_STREQ("a53,crc", cortex_a57_crc_features->GetFeatureString().c_str()); EXPECT_EQ(cortex_a57_crc_features->AsBitmap(), 3U); std::unique_ptr<const InstructionSetFeatures> cortex_a73_features( InstructionSetFeatures::FromVariant(kArm64, "cortex-a73", &error_msg)); ASSERT_TRUE(cortex_a73_features.get() != nullptr) << error_msg; EXPECT_EQ(cortex_a73_features->GetInstructionSet(), kArm64); EXPECT_TRUE(cortex_a73_features->Equals(cortex_a73_features.get())); EXPECT_STREQ("a53,-crc", cortex_a73_features->GetFeatureString().c_str()); EXPECT_EQ(cortex_a73_features->AsBitmap(), 1U); std::unique_ptr<const Arm64InstructionSetFeatures> cortex_a73_crc_features( Arm64InstructionSetFeatures::FromVariant("cortex-a73", "armv8.1-a", &error_msg)); ASSERT_TRUE(cortex_a73_crc_features.get() != nullptr) << error_msg; EXPECT_EQ(cortex_a73_crc_features->GetInstructionSet(), InstructionSet::kArm64); EXPECT_TRUE(cortex_a73_crc_features->Equals(cortex_a73_crc_features.get())); EXPECT_TRUE(cortex_a73_crc_features->AsArm64InstructionSetFeatures()->HasCRC32Instruction()); EXPECT_STREQ("a53,crc", cortex_a73_crc_features->GetFeatureString().c_str()); EXPECT_EQ(cortex_a73_crc_features->AsBitmap(), 3U); std::unique_ptr<const InstructionSetFeatures> cortex_a35_features( InstructionSetFeatures::FromVariant(kArm64, "cortex-a35", &error_msg)); ASSERT_TRUE(cortex_a35_features.get() != nullptr) << error_msg; EXPECT_EQ(cortex_a35_features->GetInstructionSet(), kArm64); EXPECT_TRUE(cortex_a35_features->Equals(cortex_a35_features.get())); EXPECT_STREQ("-a53,-crc", cortex_a35_features->GetFeatureString().c_str()); EXPECT_EQ(cortex_a35_features->AsBitmap(), 0U); std::unique_ptr<const Arm64InstructionSetFeatures> cortex_a35_crc_features( Arm64InstructionSetFeatures::FromVariant("cortex-a35", "armv8.1-a", &error_msg)); ASSERT_TRUE(cortex_a35_crc_features.get() != nullptr) << error_msg; EXPECT_EQ(cortex_a35_crc_features->GetInstructionSet(), InstructionSet::kArm64); EXPECT_TRUE(cortex_a35_crc_features->Equals(cortex_a35_crc_features.get())); EXPECT_TRUE(cortex_a35_crc_features->AsArm64InstructionSetFeatures()->HasCRC32Instruction()); EXPECT_STREQ("a53,crc", cortex_a35_crc_features->GetFeatureString().c_str()); EXPECT_EQ(cortex_a35_crc_features->AsBitmap(), 3U); std::unique_ptr<const InstructionSetFeatures> kryo_features( InstructionSetFeatures::FromVariant(kArm64, "kryo", &error_msg)); ASSERT_TRUE(kryo_features.get() != nullptr) << error_msg; EXPECT_EQ(kryo_features->GetInstructionSet(), kArm64); EXPECT_TRUE(kryo_features->Equals(kryo_features.get())); EXPECT_TRUE(kryo_features->Equals(cortex_a35_features.get())); EXPECT_FALSE(kryo_features->Equals(cortex_a57_features.get())); EXPECT_STREQ("-a53,-crc", kryo_features->GetFeatureString().c_str()); EXPECT_EQ(kryo_features->AsBitmap(), 0U); } } // namespace art
#include <iostream> //#define cin ios::sync_with_stdio(false); cin using namespace std; typedef unsigned long long ll; ll qmi(int m, int k, int p) { int res = 1 % p, t = m; while (k) { if (k&1) res = res * t % p; t = t * t % p; k >>= 1; } return res; } int main(){ ll m, k, p; m = 2; p = 100000; while (cin >> k) { ll ans = qmi(m, k, p); cout << ans << '\n'; } return 0; }
//#include <iostream> //#include <string> //#include <vector> //#include <algorithm> //#include <sstream> //using namespace std; // //int n; // //int sig(vector<char> &v, string s) //{ // int p; // int k = -1; // bool first = true; // for(int i = 0; i < s.size(); i++) // { // if(s[i] != '0' && s[i] != '.' && first) // { // p = i; // first = false; // } // if(s[i] == '.') // k = i; // } // if(k == -1) k = s.size(); // for(int j = p; j < s.size() && j < n; j++) // { // if(s[j] != '.') // v.push_back(s[j]); // } // if(k - p < 0) return k - p + 1; // else return k - p; //} // //bool equalv(vector<char> &v1, vector<char> &v2) //{ // if(v1.size() != v2.size()) return false; // for(int i = 0; i < v1.size(); i++) // if(v1[i] != v2[i]) // return false; // return true; //} // //void printv(vector<char> &v, int cof) //{ // cout<<" 0."; // for(int i = 0; i < v.size(); i++) // cout<<v[i]; // if(v.size() < n) // for(int j = 0; j < v.size() - n; j++) // cout<<'0'; // cout<<"*10^"<<cof; //} // //int main() //{ //// freopen("a.txt", "r", stdin); // string s1, s2; // cin>>n; // cin>>s1>>s2; // vector<char> v1, v2; // // int cof1 = sig(v1, s1); // int cof2 = sig(v2, s2); // bool flag = true; // if(cof1 != cof2 || !equalv(v1, v2)) // { // cout<<"NO"; // flag = false; // } // else cout<<"YES"; // printv(v1, cof1); // if(!flag) printv(v2, cof2); // cout<<endl; // return 0; //} /* test 6 3 0.00 00.00 test 3 3 0.1 0.001 0.001=0.1*10^-2 pay 前导0 不同格式的0 */ #include<iostream> #include<stdio.h> #include<string.h> using namespace std; char a[105],b[105]; struct num { char s[105]; int k; }x,y; struct num getn(char a[],int n) { int na=strlen(a),i,j=na,k=na,t,flag=0; struct num x; memset(x.s,'0',n*sizeof(char)); x.s[n]='\0'; for(i=0;i<na;i++) { if(a[i]>'0'&&a[i]<='9'&&!flag) { j=i; flag=1; } if(a[i]=='.')k=i; } // printf("%d %d\n",j,k); if(j==na) { x.k=0; } else { t=0; for(i=j;i<na&&t<n;i++) if(i!=k)x.s[t++]=a[i]; if(k>j)x.k=k-j; else x.k=k-j+1; } //printf("%s %d\n",x.s,x.k); return x; } void deal(char a[],char b[],int n) { x=getn(a,n); y=getn(b,n); if(!strcmp(x.s,y.s)&&x.k==y.k)printf("YES 0.%s*10^%d\n",x.s,x.k); else printf("NO 0.%s*10^%d 0.%s*10^%d\n",x.s,x.k,y.s,y.k); } int main() { int na,nb,i,n,t,flag; while(scanf("%d%s%s",&n,a,b)!=EOF) { deal(a,b,n); } return 0; }
/* * File: Eventos2.cpp * Author: Leonardo * * Created on 11 de Agosto de 2015, 09:16 */ #include "Eventos2.h" Eventos2::Eventos2(const Eventos2& orig) { } Eventos2::~Eventos2() { }
#include <iostream> #include <SFML/Graphics.hpp> #include <SFML/Window.hpp> #include "Game.h" Game::Game(unsigned int screen_width, unsigned int screen_height) { menu = std::make_unique<Menu>(screen_width, screen_height); gameplay = std::make_unique<Gameplay>(); } void Game::doAction(sf::RenderWindow& window) { if (view == 0) { view = menu->displayMenu(window,event); } if (view == 1) { view = gameplay->displayGame(window,event); } if (view == 3) { window.close(); } } void Game::mainLoop(sf::RenderWindow& window) { while (window.isOpen()) { window.clear(sf::Color::White); doAction(window); window.display(); } }
#include <cstdio> #include <cstring> #include <algorithm> #include <iostream> using namespace std; const int N = 15015; char a[N]; int k,lena,fail[N],g[N],ans = 0; int main() { scanf("%s",a); scanf("%d",&k); lena = strlen(a); for(int i = 0 ; i < lena-2*k ; ++i) { fail[i] = i-1; int t = i-1; for(int j = i + 1 ; j < lena ; ++j) { while(t!=i-1 && a[t+1]!=a[j]) t = fail[t]; if(a[t+1]==a[j]) t++; fail[j] = t; g[j] = t; if(g[j]>=0 && g[g[j]]-i+1>=k) g[j] = g[g[j]]; int len = g[j]-i+1; if(len>=k&&g[j]+len+1<=j) ans++; } } cout << ans << endl; }
#include <type_traits> template<typename... Types> struct typelist { template <typename T> static constexpr bool includes(T) { return std::disjunction<std::is_same<T, Types>...>::value ; } template <typename... T> static constexpr bool includes(typelist<T...>) { return (includes (T{}) && ...) ; } template <typename T> using contains = std::integral_constant<bool, includes(T{})>; static constexpr bool unique() { auto l = [](auto head, auto... tail) { if constexpr (sizeof... (tail) == 0) return true ; else return not typelist<decltype(tail)...>::includes (head) && typelist<decltype(tail)...>::unique () ; }; return l(Types{}...) ; } }; int main() { using t1 = typelist<int, double>; using t2 = typelist<double, int>; using t3 = typelist<int, double, char>; static_assert(t1::includes (int{})); static_assert(not t1::includes (float{})); static_assert(t1::includes (t2{})); static_assert(t2::includes (t1{})); static_assert(t3::includes (t2{})); static_assert(not t2::includes (t3{})); static_assert(t1::contains<int>::value); static_assert(t3::contains<t2>::value); static_assert(not t3::contains<float>::value); static_assert(not t2::contains<t3>::value); static_assert(typelist<int, double>::unique ()); static_assert(not typelist<int, double, int>::unique ()); static_assert(typelist<char, double, int>::unique ()); static_assert(not typelist<char, char, double, int>::unique ()); static_assert(typelist<char, float, double, int>::unique ()); static_assert(not typelist<char, float, char, int>::unique ()); }
#ifndef LIBNDGPP_ALGORITHM_ACCUMULATE_HPP #define LIBNDGPP_ALGORITHM_ACCUMULATE_HPP #include <cstddef> #include <cstdint> namespace ndgpp { /** Accumulates the value of each parameter * * @tparam Args The types of each parameter to accumulate * * @param args The parameters to accummulate * * @return The sum of args */ template <class ... Args> constexpr decltype(auto) accumulate(Args&& ... args); } #include "detail/accumulate.hpp" #endif
#include<cstdio> #include<iostream> using namespace std; int n; char str[200005]; int main() { int n; while(~scanf("%d",&n)) { cin >> str; int sum[5] = {0}; for(int i = 0; i < n; i++) { if(str[i] == 'x') sum[0]++; else if(str[i] == 't' && sum[1] < sum[0]) sum[1]++; else if(str[i] == 'C' && sum[2] < sum[1]) sum[2]++; else if(str[i] == 'p' && sum[3] < sum[2]) sum[3]++; else if(str[i] == 'c' && sum[4] < sum[3]) sum[4]++; } int res = n+1; for(int i = 0; i < 5; i++) { if(res > sum[i]) res = sum[i]; } cout << res << endl; } return 0; }
#pragma once #include "slice.h" #include "aecollection.h" #include "hitset.h" #include "minmax_map.h" #include "utilites/foreach.hpp" namespace data { ////////////////////////////////////////////////////////////////////////// struct ae_layer { /** * use_index_ = true - если используем индексы, то массив индексов предоставляет порядок и * количество адресуемых запией * use_index_ = false - если не используем индексы, то доступ используется * непосредственно к хранимым в хранилище значениям */ bool use_index; /** * массив используемых индексов */ std::vector<unsigned> indexes; /** * коллекция, из которой извлекаются данные */ const ae_collection *master; }; /** * @brief реализует доступ к ае данным. * * сами данные должны храниться в @ref ae_collection, доступ к ним происходит * либо напрямую либо через набор индексов, что позволяет сортировать и * отфильтровывать данные. */ class ae_slice : public slice { public: ae_slice() : contains_subhits_(0) { } /** * @brief срезка создается на основе коллекции * @param coll коллекция * @param indexes список индексов */ ae_slice(const ae_collection *coll, const std::vector<unsigned> &indexes=std::vector<unsigned>() ) : contains_subhits_(0) { layers_.resize(1); layers_[0].use_index = !indexes.empty(); layers_[0].indexes = indexes; layers_[0].master = coll; init_map(); } /** * данные текущей срезки создаются на основе указанной */ void set_source(pslice parent_slice) { ae_slice *parent=dynamic_cast<ae_slice *>(parent_slice.get()); set_source(parent); } void set_source(ae_slice const* parent) { assert(parent); layers_=parent->layers_; minmax_map_.merge(parent->get_minmax_map()); if (parent->contains_subhits_) mark_as_subhit_slice(); init_map(); } /** * данные текущей срезки создаются на основе указанной, * с учетом массива индексов. */ void set_indexed_source(pslice parent_slice, const std::vector<unsigned> &indexes) { set_source(parent_slice); set_indexes(indexes); } void set_indexes(const std::vector<unsigned> &indexes) { if (indexes.size()) { // последний индекс не ссылается за пределы родительского диапазона assert(indexes[indexes.size()-1] < size()); } foreach(ae_layer &la, layers_) { la.use_index=true; bool modify = !la.indexes.empty(); std::vector<unsigned> new_la(indexes.size()); for (unsigned j=0; j<indexes.size(); ++j) { if (modify) new_la[j] = la.indexes[ indexes[j] ]; else new_la[j] = indexes[j]; assert(new_la[j] < la.master->size()); } std::swap(new_la, la.indexes); } } void add_layer(ae_collection* col, const std::vector<unsigned>& indexes = std::vector<unsigned>()) { assert(col); #ifndef NDEBUG if (layers_.size()) if (indexes.size()) assert(indexes.size() == size()); else assert(col->size() == size()); if (indexes.size()) assert(indexes[indexes.size()-1] < col->size()); #endif for(unsigned index=0; index < indexes.size(); ++index) { assert(indexes[index] < col->size() ); } layers_.push_back( ae_layer() ); layers_.back().master = col; layers_.back().use_index = indexes.size() > 0; layers_.back().indexes = indexes; init_map(); } /** * заполняем вектор @ref ae_slice::map_, т.е. создаем * ускорительные индексы переменных используемых внутри срезки. * в массив попадают только используемые типы переменных, * а при необходимости также данные локации */ void init_map() { map_index idx; idx.layer = -1; map_.resize(256, idx); std::vector<aera::chars> common; foreach(ae_layer &la, layers_) { ++idx.layer; la.master->get_typestring(common); for (unsigned index=0; index<common.size(); ++index) { idx.index = index; map_[ static_cast<int>(common[index]) ]=idx; } } } /** * создаем точную копию срезки */ pslice clone() const { ae_slice* newby= new ae_slice; newby->set_source( this ); return pslice(newby); } // overriden slice functions virtual unsigned get_subhit_count(unsigned index) const { return static_cast<unsigned>( get_value(index, aera::C_SubHitCount) + get_value(index, aera::C_IgnoredHitCount)); } virtual hits::hitref get_subhit(unsigned index, unsigned subindex) const { const double* subhit = &get_value(index, aera::C_FirstSubHit); return hits::hitref(subhit + subindex * 2); } /** * возвращает имя переменной по ее типу */ std::string get_unit_name(aera::chars c) const { return aera::traits::get_unit_name(c); } /** * количество записей, содержащихся в срезке */ unsigned size() const { return layers_.empty() ? 0 : layers_[0].use_index ? layers_[0].indexes.size() : layers_[0].master->size(); } static const double& nan() { static double nan[] = { std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN() }; return nan[0]; } /** * @brief возвращает значение переменной хранимой в срезке по указателю на запись * @param index номер записи * @param typ тип запрашиваемой переменной * @param channe l (для ae_slice не используется) */ const double &get_value(unsigned index, aera::chars typ, int channel=0) const { const map_index idx = map_[ static_cast<int>(typ) ]; if (idx.layer >= layers_.size()) { return nan(); } ae_layer const &la = layers_[idx.layer]; if (la.use_index) { assert(index<la.indexes.size()); index = la.indexes[index]; } const double* record =la.master->get_record(index); return record[idx.index]; } /** * возвращает тип срезки */ int get_type(unsigned index) const { return contains_subhits_ ? AE_SUBHITS : AE; } void mark_as_subhit_slice() { contains_subhits_ = true; } /** * @brief возвращает список переменных по которым есть данные */ std::vector<aera::chars> get_chars() const { std::vector<aera::chars> result, temp; foreach(ae_layer const &la, layers_) { la.master->get_typestring(temp); result.insert( result.end(), STL_II(temp) ); } return result; } protected: /** * иногда создается срезках для вторичных хитов */ bool contains_subhits_; /** * ускоритель доступа, хранит индексы типов переменных */ struct map_index { unsigned layer:16; unsigned index:16; }; std::vector<map_index> map_; std::vector<ae_layer> layers_; }; inline pae_slice clone_ae(pslice slice) { return boost::dynamic_pointer_cast<data::ae_slice>(slice->clone()); } inline pae_slice slice::clone_ae() const { return data::clone_ae(clone()); } ////////////////////////////////////////////////////////////////////////// }
#pragma once #include <QMap> #include <QDate> #include <QList> #include <QString> #include <QDataStream> uint qHash(const QDate &date); struct Student { QString name; // subject -> (date -> data) QMap<QString, QMap<QDate, QString> > data; }; typedef QList<Student> StudentList; QDataStream &operator>>(QDataStream &in, Student &student); QDataStream &operator<<(QDataStream &out, const Student &student);
#ifndef READDATAOPENFOAM_H #define READDATAOPENFOAM_H #include "global_define.h" #include "qstring.h" #include "qtimer.h" #include "ReadData_Base.h" #include "vtkOpenFOAMReader.h" #include "vtkUnstructuredGrid.h" #include "vtkPointData.h" #include "vtkStructuredGrid.h" #include "vtkDataSet.h" #include "vtkDataArray.h" #include "vtkRectilinearGrid.h" #include "vtkUnstructuredGrid.h" class ReadData_OpenFoam :public ReadData_Base { public: bool Read(QString tep_filename) override; ReadData_OpenFoam(); ~ReadData_OpenFoam(); private: vtkOpenFOAMReader* mOpenFoamReader; }; #endif // HEUDATAREADVTK_H
#include<bits/stdc++.h> using namespace std; #define ll long long int main() { ll m,n,k; while(cin>>n) cout<<(6* n* (n+1) /2 ) +1<<endl; }
/*! * * \file TWebForm.h * \author peng.John * \date 2010.11.20 * \brief 描述信息窗口 * * \ref CopyRight */ #ifndef __TDESFORM_H__ #define __TDESFORM_H__ #include "TG3.h" #include "TCOM_TBrowser_WebPanel.h" //#include "TCOM_TBrowser_WebClient_EventHandler.h" /** 描述信息窗口 * */ class TWebForm : public TWindow { public: TWebForm(TApplication * pApp, const TUChar* in_pszTitle, const char* in_pszURL); virtual ~TWebForm(void); virtual Boolean EventHandler(TApplication * pApp, EventType * pEvent); Boolean _OnWinInitEvent(TApplication * pApp, EventType * pEvent); Boolean _OnCtlSelectEvent(TApplication * pApp, EventType * pEvent); void SetText(const TUChar* pszTitle, const char* pURL, const char* pDes); private: TUChar* pszTitle; char* pszURL; Int32 m_BackBtn; TBrowser::TCOM_WebClient_Interface* m_pWebPanelTComObj; TBrowser::TWebPanel* m_pWebPanel; }; #endif // __TDESFORM_H__
#include <thread> #include <chrono> #include "gtest/gtest.h" #include "reduction_space_a.h" #include "disp_engine_reduction.h" using namespace std; const int64_t kColCount = 1024*1024*1024; const int64_t kCacheSize = 32*1024;//32*1024; //4*1024*1024; const int kRepeat = 1; class ReductionSpaceSum : public AReductionSpaceBase<ReductionSpaceSum, int64_t>{ public: const int64_t kMyLocalCount = 5; int64_t *my_local = nullptr; ReductionSpaceSum() : AReductionSpaceBase(1, 1) { my_local = new int64_t[kMyLocalCount]; }; void Reduce(MirroredRegionBareBase<int64_t> &input){ auto &reduction_objs = reduction_objects(); for(int j=0; j<kRepeat; j++) for(int64_t i=0; i<input.count(); i++) reduction_objs[0][0] = reduction_objs[0][0] + input[i]; }; virtual void LocalSynchWith(ReductionSpaceSum &input_reduction_space) { std::chrono::milliseconds timespan(1000); std::this_thread::sleep_for(timespan); auto &ri = input_reduction_space.reduction_objects(); auto &ro = (this->reduction_objects()); if(ri.num_rows()!=ro.num_rows() || ri.num_cols()!=ro.num_cols()) throw std::range_error("Local and destination reduction objects have different dimension sizes!"); for(int i=0; i<ro.num_rows(); i++) for(int j=0; j<ro.num_cols(); j++) ro[i][j] += ri[i][j]; }; // Deep copy void CopyTo(ReductionSpaceSum &target){ copy(my_local, my_local+kMyLocalCount, target.my_local); }; ~ReductionSpaceSum(){ delete my_local; }; }; class DISPEngineTest : public testing::Test { protected: static ReductionSpaceSum *reduction_space; static ADataRegion<int64_t> *input; /// Before running the test case static void SetUpTestCase(){ reduction_space = new ReductionSpaceSum(); auto &reduction_objs = reduction_space->reduction_objects(); int64_t init_val = 0; reduction_objs.SetAllItems(init_val); input = new DataRegionBareBase<int64_t>(kColCount); uint64_t total=0; for(int64_t i=0; i<kColCount; i++){ (*input)[i] = i; total+=i; } cout << "Total orig=" << total << endl; }; static void TearDownTestCase(){ delete reduction_space; reduction_space = nullptr; delete input; input = nullptr; }; /// Before each test calls constructor and destructor DISPEngineTest(){ auto &reduction_objs = reduction_space->reduction_objects(); int64_t init_val = 0; reduction_objs.SetAllItems(init_val); for(int64_t i=0; i<reduction_space->kMyLocalCount; i++){ reduction_space->my_local[i] = reduction_space->kMyLocalCount-i; } }; ~DISPEngineTest(){ }; }; ReductionSpaceSum* DISPEngineTest::reduction_space = nullptr; ADataRegion<int64_t>* DISPEngineTest::input = nullptr; TEST_F(DISPEngineTest, ReduceFunc){ DISPEngineBase<ReductionSpaceSum , int64_t> *engine = new DISPEngineReduction<ReductionSpaceSum , int64_t>( nullptr, // DISPCommBase reduction_space, // ReductionSpaceBase<RST, DT> *conf_reduction_space_i, 16 // int num_reduction_threads_ (if 0, then auto set) ); int64_t req_number = kCacheSize/sizeof(int64_t); engine->RunParallelReduction(*input, req_number); engine->Print(); //engine->SeqInPlaceLocalSynchWrapper(); /* cout << "Total after local synch: " << reduction_space->reduction_objects()[0][0] << endl; */ engine->ParInPlaceLocalSynchWrapper(); cout << "Total after parallel local synch: " << reduction_space->reduction_objects()[0][0] << endl; delete engine; }
#include "..\inc.h" class input_stream { public: input_stream(){srand(int(time(0)));} // Character or -1 int read(){ return rand() % 26 + 'a'; } }; void solve() { const int LEN = 7; string seq; map<int, vector<int> > h2i; //hash -> index int h = 0; input_stream is; //first LEN chars for(int i = 0;i < LEN;++i){ int c = is.read(); seq.push_back(c); h = (h << 2) + c; } h2i[h].push_back(seq.size()); //following chars for(;;){ h -= seq[seq.size() - LEN] << (2 * LEN - 2); int c = is.read(); seq.push_back(c); h = (h << 2) + c; vector<int> & v = h2i[h]; if(!v.empty()){ string cur = seq.substr(seq.size() - LEN, LEN); for(size_t i = 0;i < v.size();++i){ if(cur == seq.substr(v[i] - LEN, LEN)){ cout<<"total sequence size: "<<seq.size()<<endl; cout<<"find repeats at pos "<<(v[i] - LEN)<<" and "<<(seq.size() - LEN)<<endl; cout<<cur<<endl; return; } } } v.push_back(seq.size()); } } int main() { solve(); }
#pragma once #include "DataManager.h" //输入:场景结构、行人、行人生成频率、每次迭代表示的物理时长 class PedestrianSimulator { public: //simulator的输入是场景结构、场景中人流频率与方向、是否可视化仿真过程以及方阵视频存储位置 PedestrianSimulator(std::string sceneFile, std::string satelliteFile,std::string pedestrianFile, int VisualRate = 0,std::string videoFile = "", std::string outputFile = ""); void DoSimulation(double delta_t, int timelong); ~PedestrianSimulator(); private: void generatePedestrian();//根据人流密度矩阵,每帧随机生成行人。 void pathPlanning();//行人路径规划 void updatePositionAndVelocity();//更新行人的位置与速度,并判断行人是否已经到达目的地 void updateAcceleration();//更新行人的加速度 void updataStateMap();//更新状态地图 void showCurState();//可视化当前场景,就是把人画上去 void showStateMap();//可视化状态地图,不过这一步是在仿真结束后才可以做的 void saveStateMap();//保存状态地图 int totalFrames;//总共仿真的帧数 int timeLong;//总共仿真的时长 double deltaT;//每帧代表的时间 单位 秒 int curFrame;//当前仿真到第几帧了 SceneStructure sceneStructure;//当前场景 cv::Mat pedestrianMatrix;//人流密度矩阵 cv::Mat StateMap;//状态地图 cv::Mat tmpMatrix; std::vector<PedestrianInfo> pedestrians;//行人们 int visualRate;//可视化速率,1为原速播放,2为2倍速播放,以此类推 cv::VideoWriter video; std::string outputDir; cv::Mat stateMapKernal; std::random_device rd{}; std::mt19937 gen{ rd() }; };
#ifndef GAMESCENE_H #define GAMESCENE_H #include "cocos2d.h" #include "ui\CocosGUI.h" USING_NS_CC; using namespace ui; class JewelsGrid; class GameScene : public Layer { public: static Scene* createScene(); CREATE_FUNC(GameScene); bool init(); public: static void addBonus(int bonus); private: static LoadingBar* m_bonusbar; static int m_score; static Label* m_scorelabel; private: void onUpdateMenuCallback(Ref*); void onReducingBonus(float dt); //开启倒计时 void publishScore(); //存储游戏分数 JewelsGrid* m_jewelsgrid; Sprite* m_bg; }; #endif
// odd even program. #include <iostream> using namespace std; int main() { int n; cout<<"plese enter any number\n"; cin>>n; if(n%2==0) { cout<"Entered number is even"; } else{ cout<<"Entered number is odd"; } }
//Programa : Arduino Ethernet Shield W5100 e HC-SR04 //Alteracoes e adaptacoes : FILIPEFLOP // //Baseado no programa exemplo de //by David A. Mellis e Tom Igoe //#include <Ultrasonic.h> #include <SPI.h> #include <Ethernet.h> #include <EthernetClient.h> #include <EthernetServer.h> #include <DHT.h> //Define os parametros para o sensor ultrasonico HC-SR04 #define trigPin 6 //Porta ligada ao pino Trigger do sensor #define echoPin 7 //Porta ligada ao pino Echo do sensor #define dht_dpin 5 //Inicializa o sensor ultrasonico //Ultrasonic ultrasonic(PINO_TRIGGER, PINO_ECHO); byte bGlobalErr; int lectura=0; int lectura1=0; byte dht_dat[5]; float humedad; //invento mio para meter valor a variable float temperatura; float temperatura1; //Definicoes de IP, mascara de rede e gateway byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192,168,1,158); //Define o endereco IP IPAddress gateway(192,168,1,1); //Define o gateway IPAddress subnet(255, 255, 255, 0); //Define a máscara de rede //Inicializa o servidor web na porta 80 EthernetServer server(80); void setup() { InitDHT(); //Inicializa la interface de red Serial.begin (9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); Ethernet.begin(mac, ip, gateway, subnet); server.begin(); } void loop() { long duration, distance; lectura=analogRead(A0); lectura1=analogRead(A1); digitalWrite(trigPin, LOW); // Added this line delayMicroseconds(2); // Added this line digitalWrite(trigPin, HIGH); // delayMicroseconds(1000); - Removed this line delayMicroseconds(10); // Added this line digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; delay(1000); //Aguarda conexao do browser EthernetClient client = server.available(); if (client) { Serial.println(""); Serial.println("Nuevo Cliente"); // an http request ends with a blank line boolean currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); Serial.write(c); // if you've gotten to the end of the line (received a newline // character) and the line is blank, the http request has ended, // so you can send a reply if (c == '\n' && currentLineIsBlank) { // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); client.println("Refresh: 2"); //Recarrega a pagina a cada 2seg client.println(); client.println("<!DOCTYPE HTML>"); client.println("<html>"); //Configura o texto e imprime o titulo no browser client.print("<font color=#FF0000><b><u>"); client.print("Envio de informacion por la red utilizando Arduino"); client.print("</u></b></font>"); client.println("<br />"); client.println("<br />"); //Mostra o estado da porta digital 3 int porta_digital = digitalRead(3); client.print("Puerta Principal : "); client.print("<b>"); client.print(porta_digital); client.println("</b>"); client.print(" (0 = Cerrada, 1 = Abierta)"); client.println("<br />"); client.print("CO2: "); client.println("</b>"); client.print(lectura); client.println("<br />"); client.print("GAS: "); client.println("</b>"); client.print(lectura1); client.println("<br />"); //Mostra as informacoes lidas pelo sensor ultrasonico client.print("Sensor Ultrasonico : "); client.print("<b>"); client.print(distance); // Serial.println(distance); client.print(" cm"); client.println("</br>"); client.print("Temperatura : "); client.print("<b>"); client.print(temperatura,1); client.print("<b>"); client.print(" C"); client.println("</br>"); client.print("Humedad : "); client.print("<b>"); client.print(humedad,1); client.print("<b>"); client.print(" %"); client.println("<br />"); client.println("</b></html>"); break; } if (c == '\n') { // you're starting a new line currentLineIsBlank = true; } else if (c != '\r') { // you've gotten a character on the current line currentLineIsBlank = false; } } } // give the web browser time to receive the data delay(1); // close the connection: client.stop(); } ReadDHT(); //float temperatura; //declarola variable switch (bGlobalErr){ case 0: Serial.print("Humedad Actual = "); Serial.print(dht_dat[0], DEC); //Serial.print("."); //Serial.print(dht_dat[1], DEC); Serial.print(" % "); Serial.print("temperatura = "); temperatura1=(temperatura/10); humedad = dht_dat[0]; temperatura = dht_dat[2]; Serial.print(dht_dat[2], DEC); Serial.println(" C "); Serial.println (""); Serial.print("Humedad Actual 1 = "); Serial.print(humedad, 0); Serial.print(" % "); Serial.print("temperatura 1 = "); Serial.print(temperatura, 0); //Serial.print (temperatura1,DEC); //imprimo la variable //Serial.print (temperatura,DEC); //imprimo la variable //Serial.print("."); // Serial.print(dht_dat[3], DEC); Serial.println(" C "); break; case 1: Serial.println("Error 1: DHT start condition 1 not met."); break; case 2: Serial.println("Error 2: DHT start condition 2 not met."); break; case 3: Serial.println("Error 3: DHT checksum error."); break; default: Serial.println("Error: Unrecognized code encountered."); break; } delay(100); } void InitDHT(){ pinMode(dht_dpin,OUTPUT); digitalWrite(dht_dpin,HIGH); } void ReadDHT(){ bGlobalErr=0; byte dht_in; byte i; digitalWrite(dht_dpin,LOW); delay(20); digitalWrite(dht_dpin,HIGH); delayMicroseconds(40); pinMode(dht_dpin,INPUT); //delayMicroseconds(40); dht_in=digitalRead(dht_dpin); if(dht_in){ bGlobalErr=1; return; } delayMicroseconds(80); dht_in=digitalRead(dht_dpin); if(!dht_in){ bGlobalErr=2; return; } delayMicroseconds(80); for (i=0; i<5; i++) dht_dat[i] = read_dht_dat(); pinMode(dht_dpin,OUTPUT); digitalWrite(dht_dpin,HIGH); byte dht_check_sum = dht_dat[0]+dht_dat[1]+dht_dat[2]+dht_dat[3]; if(dht_dat[4]!= dht_check_sum) {bGlobalErr=3;} }; byte read_dht_dat(){ byte i = 0; byte result=0; for(i=0; i< 8; i++){ while(digitalRead(dht_dpin)==LOW); delayMicroseconds(30); if (digitalRead(dht_dpin)==HIGH) result |=(1<<(7-i)); while (digitalRead(dht_dpin)==HIGH); } return result; float humedad = dht_dat[0]; //invento mio para meter valor a variable float temperatura = dht_dat[2];// lo mismo }
#include "CalcDamage.h"
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. 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 University of Oxford 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. */ /* * * Chaste tutorial - this page gets automatically changed to a wiki page * DO NOT remove the comments below, and if the code has to be changed in * order to run, please check the comments are still accurate * * */ #ifndef TESTSOLVINGODESTUTORIAL_HPP_ #define TESTSOLVINGODESTUTORIAL_HPP_ /* * = In this tutorial we show how Chaste can be used to solve an ODE system = * * The following header files need to be included. * First we include the header needed to define this class as a test suite. */ #include <cxxtest/TestSuite.h> /* * In some early versions of Boost this file has to be included first so that the name of the ODE solver * used can be written to result files. */ #include "CheckpointArchiveTypes.hpp" /* * We will use a simple forward Euler solver to solve the ODE, so the following * needs to be included. */ #include "EulerIvpOdeSolver.hpp" /* All the ODE solvers take in a concrete ODE system class, which is user-defined * and must inherit from the following class, which defines an ODE interface. */ #include "AbstractOdeSystem.hpp" /* In order to define useful information about the ODE system conveniently, such * as the names and units of variables, and suggested initial conditions, we * need the following header. */ #include "OdeSystemInformation.hpp" /* This test doesn't support being run on multiple processes, so we need this header * to prevent race conditions when writing files. */ #include "FakePetscSetup.hpp" /* * == Defining the ODE classes == * * Let us solve the ODE dy/dt = y^2^+t^2^, with y(0) = 1. To do so, we have to define * our own ODE class, inheriting from {{{AbstractOdeSystem}}}, which implements the * {{{EvaluateYDerivatives()}}} method. */ class MyOde : public AbstractOdeSystem { public: /* The constructor does very little. * It calls the base constructor, passing the number of state variables in the * ODE system (here, 1, i.e. y is a 1d vector). * It also sets the object to use to retrieve system information (see later). */ MyOde() : AbstractOdeSystem(1) { mpSystemInfo = OdeSystemInformation<MyOde>::Instance(); } /* The ODE solvers will repeatedly call a method called `EvaluateYDerivatives`, which needs * to be implemented in this concrete class. This takes in the time, a {{{std::vector}}} of * y values (in this case, of size 1), and a reference to a {{{std::vector}}} in which the * derivative(s) should be filled in by the method... */ void EvaluateYDerivatives(double time, const std::vector<double>& rY, std::vector<double>& rDY) { /*...so we set {{{rDY[0]}}} to be y^2^ + t^2^. */ rDY[0] = rY[0]*rY[0] + time*time; } }; /* The following ''template specialisation'' defines the information for this * ODE system. Note that we use the ODE system class that we have just defined * as a template parameter */ template<> void OdeSystemInformation<MyOde>::Initialise() { this->mVariableNames.push_back("y"); this->mVariableUnits.push_back("dimensionless"); this->mInitialConditions.push_back(0.0); this->mInitialised = true; } /* That would be all that is needed to solve this ODE. However, rather * than solving up to a fixed time, suppose we wanted to solve until some function * of y (and t) reached a certain value, e.g. let's say we wanted to solve the ODE until * y reached 2.5. To do this, we have to define a stopping event, by overriding * the method {{{CalculateStoppingEvent}}} from {{{AbstractOdeSystem}}}. For this, let us * define a new class, inheriting from the above class (i.e. representing the same ODE) * but with a stopping event defined. * * Note that we do not define separate ODE system information for this class - it uses * that defined in the base class `MyOde`, since it represents the same ODE. */ class MyOdeWithStoppingEvent : public MyOde { public: /* All we have to do is implement the following function. This is defined in * the base class ({{{AbstractOdeSystem}}}), where it always returns false, and here we override it * to return true if y>=2.5 */ bool CalculateStoppingEvent(double time, const std::vector<double>& rY) { return (rY[0]>=2.5); } }; /* The following class will make more sense when solving with state variables is discussed. * It is another ODE class which sets up a 'state variable'. Note that this is done in the * constructor, and the {{{EvaluateYDerivatives}}} method is identical to before. */ class MyOdeUsingStateVariables : public AbstractOdeSystem { public: MyOdeUsingStateVariables() : AbstractOdeSystem(1) { mpSystemInfo = OdeSystemInformation<MyOdeUsingStateVariables>::Instance(); mStateVariables.push_back(1.0); } void EvaluateYDerivatives(double time, const std::vector<double>& rY, std::vector<double>& rDY) { rDY[0] = rY[0]*rY[0] + time*time; } }; /* This time we do need to define the ODE system information. */ template<> void OdeSystemInformation<MyOdeUsingStateVariables>::Initialise() { this->mVariableNames.push_back("y"); this->mVariableUnits.push_back("dimensionless"); this->mInitialConditions.push_back(1.0); this->mInitialised = true; } /* This class is another simple ODE class, just as an example of how a 2d ODE is solved. Here * we solve the ODE dy,,1,,/dt = y,,2,,, dy,,2,,/dt = (y,,1,,)^2^ (which represents the second-order ODE d^2^y/dt^2^ = y^2^). */ class My2dOde : public AbstractOdeSystem { public: My2dOde() : AbstractOdeSystem(2) { mpSystemInfo = OdeSystemInformation<My2dOde>::Instance(); } void EvaluateYDerivatives(double time, const std::vector<double>& rY, std::vector<double>& rDY) { rDY[0] = rY[1]; rDY[1] = rY[0]*rY[0]; } }; /* Again we need to define the ODE system information. */ template<> void OdeSystemInformation<My2dOde>::Initialise() { this->mVariableNames.push_back("y"); this->mVariableUnits.push_back("dimensionless"); this->mInitialConditions.push_back(1.0); this->mVariableNames.push_back("ydot"); this->mVariableUnits.push_back("dimensionless"); this->mInitialConditions.push_back(0.0); this->mInitialised = true; } /* * == The Tests == * * === Standard ODE solving === * * Now we can define the test, in which the ODEs are solved. */ class TestSolvingOdesTutorial: public CxxTest::TestSuite { public: void TestSolvingOdes() { /* First, create an instance of the ODE class to be solved. */ MyOde my_ode; /* Next, create a solver. */ EulerIvpOdeSolver euler_solver; /* We will need to provide an initial condition, which needs to * be a {{{std::vector}}}.*/ std::vector<double> initial_condition; initial_condition.push_back(1.0); /* Then, just call `Solve`, passing in a pointer to the ODE, the * initial condition, the start time, end time, the solving timestep, * and sampling timestep (how often we want the solution stored in the returned `OdeSolution` object). * Here we solve from 0 to 1, with a timestep of 0.01 but a ''sampling * timestep'' of 0.1. The return value is an object of type {{{OdeSolution}}} * (which is basically just a list of times and solutions). */ OdeSolution solutions = euler_solver.Solve(&my_ode, initial_condition, 0, 1, 0.01, 0.1); /* Let's look at the results, which can be obtained from the {{{OdeSolution}}} * object using the methods {{{rGetTimes()}}} and {{{rGetSolutions()}}}, which * return a {{{std::vector}}} and a {{{std::vector}}} of {{{std::vector}}}s * respectively. */ for (unsigned i=0; i<solutions.rGetTimes().size(); i++) { /* The {{{[0]}}} here is because we are getting the zeroth component of y (a 1-dimensional vector). */ std::cout << solutions.rGetTimes()[i] << " " << solutions.rGetSolutions()[i][0] << "\n"; } /* Alternatively, we can print the solution directly to a file, using the {{{WriteToFile}}} * method on the {{{OdeSolution}}} class. */ solutions.WriteToFile("SolvingOdesTutorial", "my_ode_solution", "sec"); /* Two files are written * * {{{my_ode_solution.dat}}} contains the results (a header line, then one column for time and one column per variable) * * {{{my_ode_solution.info}}} contains information for reading the data back, a line about the ODE solver ("{{{ODE SOLVER: EulerIvpOdeSolver}}}") and provenance information. */ /* We can see from the printed out results that y goes above 2.5 somewhere just * before 0.6. To solve only up until y=2.5, we can solve the ODE that has the * stopping event defined, using the same solver as before. */ MyOdeWithStoppingEvent my_ode_stopping; /* '''Note:''' ''when a {{{std::vector}}} is passed in as an initial condition * to a {{{Solve}}} call, it gets updated as the solve takes place''. Therefore, if * we want to use the same initial condition again, we have to reset it back to 1.0. */ initial_condition[0] = 1.0; solutions = euler_solver.Solve(&my_ode_stopping, initial_condition, 0, 1, 0.01, 0.1); /* We can check with the solver that it stopped because of the stopping event, rather than because * it reached to end time. */ TS_ASSERT(euler_solver.StoppingEventOccurred()); /* Finally, let's print the time of the stopping event (to the nearest dt or so). */ std::cout << "Stopping event occurred at t="<<solutions.rGetTimes().back()<<"\n"; } /* * === ODE solving using state variables === * * In this second test, we show how to do an alternative version of ODE solving, which * does not involve passing in initial conditions and returning an {{{OdeSolution}}}. * The {{{AbstractOdeSystem}}} class has a member variable called the ''state variable vector'', which can * be used to hold the solution, and will be updated if a particular version of `Solve` * is called. This can be useful for embedding ODE models in a bigger system, since * the ODE models will then always contain their current solution state. */ void TestOdeSolvingUsingStateVariable() { /* Define an instance of the ODE. See the class definition above. * Note that this ODE has a variable called {{{mStateVariables}}}, which has * been set to be a vector of size one, containing the value 1.0. */ MyOdeUsingStateVariables my_ode_using_state_vars; /* To solve updating the state variable, just call the appropriate method on * a chosen solver. Note that no initial condition is required, no * {{{OdeSolution}}} is returned, and no sampling timestep is given. */ EulerIvpOdeSolver euler_solver; euler_solver.SolveAndUpdateStateVariable(&my_ode_using_state_vars, 0.0, 1.0, 0.01); /* To see what the solution was at the end, we have to use the state variable. */ std::cout << "Solution at end time = " << my_ode_using_state_vars.rGetStateVariables()[0] << "\n"; } /* * === Solving n-dimensional ODEs === * * Finally, here's a simple test showing how to solve a 2d ODE using the first method. * All that is different is the initial condition has be a vector of length 2, and returned * solution is of length 2 at every timestep. */ void TestWith2dOde() { My2dOde my_2d_ode; EulerIvpOdeSolver euler_solver; /* Define the initial condition for each state variable. */ std::vector<double> initial_condition; initial_condition.push_back(1.0); initial_condition.push_back(0.0); /* Solve, and print the solution as [time, y1, y2]. */ OdeSolution solutions = euler_solver.Solve(&my_2d_ode, initial_condition, 0, 1, 0.01, 0.1); for (unsigned i=0; i<solutions.rGetTimes().size(); i++) { std::cout << solutions.rGetTimes()[i] << " " << solutions.rGetSolutions()[i][0] << " " << solutions.rGetSolutions()[i][1] << "\n"; } } }; #endif /*TESTSOLVINGODESTUTORIAL_HPP_*/
#include <iostream> #include <fstream> #include "DotAndCross.h" using namespace std; int main() { int rows; int cols; ifstream indata("input.txt"); if(indata.is_open()){ while(indata >>rows >>cols){ DotAndCross dcObj(rows,cols); dcObj.createABoard(); dcObj.mainManu(); } return 0; } }
#pragma once #include <algorithm> #include <windows.h> #include <assert.h> #include "common\Singularity.Common.h" namespace Singularity { class Game; class GameTask; class BehaviorTask; namespace Threading { class Task; class WorkerThread; class TaskScheduler; class TaskQueue; } namespace Components { class GameObject; class Component; class Behavior; class Scene; class Transform; class TransformDelegate; } } #include "core\Singularity.Core.Defines.h" #include "core\threading\TaskScheduler.h" #include "core\threading\Task.h" #include "core\threading\TaskQueue.h" #include "core\threading\WorkerThread.h" #include "core\components\GameObject.h" #include "core\components\Component.h" #include "core\components\BehaviorDelegate.h" #include "core\components\Behavior.h" #include "core\components\Scene.h" #include "core\components\TransformDelegate.h" #include "core\components\Transform.h" #include "core\Game.h" #include "core\GameTask.h" #include "core\BehaviorTask.h"
/**************************************** * * INSERT-PROJECT-NAME-HERE - INSERT-GENERIC-NAME-HERE * Copyright (C) 2019 Victor Tran * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * *************************************/ #include "focusbarrier.h" #include "musicengine.h" struct FocusBarrierPrivate { QWidget* bounceWidget = nullptr; }; FocusBarrier::FocusBarrier(QWidget *parent) : QPushButton(parent) { d = new FocusBarrierPrivate(); this->setFixedHeight(0); this->setFixedWidth(0); } FocusBarrier::~FocusBarrier() { delete d; } void FocusBarrier::setBounceWidget(QWidget*widget) { d->bounceWidget = widget; } void FocusBarrier::focusInEvent(QFocusEvent*event) { MusicEngine::playSoundEffect(MusicEngine::FocusChangedFailed); if (d->bounceWidget) d->bounceWidget->setFocus(); }
#include "SwervePosition2d.h" SwervePosition2d::SwerveDelta::SwerveDelta(double x, double y, double t) { dx = x; dy = y; dtheta = t; } SwervePosition2d::SwervePosition2d() { m_translation = SwerveTranslation2d(); m_rotation = SwerveRotation2d(); } SwervePosition2d::SwervePosition2d(SwerveTranslation2d tran, SwerveRotation2d rot) { m_translation = tran; m_rotation = rot; } SwervePosition2d::SwervePosition2d(const SwervePosition2d& other) { m_translation = other.m_translation; m_rotation = other.m_rotation; } SwervePosition2d SwervePosition2d::FromTranslation(SwerveTranslation2d tran) { return SwervePosition2d(tran, SwerveRotation2d()); } SwervePosition2d SwervePosition2d::FromRotation(SwerveRotation2d rot) { return SwervePosition2d(SwerveTranslation2d(), rot); } SwervePosition2d SwervePosition2d::FromVelocity(SwerveDelta delta) { double sinT = sin(delta.dtheta); double cosT = cos(delta.dtheta); double s, c; if(fabs(delta.dtheta) < kE){ s = 1.0 - 1.0 / 6.0 * delta.dtheta * delta.dtheta; c = .5 * delta.dtheta; } else { s = sinT / delta.dtheta; c = (1.0 - cosT) / delta.dtheta; } return SwervePosition2d(SwerveTranslation2d(delta.dx * s - delta.dy * c, delta.dx * c + delta.dy * s), SwerveRotation2d(cosT, sinT, false)); } SwerveTranslation2d SwervePosition2d::GetTranslation() { return m_translation; } void SwervePosition2d::SetTranslation(SwerveTranslation2d tran) { m_translation = tran; } SwerveRotation2d SwervePosition2d::GetRotation() { return m_rotation; } void SwervePosition2d::SetRotation(SwerveRotation2d rot) { m_rotation = rot; } SwervePosition2d SwervePosition2d::TransformBy(SwervePosition2d other) { return SwervePosition2d(m_translation.TranslateBy(other.m_translation.RotateBy(m_rotation)), m_rotation.RotateBy(other.m_rotation)); } SwervePosition2d SwervePosition2d::Inverse() { SwerveRotation2d invert = m_rotation.Inverse(); return SwervePosition2d(m_translation.Inverse().RotateBy(invert), invert); } SwervePosition2d SwervePosition2d::Interpolate(SwervePosition2d other, double x) { if (x <= 0){ return *this; } else if (x >= 1){ return other; } return SwervePosition2d(m_translation.Interpolate(other.m_translation, x), m_rotation.Interpolate(other.m_rotation, x)); }
/**************************************************************************** Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "HelloWorldScene.h" #include "SimpleAudioEngine.h" #include "SecondScene.h" #include "MyTools.h" #include "MyScenes.h" USING_NS_CC; using namespace CocosDenshion; Scene *HelloWorld::createScene() { return HelloWorld::create(); } // Print useful error message instead of segfaulting when files are not there. static void problemLoading(const char *filename) { printf("Error while loading: %s\n", filename); printf("Depending on how you compiled you might have to add 'Resources/' in front of filenames in HelloWorldScene.cpp\n"); } // on "init" you need to initialize your instance bool HelloWorld::init() { ////////////////////////////// // 1. super init first if (!Scene::init()) { return false; } // this->updateDisplayedColor(Color3B(0,0,255)); // set background color OK! auto layerColor = LayerColor::create(Color4B(255,0,0,255)); layerColor->setVisible(true); this->addChild(layerColor); auto visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); ///////////////////////////// // 2. add a menu item with "X" image, which is clicked to quit the program // you may modify it. // add a "close" icon to exit the progress. it's an autorelease object auto closeItem = MenuItemImage::create( "CloseNormal.png", "CloseSelected.png", CC_CALLBACK_1(HelloWorld::menuCloseCallback, this)); if (closeItem == nullptr || closeItem->getContentSize().width <= 0 || closeItem->getContentSize().height <= 0) { problemLoading("'CloseNormal.png' and 'CloseSelected.png'"); } else { float x = origin.x + visibleSize.width - closeItem->getContentSize().width / 2 - 10; float y = origin.y + closeItem->getContentSize().height / 2 + 10; closeItem->setPosition(Vec2(x, y)); } // create menu, it's an autorelease object auto menu = Menu::create(closeItem, NULL); menu->setPosition(Vec2::ZERO); this->addChild(menu, 1); ///////////////////////////// // 3. add your codes below... // add a label shows "Hello World" // create and initialize a label auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24); if (label == nullptr) { problemLoading("'fonts/Marker Felt.ttf'"); } else { // position the label on the center of the screen label->setPosition(Vec2(origin.x + visibleSize.width / 2, origin.y + visibleSize.height - label->getContentSize().height)); // add the label as a child to this layer this->addChild(label, 1); } // add "HelloWorld" splash screen" auto sprite = Sprite::create("HelloWorld.png"); if (sprite == nullptr) { problemLoading("'HelloWorld.png'"); } else { // position the sprite on the center of the screen sprite->setPosition(Vec2(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y)); // add the sprite as a child to this layer this->addChild(sprite, 0); } auto strawberry = Sprite::create("fruit/strawberry.jpg"); strawberry->setPosition(Point(100,100)); strawberry->setAnchorPoint(Point(0.5,0.5)); this->addChild(strawberry); auto size = Director::getInstance()->getWinSize(); auto grape = Sprite::create("fruit/grape.jpg"); grape->setAnchorPoint(Point(0.5,0.5)); grape->setPosition(Point(size.width/2,size.height/2)); grape->setFlippedY(true); this->addChild(grape); auto helloLabel = Label::createWithSystemFont("Hello World","Thonburi",34); helloLabel->setPosition(Point(240,160)); helloLabel->enableShadow(Color4B::BLUE,Size(2,-2)); this->addChild(helloLabel); auto item_1 = MenuItemImage::create( "CloseNormal.png","CloseSelected.png", CC_CALLBACK_1(HelloWorld::menuCallback1,this) ); auto item_2 = MenuItemImage::create( "CloseNormal.png","CloseSelected.png", CC_CALLBACK_1(HelloWorld::menuCallback2,this) ); auto item_3 = MenuItemImage::create( "CloseNormal.png","CloseSelected.png", CC_CALLBACK_1(HelloWorld::menuCallback3,this) ); auto menu2 = Menu::create(item_1,item_2,item_3, nullptr); menu2->alignItemsVertically(); this->addChild(menu2); auto item_5 = MenuItemFont::create( "Play", CC_CALLBACK_1(HelloWorld::menuCallback1,this) ); auto item_6 = MenuItemFont::create( "High Scores", CC_CALLBACK_1(HelloWorld::menuCallback2,this) ); auto item_7 = MenuItemFont::create( "About", CC_CALLBACK_1(HelloWorld::menuCallback3,this) ); auto menu3 = Menu::create(item_5,item_6,item_7, nullptr); menu3->alignItemsVertically(); menu3->setPosition(100,100); this->addChild(menu3); alert({"HelloWorld Scene Opened!"}); auto replaceSceneItem = MenuItemFont::create("切换场景",CC_CALLBACK_1(HelloWorld::replaceScene,this)); auto toWar = MenuItemFont::create("进入战场", [](Ref *sender) { Director::getInstance()->replaceScene(WarScene::createScene()); }); auto menu5 = Menu::create(toWar, replaceSceneItem, nullptr); menu5->alignItemsVertically(); menu5->setPosition(100,200); this->addChild(menu5); auto particle = ParticleExplosion::create(); this->addChild(particle); SimpleAudioEngine::getInstance()->playBackgroundMusic("plane/audio/bgm.mp3",true); return true; } void HelloWorld::replaceScene(cocos2d::Ref *pSender) { Director::getInstance()->replaceScene(SecondScene::createScene()); alert({"replace Scene"}); } void HelloWorld::menuCallback1(Ref *pSender){ alert({"item1","called!","哈哈..."}); CCLOG("item1"); } void HelloWorld::menuCallback2(Ref *pSender){ alert({"item2","called!","哈哈..."}); CCLOG("item2"); } void HelloWorld::menuCallback3(Ref *pSender){ alert({"item3","called!","哈哈..."}); CCLOG("item3"); } void HelloWorld::menuCloseCallback(Ref *pSender) { //Close the cocos2d-x game scene and quit the application Director::getInstance()->end(); /*To navigate back to native iOS screen(if present) without quitting the application ,do not use Director::getInstance()->end() as given above,instead trigger a custom event created in RootViewController.mm as below*/ //EventCustom customEndEvent("game_scene_close_event"); //_eventDispatcher->dispatchEvent(&customEndEvent); }
/* Name: Mohit Kishorbhai Sheladiya Student ID: 117979203 Student Email: mksheladiya@myseneca.ca Date: 21/02/03 */ #ifndef SDDS_ITEM_H_ #define SDDS_ITEM_H_ namespace sdds { class Item { char m_itemName[21]; double m_price; bool m_taxed; void setName(const char* name); public: void setEmpty(); void set(const char* name, double price, bool taxed); void display()const; bool isValid()const; double price()const; double tax()const; }; } #endif // !SDDS_SUBJECT_H
#pragma once #include "IContainer.h" #include <iostream> class ArrayContainer : public IContainer { private: int size; int capacity; IE** elements; void resize(); public: ArrayContainer(int c); ArrayContainer(const ArrayContainer& ac); ~ArrayContainer(); ArrayContainer& operator=(const ArrayContainer& ac); void addElem(IE* e); void removeElem(IE* e); int getSize(); bool contains(IE* e); friend class ArrayIterator; IIterator* getIterator(); }; class ArrayIterator : public IIterator { private: ArrayContainer* container; int crtPos; public: ArrayIterator(ArrayContainer* ac) { container = ac; crtPos = 0; } ~ArrayIterator() { } void moveNext() { crtPos++; } bool hasNext() { return (crtPos < container->getSize() - 1); } bool isValid() { return (crtPos < container->getSize()); } IE* getCrtElem() { return container->elements[crtPos]; } void moveFirst() { crtPos = 0; } };
#include<bits/stdc++.h> using namespace std; int C[300][300], F[300][300]; vector< pair<int,int> > v[300]; int n,m; int main(){ scanf("%d %d",&n,&m); for(int i=1;i<=n;i++) scanf("%d",&C[0][i]); for(int i=1;i<=m;i++) scanf("%d",&C[n+i][n+m+1]); for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ scanf("%d",&C[j][n+i]); } } for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ int cost; scanf("%d",&cost); v[j].push_back({n+i,cost}); v[n+i].push_back({j,-cost}); } } // source : 0 for(int i=1;i<=n;i++){ v[0].push_back({i,0}); v[i].push_back({0,0}); } // sink : n+m+1 for(int i=n+1;i<=n+m;i++){ v[i].push_back({n+m+1,0}); v[n+m+1].push_back({i,0}); } int cnt = 0; int ans = 0; while(1){ int prev[1000]; int d[1000]; bool inq[1000]; for(int i=0;i<=n+m+1;i++){ inq[i] = 0; prev[i] = -1; d[i] = 1e9; } queue<int> q; d[0] = 0; q.push(0); inq[0] = 1; while(!q.empty()){ int cur = q.front(); q.pop(); inq[cur] = 0; for(auto x:v[cur]){ int next = x.first; int cost = x.second; if(C[cur][next] - F[cur][next] <= 0) continue; if(d[next] > d[cur] + cost){ prev[next] = cur; d[next] = d[cur] + cost; if(!inq[next]){ q.push(next); inq[next] = 1; } } } } if(prev[n+m+1] == -1) break; int flow = 1e9; for(int i=n+m+1;i;i=prev[i]) flow = min(flow, C[prev[i]][i]-F[prev[i]][i]); for(int i=n+m+1;i;i=prev[i]){ F[prev[i]][i] += flow; F[i][prev[i]] -= flow; } //printf("%d %d\n",d[n+m+1],flow); cnt += flow; ans += d[n+m+1] * flow; } printf("%d\n%d",cnt,ans); }
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "ObjectMacros.h" #include "ScriptMacros.h" PRAGMA_DISABLE_DEPRECATION_WARNINGS #ifdef QBERT_PROJECT_Elevator_generated_h #error "Elevator.generated.h already included, missing '#pragma once' in Elevator.h" #endif #define QBERT_PROJECT_Elevator_generated_h #define QBert_Project_Source_QBert_Project_Elevator_h_12_RPC_WRAPPERS #define QBert_Project_Source_QBert_Project_Elevator_h_12_RPC_WRAPPERS_NO_PURE_DECLS #define QBert_Project_Source_QBert_Project_Elevator_h_12_INCLASS_NO_PURE_DECLS \ private: \ static void StaticRegisterNativesAElevator(); \ friend QBERT_PROJECT_API class UClass* Z_Construct_UClass_AElevator(); \ public: \ DECLARE_CLASS(AElevator, AActor, COMPILED_IN_FLAGS(0), 0, TEXT("/Script/QBert_Project"), NO_API) \ DECLARE_SERIALIZER(AElevator) \ enum {IsIntrinsic=COMPILED_IN_INTRINSIC}; #define QBert_Project_Source_QBert_Project_Elevator_h_12_INCLASS \ private: \ static void StaticRegisterNativesAElevator(); \ friend QBERT_PROJECT_API class UClass* Z_Construct_UClass_AElevator(); \ public: \ DECLARE_CLASS(AElevator, AActor, COMPILED_IN_FLAGS(0), 0, TEXT("/Script/QBert_Project"), NO_API) \ DECLARE_SERIALIZER(AElevator) \ enum {IsIntrinsic=COMPILED_IN_INTRINSIC}; #define QBert_Project_Source_QBert_Project_Elevator_h_12_STANDARD_CONSTRUCTORS \ /** Standard constructor, called after all reflected properties have been initialized */ \ NO_API AElevator(const FObjectInitializer& ObjectInitializer); \ DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(AElevator) \ DECLARE_VTABLE_PTR_HELPER_CTOR(NO_API, AElevator); \ DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(AElevator); \ private: \ /** Private move- and copy-constructors, should never be used */ \ NO_API AElevator(AElevator&&); \ NO_API AElevator(const AElevator&); \ public: #define QBert_Project_Source_QBert_Project_Elevator_h_12_ENHANCED_CONSTRUCTORS \ private: \ /** Private move- and copy-constructors, should never be used */ \ NO_API AElevator(AElevator&&); \ NO_API AElevator(const AElevator&); \ public: \ DECLARE_VTABLE_PTR_HELPER_CTOR(NO_API, AElevator); \ DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(AElevator); \ DEFINE_DEFAULT_CONSTRUCTOR_CALL(AElevator) #define QBert_Project_Source_QBert_Project_Elevator_h_12_PRIVATE_PROPERTY_OFFSET #define QBert_Project_Source_QBert_Project_Elevator_h_9_PROLOG #define QBert_Project_Source_QBert_Project_Elevator_h_12_GENERATED_BODY_LEGACY \ PRAGMA_DISABLE_DEPRECATION_WARNINGS \ public: \ QBert_Project_Source_QBert_Project_Elevator_h_12_PRIVATE_PROPERTY_OFFSET \ QBert_Project_Source_QBert_Project_Elevator_h_12_RPC_WRAPPERS \ QBert_Project_Source_QBert_Project_Elevator_h_12_INCLASS \ QBert_Project_Source_QBert_Project_Elevator_h_12_STANDARD_CONSTRUCTORS \ public: \ PRAGMA_ENABLE_DEPRECATION_WARNINGS #define QBert_Project_Source_QBert_Project_Elevator_h_12_GENERATED_BODY \ PRAGMA_DISABLE_DEPRECATION_WARNINGS \ public: \ QBert_Project_Source_QBert_Project_Elevator_h_12_PRIVATE_PROPERTY_OFFSET \ QBert_Project_Source_QBert_Project_Elevator_h_12_RPC_WRAPPERS_NO_PURE_DECLS \ QBert_Project_Source_QBert_Project_Elevator_h_12_INCLASS_NO_PURE_DECLS \ QBert_Project_Source_QBert_Project_Elevator_h_12_ENHANCED_CONSTRUCTORS \ private: \ PRAGMA_ENABLE_DEPRECATION_WARNINGS #undef CURRENT_FILE_ID #define CURRENT_FILE_ID QBert_Project_Source_QBert_Project_Elevator_h PRAGMA_ENABLE_DEPRECATION_WARNINGS
/* * DetectorNumPrimo.cpp * * Created on: 17 de fev de 2018 * Author: kryptonian */ #include <iostream> using namespace std; int num, ini, cnt; int main(){ cout << "\n************************************" << endl; cout << "**** Detector de números primos ****" << endl; cout << "************************************" << endl; cout << "\nDigite um número: "; cin >> num; ini = num; cout << "\nOs seguintes números são divisíveis por " << ini << ": "; for (int c = 1; c < num + 1; c++ ){ if (num % c == 0){ cout << c << " "; cnt += 1; } } if (cnt == 2){ cout << "\n\n" << ini << " É um número PRIMO."; } else { cout << "\n\n" << ini << " NÃO É um número PRIMO."; } }
/*void twoCloseOpen() { servoTwo.write(180); delay(1000); servoTwo.write(0); delay(1000); servoTwo.write(90); delay(1000); }*/ void twoOpen() { servoTwo.write(180); } void twoClose() { servoTwo.write(0); }
//$Id: StatisticAcceptFilter.cpp 1398 2015-03-03 14:10:37Z tdnguyen $ //------------------------------------------------------------------------------ // StatisticAcceptFilter //------------------------------------------------------------------------------ // GMAT: General Mission Analysis Tool // // Copyright (c) 2002-2014 United States Government as represented by the // Administrator of The National Aeronautics and Space Administration. // All Other Rights Reserved. // // Developed jointly by NASA/GSFC and Thinking Systems, Inc. under contract // number NNG06CA54C // // Author: Tuan Dang Nguyen, NASA/GSFC. // Created: 2015/03/03 // /** * Implementation for the StatisticAcceptFilter class */ //------------------------------------------------------------------------------ #include "StatisticAcceptFilter.hpp" #include "GmatBase.hpp" #include "MessageInterface.hpp" #include "MeasurementException.hpp" #include <sstream> //#define DEBUG_CONSTRUCTION //#define DEBUG_INITIALIZATION //#define DEBUG_DATA_FILTER //#define DEBUG_FILTER //------------------------------------------------------------------------------ // static data //------------------------------------------------------------------------------ const std::string StatisticAcceptFilter::PARAMETER_TEXT[] = { "ThinMode", "ThinningFrequency", }; const Gmat::ParameterType StatisticAcceptFilter::PARAMETER_TYPE[] = { Gmat::STRING_TYPE, // THIN_MODE Gmat::INTEGER_TYPE, // THINNING_FREQUENCY }; //------------------------------------------------------------------------------ // StatisticAcceptFilter(const std::string name) //------------------------------------------------------------------------------ /** * Constructor for StatisticAcceptFilter objects * * @param name The name of the object */ //------------------------------------------------------------------------------ StatisticAcceptFilter::StatisticAcceptFilter(const std::string name) : DataFilter (name), thinMode ("Frequency"), thinningFrequency (1) { #ifdef DEBUG_CONSTRUCTION MessageInterface::ShowMessage("StatisticAcceptFilter default constructor <%s,%p>\n", GetName().c_str(), this); #endif objectTypes.push_back(Gmat::DATA_FILTER); objectTypeNames.push_back("StatisticsAcceptFilter"); parameterCount = StatisticAcceptFilterParamCount; } //------------------------------------------------------------------------------ // ~StatisticAcceptFilter() //------------------------------------------------------------------------------ /** * StatisticAcceptFilter destructor */ //------------------------------------------------------------------------------ StatisticAcceptFilter::~StatisticAcceptFilter() { } //------------------------------------------------------------------------------ // StatisticAcceptFilter(const StatisticAcceptFilter& saf) //------------------------------------------------------------------------------ /** * Copy constructor for a StatisticAcceptFilter * * @param saf The StatisticAcceptFilter object that provides data for the new one */ //------------------------------------------------------------------------------ StatisticAcceptFilter::StatisticAcceptFilter(const StatisticAcceptFilter& saf) : DataFilter (saf), thinMode (saf.thinMode), thinningFrequency (saf.thinningFrequency) { #ifdef DEBUG_CONSTRUCTION MessageInterface::ShowMessage("StatisticAcceptFilter copy constructor from <%s,%p> to <%s,%p>\n", saf.GetName().c_str(), &saf, GetName().c_str(), this); #endif } //------------------------------------------------------------------------------ // StatisticAcceptFilter& operator=(const StatisticAcceptFilter& saf) //------------------------------------------------------------------------------ /** * StatisticAcceptFilter assignment operator * * @param saf The StatisticAcceptFilter object that provides data for the this one * * @return This object, configured to match saf */ //------------------------------------------------------------------------------ StatisticAcceptFilter& StatisticAcceptFilter::operator=(const StatisticAcceptFilter& saf) { #ifdef DEBUG_CONSTRUCTION MessageInterface::ShowMessage("StatisticAcceptFilter operator = <%s,%p>\n", GetName().c_str(), this); #endif if (this != &saf) { DataFilter::operator=(saf); thinMode = saf.thinMode; thinningFrequency = saf.thinningFrequency; } return *this; } //------------------------------------------------------------------------------ // GmatBase* Clone() const //------------------------------------------------------------------------------ /** * Clone method for StatisticAcceptFilter * * @return A clone of this object. */ //------------------------------------------------------------------------------ GmatBase* StatisticAcceptFilter::Clone() const { return new StatisticAcceptFilter(*this); } //------------------------------------------------------------------------------ // bool Initialize() //------------------------------------------------------------------------------ /** * Code fired in the Sandbox when the Sandbox initializes objects prior to a run * * @return true on success, false on failure */ //------------------------------------------------------------------------------ bool StatisticAcceptFilter::Initialize() { #ifdef DEBUG_INITIALIZATION MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::Initialize() entered\n", GetName().c_str(), this); #endif bool retval = false; if (DataFilter::Initialize()) { //@todo: Initialize code is here isInitialized = retval; } #ifdef DEBUG_INITIALIZATION MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::Initialize() exit\n", GetName().c_str(), this); #endif return retval; } //------------------------------------------------------------------------------ // std::string GetParameterText(const Integer id) const //------------------------------------------------------------------------------ /** * Retrieves the text string used to script a StatisticAcceptFilter property * * @param id The ID of the property * * @return The string */ //------------------------------------------------------------------------------ std::string StatisticAcceptFilter::GetParameterText(const Integer id) const { if (id >= DataFilterParamCount && id < StatisticAcceptFilterParamCount) return PARAMETER_TEXT[id - DataFilterParamCount]; return DataFilter::GetParameterText(id); } //------------------------------------------------------------------------------ // std::string GetParameterUnit(const Integer id) const //------------------------------------------------------------------------------ /** * Retrieves the units used for a property * * @param id The ID of the property * * @return The text string specifying the property's units */ //------------------------------------------------------------------------------ std::string StatisticAcceptFilter::GetParameterUnit(const Integer id) const { // @Todo: It needs to add code to specify unit used for each parameter return DataFilter::GetParameterUnit(id); } //------------------------------------------------------------------------------ // Integer GetParameterID(const std::string &str) const //------------------------------------------------------------------------------ /** * Retrieves the ID associated with a scripted property string * * @param str The scripted string used for the property * * @return The associated ID */ //------------------------------------------------------------------------------ Integer StatisticAcceptFilter::GetParameterID(const std::string &str) const { for (Integer i = DataFilterParamCount; i < StatisticAcceptFilterParamCount; i++) { if (str == PARAMETER_TEXT[i - DataFilterParamCount]) { if (IsParameterReadOnly(i)) throw MeasurementException("Error: " + str + "parameter was not defined in StatisticsAcceptFilter.\n"); return i; } } return DataFilter::GetParameterID(str); } //------------------------------------------------------------------------------ // Gmat::ParameterType GetParameterType(const Integer id) const //------------------------------------------------------------------------------ /** * Retrieves the parameter type for a property * * @param id The ID of the property * * @return The ParameterType of the property */ //------------------------------------------------------------------------------ Gmat::ParameterType StatisticAcceptFilter::GetParameterType(const Integer id) const { if (id >= DataFilterParamCount && id < StatisticAcceptFilterParamCount) return PARAMETER_TYPE[id - DataFilterParamCount]; return DataFilter::GetParameterType(id); } //------------------------------------------------------------------------------ // std::string GetParameterTypeString(const Integer id) const //------------------------------------------------------------------------------ /** * Retrieves a string describing the type of a property * * @param id The ID of the property * * @return The text description of the property type */ //------------------------------------------------------------------------------ std::string StatisticAcceptFilter::GetParameterTypeString(const Integer id) const { return GmatBase::PARAM_TYPE_STRING[GetParameterType(id)]; } bool StatisticAcceptFilter::IsParameterReadOnly(const Integer id) const { return DataFilter::IsParameterReadOnly(id); } bool StatisticAcceptFilter::IsParameterReadOnly(const std::string &label) const { return IsParameterReadOnly(GetParameterID(label)); } //------------------------------------------------------------------------------ // std::string GetStringParameter(const Integer id) const //------------------------------------------------------------------------------ /** * Retrieves a string property * * @param id The ID of the property * * @return The property value */ //------------------------------------------------------------------------------ std::string StatisticAcceptFilter::GetStringParameter(const Integer id) const { if (id == THIN_MODE) return thinMode; return DataFilter::GetStringParameter(id); } //------------------------------------------------------------------------------ // bool SetStringParameter(const Integer id, const std::string &value) //------------------------------------------------------------------------------ /** * Sets a string property * * @param id The ID of the property * @param value The new value * * @return true on success, false on failure */ //------------------------------------------------------------------------------ bool StatisticAcceptFilter::SetStringParameter(const Integer id, const std::string &value) { if (id == THIN_MODE) { StringArray nameList = GetAllAvailableThinModes(); if (find(nameList.begin(), nameList.end(), value) != nameList.end()) { thinMode = value; return true; } else throw MeasurementException("Error: Value '" + value + "' set to " + GetName() + ".ThinMode is invalid.\n"); } if (id == FILENAMES) { if (value == "All") { if (find(observers.begin(), observers.end(), "From_AddTrackingConfig") != observers.end()) throw MeasurementException("Error: Both 'All' and 'From_AddTrackingConfig' can not set to " + GetName() + ".FileNames simultanously.\n"); } else if (value == "From_AddTrackingConfig") { if (find(observers.begin(), observers.end(), "All") != observers.end()) throw MeasurementException("Error: Both 'All' and 'From_AddTrackingConfig' can not set to " + GetName() + ".FileNames simultanously.\n"); } } return DataFilter::SetStringParameter(id, value); } //------------------------------------------------------------------------------ // std::string GetStringParameter(const std::string &label) const //------------------------------------------------------------------------------ /** * Retrieves a string property of a ErrorModel * * @param label The text description of the property * * @return The property value */ //------------------------------------------------------------------------------ std::string StatisticAcceptFilter::GetStringParameter(const std::string &label) const { return GetStringParameter(GetParameterID(label)); } //------------------------------------------------------------------------------ // bool SetStringParameter(const std::string &label, const std::string &value) //------------------------------------------------------------------------------ /** * Sets a string property * * @param label The text description of the property * @param value The new value * * @return true on success, false on failure */ //------------------------------------------------------------------------------ bool StatisticAcceptFilter::SetStringParameter(const std::string &label, const std::string &value) { return SetStringParameter(GetParameterID(label), value); } //------------------------------------------------------------------------------ // Integer GetIntegerParameter(const Integer id) const //------------------------------------------------------------------------------ /** * Retrieves an integer parameter * * @param id Parameter ID * * @return The parameter value */ //------------------------------------------------------------------------------ Integer StatisticAcceptFilter::GetIntegerParameter(const Integer id) const { if (id == THINNING_FREQUENCY) return thinningFrequency; return DataFilter::GetIntegerParameter(id); } //------------------------------------------------------------------------------ // Integer SetIntegerParameter(const Integer id, const Integer value) //------------------------------------------------------------------------------ /** * Set value to an integer parameter * * @param id Parameter ID * @param value Value which is set to the parameter * * @return The parameter value */ //------------------------------------------------------------------------------ Integer StatisticAcceptFilter::SetIntegerParameter(const Integer id, const Integer value) { if (id == THINNING_FREQUENCY) { if (value > 0) { thinningFrequency = value; return thinningFrequency; } else { std::stringstream ss; ss << "Error: An invalid value (" << value << ") is set to " << GetName() << ".ThinningFrequency parameter.\n"; throw MeasurementException(ss.str()); } } return DataFilter::SetIntegerParameter(id, value); } //------------------------------------------------------------------------------ // Integer GetIntegerParameter(const std::string &label) const //------------------------------------------------------------------------------ /** * Retrieves an integer parameter * * @param label Name of the parameter * * @return The parameter value */ //------------------------------------------------------------------------------ Integer StatisticAcceptFilter::GetIntegerParameter(const std::string &label) const { return GetIntegerParameter(GetParameterID(label)); } //------------------------------------------------------------------------------ // Integer SetIntegerParameter(const std::string &label, const Integer value) //------------------------------------------------------------------------------ /** * Set value to an integer parameter * * @param label Parameter's name * @param value Value which is set to the parameter * * @return The parameter value */ //------------------------------------------------------------------------------ Integer StatisticAcceptFilter::SetIntegerParameter(const std::string &label, const Integer value) { return SetIntegerParameter(GetParameterID(label), value); } //------------------------------------------------------------------------------ // bool SetTrackingConfigs(StringArray tkconfigs) //------------------------------------------------------------------------------ /** * Set value to an integer parameter * * @param tkconfigs A list of tracking configuration * * @return true if the setting is successfull */ //------------------------------------------------------------------------------ bool StatisticAcceptFilter::SetTrackingConfigs(StringArray tkconfigs) { tkConfigList = tkconfigs; return true; } //------------------------------------------------------------------------------ // ObservationData* FilteringData(ObservationData* dataObject, Integer& rejectedReason) //------------------------------------------------------------------------------ /** * This function is used to filter data * * @param dataObject An input data record * @param rejectedReason Reason the record is rejected * * @return NULL if the input data record is rejected, * the input data record otherwise */ //------------------------------------------------------------------------------ ObservationData* StatisticAcceptFilter::FilteringData(ObservationData* dataObject, Integer& rejectedReason) { #ifdef DEBUG_DATA_FILTER MessageInterface::ShowMessage("StatisticAcceptFilter::FilteringData(dataObject = <%p>, rejectedReason = %d) enter\n", dataObject, rejectedReason); #endif // 0. FileNames verify: data is rejected when file name list is empty bool pass0 = true; rejectedReason = 0; // 0: no rejected due to accept all spacecrafts if (fileNames.empty()) { pass0 = false; rejectedReason = 8; // 8: rejected due to file name list is empty } if (!pass0) { #ifdef DEBUG_FILTER MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::FilteringData(dataObject = <%p>, rejectedReason = %d) exit6 return NULL\n", GetName().c_str(), this, dataObject, rejectedReason); #endif return NULL; // return NULL when it does not pass the test. The value of rejectedReason has to be 8 } // Filter data using tracking configs bool pass5 = true; rejectedReason = 0; if (find(fileNames.begin(), fileNames.end(), "From_AddTrackingConfig") != fileNames.end()) { // Filter data based on tracking configs when tracking configs are not generated automatically if (tkConfigList.size() != 0) { bool pass5 = false; rejectedReason = 9; // 9: reject due to tracking configuration for(UnsignedInt i = 0; i < tkConfigList.size(); ++i) { if (dataObject->GetTrackingConfig() == tkConfigList[i]) { pass5 = true; rejectedReason = 0; break; } } if (!pass5) { #ifdef DEBUG_FILTER MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::FilteringData(dataObject = <%p>, rejectedReason = %d) exit7 return NULL\n", GetName().c_str(), this, dataObject, rejectedReason); #endif return NULL; } } } else { if (!HasFile(dataObject)) { #ifdef DEBUG_FILTER MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::FilteringData(dataObject = <%p>, rejectedReason = %d) exit6.1 return NULL\n", GetName().c_str(), this, dataObject, rejectedReason); #endif rejectedReason = 8; return NULL; } } // 1. Observated objects verify: It will be passed the test when observation data contains one spacecraft in "observers" array if (!HasObserver(dataObject)) { rejectedReason = 6; // 6: rejected due to spacecraft is not found #ifdef DEBUG_FILTER MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::FilteringData(dataObject = <%p>, rejectedReason = %d) exit1 return NULL\n", GetName().c_str(), this, dataObject, rejectedReason); #endif return NULL; // return NULL when it does not have any observer listing in DataFilter object. The value of rejectedReason has to be 6 } // 2. Trackers verify: It will be passed the test when observation data contains one ground station in "trackers" array if (!HasTracker(dataObject)) { rejectedReason = 5; // 5: rejected due to ground station is not found #ifdef DEBUG_FILTER MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::FilteringData(dataObject = <%p>, rejectedReason = %d) exit2 return NULL\n", GetName().c_str(), this, dataObject, rejectedReason); #endif return NULL; // return NULL when it does not have any tracker listing in DataFilter object. The value of rejectedReason has to be 5 } // 3. Measurement type verify: It will be passed the test when data type of observation data is found in "dataTypes" array if (!HasDataType(dataObject)) { rejectedReason = 7; // 7: rejected due to data type of observation data is not found #ifdef DEBUG_FILTER MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::FilteringData(dataObject = <%p>, rejectedReason = %d) exit3 return NULL\n", GetName().c_str(), this, dataObject, rejectedReason); #endif return NULL; // return NULL when it does not have any data type listing in DataFilter object. The value of rejectedReason has to be 7 } // Strands verify: // 4. Time interval verify: if (!IsInTimeWindow(dataObject)) { rejectedReason = 2; // 2: rejected due to time span #ifdef DEBUG_FILTER GmatEpoch currentEpoch = TimeConverterUtil::Convert(dataObject->epoch, dataObject->epochSystem, TimeConverterUtil::A1MJD); MessageInterface::ShowMessage(" currentEpoch = %.12lf epochStart = %.12lf epochEnd = %.12lf\n", currentEpoch, epochStart, epochEnd); MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::FilteringData(dataObject = <%p>, rejectedReason = %d) exit4 return NULL time out of range\n", GetName().c_str(), this, dataObject, rejectedReason); #endif return NULL; // return NULL when measurement epoch is not in time window. The value of rejectedReason has to be 2 } // 5. Data thin verify: if (!IsThin(dataObject)) { rejectedReason = 1; // 1: reject due to thinning ratio #ifdef DEBUG_FILTER //MessageInterface::ShowMessage("StatisticAcceptFilter::FilteringData(dataObject = <%p>, rejectedReason = %d) exit5 return NULL recCount = %d thinningFrequency = %d\n", dataObject, rejectedReason, recCount, thinningFrequency); MessageInterface::ShowMessage("StatisticAcceptFilter::FilteringData(dataObject = <%p>, rejectedReason = %d) exit5 return NULL thinningFrequency = %d\n", dataObject, rejectedReason, thinningFrequency); #endif return NULL; } #ifdef DEBUG_FILTER MessageInterface::ShowMessage("StatisticAcceptFilter<%s,%p>::FilteringData(dataObject = <%p>, rejectedReason = %d) exit0 return <%p>\n", GetName().c_str(), this, dataObject, rejectedReason, dataObject); #endif return dataObject; } //------------------------------------------------------------------------------ // StringArray GetAllAvailableThinModes() //------------------------------------------------------------------------------ /** * Retrieves a list of all available thin modes * * @return A list of all available thin modes */ //------------------------------------------------------------------------------ StringArray StatisticAcceptFilter::GetAllAvailableThinModes() { StringArray nameList; nameList.push_back("Frequency"); // data thinning is applied based on record count nameList.push_back("Time"); // data thinning is applied based on time range return nameList; } //------------------------------------------------------------------------------ // bool IsThin(ObservationData* dataObject) //------------------------------------------------------------------------------ /** * Verify a data record to be satisfied thinning criteria * * @return true if it is satisfied, false otherwise */ //------------------------------------------------------------------------------ bool StatisticAcceptFilter::IsThin(ObservationData* dataObject) { bool isAccepted = false; // 1. Get tracking config from observation data std::string trackingConfig = dataObject->GetTrackingConfig(); if (thinMode == "Frequency") { // 2. If tracking config is not in recCountMap, set record count to 0 for that tracking config bool found = false; for (std::map<std::string, Integer>::iterator i = recCountMap.begin(); i != recCountMap.end(); ++i) { if (i->first == trackingConfig) { found = true; break; } } if (!found) recCountMap[trackingConfig] = 0; // 3. Book keeping record count for this tracking config if (recCountMap[trackingConfig] == (thinningFrequency - 1)) { isAccepted = true; recCountMap[trackingConfig] = 0; } else { ++recCountMap[trackingConfig]; } } else if (thinMode == "Time") { // 2. If tracking config is not in startTimeWindowMap, set start time window to epochStart for that tracking config bool found = false; for (std::map<std::string,GmatEpoch>::iterator i = startTimeWindowMap.begin(); i != startTimeWindowMap.end(); ++i) { if (i->first == trackingConfig) { found = true; break; } } if (!found) startTimeWindowMap[trackingConfig] = epochStart; if (dataObject->epoch > startTimeWindowMap[trackingConfig]) { isAccepted = true; Real step = GmatMathUtil::Floor((dataObject->epoch - startTimeWindowMap[trackingConfig]) * GmatTimeConstants::SECS_PER_DAY / thinningFrequency); startTimeWindowMap[trackingConfig] = startTimeWindowMap[trackingConfig] + (step + 1)*(thinningFrequency / GmatTimeConstants::SECS_PER_DAY); } } else throw MeasurementException("Error: " + GetName() + ".ThinMode parameter has an invalid value ('" + thinMode + "'.\n"); return isAccepted; }
/* ============================================================================ * Copyright (c) 2009-2016 BlueQuartz Software, LLC * * 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 BlueQuartz Software, the US Air Force, 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. * * The code contained herein was partially funded by the followig contracts: * United States Air Force Prime Contract FA8650-07-D-5800 * United States Air Force Prime Contract FA8650-10-D-5210 * United States Prime Contract Navy N00173-07-C-2068 * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #include "ExtractAttributeArraysFromGeometry.h" #include <cassert> #include <cstring> #include "SIMPLib/Common/Constants.h" #include "SIMPLib/FilterParameters/AbstractFilterParametersReader.h" #include "SIMPLib/FilterParameters/DataArrayCreationFilterParameter.h" #include "SIMPLib/FilterParameters/LinkedDataContainerSelectionFilterParameter.h" #include "SIMPLib/Geometry/EdgeGeom.h" #include "SIMPLib/Geometry/HexahedralGeom.h" #include "SIMPLib/Geometry/ImageGeom.h" #include "SIMPLib/Geometry/QuadGeom.h" #include "SIMPLib/Geometry/RectGridGeom.h" #include "SIMPLib/Geometry/TetrahedralGeom.h" #include "SIMPLib/Geometry/TriangleGeom.h" #include "SIMPLib/Geometry/VertexGeom.h" #include "SIMPLib/SIMPLibVersion.h" enum createdPathID : RenameDataPath::DataID_t { RectGrid_XBoundsID = 1, RectGrid_YBoundsID, RectGrid_ZBoundsID, Vert_SharedVertexID, Edge_SharedVertexID, Edge_SharedEdgeID, Tri_SharedVertexID, Tri_SharedTriangleID, Quad_SharedVertexID, Quad_SharedQuadID, Tet_SharedVertexID, Tet_SharedTetID, Hex_SharedVertexID, Hex_SharedHexID }; // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- ExtractAttributeArraysFromGeometry::ExtractAttributeArraysFromGeometry() : m_DataContainerName("") , m_SharedVertexListArrayPath0(SIMPL::Defaults::VertexDataContainerName, SIMPL::Defaults::VertexAttributeMatrixName, "VertexCoordinates") , m_SharedVertexListArrayPath1(SIMPL::Defaults::EdgeDataContainerName, SIMPL::Defaults::VertexAttributeMatrixName, "VertexCoordinates") , m_SharedVertexListArrayPath2(SIMPL::Defaults::TriangleDataContainerName, SIMPL::Defaults::VertexAttributeMatrixName, "VertexCoordinates") , m_SharedVertexListArrayPath3(SIMPL::Defaults::QuadDataContainerName, SIMPL::Defaults::VertexAttributeMatrixName, "VertexCoordinates") , m_SharedVertexListArrayPath4(SIMPL::Defaults::TetrahedralDataContainerName, SIMPL::Defaults::VertexAttributeMatrixName, "VertexCoordinates") , m_SharedVertexListArrayPath5(SIMPL::Defaults::HexahedralDataContainerName, SIMPL::Defaults::VertexAttributeMatrixName, "VertexCoordinates") , m_SharedEdgeListArrayPath(SIMPL::Defaults::EdgeDataContainerName, SIMPL::Defaults::EdgeAttributeMatrixName, "EdgeConnectivity") , m_SharedTriListArrayPath(SIMPL::Defaults::TriangleDataContainerName, SIMPL::Defaults::FaceAttributeMatrixName, "TriangleConnectivity") , m_SharedQuadListArrayPath(SIMPL::Defaults::QuadDataContainerName, SIMPL::Defaults::FaceAttributeMatrixName, "QuadConnectivity") , m_SharedTetListArrayPath(SIMPL::Defaults::TetrahedralDataContainerName, SIMPL::Defaults::CellAttributeMatrixName, "TetConnectivity") , m_SharedHexListArrayPath(SIMPL::Defaults::HexahedralDataContainerName, SIMPL::Defaults::CellAttributeMatrixName, "HexConnectivity") , m_XBoundsArrayPath("", "", "XBounds") , m_YBoundsArrayPath("", "", "YBounds") , m_ZBoundsArrayPath("", "", "ZBounds") { initialize(); } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- ExtractAttributeArraysFromGeometry::~ExtractAttributeArraysFromGeometry() = default; // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ExtractAttributeArraysFromGeometry::initialize() { clearErrorCode(); clearWarningCode(); setCancel(false); } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ExtractAttributeArraysFromGeometry::setupFilterParameters() { FilterParameterVectorType parameters; { LinkedDataContainerSelectionFilterParameter::Pointer parameter = LinkedDataContainerSelectionFilterParameter::New(); parameter->setHumanLabel("Geometry"); parameter->setPropertyName("DataContainerName"); parameter->setSetterCallback(SIMPL_BIND_SETTER(ExtractAttributeArraysFromGeometry, this, DataContainerName)); parameter->setGetterCallback(SIMPL_BIND_GETTER(ExtractAttributeArraysFromGeometry, this, DataContainerName)); QStringList linkedProps = { "XBoundsArrayPath", "YBoundsArrayPath", "ZBoundsArrayPath", // RectGridGeom "SharedVertexListArrayPath0", // VertexGeom "SharedVertexListArrayPath1", "SharedEdgeListArrayPath", // EdgeGeom "SharedVertexListArrayPath2", "SharedTriListArrayPath", // TriangleGeom "SharedVertexListArrayPath3", "SharedQuadListArrayPath", // QuadGeom "SharedVertexListArrayPath4", "SharedTetListArrayPath", // TetrahedralGeom "SharedVertexListArrayPath5", "SharedHexListArrayPath" // HexahedralGeom }; parameter->setLinkedProperties(linkedProps); parameter->setCategory(FilterParameter::Parameter); IGeometry::Types geomTypes = {IGeometry::Type::RectGrid, IGeometry::Type::Vertex, IGeometry::Type::Edge, IGeometry::Type::Triangle, IGeometry::Type::Quad, IGeometry::Type::Tetrahedral, IGeometry::Type::Hexahedral}; parameter->setDefaultGeometryTypes(geomTypes); parameters.push_back(parameter); } { DataArrayCreationFilterParameter::RequirementType req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Any, IGeometry::Type::RectGrid); parameters.push_back( SIMPL_NEW_DA_CREATION_FP("X Bounds", XBoundsArrayPath, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::RectGrid))); parameters.push_back( SIMPL_NEW_DA_CREATION_FP("Y Bounds", YBoundsArrayPath, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::RectGrid))); parameters.push_back( SIMPL_NEW_DA_CREATION_FP("Z Bounds", ZBoundsArrayPath, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::RectGrid))); } { DataArrayCreationFilterParameter::RequirementType req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Vertex, IGeometry::Type::Vertex); parameters.push_back( SIMPL_NEW_DA_CREATION_FP("Vertex List", SharedVertexListArrayPath0, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Vertex))); } { DataArrayCreationFilterParameter::RequirementType req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Vertex, IGeometry::Type::Edge); parameters.push_back(SIMPL_NEW_DA_CREATION_FP("Shared Vertex List", SharedVertexListArrayPath1, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Edge))); req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Edge, IGeometry::Type::Edge); parameters.push_back( SIMPL_NEW_DA_CREATION_FP("Edge List", SharedEdgeListArrayPath, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Edge))); } { DataArrayCreationFilterParameter::RequirementType req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Vertex, IGeometry::Type::Triangle); parameters.push_back(SIMPL_NEW_DA_CREATION_FP("Shared Vertex List", SharedVertexListArrayPath2, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Triangle))); req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Face, IGeometry::Type::Triangle); parameters.push_back( SIMPL_NEW_DA_CREATION_FP("Triangle List", SharedTriListArrayPath, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Triangle))); } { DataArrayCreationFilterParameter::RequirementType req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Vertex, IGeometry::Type::Quad); parameters.push_back(SIMPL_NEW_DA_CREATION_FP("Shared Vertex List", SharedVertexListArrayPath3, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Quad))); req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Face, IGeometry::Type::Quad); parameters.push_back( SIMPL_NEW_DA_CREATION_FP("Quadrilateral List", SharedQuadListArrayPath, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Quad))); } { DataArrayCreationFilterParameter::RequirementType req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Vertex, IGeometry::Type::Tetrahedral); parameters.push_back(SIMPL_NEW_DA_CREATION_FP("Shared Vertex List", SharedVertexListArrayPath4, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Tetrahedral))); req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Cell, IGeometry::Type::Tetrahedral); parameters.push_back(SIMPL_NEW_DA_CREATION_FP("Tetrahedral List", SharedTetListArrayPath, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Tetrahedral))); } { DataArrayCreationFilterParameter::RequirementType req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Vertex, IGeometry::Type::Hexahedral); parameters.push_back(SIMPL_NEW_DA_CREATION_FP("Shared Vertex List", SharedVertexListArrayPath5, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Hexahedral))); req = DataArrayCreationFilterParameter::CreateRequirement(AttributeMatrix::Type::Cell, IGeometry::Type::Hexahedral); parameters.push_back(SIMPL_NEW_DA_CREATION_FP("Hexahedral List", SharedHexListArrayPath, FilterParameter::RequiredArray, ExtractAttributeArraysFromGeometry, req, static_cast<int32_t>(IGeometry::Type::Hexahedral))); } setFilterParameters(parameters); } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ExtractAttributeArraysFromGeometry::readFilterParameters(AbstractFilterParametersReader* reader, int index) { reader->openFilterGroup(this, index); setDataContainerName(reader->readDataArrayPath("DataContainerName", getDataContainerName())); setSharedVertexListArrayPath0(reader->readDataArrayPath("SharedVertexListArrayPath0", getSharedVertexListArrayPath0())); setSharedVertexListArrayPath1(reader->readDataArrayPath("SharedVertexListArrayPath1", getSharedVertexListArrayPath1())); setSharedVertexListArrayPath2(reader->readDataArrayPath("SharedVertexListArrayPath2", getSharedVertexListArrayPath2())); setSharedVertexListArrayPath3(reader->readDataArrayPath("SharedVertexListArrayPath3", getSharedVertexListArrayPath3())); setSharedVertexListArrayPath4(reader->readDataArrayPath("SharedVertexListArrayPath4", getSharedVertexListArrayPath4())); setSharedVertexListArrayPath5(reader->readDataArrayPath("SharedVertexListArrayPath5", getSharedVertexListArrayPath5())); setSharedEdgeListArrayPath(reader->readDataArrayPath("SharedEdgeListArrayPath", getSharedEdgeListArrayPath())); setSharedTriListArrayPath(reader->readDataArrayPath("SharedTriListArrayPath", getSharedTriListArrayPath())); setSharedQuadListArrayPath(reader->readDataArrayPath("SharedQuadListArrayPath", getSharedQuadListArrayPath())); setSharedTetListArrayPath(reader->readDataArrayPath("SharedTetListArrayPath", getSharedTetListArrayPath())); setSharedHexListArrayPath(reader->readDataArrayPath("SharedHexListArrayPath", getSharedHexListArrayPath())); setXBoundsArrayPath(reader->readDataArrayPath("XBoundsArrayPath", getXBoundsArrayPath())); setYBoundsArrayPath(reader->readDataArrayPath("YBoundsArrayPath", getYBoundsArrayPath())); setZBoundsArrayPath(reader->readDataArrayPath("ZBoundsArrayPath", getZBoundsArrayPath())); reader->closeFilterGroup(); } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ExtractAttributeArraysFromGeometry::dataCheck() { clearErrorCode(); clearWarningCode(); initialize(); IGeometry::Pointer igeom = getDataContainerArray()->getPrereqGeometryFromDataContainer<IGeometry, AbstractFilter>(this, getDataContainerName()); if(getErrorCode() < 0) { return; } IGeometry::Type geomType = igeom->getGeometryType(); switch(geomType) { case IGeometry::Type::RectGrid: // RectGridGeom { RectGridGeom::Pointer rectgrid = std::static_pointer_cast<RectGridGeom>(igeom); QVector<IDataArray::Pointer> xarrays; QVector<IDataArray::Pointer> yarrays; QVector<IDataArray::Pointer> zarrays; xarrays.push_back(rectgrid->getXBounds()); yarrays.push_back(rectgrid->getYBounds()); zarrays.push_back(rectgrid->getZBounds()); std::vector<size_t> cDims(1, 1); m_XBoundsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, getXBoundsArrayPath(), 0, cDims, "", RectGrid_XBoundsID); if(m_XBoundsPtr.lock()) { m_XBounds = m_XBoundsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { xarrays.push_back(m_XBoundsPtr.lock()); } m_YBoundsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, getYBoundsArrayPath(), 0, cDims, "", RectGrid_YBoundsID); if(m_YBoundsPtr.lock()) { m_YBounds = m_YBoundsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { yarrays.push_back(m_YBoundsPtr.lock()); } m_ZBoundsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, getZBoundsArrayPath(), 0, cDims, "", RectGrid_ZBoundsID); if(m_ZBoundsPtr.lock()) { m_ZBounds = m_ZBoundsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { zarrays.push_back(m_ZBoundsPtr.lock()); } getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, xarrays); getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, yarrays); getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, zarrays); break; } case IGeometry::Type::Vertex: // VertexGeom { VertexGeom::Pointer vertex = std::static_pointer_cast<VertexGeom>(igeom); QVector<IDataArray::Pointer> arrays; arrays.push_back(vertex->getVertices()); std::vector<size_t> cDims(1, 3); m_VertsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, getSharedVertexListArrayPath0(), 0, cDims, "", Vert_SharedVertexID); if(m_VertsPtr.lock()) { m_Verts = m_VertsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { arrays.push_back(m_VertsPtr.lock()); } getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, arrays); break; } case IGeometry::Type::Edge: // EdgeGeom { EdgeGeom::Pointer edge = std::static_pointer_cast<EdgeGeom>(igeom); QVector<IDataArray::Pointer> varrays; QVector<IDataArray::Pointer> earrays; varrays.push_back(edge->getVertices()); earrays.push_back(edge->getEdges()); std::vector<size_t> cDims(1, 3); m_VertsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, getSharedVertexListArrayPath1(), 0, cDims, "", Edge_SharedVertexID); if(m_VertsPtr.lock()) { m_Verts = m_VertsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { varrays.push_back(m_VertsPtr.lock()); } cDims[0] = 2; m_EdgesPtr = getDataContainerArray()->createNonPrereqArrayFromPath<SharedEdgeList, AbstractFilter, MeshIndexType>(this, getSharedEdgeListArrayPath(), 0, cDims, "", Edge_SharedEdgeID); if(m_EdgesPtr.lock()) { m_Edges = m_EdgesPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { earrays.push_back(m_EdgesPtr.lock()); } getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, varrays); getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, earrays); break; } case IGeometry::Type::Triangle: // TriangleGeom { TriangleGeom::Pointer triangle = std::static_pointer_cast<TriangleGeom>(igeom); QVector<IDataArray::Pointer> varrays; QVector<IDataArray::Pointer> earrays; varrays.push_back(triangle->getVertices()); earrays.push_back(triangle->getTriangles()); std::vector<size_t> cDims(1, 3); m_VertsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, getSharedVertexListArrayPath2(), 0, cDims, "", Tri_SharedVertexID); if(m_VertsPtr.lock()) { m_Verts = m_VertsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { varrays.push_back(m_VertsPtr.lock()); } m_TrisPtr = getDataContainerArray()->createNonPrereqArrayFromPath<SharedTriList, AbstractFilter, MeshIndexType>(this, getSharedTriListArrayPath(), 0, cDims, "", Tri_SharedTriangleID); if(m_TrisPtr.lock()) { m_Tris = m_TrisPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { earrays.push_back(m_TrisPtr.lock()); } getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, varrays); getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, earrays); break; } case IGeometry::Type::Quad: // QuadGeom { QuadGeom::Pointer quad = std::static_pointer_cast<QuadGeom>(igeom); QVector<IDataArray::Pointer> varrays; QVector<IDataArray::Pointer> earrays; varrays.push_back(quad->getVertices()); earrays.push_back(quad->getQuads()); std::vector<size_t> cDims(1, 3); m_VertsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, getSharedVertexListArrayPath3(), 0, cDims, "", Quad_SharedVertexID); if(m_VertsPtr.lock()) { m_Verts = m_VertsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { varrays.push_back(m_VertsPtr.lock()); } cDims[0] = 4; m_QuadsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<SharedQuadList, AbstractFilter, MeshIndexType>(this, getSharedQuadListArrayPath(), 0, cDims, "", Quad_SharedQuadID); if(m_QuadsPtr.lock()) { m_Quads = m_QuadsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { earrays.push_back(m_QuadsPtr.lock()); } getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, varrays); getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, earrays); break; } case IGeometry::Type::Tetrahedral: // TetrahedralGeom { TetrahedralGeom::Pointer tet = std::static_pointer_cast<TetrahedralGeom>(igeom); QVector<IDataArray::Pointer> varrays; QVector<IDataArray::Pointer> earrays; varrays.push_back(tet->getVertices()); earrays.push_back(tet->getTetrahedra()); std::vector<size_t> cDims(1, 3); m_VertsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, getSharedVertexListArrayPath4(), 0, cDims, "", Tet_SharedVertexID); if(m_VertsPtr.lock()) { m_Verts = m_VertsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { varrays.push_back(m_VertsPtr.lock()); } cDims[0] = 4; m_TetsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<SharedTetList, AbstractFilter, MeshIndexType>(this, getSharedTetListArrayPath(), 0, cDims, "", Tet_SharedTetID); if(m_TetsPtr.lock()) { m_Tets = m_TetsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { earrays.push_back(m_TetsPtr.lock()); } getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, varrays); getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, earrays); break; } case IGeometry::Type::Hexahedral: // HexahedralGeom { HexahedralGeom::Pointer hex = std::static_pointer_cast<HexahedralGeom>(igeom); QVector<IDataArray::Pointer> varrays; QVector<IDataArray::Pointer> earrays; varrays.push_back(hex->getVertices()); earrays.push_back(hex->getHexahedra()); std::vector<size_t> cDims(1, 3); m_VertsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<DataArray<float>, AbstractFilter, float>(this, getSharedVertexListArrayPath5(), 0, cDims, "", Hex_SharedVertexID); if(m_VertsPtr.lock()) { m_Verts = m_VertsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { varrays.push_back(m_VertsPtr.lock()); } cDims[0] = 8; m_TetsPtr = getDataContainerArray()->createNonPrereqArrayFromPath<SharedHexList, AbstractFilter, MeshIndexType>(this, getSharedHexListArrayPath(), 0, cDims, "", Hex_SharedHexID); if(m_TetsPtr.lock()) { m_Tets = m_TetsPtr.lock()->getPointer(0); } if(getErrorCode() >= 0) { earrays.push_back(m_TetsPtr.lock()); } getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, varrays); getDataContainerArray()->validateNumberOfTuples<AbstractFilter>(this, earrays); break; } default: { QString ss = QObject::tr("Selected Data Container (%1) does not contain a valid geometry\n" "Geometry Type: %2\n" "Valid Geometry Types: Rectilinear Grid, Vertex, Edge, Triangle, Quadrilateral, Tetrahedral") .arg(getDataContainerName().getDataContainerName()) .arg(igeom->getGeometryTypeAsString()); setErrorCondition(-701, ss); break; } } } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ExtractAttributeArraysFromGeometry::preflight() { // These are the REQUIRED lines of CODE to make sure the filter behaves correctly setInPreflight(true); // Set the fact that we are preflighting. emit preflightAboutToExecute(); // Emit this signal so that other widgets can do one file update emit updateFilterParameters(this); // Emit this signal to have the widgets push their values down to the filter dataCheck(); // Run our DataCheck to make sure everthing is setup correctly emit preflightExecuted(); // We are done preflighting this filter setInPreflight(false); // Inform the system this filter is NOT in preflight mode anymore. } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ExtractAttributeArraysFromGeometry::execute() { initialize(); dataCheck(); if(getErrorCode() < 0) { return; } IGeometry::Pointer igeom = getDataContainerArray()->getPrereqGeometryFromDataContainer<IGeometry, AbstractFilter>(this, getDataContainerName()); IGeometry::Type geomType = igeom->getGeometryType(); switch(geomType) { case IGeometry::Type::RectGrid: // RectGridGeom { RectGridGeom::Pointer rectgrid = std::static_pointer_cast<RectGridGeom>(igeom); FloatArrayType::Pointer xbounds = rectgrid->getXBounds(); FloatArrayType::Pointer ybounds = rectgrid->getYBounds(); FloatArrayType::Pointer zbounds = rectgrid->getZBounds(); assert(xbounds->getSize() == m_XBoundsPtr.lock()->getSize()); assert(ybounds->getSize() == m_YBoundsPtr.lock()->getSize()); assert(zbounds->getSize() == m_ZBoundsPtr.lock()->getSize()); std::memcpy(m_XBounds, xbounds->getPointer(0), xbounds->getSize() * sizeof(float)); std::memcpy(m_YBounds, ybounds->getPointer(0), ybounds->getSize() * sizeof(float)); std::memcpy(m_ZBounds, zbounds->getPointer(0), zbounds->getSize() * sizeof(float)); break; } case IGeometry::Type::Vertex: // VertexGeom { VertexGeom::Pointer vertex = std::static_pointer_cast<VertexGeom>(igeom); SharedVertexList::Pointer verts = vertex->getVertices(); assert(verts->getSize() == m_VertsPtr.lock()->getSize()); std::memcpy(m_Verts, verts->getPointer(0), verts->getSize() * sizeof(float)); break; } case IGeometry::Type::Edge: // EdgeGeom { EdgeGeom::Pointer edge = std::static_pointer_cast<EdgeGeom>(igeom); SharedVertexList::Pointer verts = edge->getVertices(); SharedEdgeList::Pointer edges = edge->getEdges(); assert(verts->getSize() == m_VertsPtr.lock()->getSize()); assert(edges->getSize() == m_EdgesPtr.lock()->getSize()); std::memcpy(m_Verts, verts->getPointer(0), verts->getSize() * sizeof(float)); std::memcpy(m_Edges, edges->getPointer(0), edges->getSize() * sizeof(int64_t)); break; } case IGeometry::Type::Triangle: // TriangleGeom { TriangleGeom::Pointer triangle = std::static_pointer_cast<TriangleGeom>(igeom); SharedVertexList::Pointer verts = triangle->getVertices(); SharedTriList::Pointer tris = triangle->getTriangles(); assert(verts->getSize() == m_VertsPtr.lock()->getSize()); assert(tris->getSize() == m_TrisPtr.lock()->getSize()); std::memcpy(m_Verts, verts->getPointer(0), verts->getSize() * sizeof(float)); std::memcpy(m_Tris, tris->getPointer(0), tris->getSize() * sizeof(int64_t)); break; } case IGeometry::Type::Quad: // QuadGeom { QuadGeom::Pointer quad = std::static_pointer_cast<QuadGeom>(igeom); SharedVertexList::Pointer verts = quad->getVertices(); SharedQuadList::Pointer quads = quad->getQuads(); assert(verts->getSize() == m_VertsPtr.lock()->getSize()); assert(quads->getSize() == m_QuadsPtr.lock()->getSize()); std::memcpy(m_Verts, verts->getPointer(0), verts->getSize() * sizeof(float)); std::memcpy(m_Quads, quads->getPointer(0), quads->getSize() * sizeof(int64_t)); break; } case IGeometry::Type::Tetrahedral: // TetrahedralGeom { TetrahedralGeom::Pointer tet = std::static_pointer_cast<TetrahedralGeom>(igeom); SharedVertexList::Pointer verts = tet->getVertices(); SharedTetList::Pointer tets = tet->getTetrahedra(); assert(verts->getSize() == m_VertsPtr.lock()->getSize()); assert(tets->getSize() == m_TetsPtr.lock()->getSize()); std::memcpy(m_Verts, verts->getPointer(0), verts->getSize() * sizeof(float)); std::memcpy(m_Tets, tets->getPointer(0), tets->getSize() * sizeof(int64_t)); break; } case IGeometry::Type::Hexahedral: // HexahedralGeom { HexahedralGeom::Pointer hex = std::static_pointer_cast<HexahedralGeom>(igeom); SharedVertexList::Pointer verts = hex->getVertices(); SharedTetList::Pointer tets = hex->getHexahedra(); assert(verts->getSize() == m_VertsPtr.lock()->getSize()); assert(tets->getSize() == m_TetsPtr.lock()->getSize()); std::memcpy(m_Verts, verts->getPointer(0), verts->getSize() * sizeof(float)); std::memcpy(m_Tets, tets->getPointer(0), tets->getSize() * sizeof(int64_t)); break; } default: { break; } } } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- AbstractFilter::Pointer ExtractAttributeArraysFromGeometry::newFilterInstance(bool copyFilterParameters) const { ExtractAttributeArraysFromGeometry::Pointer filter = ExtractAttributeArraysFromGeometry::New(); if(copyFilterParameters) { copyFilterParameterInstanceVariables(filter.get()); } return filter; } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- const QString ExtractAttributeArraysFromGeometry::getCompiledLibraryName() const { return Core::CoreBaseName; } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- const QString ExtractAttributeArraysFromGeometry::getBrandingString() const { return "SIMPLib Core Filter"; } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- const QString ExtractAttributeArraysFromGeometry::getFilterVersion() const { QString version; QTextStream vStream(&version); vStream << SIMPLib::Version::Major() << "." << SIMPLib::Version::Minor() << "." << SIMPLib::Version::Patch(); return version; } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- const QString ExtractAttributeArraysFromGeometry::getGroupName() const { return SIMPL::FilterGroups::CoreFilters; } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- const QUuid ExtractAttributeArraysFromGeometry::getUuid() { return QUuid("{2060a933-b6f5-50fd-9382-a008a5cef17f}"); } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- const QString ExtractAttributeArraysFromGeometry::getSubGroupName() const { return SIMPL::FilterSubGroups::GeometryFilters; } // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- const QString ExtractAttributeArraysFromGeometry::getHumanLabel() const { return "Extract Attribute Arrays from Geometry"; }
// C++ for the Windows Runtime vv1.0.170303.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "../base.h" #include "Windows.ApplicationModel.Calls.0.h" #include "Windows.ApplicationModel.Contacts.0.h" #include "Windows.Foundation.0.h" #include "Windows.System.0.h" #include "Windows.UI.0.h" #include "Windows.Foundation.1.h" #include "Windows.Foundation.Collections.1.h" WINRT_EXPORT namespace winrt { namespace ABI::Windows::ApplicationModel::Calls { struct __declspec(uuid("fd789617-2dd7-4c8c-b2bd-95d17a5bb733")) __declspec(novtable) ICallAnswerEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_AcceptedMedia(winrt::Windows::ApplicationModel::Calls::VoipPhoneCallMedia * value) = 0; }; struct __declspec(uuid("da47fad7-13d4-4d92-a1c2-b77811ee37ec")) __declspec(novtable) ICallRejectEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_RejectReason(winrt::Windows::ApplicationModel::Calls::VoipPhoneCallRejectReason * value) = 0; }; struct __declspec(uuid("eab2349e-66f5-47f9-9fb5-459c5198c720")) __declspec(novtable) ICallStateChangeEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_State(winrt::Windows::ApplicationModel::Calls::VoipPhoneCallState * value) = 0; }; struct __declspec(uuid("2dd7ed0d-98ed-4041-9632-50ff812b773f")) __declspec(novtable) ILockScreenCallEndCallDeferral : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_Complete() = 0; }; struct __declspec(uuid("8190a363-6f27-46e9-aeb6-c0ae83e47dc7")) __declspec(novtable) ILockScreenCallEndRequestedEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_GetDeferral(Windows::ApplicationModel::Calls::ILockScreenCallEndCallDeferral ** value) = 0; virtual HRESULT __stdcall get_Deadline(Windows::Foundation::DateTime * value) = 0; }; struct __declspec(uuid("c596fd8d-73c9-4a14-b021-ec1c50a3b727")) __declspec(novtable) ILockScreenCallUI : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_Dismiss() = 0; virtual HRESULT __stdcall add_EndRequested(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::LockScreenCallUI, Windows::ApplicationModel::Calls::LockScreenCallEndRequestedEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_EndRequested(event_token token) = 0; virtual HRESULT __stdcall add_Closed(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::LockScreenCallUI, Windows::Foundation::IInspectable> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_Closed(event_token token) = 0; virtual HRESULT __stdcall get_CallTitle(hstring * value) = 0; virtual HRESULT __stdcall put_CallTitle(hstring value) = 0; }; struct __declspec(uuid("8585e159-0c41-432c-814d-c5f1fdf530be")) __declspec(novtable) IMuteChangeEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Muted(bool * value) = 0; }; struct __declspec(uuid("19646f84-2b79-26f1-a46f-694be043f313")) __declspec(novtable) IPhoneCallBlockingStatics : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_BlockUnknownNumbers(bool * value) = 0; virtual HRESULT __stdcall put_BlockUnknownNumbers(bool value) = 0; virtual HRESULT __stdcall get_BlockPrivateNumbers(bool * value) = 0; virtual HRESULT __stdcall put_BlockPrivateNumbers(bool value) = 0; virtual HRESULT __stdcall abi_SetCallBlockingListAsync(Windows::Foundation::Collections::IIterable<hstring> * phoneNumberList, Windows::Foundation::IAsyncOperation<bool> ** result) = 0; }; struct __declspec(uuid("fab0e129-32a4-4b85-83d1-f90d8c23a857")) __declspec(novtable) IPhoneCallHistoryEntry : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Id(hstring * value) = 0; virtual HRESULT __stdcall get_Address(Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryAddress ** value) = 0; virtual HRESULT __stdcall put_Address(Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryAddress * value) = 0; virtual HRESULT __stdcall get_Duration(Windows::Foundation::IReference<Windows::Foundation::TimeSpan> ** value) = 0; virtual HRESULT __stdcall put_Duration(Windows::Foundation::IReference<Windows::Foundation::TimeSpan> * value) = 0; virtual HRESULT __stdcall get_IsCallerIdBlocked(bool * value) = 0; virtual HRESULT __stdcall put_IsCallerIdBlocked(bool value) = 0; virtual HRESULT __stdcall get_IsEmergency(bool * value) = 0; virtual HRESULT __stdcall put_IsEmergency(bool value) = 0; virtual HRESULT __stdcall get_IsIncoming(bool * value) = 0; virtual HRESULT __stdcall put_IsIncoming(bool value) = 0; virtual HRESULT __stdcall get_IsMissed(bool * value) = 0; virtual HRESULT __stdcall put_IsMissed(bool value) = 0; virtual HRESULT __stdcall get_IsRinging(bool * value) = 0; virtual HRESULT __stdcall put_IsRinging(bool value) = 0; virtual HRESULT __stdcall get_IsSeen(bool * value) = 0; virtual HRESULT __stdcall put_IsSeen(bool value) = 0; virtual HRESULT __stdcall get_IsSuppressed(bool * value) = 0; virtual HRESULT __stdcall put_IsSuppressed(bool value) = 0; virtual HRESULT __stdcall get_IsVoicemail(bool * value) = 0; virtual HRESULT __stdcall put_IsVoicemail(bool value) = 0; virtual HRESULT __stdcall get_Media(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryMedia * value) = 0; virtual HRESULT __stdcall put_Media(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryMedia value) = 0; virtual HRESULT __stdcall get_OtherAppReadAccess(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryOtherAppReadAccess * value) = 0; virtual HRESULT __stdcall put_OtherAppReadAccess(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryOtherAppReadAccess value) = 0; virtual HRESULT __stdcall get_RemoteId(hstring * value) = 0; virtual HRESULT __stdcall put_RemoteId(hstring value) = 0; virtual HRESULT __stdcall get_SourceDisplayName(hstring * value) = 0; virtual HRESULT __stdcall get_SourceId(hstring * value) = 0; virtual HRESULT __stdcall put_SourceId(hstring value) = 0; virtual HRESULT __stdcall get_SourceIdKind(winrt::Windows::ApplicationModel::Calls::PhoneCallHistorySourceIdKind * value) = 0; virtual HRESULT __stdcall put_SourceIdKind(winrt::Windows::ApplicationModel::Calls::PhoneCallHistorySourceIdKind value) = 0; virtual HRESULT __stdcall get_StartTime(Windows::Foundation::DateTime * value) = 0; virtual HRESULT __stdcall put_StartTime(Windows::Foundation::DateTime value) = 0; }; struct __declspec(uuid("30f159da-3955-4042-84e6-66eebf82e67f")) __declspec(novtable) IPhoneCallHistoryEntryAddress : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_ContactId(hstring * value) = 0; virtual HRESULT __stdcall put_ContactId(hstring value) = 0; virtual HRESULT __stdcall get_DisplayName(hstring * value) = 0; virtual HRESULT __stdcall put_DisplayName(hstring value) = 0; virtual HRESULT __stdcall get_RawAddress(hstring * value) = 0; virtual HRESULT __stdcall put_RawAddress(hstring value) = 0; virtual HRESULT __stdcall get_RawAddressKind(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryRawAddressKind * value) = 0; virtual HRESULT __stdcall put_RawAddressKind(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryRawAddressKind value) = 0; }; struct __declspec(uuid("fb0fadba-c7f0-4bb6-9f6b-ba5d73209aca")) __declspec(novtable) IPhoneCallHistoryEntryAddressFactory : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_Create(hstring rawAddress, winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryRawAddressKind rawAddressKind, Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryAddress ** result) = 0; }; struct __declspec(uuid("9c5fe15c-8bed-40ca-b06e-c4ca8eae5c87")) __declspec(novtable) IPhoneCallHistoryEntryQueryOptions : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_DesiredMedia(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryQueryDesiredMedia * value) = 0; virtual HRESULT __stdcall put_DesiredMedia(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryQueryDesiredMedia value) = 0; virtual HRESULT __stdcall get_SourceIds(Windows::Foundation::Collections::IVector<hstring> ** value) = 0; }; struct __declspec(uuid("61ece4be-8d86-479f-8404-a9846920fee6")) __declspec(novtable) IPhoneCallHistoryEntryReader : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_ReadBatchAsync(Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry>> ** result) = 0; }; struct __declspec(uuid("d925c523-f55f-4353-9db4-0205a5265a55")) __declspec(novtable) IPhoneCallHistoryManagerForUser : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_RequestStoreAsync(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryStoreAccessType accessType, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallHistoryStore> ** result) = 0; virtual HRESULT __stdcall get_User(Windows::System::IUser ** value) = 0; }; struct __declspec(uuid("f5a6da39-b31f-4f45-ac8e-1b08893c1b50")) __declspec(novtable) IPhoneCallHistoryManagerStatics : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_RequestStoreAsync(winrt::Windows::ApplicationModel::Calls::PhoneCallHistoryStoreAccessType accessType, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallHistoryStore> ** result) = 0; }; struct __declspec(uuid("efd474f0-a2db-4188-9e92-bc3cfa6813cf")) __declspec(novtable) IPhoneCallHistoryManagerStatics2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_GetForUser(Windows::System::IUser * user, Windows::ApplicationModel::Calls::IPhoneCallHistoryManagerForUser ** result) = 0; }; struct __declspec(uuid("2f907db8-b40e-422b-8545-cb1910a61c52")) __declspec(novtable) IPhoneCallHistoryStore : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_GetEntryAsync(hstring callHistoryEntryId, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry> ** result) = 0; virtual HRESULT __stdcall abi_GetEntryReader(Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryReader ** result) = 0; virtual HRESULT __stdcall abi_GetEntryReaderWithOptions(Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryQueryOptions * queryOptions, Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryReader ** result) = 0; virtual HRESULT __stdcall abi_SaveEntryAsync(Windows::ApplicationModel::Calls::IPhoneCallHistoryEntry * callHistoryEntry, Windows::Foundation::IAsyncAction ** result) = 0; virtual HRESULT __stdcall abi_DeleteEntryAsync(Windows::ApplicationModel::Calls::IPhoneCallHistoryEntry * callHistoryEntry, Windows::Foundation::IAsyncAction ** result) = 0; virtual HRESULT __stdcall abi_DeleteEntriesAsync(Windows::Foundation::Collections::IIterable<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry> * callHistoryEntries, Windows::Foundation::IAsyncAction ** result) = 0; virtual HRESULT __stdcall abi_MarkEntryAsSeenAsync(Windows::ApplicationModel::Calls::IPhoneCallHistoryEntry * callHistoryEntry, Windows::Foundation::IAsyncAction ** result) = 0; virtual HRESULT __stdcall abi_MarkEntriesAsSeenAsync(Windows::Foundation::Collections::IIterable<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry> * callHistoryEntries, Windows::Foundation::IAsyncAction ** result) = 0; virtual HRESULT __stdcall abi_GetUnseenCountAsync(Windows::Foundation::IAsyncOperation<uint32_t> ** result) = 0; virtual HRESULT __stdcall abi_MarkAllAsSeenAsync(Windows::Foundation::IAsyncAction ** result) = 0; virtual HRESULT __stdcall abi_GetSourcesUnseenCountAsync(Windows::Foundation::Collections::IIterable<hstring> * sourceIds, Windows::Foundation::IAsyncOperation<uint32_t> ** result) = 0; virtual HRESULT __stdcall abi_MarkSourcesAsSeenAsync(Windows::Foundation::Collections::IIterable<hstring> * sourceIds, Windows::Foundation::IAsyncAction ** result) = 0; }; struct __declspec(uuid("60edac78-78a6-4872-a3ef-98325ec8b843")) __declspec(novtable) IPhoneCallManagerStatics : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_ShowPhoneCallUI(hstring phoneNumber, hstring displayName) = 0; }; struct __declspec(uuid("c7e3c8bc-2370-431c-98fd-43be5f03086d")) __declspec(novtable) IPhoneCallManagerStatics2 : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_CallStateChanged(Windows::Foundation::EventHandler<Windows::Foundation::IInspectable> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_CallStateChanged(event_token token) = 0; virtual HRESULT __stdcall get_IsCallActive(bool * value) = 0; virtual HRESULT __stdcall get_IsCallIncoming(bool * value) = 0; virtual HRESULT __stdcall abi_ShowPhoneCallSettingsUI() = 0; virtual HRESULT __stdcall abi_RequestStoreAsync(Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallStore> ** result) = 0; }; struct __declspec(uuid("5f610748-18a6-4173-86d1-28be9dc62dba")) __declspec(novtable) IPhoneCallStore : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_IsEmergencyPhoneNumberAsync(hstring number, Windows::Foundation::IAsyncOperation<bool> ** result) = 0; virtual HRESULT __stdcall abi_GetDefaultLineAsync(Windows::Foundation::IAsyncOperation<GUID> ** result) = 0; virtual HRESULT __stdcall abi_RequestLineWatcher(Windows::ApplicationModel::Calls::IPhoneLineWatcher ** result) = 0; }; struct __declspec(uuid("02382786-b16a-4fdb-be3b-c4240e13ad0d")) __declspec(novtable) IPhoneCallVideoCapabilities : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_IsVideoCallingCapable(bool * pValue) = 0; }; struct __declspec(uuid("f3c64b56-f00b-4a1c-a0c6-ee1910749ce7")) __declspec(novtable) IPhoneCallVideoCapabilitiesManagerStatics : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_GetCapabilitiesAsync(hstring phoneNumber, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallVideoCapabilities> ** result) = 0; }; struct __declspec(uuid("b639c4b8-f06f-36cb-a863-823742b5f2d4")) __declspec(novtable) IPhoneDialOptions : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Number(hstring * value) = 0; virtual HRESULT __stdcall put_Number(hstring value) = 0; virtual HRESULT __stdcall get_DisplayName(hstring * value) = 0; virtual HRESULT __stdcall put_DisplayName(hstring value) = 0; virtual HRESULT __stdcall get_Contact(Windows::ApplicationModel::Contacts::IContact ** value) = 0; virtual HRESULT __stdcall put_Contact(Windows::ApplicationModel::Contacts::IContact * value) = 0; virtual HRESULT __stdcall get_ContactPhone(Windows::ApplicationModel::Contacts::IContactPhone ** value) = 0; virtual HRESULT __stdcall put_ContactPhone(Windows::ApplicationModel::Contacts::IContactPhone * value) = 0; virtual HRESULT __stdcall get_Media(winrt::Windows::ApplicationModel::Calls::PhoneCallMedia * value) = 0; virtual HRESULT __stdcall put_Media(winrt::Windows::ApplicationModel::Calls::PhoneCallMedia value) = 0; virtual HRESULT __stdcall get_AudioEndpoint(winrt::Windows::ApplicationModel::Calls::PhoneAudioRoutingEndpoint * value) = 0; virtual HRESULT __stdcall put_AudioEndpoint(winrt::Windows::ApplicationModel::Calls::PhoneAudioRoutingEndpoint value) = 0; }; struct __declspec(uuid("27c66f30-6a69-34ca-a2ba-65302530c311")) __declspec(novtable) IPhoneLine : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_LineChanged(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLine, Windows::Foundation::IInspectable> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_LineChanged(event_token token) = 0; virtual HRESULT __stdcall get_Id(GUID * value) = 0; virtual HRESULT __stdcall get_DisplayColor(Windows::UI::Color * value) = 0; virtual HRESULT __stdcall get_NetworkState(winrt::Windows::ApplicationModel::Calls::PhoneNetworkState * value) = 0; virtual HRESULT __stdcall get_DisplayName(hstring * value) = 0; virtual HRESULT __stdcall get_Voicemail(Windows::ApplicationModel::Calls::IPhoneVoicemail ** value) = 0; virtual HRESULT __stdcall get_NetworkName(hstring * value) = 0; virtual HRESULT __stdcall get_CellularDetails(Windows::ApplicationModel::Calls::IPhoneLineCellularDetails ** value) = 0; virtual HRESULT __stdcall get_Transport(winrt::Windows::ApplicationModel::Calls::PhoneLineTransport * value) = 0; virtual HRESULT __stdcall get_CanDial(bool * value) = 0; virtual HRESULT __stdcall get_SupportsTile(bool * value) = 0; virtual HRESULT __stdcall get_VideoCallingCapabilities(Windows::ApplicationModel::Calls::IPhoneCallVideoCapabilities ** value) = 0; virtual HRESULT __stdcall get_LineConfiguration(Windows::ApplicationModel::Calls::IPhoneLineConfiguration ** value) = 0; virtual HRESULT __stdcall abi_IsImmediateDialNumberAsync(hstring number, Windows::Foundation::IAsyncOperation<bool> ** result) = 0; virtual HRESULT __stdcall abi_Dial(hstring number, hstring displayName) = 0; virtual HRESULT __stdcall abi_DialWithOptions(Windows::ApplicationModel::Calls::IPhoneDialOptions * options) = 0; }; struct __declspec(uuid("192601d5-147c-4769-b673-98a5ec8426cb")) __declspec(novtable) IPhoneLineCellularDetails : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_SimState(winrt::Windows::ApplicationModel::Calls::PhoneSimState * value) = 0; virtual HRESULT __stdcall get_SimSlotIndex(int32_t * value) = 0; virtual HRESULT __stdcall get_IsModemOn(bool * value) = 0; virtual HRESULT __stdcall get_RegistrationRejectCode(int32_t * value) = 0; virtual HRESULT __stdcall abi_GetNetworkOperatorDisplayText(winrt::Windows::ApplicationModel::Calls::PhoneLineNetworkOperatorDisplayTextLocation location, hstring * value) = 0; }; struct __declspec(uuid("fe265862-f64f-4312-b2a8-4e257721aa95")) __declspec(novtable) IPhoneLineConfiguration : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_IsVideoCallingEnabled(bool * value) = 0; virtual HRESULT __stdcall get_ExtendedProperties(Windows::Foundation::Collections::IMapView<hstring, Windows::Foundation::IInspectable> ** value) = 0; }; struct __declspec(uuid("f38b5f23-ceb0-404f-bcf2-ba9f697d8adf")) __declspec(novtable) IPhoneLineStatics : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_FromIdAsync(GUID lineId, Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneLine> ** result) = 0; }; struct __declspec(uuid("8a45cd0a-6323-44e0-a6f6-9f21f64dc90a")) __declspec(novtable) IPhoneLineWatcher : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_Start() = 0; virtual HRESULT __stdcall abi_Stop() = 0; virtual HRESULT __stdcall add_LineAdded(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_LineAdded(event_token token) = 0; virtual HRESULT __stdcall add_LineRemoved(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_LineRemoved(event_token token) = 0; virtual HRESULT __stdcall add_LineUpdated(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_LineUpdated(event_token token) = 0; virtual HRESULT __stdcall add_EnumerationCompleted(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::Foundation::IInspectable> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_EnumerationCompleted(event_token token) = 0; virtual HRESULT __stdcall add_Stopped(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::Foundation::IInspectable> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_Stopped(event_token token) = 0; virtual HRESULT __stdcall get_Status(winrt::Windows::ApplicationModel::Calls::PhoneLineWatcherStatus * status) = 0; }; struct __declspec(uuid("d07c753e-9e12-4a37-82b7-ad535dad6a67")) __declspec(novtable) IPhoneLineWatcherEventArgs : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_LineId(GUID * value) = 0; }; struct __declspec(uuid("c9ce77f6-6e9f-3a8b-b727-6e0cf6998224")) __declspec(novtable) IPhoneVoicemail : Windows::Foundation::IInspectable { virtual HRESULT __stdcall get_Number(hstring * value) = 0; virtual HRESULT __stdcall get_MessageCount(int32_t * value) = 0; virtual HRESULT __stdcall get_Type(winrt::Windows::ApplicationModel::Calls::PhoneVoicemailType * value) = 0; virtual HRESULT __stdcall abi_DialVoicemailAsync(Windows::Foundation::IAsyncAction ** result) = 0; }; struct __declspec(uuid("4f118bcf-e8ef-4434-9c5f-a8d893fafe79")) __declspec(novtable) IVoipCallCoordinator : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_ReserveCallResourcesAsync(hstring taskEntryPoint, Windows::Foundation::IAsyncOperation<winrt::Windows::ApplicationModel::Calls::VoipPhoneCallResourceReservationStatus> ** operation) = 0; virtual HRESULT __stdcall add_MuteStateChanged(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipCallCoordinator, Windows::ApplicationModel::Calls::MuteChangeEventArgs> * muteChangeHandler, event_token * token) = 0; virtual HRESULT __stdcall remove_MuteStateChanged(event_token token) = 0; virtual HRESULT __stdcall abi_RequestNewIncomingCall(hstring context, hstring contactName, hstring contactNumber, Windows::Foundation::IUriRuntimeClass * contactImage, hstring serviceName, Windows::Foundation::IUriRuntimeClass * brandingImage, hstring callDetails, Windows::Foundation::IUriRuntimeClass * ringtone, winrt::Windows::ApplicationModel::Calls::VoipPhoneCallMedia media, Windows::Foundation::TimeSpan ringTimeout, Windows::ApplicationModel::Calls::IVoipPhoneCall ** call) = 0; virtual HRESULT __stdcall abi_RequestNewOutgoingCall(hstring context, hstring contactName, hstring serviceName, winrt::Windows::ApplicationModel::Calls::VoipPhoneCallMedia media, Windows::ApplicationModel::Calls::IVoipPhoneCall ** call) = 0; virtual HRESULT __stdcall abi_NotifyMuted() = 0; virtual HRESULT __stdcall abi_NotifyUnmuted() = 0; virtual HRESULT __stdcall abi_RequestOutgoingUpgradeToVideoCall(GUID callUpgradeGuid, hstring context, hstring contactName, hstring serviceName, Windows::ApplicationModel::Calls::IVoipPhoneCall ** call) = 0; virtual HRESULT __stdcall abi_RequestIncomingUpgradeToVideoCall(hstring context, hstring contactName, hstring contactNumber, Windows::Foundation::IUriRuntimeClass * contactImage, hstring serviceName, Windows::Foundation::IUriRuntimeClass * brandingImage, hstring callDetails, Windows::Foundation::IUriRuntimeClass * ringtone, Windows::Foundation::TimeSpan ringTimeout, Windows::ApplicationModel::Calls::IVoipPhoneCall ** call) = 0; virtual HRESULT __stdcall abi_TerminateCellularCall(GUID callUpgradeGuid) = 0; virtual HRESULT __stdcall abi_CancelUpgrade(GUID callUpgradeGuid) = 0; }; struct __declspec(uuid("7f5d1f2b-e04a-4d10-b31a-a55c922cc2fb")) __declspec(novtable) IVoipCallCoordinatorStatics : Windows::Foundation::IInspectable { virtual HRESULT __stdcall abi_GetDefault(Windows::ApplicationModel::Calls::IVoipCallCoordinator ** coordinator) = 0; }; struct __declspec(uuid("6cf1f19a-7794-4a5a-8c68-ae87947a6990")) __declspec(novtable) IVoipPhoneCall : Windows::Foundation::IInspectable { virtual HRESULT __stdcall add_EndRequested(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallStateChangeEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_EndRequested(event_token token) = 0; virtual HRESULT __stdcall add_HoldRequested(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallStateChangeEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_HoldRequested(event_token token) = 0; virtual HRESULT __stdcall add_ResumeRequested(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallStateChangeEventArgs> * handler, event_token * token) = 0; virtual HRESULT __stdcall remove_ResumeRequested(event_token token) = 0; virtual HRESULT __stdcall add_AnswerRequested(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallAnswerEventArgs> * acceptHandler, event_token * token) = 0; virtual HRESULT __stdcall remove_AnswerRequested(event_token token) = 0; virtual HRESULT __stdcall add_RejectRequested(Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallRejectEventArgs> * rejectHandler, event_token * token) = 0; virtual HRESULT __stdcall remove_RejectRequested(event_token token) = 0; virtual HRESULT __stdcall abi_NotifyCallHeld() = 0; virtual HRESULT __stdcall abi_NotifyCallActive() = 0; virtual HRESULT __stdcall abi_NotifyCallEnded() = 0; virtual HRESULT __stdcall get_ContactName(hstring * value) = 0; virtual HRESULT __stdcall put_ContactName(hstring value) = 0; virtual HRESULT __stdcall get_StartTime(Windows::Foundation::DateTime * value) = 0; virtual HRESULT __stdcall put_StartTime(Windows::Foundation::DateTime value) = 0; virtual HRESULT __stdcall get_CallMedia(winrt::Windows::ApplicationModel::Calls::VoipPhoneCallMedia * value) = 0; virtual HRESULT __stdcall put_CallMedia(winrt::Windows::ApplicationModel::Calls::VoipPhoneCallMedia value) = 0; virtual HRESULT __stdcall abi_NotifyCallReady() = 0; }; } namespace ABI { template <> struct traits<Windows::ApplicationModel::Calls::CallAnswerEventArgs> { using default_interface = Windows::ApplicationModel::Calls::ICallAnswerEventArgs; }; template <> struct traits<Windows::ApplicationModel::Calls::CallRejectEventArgs> { using default_interface = Windows::ApplicationModel::Calls::ICallRejectEventArgs; }; template <> struct traits<Windows::ApplicationModel::Calls::CallStateChangeEventArgs> { using default_interface = Windows::ApplicationModel::Calls::ICallStateChangeEventArgs; }; template <> struct traits<Windows::ApplicationModel::Calls::LockScreenCallEndCallDeferral> { using default_interface = Windows::ApplicationModel::Calls::ILockScreenCallEndCallDeferral; }; template <> struct traits<Windows::ApplicationModel::Calls::LockScreenCallEndRequestedEventArgs> { using default_interface = Windows::ApplicationModel::Calls::ILockScreenCallEndRequestedEventArgs; }; template <> struct traits<Windows::ApplicationModel::Calls::LockScreenCallUI> { using default_interface = Windows::ApplicationModel::Calls::ILockScreenCallUI; }; template <> struct traits<Windows::ApplicationModel::Calls::MuteChangeEventArgs> { using default_interface = Windows::ApplicationModel::Calls::IMuteChangeEventArgs; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry> { using default_interface = Windows::ApplicationModel::Calls::IPhoneCallHistoryEntry; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryEntryAddress> { using default_interface = Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryAddress; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryEntryQueryOptions> { using default_interface = Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryQueryOptions; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryEntryReader> { using default_interface = Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryReader; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryManagerForUser> { using default_interface = Windows::ApplicationModel::Calls::IPhoneCallHistoryManagerForUser; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryStore> { using default_interface = Windows::ApplicationModel::Calls::IPhoneCallHistoryStore; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallStore> { using default_interface = Windows::ApplicationModel::Calls::IPhoneCallStore; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallVideoCapabilities> { using default_interface = Windows::ApplicationModel::Calls::IPhoneCallVideoCapabilities; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneDialOptions> { using default_interface = Windows::ApplicationModel::Calls::IPhoneDialOptions; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLine> { using default_interface = Windows::ApplicationModel::Calls::IPhoneLine; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLineCellularDetails> { using default_interface = Windows::ApplicationModel::Calls::IPhoneLineCellularDetails; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLineConfiguration> { using default_interface = Windows::ApplicationModel::Calls::IPhoneLineConfiguration; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLineWatcher> { using default_interface = Windows::ApplicationModel::Calls::IPhoneLineWatcher; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> { using default_interface = Windows::ApplicationModel::Calls::IPhoneLineWatcherEventArgs; }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneVoicemail> { using default_interface = Windows::ApplicationModel::Calls::IPhoneVoicemail; }; template <> struct traits<Windows::ApplicationModel::Calls::VoipCallCoordinator> { using default_interface = Windows::ApplicationModel::Calls::IVoipCallCoordinator; }; template <> struct traits<Windows::ApplicationModel::Calls::VoipPhoneCall> { using default_interface = Windows::ApplicationModel::Calls::IVoipPhoneCall; }; } namespace Windows::ApplicationModel::Calls { template <typename D> struct WINRT_EBO impl_ICallAnswerEventArgs { Windows::ApplicationModel::Calls::VoipPhoneCallMedia AcceptedMedia() const; }; template <typename D> struct WINRT_EBO impl_ICallRejectEventArgs { Windows::ApplicationModel::Calls::VoipPhoneCallRejectReason RejectReason() const; }; template <typename D> struct WINRT_EBO impl_ICallStateChangeEventArgs { Windows::ApplicationModel::Calls::VoipPhoneCallState State() const; }; template <typename D> struct WINRT_EBO impl_ILockScreenCallEndCallDeferral { void Complete() const; }; template <typename D> struct WINRT_EBO impl_ILockScreenCallEndRequestedEventArgs { Windows::ApplicationModel::Calls::LockScreenCallEndCallDeferral GetDeferral() const; Windows::Foundation::DateTime Deadline() const; }; template <typename D> struct WINRT_EBO impl_ILockScreenCallUI { void Dismiss() const; event_token EndRequested(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::LockScreenCallUI, Windows::ApplicationModel::Calls::LockScreenCallEndRequestedEventArgs> & handler) const; using EndRequested_revoker = event_revoker<ILockScreenCallUI>; EndRequested_revoker EndRequested(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::LockScreenCallUI, Windows::ApplicationModel::Calls::LockScreenCallEndRequestedEventArgs> & handler) const; void EndRequested(event_token token) const; event_token Closed(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::LockScreenCallUI, Windows::Foundation::IInspectable> & handler) const; using Closed_revoker = event_revoker<ILockScreenCallUI>; Closed_revoker Closed(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::LockScreenCallUI, Windows::Foundation::IInspectable> & handler) const; void Closed(event_token token) const; hstring CallTitle() const; void CallTitle(hstring_view value) const; }; template <typename D> struct WINRT_EBO impl_IMuteChangeEventArgs { bool Muted() const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallBlockingStatics { bool BlockUnknownNumbers() const; void BlockUnknownNumbers(bool value) const; bool BlockPrivateNumbers() const; void BlockPrivateNumbers(bool value) const; Windows::Foundation::IAsyncOperation<bool> SetCallBlockingListAsync(iterable<hstring> phoneNumberList) const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallHistoryEntry { hstring Id() const; Windows::ApplicationModel::Calls::PhoneCallHistoryEntryAddress Address() const; void Address(const Windows::ApplicationModel::Calls::PhoneCallHistoryEntryAddress & value) const; Windows::Foundation::IReference<Windows::Foundation::TimeSpan> Duration() const; void Duration(const optional<Windows::Foundation::TimeSpan> & value) const; bool IsCallerIdBlocked() const; void IsCallerIdBlocked(bool value) const; bool IsEmergency() const; void IsEmergency(bool value) const; bool IsIncoming() const; void IsIncoming(bool value) const; bool IsMissed() const; void IsMissed(bool value) const; bool IsRinging() const; void IsRinging(bool value) const; bool IsSeen() const; void IsSeen(bool value) const; bool IsSuppressed() const; void IsSuppressed(bool value) const; bool IsVoicemail() const; void IsVoicemail(bool value) const; Windows::ApplicationModel::Calls::PhoneCallHistoryEntryMedia Media() const; void Media(Windows::ApplicationModel::Calls::PhoneCallHistoryEntryMedia value) const; Windows::ApplicationModel::Calls::PhoneCallHistoryEntryOtherAppReadAccess OtherAppReadAccess() const; void OtherAppReadAccess(Windows::ApplicationModel::Calls::PhoneCallHistoryEntryOtherAppReadAccess value) const; hstring RemoteId() const; void RemoteId(hstring_view value) const; hstring SourceDisplayName() const; hstring SourceId() const; void SourceId(hstring_view value) const; Windows::ApplicationModel::Calls::PhoneCallHistorySourceIdKind SourceIdKind() const; void SourceIdKind(Windows::ApplicationModel::Calls::PhoneCallHistorySourceIdKind value) const; Windows::Foundation::DateTime StartTime() const; void StartTime(const Windows::Foundation::DateTime & value) const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallHistoryEntryAddress { hstring ContactId() const; void ContactId(hstring_view value) const; hstring DisplayName() const; void DisplayName(hstring_view value) const; hstring RawAddress() const; void RawAddress(hstring_view value) const; Windows::ApplicationModel::Calls::PhoneCallHistoryEntryRawAddressKind RawAddressKind() const; void RawAddressKind(Windows::ApplicationModel::Calls::PhoneCallHistoryEntryRawAddressKind value) const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallHistoryEntryAddressFactory { Windows::ApplicationModel::Calls::PhoneCallHistoryEntryAddress Create(hstring_view rawAddress, Windows::ApplicationModel::Calls::PhoneCallHistoryEntryRawAddressKind rawAddressKind) const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallHistoryEntryQueryOptions { Windows::ApplicationModel::Calls::PhoneCallHistoryEntryQueryDesiredMedia DesiredMedia() const; void DesiredMedia(Windows::ApplicationModel::Calls::PhoneCallHistoryEntryQueryDesiredMedia value) const; Windows::Foundation::Collections::IVector<hstring> SourceIds() const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallHistoryEntryReader { Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry>> ReadBatchAsync() const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallHistoryManagerForUser { Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallHistoryStore> RequestStoreAsync(Windows::ApplicationModel::Calls::PhoneCallHistoryStoreAccessType accessType) const; Windows::System::User User() const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallHistoryManagerStatics { Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallHistoryStore> RequestStoreAsync(Windows::ApplicationModel::Calls::PhoneCallHistoryStoreAccessType accessType) const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallHistoryManagerStatics2 { Windows::ApplicationModel::Calls::PhoneCallHistoryManagerForUser GetForUser(const Windows::System::User & user) const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallHistoryStore { Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry> GetEntryAsync(hstring_view callHistoryEntryId) const; Windows::ApplicationModel::Calls::PhoneCallHistoryEntryReader GetEntryReader() const; Windows::ApplicationModel::Calls::PhoneCallHistoryEntryReader GetEntryReader(const Windows::ApplicationModel::Calls::PhoneCallHistoryEntryQueryOptions & queryOptions) const; Windows::Foundation::IAsyncAction SaveEntryAsync(const Windows::ApplicationModel::Calls::PhoneCallHistoryEntry & callHistoryEntry) const; Windows::Foundation::IAsyncAction DeleteEntryAsync(const Windows::ApplicationModel::Calls::PhoneCallHistoryEntry & callHistoryEntry) const; Windows::Foundation::IAsyncAction DeleteEntriesAsync(iterable<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry> callHistoryEntries) const; Windows::Foundation::IAsyncAction MarkEntryAsSeenAsync(const Windows::ApplicationModel::Calls::PhoneCallHistoryEntry & callHistoryEntry) const; Windows::Foundation::IAsyncAction MarkEntriesAsSeenAsync(iterable<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry> callHistoryEntries) const; Windows::Foundation::IAsyncOperation<uint32_t> GetUnseenCountAsync() const; Windows::Foundation::IAsyncAction MarkAllAsSeenAsync() const; Windows::Foundation::IAsyncOperation<uint32_t> GetSourcesUnseenCountAsync(iterable<hstring> sourceIds) const; Windows::Foundation::IAsyncAction MarkSourcesAsSeenAsync(iterable<hstring> sourceIds) const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallManagerStatics { void ShowPhoneCallUI(hstring_view phoneNumber, hstring_view displayName) const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallManagerStatics2 { event_token CallStateChanged(const Windows::Foundation::EventHandler<Windows::Foundation::IInspectable> & handler) const; using CallStateChanged_revoker = event_revoker<IPhoneCallManagerStatics2>; CallStateChanged_revoker CallStateChanged(auto_revoke_t, const Windows::Foundation::EventHandler<Windows::Foundation::IInspectable> & handler) const; void CallStateChanged(event_token token) const; bool IsCallActive() const; bool IsCallIncoming() const; void ShowPhoneCallSettingsUI() const; Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallStore> RequestStoreAsync() const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallStore { Windows::Foundation::IAsyncOperation<bool> IsEmergencyPhoneNumberAsync(hstring_view number) const; Windows::Foundation::IAsyncOperation<GUID> GetDefaultLineAsync() const; Windows::ApplicationModel::Calls::PhoneLineWatcher RequestLineWatcher() const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallVideoCapabilities { bool IsVideoCallingCapable() const; }; template <typename D> struct WINRT_EBO impl_IPhoneCallVideoCapabilitiesManagerStatics { Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneCallVideoCapabilities> GetCapabilitiesAsync(hstring_view phoneNumber) const; }; template <typename D> struct WINRT_EBO impl_IPhoneDialOptions { hstring Number() const; void Number(hstring_view value) const; hstring DisplayName() const; void DisplayName(hstring_view value) const; Windows::ApplicationModel::Contacts::Contact Contact() const; void Contact(const Windows::ApplicationModel::Contacts::Contact & value) const; Windows::ApplicationModel::Contacts::ContactPhone ContactPhone() const; void ContactPhone(const Windows::ApplicationModel::Contacts::ContactPhone & value) const; Windows::ApplicationModel::Calls::PhoneCallMedia Media() const; void Media(Windows::ApplicationModel::Calls::PhoneCallMedia value) const; Windows::ApplicationModel::Calls::PhoneAudioRoutingEndpoint AudioEndpoint() const; void AudioEndpoint(Windows::ApplicationModel::Calls::PhoneAudioRoutingEndpoint value) const; }; template <typename D> struct WINRT_EBO impl_IPhoneLine { event_token LineChanged(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLine, Windows::Foundation::IInspectable> & handler) const; using LineChanged_revoker = event_revoker<IPhoneLine>; LineChanged_revoker LineChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLine, Windows::Foundation::IInspectable> & handler) const; void LineChanged(event_token token) const; GUID Id() const; Windows::UI::Color DisplayColor() const; Windows::ApplicationModel::Calls::PhoneNetworkState NetworkState() const; hstring DisplayName() const; Windows::ApplicationModel::Calls::PhoneVoicemail Voicemail() const; hstring NetworkName() const; Windows::ApplicationModel::Calls::PhoneLineCellularDetails CellularDetails() const; Windows::ApplicationModel::Calls::PhoneLineTransport Transport() const; bool CanDial() const; bool SupportsTile() const; Windows::ApplicationModel::Calls::PhoneCallVideoCapabilities VideoCallingCapabilities() const; Windows::ApplicationModel::Calls::PhoneLineConfiguration LineConfiguration() const; Windows::Foundation::IAsyncOperation<bool> IsImmediateDialNumberAsync(hstring_view number) const; void Dial(hstring_view number, hstring_view displayName) const; void DialWithOptions(const Windows::ApplicationModel::Calls::PhoneDialOptions & options) const; }; template <typename D> struct WINRT_EBO impl_IPhoneLineCellularDetails { Windows::ApplicationModel::Calls::PhoneSimState SimState() const; int32_t SimSlotIndex() const; bool IsModemOn() const; int32_t RegistrationRejectCode() const; hstring GetNetworkOperatorDisplayText(Windows::ApplicationModel::Calls::PhoneLineNetworkOperatorDisplayTextLocation location) const; }; template <typename D> struct WINRT_EBO impl_IPhoneLineConfiguration { bool IsVideoCallingEnabled() const; Windows::Foundation::Collections::IMapView<hstring, Windows::Foundation::IInspectable> ExtendedProperties() const; }; template <typename D> struct WINRT_EBO impl_IPhoneLineStatics { Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::Calls::PhoneLine> FromIdAsync(GUID lineId) const; }; template <typename D> struct WINRT_EBO impl_IPhoneLineWatcher { void Start() const; void Stop() const; event_token LineAdded(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> & handler) const; using LineAdded_revoker = event_revoker<IPhoneLineWatcher>; LineAdded_revoker LineAdded(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> & handler) const; void LineAdded(event_token token) const; event_token LineRemoved(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> & handler) const; using LineRemoved_revoker = event_revoker<IPhoneLineWatcher>; LineRemoved_revoker LineRemoved(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> & handler) const; void LineRemoved(event_token token) const; event_token LineUpdated(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> & handler) const; using LineUpdated_revoker = event_revoker<IPhoneLineWatcher>; LineUpdated_revoker LineUpdated(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> & handler) const; void LineUpdated(event_token token) const; event_token EnumerationCompleted(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::Foundation::IInspectable> & handler) const; using EnumerationCompleted_revoker = event_revoker<IPhoneLineWatcher>; EnumerationCompleted_revoker EnumerationCompleted(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::Foundation::IInspectable> & handler) const; void EnumerationCompleted(event_token token) const; event_token Stopped(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::Foundation::IInspectable> & handler) const; using Stopped_revoker = event_revoker<IPhoneLineWatcher>; Stopped_revoker Stopped(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::PhoneLineWatcher, Windows::Foundation::IInspectable> & handler) const; void Stopped(event_token token) const; Windows::ApplicationModel::Calls::PhoneLineWatcherStatus Status() const; }; template <typename D> struct WINRT_EBO impl_IPhoneLineWatcherEventArgs { GUID LineId() const; }; template <typename D> struct WINRT_EBO impl_IPhoneVoicemail { hstring Number() const; int32_t MessageCount() const; Windows::ApplicationModel::Calls::PhoneVoicemailType Type() const; Windows::Foundation::IAsyncAction DialVoicemailAsync() const; }; template <typename D> struct WINRT_EBO impl_IVoipCallCoordinator { Windows::Foundation::IAsyncOperation<winrt::Windows::ApplicationModel::Calls::VoipPhoneCallResourceReservationStatus> ReserveCallResourcesAsync(hstring_view taskEntryPoint) const; event_token MuteStateChanged(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipCallCoordinator, Windows::ApplicationModel::Calls::MuteChangeEventArgs> & muteChangeHandler) const; using MuteStateChanged_revoker = event_revoker<IVoipCallCoordinator>; MuteStateChanged_revoker MuteStateChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipCallCoordinator, Windows::ApplicationModel::Calls::MuteChangeEventArgs> & muteChangeHandler) const; void MuteStateChanged(event_token token) const; Windows::ApplicationModel::Calls::VoipPhoneCall RequestNewIncomingCall(hstring_view context, hstring_view contactName, hstring_view contactNumber, const Windows::Foundation::Uri & contactImage, hstring_view serviceName, const Windows::Foundation::Uri & brandingImage, hstring_view callDetails, const Windows::Foundation::Uri & ringtone, Windows::ApplicationModel::Calls::VoipPhoneCallMedia media, const Windows::Foundation::TimeSpan & ringTimeout) const; Windows::ApplicationModel::Calls::VoipPhoneCall RequestNewOutgoingCall(hstring_view context, hstring_view contactName, hstring_view serviceName, Windows::ApplicationModel::Calls::VoipPhoneCallMedia media) const; void NotifyMuted() const; void NotifyUnmuted() const; Windows::ApplicationModel::Calls::VoipPhoneCall RequestOutgoingUpgradeToVideoCall(GUID callUpgradeGuid, hstring_view context, hstring_view contactName, hstring_view serviceName) const; Windows::ApplicationModel::Calls::VoipPhoneCall RequestIncomingUpgradeToVideoCall(hstring_view context, hstring_view contactName, hstring_view contactNumber, const Windows::Foundation::Uri & contactImage, hstring_view serviceName, const Windows::Foundation::Uri & brandingImage, hstring_view callDetails, const Windows::Foundation::Uri & ringtone, const Windows::Foundation::TimeSpan & ringTimeout) const; void TerminateCellularCall(GUID callUpgradeGuid) const; void CancelUpgrade(GUID callUpgradeGuid) const; }; template <typename D> struct WINRT_EBO impl_IVoipCallCoordinatorStatics { Windows::ApplicationModel::Calls::VoipCallCoordinator GetDefault() const; }; template <typename D> struct WINRT_EBO impl_IVoipPhoneCall { event_token EndRequested(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallStateChangeEventArgs> & handler) const; using EndRequested_revoker = event_revoker<IVoipPhoneCall>; EndRequested_revoker EndRequested(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallStateChangeEventArgs> & handler) const; void EndRequested(event_token token) const; event_token HoldRequested(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallStateChangeEventArgs> & handler) const; using HoldRequested_revoker = event_revoker<IVoipPhoneCall>; HoldRequested_revoker HoldRequested(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallStateChangeEventArgs> & handler) const; void HoldRequested(event_token token) const; event_token ResumeRequested(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallStateChangeEventArgs> & handler) const; using ResumeRequested_revoker = event_revoker<IVoipPhoneCall>; ResumeRequested_revoker ResumeRequested(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallStateChangeEventArgs> & handler) const; void ResumeRequested(event_token token) const; event_token AnswerRequested(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallAnswerEventArgs> & acceptHandler) const; using AnswerRequested_revoker = event_revoker<IVoipPhoneCall>; AnswerRequested_revoker AnswerRequested(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallAnswerEventArgs> & acceptHandler) const; void AnswerRequested(event_token token) const; event_token RejectRequested(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallRejectEventArgs> & rejectHandler) const; using RejectRequested_revoker = event_revoker<IVoipPhoneCall>; RejectRequested_revoker RejectRequested(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::Calls::VoipPhoneCall, Windows::ApplicationModel::Calls::CallRejectEventArgs> & rejectHandler) const; void RejectRequested(event_token token) const; void NotifyCallHeld() const; void NotifyCallActive() const; void NotifyCallEnded() const; hstring ContactName() const; void ContactName(hstring_view value) const; Windows::Foundation::DateTime StartTime() const; void StartTime(const Windows::Foundation::DateTime & value) const; Windows::ApplicationModel::Calls::VoipPhoneCallMedia CallMedia() const; void CallMedia(Windows::ApplicationModel::Calls::VoipPhoneCallMedia value) const; void NotifyCallReady() const; }; } namespace impl { template <> struct traits<Windows::ApplicationModel::Calls::ICallAnswerEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::ICallAnswerEventArgs; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_ICallAnswerEventArgs<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::ICallRejectEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::ICallRejectEventArgs; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_ICallRejectEventArgs<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::ICallStateChangeEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::ICallStateChangeEventArgs; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_ICallStateChangeEventArgs<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::ILockScreenCallEndCallDeferral> { using abi = ABI::Windows::ApplicationModel::Calls::ILockScreenCallEndCallDeferral; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_ILockScreenCallEndCallDeferral<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::ILockScreenCallEndRequestedEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::ILockScreenCallEndRequestedEventArgs; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_ILockScreenCallEndRequestedEventArgs<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::ILockScreenCallUI> { using abi = ABI::Windows::ApplicationModel::Calls::ILockScreenCallUI; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_ILockScreenCallUI<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IMuteChangeEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::IMuteChangeEventArgs; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IMuteChangeEventArgs<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallBlockingStatics> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallBlockingStatics; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallBlockingStatics<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallHistoryEntry> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallHistoryEntry; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallHistoryEntry<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryAddress> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryAddress; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallHistoryEntryAddress<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryAddressFactory> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryAddressFactory; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallHistoryEntryAddressFactory<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryQueryOptions> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryQueryOptions; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallHistoryEntryQueryOptions<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryReader> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallHistoryEntryReader; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallHistoryEntryReader<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallHistoryManagerForUser> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallHistoryManagerForUser; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallHistoryManagerForUser<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallHistoryManagerStatics> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallHistoryManagerStatics; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallHistoryManagerStatics<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallHistoryManagerStatics2> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallHistoryManagerStatics2; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallHistoryManagerStatics2<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallHistoryStore> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallHistoryStore; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallHistoryStore<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallManagerStatics> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallManagerStatics; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallManagerStatics<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallManagerStatics2> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallManagerStatics2; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallManagerStatics2<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallStore> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallStore; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallStore<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallVideoCapabilities> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallVideoCapabilities; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallVideoCapabilities<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneCallVideoCapabilitiesManagerStatics> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneCallVideoCapabilitiesManagerStatics; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneCallVideoCapabilitiesManagerStatics<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneDialOptions> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneDialOptions; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneDialOptions<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneLine> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneLine; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneLine<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneLineCellularDetails> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneLineCellularDetails; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneLineCellularDetails<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneLineConfiguration> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneLineConfiguration; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneLineConfiguration<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneLineStatics> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneLineStatics; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneLineStatics<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneLineWatcher> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneLineWatcher; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneLineWatcher<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneLineWatcherEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneLineWatcherEventArgs; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneLineWatcherEventArgs<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IPhoneVoicemail> { using abi = ABI::Windows::ApplicationModel::Calls::IPhoneVoicemail; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IPhoneVoicemail<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IVoipCallCoordinator> { using abi = ABI::Windows::ApplicationModel::Calls::IVoipCallCoordinator; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IVoipCallCoordinator<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IVoipCallCoordinatorStatics> { using abi = ABI::Windows::ApplicationModel::Calls::IVoipCallCoordinatorStatics; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IVoipCallCoordinatorStatics<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::IVoipPhoneCall> { using abi = ABI::Windows::ApplicationModel::Calls::IVoipPhoneCall; template <typename D> using consume = Windows::ApplicationModel::Calls::impl_IVoipPhoneCall<D>; }; template <> struct traits<Windows::ApplicationModel::Calls::CallAnswerEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::CallAnswerEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.CallAnswerEventArgs"; } }; template <> struct traits<Windows::ApplicationModel::Calls::CallRejectEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::CallRejectEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.CallRejectEventArgs"; } }; template <> struct traits<Windows::ApplicationModel::Calls::CallStateChangeEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::CallStateChangeEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.CallStateChangeEventArgs"; } }; template <> struct traits<Windows::ApplicationModel::Calls::LockScreenCallEndCallDeferral> { using abi = ABI::Windows::ApplicationModel::Calls::LockScreenCallEndCallDeferral; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.LockScreenCallEndCallDeferral"; } }; template <> struct traits<Windows::ApplicationModel::Calls::LockScreenCallEndRequestedEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::LockScreenCallEndRequestedEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.LockScreenCallEndRequestedEventArgs"; } }; template <> struct traits<Windows::ApplicationModel::Calls::LockScreenCallUI> { using abi = ABI::Windows::ApplicationModel::Calls::LockScreenCallUI; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.LockScreenCallUI"; } }; template <> struct traits<Windows::ApplicationModel::Calls::MuteChangeEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::MuteChangeEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.MuteChangeEventArgs"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallBlocking> { static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallBlocking"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryEntry> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneCallHistoryEntry; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallHistoryEntry"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryEntryAddress> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryAddress; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallHistoryEntryAddress"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryEntryQueryOptions> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryQueryOptions; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallHistoryEntryQueryOptions"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryEntryReader> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneCallHistoryEntryReader; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallHistoryEntryReader"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryManager> { static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallHistoryManager"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryManagerForUser> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneCallHistoryManagerForUser; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallHistoryManagerForUser"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallHistoryStore> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneCallHistoryStore; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallHistoryStore"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallManager> { static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallManager"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallStore> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneCallStore; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallStore"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallVideoCapabilities> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneCallVideoCapabilities; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallVideoCapabilities"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneCallVideoCapabilitiesManager> { static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneCallVideoCapabilitiesManager"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneDialOptions> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneDialOptions; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneDialOptions"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLine> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneLine; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneLine"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLineCellularDetails> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneLineCellularDetails; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneLineCellularDetails"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLineConfiguration> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneLineConfiguration; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneLineConfiguration"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLineWatcher> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneLineWatcher; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneLineWatcher"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneLineWatcherEventArgs; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneLineWatcherEventArgs"; } }; template <> struct traits<Windows::ApplicationModel::Calls::PhoneVoicemail> { using abi = ABI::Windows::ApplicationModel::Calls::PhoneVoicemail; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.PhoneVoicemail"; } }; template <> struct traits<Windows::ApplicationModel::Calls::VoipCallCoordinator> { using abi = ABI::Windows::ApplicationModel::Calls::VoipCallCoordinator; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.VoipCallCoordinator"; } }; template <> struct traits<Windows::ApplicationModel::Calls::VoipPhoneCall> { using abi = ABI::Windows::ApplicationModel::Calls::VoipPhoneCall; static constexpr const wchar_t * name() noexcept { return L"Windows.ApplicationModel.Calls.VoipPhoneCall"; } }; } }
#ifndef BSCHEDULER_BASE_THREAD_NAME_HH #define BSCHEDULER_BASE_THREAD_NAME_HH namespace bsc { namespace this_thread { extern thread_local const char* name; extern thread_local unsigned number; } } #endif // vim:filetype=cpp
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and OpenCL // Version: 2019.2 // Copyright (C) 1986-2019 Xilinx, Inc. All Rights Reserved. // // =========================================================== #include "honeybee.h" #include "AESL_pkg.h" using namespace std; namespace ap_rtl { const sc_logic honeybee::ap_const_logic_1 = sc_dt::Log_1; const sc_logic honeybee::ap_const_logic_0 = sc_dt::Log_0; const sc_lv<2> honeybee::ap_ST_fsm_state1 = "1"; const sc_lv<2> honeybee::ap_ST_fsm_state2 = "10"; const sc_lv<32> honeybee::ap_const_lv32_0 = "00000000000000000000000000000000"; const sc_lv<32> honeybee::ap_const_lv32_1 = "1"; const bool honeybee::ap_const_boolean_0 = false; const bool honeybee::ap_const_boolean_1 = true; honeybee::honeybee(sc_module_name name) : sc_module(name), mVcdFile(0) { grp_checkAxis_2_fu_64 = new checkAxis_2("grp_checkAxis_2_fu_64"); grp_checkAxis_2_fu_64->ap_clk(ap_clk); grp_checkAxis_2_fu_64->ap_rst(ap_rst); grp_checkAxis_2_fu_64->ap_start(grp_checkAxis_2_fu_64_ap_start); grp_checkAxis_2_fu_64->ap_done(grp_checkAxis_2_fu_64_ap_done); grp_checkAxis_2_fu_64->ap_idle(grp_checkAxis_2_fu_64_ap_idle); grp_checkAxis_2_fu_64->ap_ready(grp_checkAxis_2_fu_64_ap_ready); grp_checkAxis_2_fu_64->edge_p1_x(edge_p1_x); grp_checkAxis_2_fu_64->edge_p1_y(edge_p1_y); grp_checkAxis_2_fu_64->edge_p1_z(edge_p1_z); grp_checkAxis_2_fu_64->edge_p2_x(edge_p2_x); grp_checkAxis_2_fu_64->edge_p2_y(edge_p2_y); grp_checkAxis_2_fu_64->edge_p2_z(edge_p2_z); grp_checkAxis_2_fu_64->ap_return(grp_checkAxis_2_fu_64_ap_return); grp_checkAxis_1_fu_80 = new checkAxis_1("grp_checkAxis_1_fu_80"); grp_checkAxis_1_fu_80->ap_clk(ap_clk); grp_checkAxis_1_fu_80->ap_rst(ap_rst); grp_checkAxis_1_fu_80->ap_start(grp_checkAxis_1_fu_80_ap_start); grp_checkAxis_1_fu_80->ap_done(grp_checkAxis_1_fu_80_ap_done); grp_checkAxis_1_fu_80->ap_idle(grp_checkAxis_1_fu_80_ap_idle); grp_checkAxis_1_fu_80->ap_ready(grp_checkAxis_1_fu_80_ap_ready); grp_checkAxis_1_fu_80->edge_p1_x(edge_p1_z); grp_checkAxis_1_fu_80->edge_p1_y(edge_p1_y); grp_checkAxis_1_fu_80->edge_p1_z(edge_p1_x); grp_checkAxis_1_fu_80->edge_p2_x(edge_p2_z); grp_checkAxis_1_fu_80->edge_p2_y(edge_p2_y); grp_checkAxis_1_fu_80->edge_p2_z(edge_p2_x); grp_checkAxis_1_fu_80->ap_return(grp_checkAxis_1_fu_80_ap_return); grp_checkAxis_0_fu_96 = new checkAxis_0("grp_checkAxis_0_fu_96"); grp_checkAxis_0_fu_96->ap_clk(ap_clk); grp_checkAxis_0_fu_96->ap_rst(ap_rst); grp_checkAxis_0_fu_96->ap_start(grp_checkAxis_0_fu_96_ap_start); grp_checkAxis_0_fu_96->ap_done(grp_checkAxis_0_fu_96_ap_done); grp_checkAxis_0_fu_96->ap_idle(grp_checkAxis_0_fu_96_ap_idle); grp_checkAxis_0_fu_96->ap_ready(grp_checkAxis_0_fu_96_ap_ready); grp_checkAxis_0_fu_96->edge_p1_x(edge_p1_x); grp_checkAxis_0_fu_96->edge_p1_y(edge_p1_z); grp_checkAxis_0_fu_96->edge_p1_z(edge_p1_y); grp_checkAxis_0_fu_96->edge_p2_x(edge_p2_x); grp_checkAxis_0_fu_96->edge_p2_y(edge_p2_z); grp_checkAxis_0_fu_96->edge_p2_z(edge_p2_y); grp_checkAxis_0_fu_96->ap_return(grp_checkAxis_0_fu_96_ap_return); SC_METHOD(thread_ap_clk_no_reset_); dont_initialize(); sensitive << ( ap_clk.pos() ); SC_METHOD(thread_ap_CS_fsm_state1); sensitive << ( ap_CS_fsm ); SC_METHOD(thread_ap_CS_fsm_state2); sensitive << ( ap_CS_fsm ); SC_METHOD(thread_ap_block_state2_on_subcall_done); sensitive << ( grp_checkAxis_2_fu_64_ap_done ); sensitive << ( grp_checkAxis_1_fu_80_ap_done ); sensitive << ( grp_checkAxis_0_fu_96_ap_done ); SC_METHOD(thread_ap_done); sensitive << ( ap_CS_fsm_state2 ); sensitive << ( ap_block_state2_on_subcall_done ); SC_METHOD(thread_ap_idle); sensitive << ( ap_start ); sensitive << ( ap_CS_fsm_state1 ); SC_METHOD(thread_ap_ready); sensitive << ( ap_CS_fsm_state2 ); sensitive << ( ap_block_state2_on_subcall_done ); SC_METHOD(thread_ap_return); sensitive << ( grp_checkAxis_0_fu_96_ap_return ); sensitive << ( ap_CS_fsm_state2 ); sensitive << ( or_ln159_fu_112_p2 ); sensitive << ( ap_block_state2_on_subcall_done ); SC_METHOD(thread_grp_checkAxis_0_fu_96_ap_start); sensitive << ( grp_checkAxis_0_fu_96_ap_start_reg ); SC_METHOD(thread_grp_checkAxis_1_fu_80_ap_start); sensitive << ( grp_checkAxis_1_fu_80_ap_start_reg ); SC_METHOD(thread_grp_checkAxis_2_fu_64_ap_start); sensitive << ( grp_checkAxis_2_fu_64_ap_start_reg ); SC_METHOD(thread_or_ln159_fu_112_p2); sensitive << ( grp_checkAxis_2_fu_64_ap_return ); sensitive << ( grp_checkAxis_1_fu_80_ap_return ); SC_METHOD(thread_ap_NS_fsm); sensitive << ( ap_start ); sensitive << ( ap_CS_fsm ); sensitive << ( ap_CS_fsm_state1 ); sensitive << ( ap_CS_fsm_state2 ); sensitive << ( ap_block_state2_on_subcall_done ); SC_THREAD(thread_hdltv_gen); sensitive << ( ap_clk.pos() ); ap_CS_fsm = "01"; grp_checkAxis_2_fu_64_ap_start_reg = SC_LOGIC_0; grp_checkAxis_1_fu_80_ap_start_reg = SC_LOGIC_0; grp_checkAxis_0_fu_96_ap_start_reg = SC_LOGIC_0; static int apTFileNum = 0; stringstream apTFilenSS; apTFilenSS << "honeybee_sc_trace_" << apTFileNum ++; string apTFn = apTFilenSS.str(); mVcdFile = sc_create_vcd_trace_file(apTFn.c_str()); mVcdFile->set_time_unit(1, SC_PS); if (1) { #ifdef __HLS_TRACE_LEVEL_PORT__ sc_trace(mVcdFile, ap_clk, "(port)ap_clk"); sc_trace(mVcdFile, ap_rst, "(port)ap_rst"); sc_trace(mVcdFile, ap_start, "(port)ap_start"); sc_trace(mVcdFile, ap_done, "(port)ap_done"); sc_trace(mVcdFile, ap_idle, "(port)ap_idle"); sc_trace(mVcdFile, ap_ready, "(port)ap_ready"); sc_trace(mVcdFile, edge_p1_x, "(port)edge_p1_x"); sc_trace(mVcdFile, edge_p1_y, "(port)edge_p1_y"); sc_trace(mVcdFile, edge_p1_z, "(port)edge_p1_z"); sc_trace(mVcdFile, edge_p2_x, "(port)edge_p2_x"); sc_trace(mVcdFile, edge_p2_y, "(port)edge_p2_y"); sc_trace(mVcdFile, edge_p2_z, "(port)edge_p2_z"); sc_trace(mVcdFile, ap_return, "(port)ap_return"); #endif #ifdef __HLS_TRACE_LEVEL_INT__ sc_trace(mVcdFile, ap_CS_fsm, "ap_CS_fsm"); sc_trace(mVcdFile, ap_CS_fsm_state1, "ap_CS_fsm_state1"); sc_trace(mVcdFile, grp_checkAxis_2_fu_64_ap_start, "grp_checkAxis_2_fu_64_ap_start"); sc_trace(mVcdFile, grp_checkAxis_2_fu_64_ap_done, "grp_checkAxis_2_fu_64_ap_done"); sc_trace(mVcdFile, grp_checkAxis_2_fu_64_ap_idle, "grp_checkAxis_2_fu_64_ap_idle"); sc_trace(mVcdFile, grp_checkAxis_2_fu_64_ap_ready, "grp_checkAxis_2_fu_64_ap_ready"); sc_trace(mVcdFile, grp_checkAxis_2_fu_64_ap_return, "grp_checkAxis_2_fu_64_ap_return"); sc_trace(mVcdFile, grp_checkAxis_1_fu_80_ap_start, "grp_checkAxis_1_fu_80_ap_start"); sc_trace(mVcdFile, grp_checkAxis_1_fu_80_ap_done, "grp_checkAxis_1_fu_80_ap_done"); sc_trace(mVcdFile, grp_checkAxis_1_fu_80_ap_idle, "grp_checkAxis_1_fu_80_ap_idle"); sc_trace(mVcdFile, grp_checkAxis_1_fu_80_ap_ready, "grp_checkAxis_1_fu_80_ap_ready"); sc_trace(mVcdFile, grp_checkAxis_1_fu_80_ap_return, "grp_checkAxis_1_fu_80_ap_return"); sc_trace(mVcdFile, grp_checkAxis_0_fu_96_ap_start, "grp_checkAxis_0_fu_96_ap_start"); sc_trace(mVcdFile, grp_checkAxis_0_fu_96_ap_done, "grp_checkAxis_0_fu_96_ap_done"); sc_trace(mVcdFile, grp_checkAxis_0_fu_96_ap_idle, "grp_checkAxis_0_fu_96_ap_idle"); sc_trace(mVcdFile, grp_checkAxis_0_fu_96_ap_ready, "grp_checkAxis_0_fu_96_ap_ready"); sc_trace(mVcdFile, grp_checkAxis_0_fu_96_ap_return, "grp_checkAxis_0_fu_96_ap_return"); sc_trace(mVcdFile, grp_checkAxis_2_fu_64_ap_start_reg, "grp_checkAxis_2_fu_64_ap_start_reg"); sc_trace(mVcdFile, ap_CS_fsm_state2, "ap_CS_fsm_state2"); sc_trace(mVcdFile, grp_checkAxis_1_fu_80_ap_start_reg, "grp_checkAxis_1_fu_80_ap_start_reg"); sc_trace(mVcdFile, grp_checkAxis_0_fu_96_ap_start_reg, "grp_checkAxis_0_fu_96_ap_start_reg"); sc_trace(mVcdFile, or_ln159_fu_112_p2, "or_ln159_fu_112_p2"); sc_trace(mVcdFile, ap_block_state2_on_subcall_done, "ap_block_state2_on_subcall_done"); sc_trace(mVcdFile, ap_NS_fsm, "ap_NS_fsm"); #endif } mHdltvinHandle.open("honeybee.hdltvin.dat"); mHdltvoutHandle.open("honeybee.hdltvout.dat"); } honeybee::~honeybee() { if (mVcdFile) sc_close_vcd_trace_file(mVcdFile); mHdltvinHandle << "] " << endl; mHdltvoutHandle << "] " << endl; mHdltvinHandle.close(); mHdltvoutHandle.close(); delete grp_checkAxis_2_fu_64; delete grp_checkAxis_1_fu_80; delete grp_checkAxis_0_fu_96; } void honeybee::thread_ap_clk_no_reset_() { if ( ap_rst.read() == ap_const_logic_1) { ap_CS_fsm = ap_ST_fsm_state1; } else { ap_CS_fsm = ap_NS_fsm.read(); } if ( ap_rst.read() == ap_const_logic_1) { grp_checkAxis_0_fu_96_ap_start_reg = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read()) && esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_1))) { grp_checkAxis_0_fu_96_ap_start_reg = ap_const_logic_1; } else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_checkAxis_0_fu_96_ap_ready.read())) { grp_checkAxis_0_fu_96_ap_start_reg = ap_const_logic_0; } } if ( ap_rst.read() == ap_const_logic_1) { grp_checkAxis_1_fu_80_ap_start_reg = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read()) && esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_1))) { grp_checkAxis_1_fu_80_ap_start_reg = ap_const_logic_1; } else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_checkAxis_1_fu_80_ap_ready.read())) { grp_checkAxis_1_fu_80_ap_start_reg = ap_const_logic_0; } } if ( ap_rst.read() == ap_const_logic_1) { grp_checkAxis_2_fu_64_ap_start_reg = ap_const_logic_0; } else { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read()) && esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_1))) { grp_checkAxis_2_fu_64_ap_start_reg = ap_const_logic_1; } else if (esl_seteq<1,1,1>(ap_const_logic_1, grp_checkAxis_2_fu_64_ap_ready.read())) { grp_checkAxis_2_fu_64_ap_start_reg = ap_const_logic_0; } } } void honeybee::thread_ap_CS_fsm_state1() { ap_CS_fsm_state1 = ap_CS_fsm.read()[0]; } void honeybee::thread_ap_CS_fsm_state2() { ap_CS_fsm_state2 = ap_CS_fsm.read()[1]; } void honeybee::thread_ap_block_state2_on_subcall_done() { ap_block_state2_on_subcall_done = (esl_seteq<1,1,1>(ap_const_logic_0, grp_checkAxis_2_fu_64_ap_done.read()) || esl_seteq<1,1,1>(ap_const_logic_0, grp_checkAxis_0_fu_96_ap_done.read()) || esl_seteq<1,1,1>(ap_const_logic_0, grp_checkAxis_1_fu_80_ap_done.read())); } void honeybee::thread_ap_done() { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state2.read()) && esl_seteq<1,1,1>(ap_block_state2_on_subcall_done.read(), ap_const_boolean_0))) { ap_done = ap_const_logic_1; } else { ap_done = ap_const_logic_0; } } void honeybee::thread_ap_idle() { if ((esl_seteq<1,1,1>(ap_const_logic_0, ap_start.read()) && esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read()))) { ap_idle = ap_const_logic_1; } else { ap_idle = ap_const_logic_0; } } void honeybee::thread_ap_ready() { if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state2.read()) && esl_seteq<1,1,1>(ap_block_state2_on_subcall_done.read(), ap_const_boolean_0))) { ap_ready = ap_const_logic_1; } else { ap_ready = ap_const_logic_0; } } void honeybee::thread_ap_return() { ap_return = (or_ln159_fu_112_p2.read() | grp_checkAxis_0_fu_96_ap_return.read()); } void honeybee::thread_grp_checkAxis_0_fu_96_ap_start() { grp_checkAxis_0_fu_96_ap_start = grp_checkAxis_0_fu_96_ap_start_reg.read(); } void honeybee::thread_grp_checkAxis_1_fu_80_ap_start() { grp_checkAxis_1_fu_80_ap_start = grp_checkAxis_1_fu_80_ap_start_reg.read(); } void honeybee::thread_grp_checkAxis_2_fu_64_ap_start() { grp_checkAxis_2_fu_64_ap_start = grp_checkAxis_2_fu_64_ap_start_reg.read(); } void honeybee::thread_or_ln159_fu_112_p2() { or_ln159_fu_112_p2 = (grp_checkAxis_2_fu_64_ap_return.read() | grp_checkAxis_1_fu_80_ap_return.read()); } void honeybee::thread_ap_NS_fsm() { switch (ap_CS_fsm.read().to_uint64()) { case 1 : if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state1.read()) && esl_seteq<1,1,1>(ap_start.read(), ap_const_logic_1))) { ap_NS_fsm = ap_ST_fsm_state2; } else { ap_NS_fsm = ap_ST_fsm_state1; } break; case 2 : if ((esl_seteq<1,1,1>(ap_const_logic_1, ap_CS_fsm_state2.read()) && esl_seteq<1,1,1>(ap_block_state2_on_subcall_done.read(), ap_const_boolean_0))) { ap_NS_fsm = ap_ST_fsm_state1; } else { ap_NS_fsm = ap_ST_fsm_state2; } break; default : ap_NS_fsm = "XX"; break; } } void honeybee::thread_hdltv_gen() { const char* dump_tv = std::getenv("AP_WRITE_TV"); if (!(dump_tv && string(dump_tv) == "on")) return; wait(); mHdltvinHandle << "[ " << endl; mHdltvoutHandle << "[ " << endl; int ap_cycleNo = 0; while (1) { wait(); const char* mComma = ap_cycleNo == 0 ? " " : ", " ; mHdltvinHandle << mComma << "{" << " \"ap_rst\" : \"" << ap_rst.read() << "\" "; mHdltvinHandle << " , " << " \"ap_start\" : \"" << ap_start.read() << "\" "; mHdltvoutHandle << mComma << "{" << " \"ap_done\" : \"" << ap_done.read() << "\" "; mHdltvoutHandle << " , " << " \"ap_idle\" : \"" << ap_idle.read() << "\" "; mHdltvoutHandle << " , " << " \"ap_ready\" : \"" << ap_ready.read() << "\" "; mHdltvinHandle << " , " << " \"edge_p1_x\" : \"" << edge_p1_x.read() << "\" "; mHdltvinHandle << " , " << " \"edge_p1_y\" : \"" << edge_p1_y.read() << "\" "; mHdltvinHandle << " , " << " \"edge_p1_z\" : \"" << edge_p1_z.read() << "\" "; mHdltvinHandle << " , " << " \"edge_p2_x\" : \"" << edge_p2_x.read() << "\" "; mHdltvinHandle << " , " << " \"edge_p2_y\" : \"" << edge_p2_y.read() << "\" "; mHdltvinHandle << " , " << " \"edge_p2_z\" : \"" << edge_p2_z.read() << "\" "; mHdltvoutHandle << " , " << " \"ap_return\" : \"" << ap_return.read() << "\" "; mHdltvinHandle << "}" << std::endl; mHdltvoutHandle << "}" << std::endl; ap_cycleNo++; } } }
/* Copyright (c) 2005-2023, University of Oxford. All rights reserved. University of Oxford means the Chancellor, Masters and Scholars of the University of Oxford, having an administrative office at Wellington Square, Oxford OX1 2JD, UK. This file is part of Chaste. 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 University of Oxford 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. */ #ifndef _TESTQUADRATICMESH_HPP_ #define _TESTQUADRATICMESH_HPP_ #include <cxxtest/TestSuite.h> #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #include "QuadraticMesh.hpp" #include "TetrahedralMesh.hpp" #include "OutputFileHandler.hpp" #include "FileComparison.hpp" #include "ArchiveOpener.hpp" #include "Warnings.hpp" #include "PetscMatTools.hpp" #include "PetscSetupAndFinalize.hpp" class TestQuadraticMesh : public CxxTest::TestSuite { public: void TestQuadraticMesh1d() { QuadraticMesh<1> mesh; TrianglesMeshReader<1,1> mesh_reader("mesh/test/data/1D_0_to_1_10_elements_quadratic",2,1,false); mesh.ConstructFromMeshReader(mesh_reader); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 21u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 10u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 11u); // Node 2 (ie middle) of element 0 TS_ASSERT_EQUALS(mesh.GetElement(0)->GetNodeGlobalIndex(2), 11u); TS_ASSERT_DELTA(mesh.GetNode(11)->rGetLocation()[0], 0.05, 1e-12); for (unsigned i=0; i<mesh.GetNumNodes(); i++) { double x = mesh.GetNode(i)->rGetLocation()[0]; bool is_boundary_node = mesh.GetNode(i)->IsBoundaryNode(); TS_ASSERT_EQUALS(is_boundary_node, ((x==0)||(x==1))); } for (unsigned i=0; i<mesh.GetNumElements(); i++) { // Check internal nodes have corrent element associated with them std::set<unsigned> internal_node_elems; internal_node_elems.insert(mesh.GetElement(i)->GetIndex()); TS_ASSERT_EQUALS(internal_node_elems,mesh.GetElement(i)->GetNode(2)->rGetContainingElementIndices()); } } // Identical to above, except mesh is generated not read void TestQuadraticMesh1dAutomaticallyGenerated() { QuadraticMesh<1> mesh(0.1, 1.0); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 21u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 10u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 11u); // Node 2 (ie middle) of element 0 TS_ASSERT_EQUALS(mesh.GetElement(0)->GetNodeGlobalIndex(2), 11u); TS_ASSERT_DELTA(mesh.GetNode(11)->rGetLocation()[0], 0.05, 1e-12); for (unsigned i=0; i<mesh.GetNumNodes(); i++) { double x = mesh.GetNode(i)->rGetLocation()[0]; bool is_boundary_node = mesh.GetNode(i)->IsBoundaryNode(); TS_ASSERT_EQUALS(is_boundary_node, ((x==0)||(x==1))); } for (unsigned i=0; i<mesh.GetNumElements(); i++) { // Check internal nodes have correct element associated with them std::set<unsigned> internal_node_elems; internal_node_elems.insert(mesh.GetElement(i)->GetIndex()); TS_ASSERT_EQUALS(internal_node_elems,mesh.GetElement(i)->GetNode(2)->rGetContainingElementIndices()); } } void TestQuadraticMesh2d() { QuadraticMesh<2> mesh; TrianglesMeshReader<2,2> mesh_reader("mesh/test/data/square_128_elements_quadratic",2,1, false); mesh.ConstructFromMeshReader(mesh_reader); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 289u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 128u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 81u); // Each element should have 6 nodes for (unsigned i=0; i<mesh.GetNumElements(); i++) { TS_ASSERT_EQUALS(mesh.GetElement(i)->GetNumNodes(), 6u); for (unsigned j=0; j<2; j++) { // Check internal nodes have corrent element associated with them TS_ASSERT(mesh.GetElement(i)->GetNode(j+3)->GetNumContainingElements() <= 2u); TS_ASSERT(mesh.GetElement(i)->GetNode(j+3)->GetNumContainingElements() > 0u); std::set<unsigned> current_node_indices = mesh.GetElement(i)->GetNode(j)->rGetContainingElementIndices(); TS_ASSERT_EQUALS(current_node_indices.count(mesh.GetElement(i)->GetIndex()), 1u); current_node_indices = mesh.GetElement(i)->GetNode(j+3)->rGetContainingElementIndices(); TS_ASSERT_EQUALS(current_node_indices.count(mesh.GetElement(i)->GetIndex()), 1u); } } // Node 3 (ie fourth) of element 0 TS_ASSERT_EQUALS(mesh.GetElement(0)->GetNodeGlobalIndex(3), 82u); // Node 4 (ie fifth) of element 0 TS_ASSERT_EQUALS(mesh.GetElement(0)->GetNodeGlobalIndex(4), 83u); // Node 5 (ie last) of element 0 TS_ASSERT_EQUALS(mesh.GetElement(0)->GetNodeGlobalIndex(5), 81u); // Each boundary element should have three nodes for (TetrahedralMesh<2,2>::BoundaryElementIterator iter = mesh.GetBoundaryElementIteratorBegin(); iter != mesh.GetBoundaryElementIteratorEnd(); ++iter) { TS_ASSERT_EQUALS((*iter)->GetNumNodes(), 3u); } TetrahedralMesh<2,2>::BoundaryElementIterator iter = mesh.GetBoundaryElementIteratorBegin(); // The first edge has nodes 53 and 0, according to the edge file... TS_ASSERT_EQUALS( (*iter)->GetNodeGlobalIndex(0), 53u); TS_ASSERT_EQUALS( (*iter)->GetNodeGlobalIndex(1), 0u); // ...the midnode has to be computed (found) by the QuadraticMesh class TS_ASSERT_EQUALS( (*iter)->GetNodeGlobalIndex(2), 81u); for (unsigned i=0; i<mesh.GetNumNodes(); i++) { double x = mesh.GetNode(i)->rGetLocation()[0]; double y = mesh.GetNode(i)->rGetLocation()[1]; bool is_boundary_node = mesh.GetNode(i)->IsBoundaryNode(); TS_ASSERT_EQUALS(is_boundary_node, ((x==0)||(x==1)||(y==0)||(y==1))); } } void TestQuadraticMesh3d() { QuadraticMesh<3> mesh; TrianglesMeshReader<3,3> mesh_reader("mesh/test/data/3D_Single_tetrahedron_element_quadratic",2,1, false); mesh.ConstructFromMeshReader(mesh_reader); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 10u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 1u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 4u); // Check getting global numbers of nodes 4-9 (in non-vertices) for (unsigned i=4; i<10; i++) { TS_ASSERT_EQUALS(mesh.GetElement(0)->GetNodeGlobalIndex(i), i); } for (unsigned i=0; i<mesh.GetNumNodes(); i++) { TS_ASSERT_EQUALS(mesh.GetNode(i)->IsBoundaryNode(), true); TS_ASSERT_EQUALS(mesh.GetNode(i)->GetNumContainingElements(), 1u); } // Lots of internal and boundary nodes in this mesh.. QuadraticMesh<3> mesh2; TrianglesMeshReader<3,3> mesh_reader2("mesh/test/data/cube_1626_elements_quadratic",2,1, false); mesh2.ConstructFromMeshReader(mesh_reader2); TS_ASSERT_EQUALS(mesh2.GetNumNodes(), 2570u); TS_ASSERT_EQUALS(mesh2.GetNumElements(), 1626u); TS_ASSERT_EQUALS(mesh2.GetNumVertices(), 375u); // Each element should have 10 nodes for (unsigned i=0; i<mesh2.GetNumElements(); i++) { TS_ASSERT_EQUALS(mesh2.GetElement(i)->GetNumNodes(), 10u); for (unsigned j=3; j<9; j++) { // Check internal nodes have corrent element associated with them TS_ASSERT(mesh2.GetElement(i)->GetNode(j)->GetNumContainingElements() > 0u); std::set<unsigned> current_node_indices = mesh2.GetElement(i)->GetNode(j)->rGetContainingElementIndices(); TS_ASSERT_EQUALS(current_node_indices.count(mesh2.GetElement(i)->GetIndex()),1u); } } // Each boundary element should have 6 nodes for (TetrahedralMesh<3,3>::BoundaryElementIterator iter= mesh2.GetBoundaryElementIteratorBegin(); iter != mesh2.GetBoundaryElementIteratorEnd(); ++iter) { TS_ASSERT_EQUALS((*iter)->GetNumNodes(), 6u); } TetrahedralMesh<3,3>::BoundaryElementIterator iter = mesh2.GetBoundaryElementIteratorBegin(); // The first boundary elem has these nodes, according to the edge file.. TS_ASSERT_EQUALS( (*iter)->GetNodeGlobalIndex(0), 177u); TS_ASSERT_EQUALS( (*iter)->GetNodeGlobalIndex(1), 43u); TS_ASSERT_EQUALS( (*iter)->GetNodeGlobalIndex(2), 85u); // .. the internal nodes have to be computed (found) by the QuadraticMesh. // The nodes 177,43,85 are all in the third element in the ele file, and // they are nodes 1,3,2 respectively. Therefore, the internals are the local // nodes 9,5,8 respectively (look the the ordering picture), so.. TS_ASSERT_EQUALS( (*iter)->GetNodeGlobalIndex(3), 392u); TS_ASSERT_EQUALS( (*iter)->GetNodeGlobalIndex(4), 388u); TS_ASSERT_EQUALS( (*iter)->GetNodeGlobalIndex(5), 391u); for (unsigned i=0; i<mesh2.GetNumNodes(); i++) { double x = mesh2.GetNode(i)->rGetLocation()[0]; double y = mesh2.GetNode(i)->rGetLocation()[1]; double z = mesh2.GetNode(i)->rGetLocation()[2]; bool is_boundary_node = mesh2.GetNode(i)->IsBoundaryNode(); TS_ASSERT_EQUALS(is_boundary_node, ((x==0)||(x==1)||(y==0)||(y==1)||(z==0)||(z==1))); } } void TestAutomaticallyGenerated2dMesh1() { QuadraticMesh<2> mesh(1.0, 1.0, 1.0); TS_ASSERT_THROWS_CONTAINS(QuadraticMesh<2> bad_mesh(0.645, 1.0, 1.0), "does not divide"); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 9u); TS_ASSERT_EQUALS(mesh.GetNumBoundaryNodes(), 8u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 2u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 4u); // Each element should have 6 nodes and a valid Jacobian double det; c_matrix<double, 2, 2> jacob; c_matrix<double, 2, 2> inv; for (unsigned i=0; i<mesh.GetNumElements(); i++) { TS_ASSERT_EQUALS(mesh.GetElement(i)->GetNumNodes(), 6u); mesh.GetInverseJacobianForElement(i, jacob, det, inv); TS_ASSERT_EQUALS(det, 1.0); } // Test vertex containment TS_ASSERT_EQUALS(mesh.GetNode(0)->GetNumContainingElements(), 1u); //(0,0) TS_ASSERT_EQUALS(mesh.GetNode(1)->GetNumContainingElements(), 2u); TS_ASSERT_EQUALS(mesh.GetNode(2)->GetNumContainingElements(), 2u); TS_ASSERT_EQUALS(mesh.GetNode(3)->GetNumContainingElements(), 1u); //(1,1) // Test internal node containment TS_ASSERT_EQUALS(mesh.GetNode(4)->GetNumContainingElements(), 1u); TS_ASSERT_EQUALS(mesh.GetNode(5)->GetNumContainingElements(), 1u); TS_ASSERT_EQUALS(mesh.GetNode(6)->GetNumContainingElements(), 2u); //(.5,.5) TS_ASSERT_EQUALS(mesh.GetNode(7)->GetNumContainingElements(), 1u); TS_ASSERT_EQUALS(mesh.GetNode(8)->GetNumContainingElements(), 1u); TS_ASSERT_DELTA( mesh.GetNode(3)->rGetLocation()[0], 1.0, 1e-6); TS_ASSERT_DELTA( mesh.GetNode(3)->rGetLocation()[1], 1.0, 1e-6); // Test boundary elements unsigned num_boundary_elements=0; for (TetrahedralMesh<2,2>::BoundaryElementIterator iter = mesh.GetBoundaryElementIteratorBegin(); iter != mesh.GetBoundaryElementIteratorEnd(); ++iter) { TS_ASSERT_EQUALS((*iter)->GetNumNodes(), 3u); bool all_x_zero = (fabs((*iter)->GetNode(0)->rGetLocation()[0])<1e-6) && (fabs((*iter)->GetNode(1)->rGetLocation()[0])<1e-6) && (fabs((*iter)->GetNode(2)->rGetLocation()[0])<1e-6); bool all_x_one = (fabs((*iter)->GetNode(0)->rGetLocation()[0] - 1.0)<1e-6) && (fabs((*iter)->GetNode(1)->rGetLocation()[0] - 1.0)<1e-6) && (fabs((*iter)->GetNode(2)->rGetLocation()[0] - 1.0)<1e-6); bool all_y_zero = (fabs((*iter)->GetNode(0)->rGetLocation()[1])<1e-6) && (fabs((*iter)->GetNode(1)->rGetLocation()[1])<1e-6) && (fabs((*iter)->GetNode(2)->rGetLocation()[1])<1e-6); bool all_y_one = (fabs((*iter)->GetNode(0)->rGetLocation()[1] - 1.0)<1e-6) && (fabs((*iter)->GetNode(1)->rGetLocation()[1] - 1.0)<1e-6) && (fabs((*iter)->GetNode(2)->rGetLocation()[1] - 1.0)<1e-6); TS_ASSERT_EQUALS(true, all_x_zero || all_x_one || all_y_zero || all_y_one); num_boundary_elements++; } TS_ASSERT_EQUALS(num_boundary_elements, 4u); TS_ASSERT_EQUALS(mesh.GetNumBoundaryElements(), 4u); } void TestAutomaticallyGenerated2dMesh2() { QuadraticMesh<2> mesh(3.14159/10, 3.14159, 3.14159/2); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 21*11u); TS_ASSERT_EQUALS(mesh.GetNumBoundaryNodes(), 60u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 100u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 11*6u); // Each element should have 6 nodes for (unsigned i=0; i<mesh.GetNumElements(); i++) { TS_ASSERT_EQUALS(mesh.GetElement(i)->GetNumNodes(), 6u); } for (unsigned i=0; i<mesh.GetNumBoundaryElements(); i++) { TS_ASSERT_EQUALS(mesh.GetBoundaryElement(i)->GetNumNodes(), 3u); } TS_ASSERT_DELTA( mesh.GetNode(65)->rGetLocation()[0], 3.14159, 1e-4); TS_ASSERT_DELTA( mesh.GetNode(65)->rGetLocation()[1], 3.14159/2, 1e-5); TS_ASSERT_EQUALS(mesh.GetNumBoundaryElements(), 30u); } void TestAutomaticallyGenerated3dMeshSimple() { double h = 3.14159; double width = h; QuadraticMesh<3> mesh(h, width, 2*width, 3*width); TS_ASSERT_THROWS_CONTAINS(QuadraticMesh<3> bad_mesh(0.645, 1.0, 1.0, 1.0), "does not divide"); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 3*5*7u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 6*1*2*3u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 2*3*4u); TS_ASSERT_EQUALS(mesh.GetNumBoundaryNodes(), 90u); for (unsigned i=1; i<mesh.GetNumNodes(); i++) { c_vector<double,3> x = mesh.GetNode(i)->rGetLocation(); // Check the extra nodes aren't (0,0,0). // This fails with 32bit outdated binary. TS_ASSERT_LESS_THAN(1e-12, norm_2(x)); // assert x not equal to 0 } TS_ASSERT_DELTA( mesh.GetNode(23)->rGetLocation()[0], width, 1e-8); TS_ASSERT_DELTA( mesh.GetNode(23)->rGetLocation()[1], 2*width, 1e-8); TS_ASSERT_DELTA( mesh.GetNode(23)->rGetLocation()[2], 3*width, 1e-8); // Second 1 by 1 by 1 mesh QuadraticMesh<3> mesh2(h, width, width, width); for (unsigned i=1; i<mesh2.GetNumNodes(); i++) { //Check that all nodes have containg elements TS_ASSERT_LESS_THAN(0u, mesh2.GetNode(i)->GetNumContainingElements()); //Mid-point of cube will have access to all 6 elements TS_ASSERT_LESS_THAN_EQUALS(mesh2.GetNode(i)->GetNumContainingElements(), 6u); } TS_ASSERT_EQUALS(mesh2.CalculateMaximumContainingElementsPerProcess(), 6U); //The midpoint, as given above // There are 8 vertex nodes in the cube // There are 12 internal nodes on the cube edges // There are 6 internal nodes on the diagonals to the cube faces // There is 1 interal node on the separating diagonal // 8V + 19I = 27 nodes TS_ASSERT_EQUALS(mesh2.CalculateMaximumNodeConnectivityPerProcess(), 27U); //The midpoint, as given above } void TestAutomaticallyGenerated3dMesh() { QuadraticMesh<3> mesh(0.5, 2.5, 2.5, 2.5); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 1331u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 750u); // 5 cubes in each direction = 125 cubes => 125 x 6 tetrahedra per cube = 750 TS_ASSERT_EQUALS(mesh.GetNumVertices(), 216u); // 6^3 = 216 TS_ASSERT_EQUALS(mesh.GetNumBoundaryNodes(), 602u); // Each element should have 10 nodes for (unsigned i=0; i<mesh.GetNumElements(); i++) { TS_ASSERT_EQUALS(mesh.GetElement(i)->GetNumNodes(), 10u); } TS_ASSERT_DELTA(mesh.GetNode(215)->rGetLocation()[0], 2.5, 1e-4); TS_ASSERT_DELTA(mesh.GetNode(215)->rGetLocation()[1], 2.5, 1e-5); TS_ASSERT_DELTA(mesh.GetNode(215)->rGetLocation()[2], 2.5, 1e-4); TS_ASSERT_EQUALS(mesh.CalculateMaximumContainingElementsPerProcess(), 24U); // Four surrounding cubes may have all 6 tetrahedra meeting at a node TS_ASSERT_EQUALS(mesh.CalculateMaximumNodeConnectivityPerProcess(), 65U); } void TestWritingReadingBoundaryElementsWithContainingElementInfo() { // This mesh has quadratic node and ele files, a linear face file that has containing element info QuadraticMesh<3> mesh; TrianglesMeshReader<3,3> mesh_reader("mesh/test/data/cube_2mm_152_elements_v3",2,1,true); mesh.ConstructFromMeshReader(mesh_reader); for (QuadraticMesh<3>::BoundaryElementIterator iter = mesh.GetBoundaryElementIteratorBegin(); iter != mesh.GetBoundaryElementIteratorEnd(); ++iter) { TS_ASSERT_EQUALS( (*iter)->GetNumNodes(), 6u ); } } void TestArchiving() { FileFinder archive_dir("archive", RelativeTo::ChasteTestOutput); std::string archive_file = "quadratic_mesh.arch"; ArchiveLocationInfo::SetMeshFilename("quadratic_mesh"); AbstractTetrahedralMesh<3,3>* const p_mesh = new QuadraticMesh<3>; TrianglesMeshReader<3,3> mesh_reader("mesh/test/data/cube_1626_elements_fully_quadratic", 2, 2, false); static_cast<QuadraticMesh<3>*>(p_mesh)->ConstructFromMeshReader(mesh_reader); { // Create output archive ArchiveOpener<boost::archive::text_oarchive, std::ofstream> arch_opener(archive_dir, archive_file); boost::archive::text_oarchive* p_arch = arch_opener.GetCommonArchive(); (*p_arch) << p_mesh; } { // Should archive the most abstract class you can to check boost knows what individual classes are. // (but here AbstractMesh doesn't have the methods below). AbstractTetrahedralMesh<3,3>* p_mesh2; // Create an input archive ArchiveOpener<boost::archive::text_iarchive, std::ifstream> arch_opener(archive_dir, archive_file); boost::archive::text_iarchive* p_arch = arch_opener.GetCommonArchive(); // Restore from the archive (*p_arch) >> p_mesh2; // Compare the boundary elements of both meshes, should be identical (as one was created from the other) QuadraticMesh<3>::BoundaryElementIterator iter1 = p_mesh->GetBoundaryElementIteratorBegin(); for (QuadraticMesh<3>::BoundaryElementIterator iter2 = p_mesh2->GetBoundaryElementIteratorBegin(); iter2 != p_mesh2->GetBoundaryElementIteratorEnd(); ++iter2) { TS_ASSERT_EQUALS( (*iter1)->GetNumNodes(), 6u ); TS_ASSERT_EQUALS( (*iter2)->GetNumNodes(), 6u ); for (unsigned i=0; i<6; i++) { TS_ASSERT_EQUALS( (*iter1)->GetNodeGlobalIndex(i), (*iter2)->GetNodeGlobalIndex(i)); } iter1++; } delete p_mesh2; } delete p_mesh; } void TestConstructRegularSlabMesh_Directly_1d() { QuadraticMesh<1> mesh; TS_ASSERT_THROWS_THIS(mesh.ConstructRegularSlabMesh(0.75, 1.0), "Space step does not divide the size of the mesh"); mesh.ConstructRegularSlabMesh(0.1, 1.0); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 21u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 11u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 10u); TS_ASSERT_EQUALS(mesh.GetNumBoundaryNodes(), 2u); for (unsigned i=0; i<mesh.GetNumVertices(); i++) { TS_ASSERT_DELTA(mesh.GetNode(i)->rGetLocation()[0], (i+0.0)/10, 1e-8); bool is_boundary = (i==0 || i+1==mesh.GetNumVertices()); TS_ASSERT_EQUALS(mesh.GetNode(i)->IsBoundaryNode(), is_boundary); std::set<unsigned> containing_elems = mesh.GetNode(i)->rGetContainingElementIndices(); TS_ASSERT_EQUALS(containing_elems.size(), (is_boundary ? 1u : 2u)); } for (unsigned i=mesh.GetNumVertices(); i<mesh.GetNumNodes(); i++) { TS_ASSERT_DELTA(mesh.GetNode(i)->rGetLocation()[0], (i-11.0)/10 + 0.05, 1e-8); std::set<unsigned> containing_elems = mesh.GetNode(i)->rGetContainingElementIndices(); TS_ASSERT_EQUALS(containing_elems.size(), 1u); } TrianglesMeshWriter<1,1> mesh_writer("TestQuadraticMesh", "QuadraticSlab1D", false); mesh_writer.WriteFilesUsingMesh(mesh); std::string output_dir = mesh_writer.GetOutputDirectory(); TrianglesMeshReader<1,1> quadratic_mesh_reader(output_dir + "QuadraticSlab1D", 2, 2); QuadraticMesh<1> quad_mesh_read_back; quad_mesh_read_back.ConstructFromMeshReader(quadratic_mesh_reader); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumNodes(), 21u); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumVertices(), 11u); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumElements(), 10u); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumBoundaryNodes(), 2u); } void TestConstructRegularSlabMesh_Directly_2d() { QuadraticMesh<2> mesh; mesh.ConstructRegularSlabMesh(0.1, 1.0, 2.0); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 21*41u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 11*21u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 2*10*20u); TS_ASSERT_EQUALS(mesh.GetNumBoundaryNodes(), 120u); TrianglesMeshWriter<2,2> mesh_writer("TestQuadraticMesh", "QuadraticSlab2D", false); mesh_writer.WriteFilesUsingMesh(mesh); std::string output_dir = mesh_writer.GetOutputDirectory(); TrianglesMeshReader<2,2> quadratic_mesh_reader(output_dir + "QuadraticSlab2D", 2, 2); QuadraticMesh<2> quad_mesh_read_back; quad_mesh_read_back.ConstructFromMeshReader(quadratic_mesh_reader); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumNodes(), 21*41u); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumVertices(), 11*21u); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumElements(), 2*10*20u); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumBoundaryNodes(), 120u); } void TestConstructRegularSlabMesh_Directly_3d() { QuadraticMesh<3> mesh; mesh.ConstructRegularSlabMesh(1.0, 1.0, 2.0, 3.0); TS_ASSERT_EQUALS(mesh.GetNumNodes(), 3*5*7u); TS_ASSERT_EQUALS(mesh.GetNumVertices(), 2*3*4u); TS_ASSERT_EQUALS(mesh.GetNumElements(), 6*1*2*3u); TS_ASSERT_EQUALS(mesh.GetNumBoundaryNodes(), 90u); TrianglesMeshWriter<3,3> mesh_writer("TestQuadraticMesh", "QuadraticSlab3D", false); mesh_writer.WriteFilesUsingMesh(mesh); std::string output_dir = mesh_writer.GetOutputDirectory(); TrianglesMeshReader<3,3> quadratic_mesh_reader(output_dir + "QuadraticSlab3D", 2, 2); QuadraticMesh<3> quad_mesh_read_back; quad_mesh_read_back.ConstructFromMeshReader(quadratic_mesh_reader); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumNodes(), 3*5*7u); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumVertices(), 2*3*4u); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumElements(), 6*1*2*3u); TS_ASSERT_EQUALS(quad_mesh_read_back.GetNumBoundaryNodes(), 90u); } void TestConstructionConversionVersusConstruction2dNoStagger() { QuadraticMesh<2> quad_mesh_read_back; QuadraticMesh<2> quad_mesh_constructed; unsigned width = 1.0; unsigned height = 2.0; { //Two-dimensional two squares TetrahedralMesh<2,2> mesh; bool stagger=false; mesh.ConstructRectangularMesh(width, height, stagger); TrianglesMeshWriter<2,2> mesh_writer("TestQuadraticMesh", "TempGrid2d", false); mesh_writer.WriteFilesUsingMesh(mesh); //Convert to quadratic std::string output_dir = mesh_writer.GetOutputDirectory(); TrianglesMeshReader<2,2> quadratic_mesh_reader(output_dir + "TempGrid2d"); quad_mesh_read_back.ConstructFromLinearMeshReader(quadratic_mesh_reader); quad_mesh_constructed.ConstructRectangularMesh(width, height, stagger); } TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumNodes(), quad_mesh_read_back.GetNumNodes()); TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumBoundaryNodes(), quad_mesh_read_back.GetNumBoundaryNodes()); TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumVertices(), quad_mesh_read_back.GetNumVertices()); for (unsigned elem=0; elem<quad_mesh_constructed.GetNumElements(); elem++) { Element<2,2>* p_elem_constructed = quad_mesh_constructed.GetElement(elem); Element<2,2>* p_elem_read_back = quad_mesh_read_back.GetElement(elem); TS_ASSERT_EQUALS(p_elem_constructed->GetNumNodes(), p_elem_read_back->GetNumNodes()); for (unsigned i = 0; i < p_elem_constructed->GetNumNodes(); i++) { c_vector<double, 2> loc_read_back; loc_read_back = p_elem_read_back->GetNode(i)->rGetLocation(); c_vector<double, 2> loc_constructed; loc_constructed = p_elem_constructed->GetNode(i)->rGetLocation(); TS_ASSERT_DELTA(loc_read_back[0], loc_constructed[0], 1e-10); TS_ASSERT_DELTA(loc_read_back[1], loc_constructed[1], 1e-10); TS_ASSERT_EQUALS(p_elem_read_back->GetNode(i)->IsBoundaryNode(), p_elem_constructed->GetNode(i)->IsBoundaryNode()); } } // Can't check edges exactly because the linear to quadratic converter doesn't send any boundary information to the // external mesher. (So the edges come back in a different order.) for (unsigned b_elem=0; b_elem<quad_mesh_constructed.GetNumBoundaryElements(); b_elem++) { BoundaryElement<1,2>* p_b_elem_constructed = quad_mesh_constructed.GetBoundaryElement(b_elem); BoundaryElement<1,2>* p_b_elem_read_back = quad_mesh_read_back.GetBoundaryElement(b_elem); TS_ASSERT_EQUALS(p_b_elem_constructed->GetNumNodes(), p_b_elem_read_back->GetNumNodes()); } } void TestConstructionConversionVersusConstruction2dWithStagger() { QuadraticMesh<2> quad_mesh_read_back; QuadraticMesh<2> quad_mesh_constructed; double width = 1.0; double height = 2.0; { //Two-dimensional two squares TetrahedralMesh<2,2> mesh; mesh.ConstructRegularSlabMesh(1.0, width, height); TrianglesMeshWriter<2,2> mesh_writer("TestQuadraticMesh", "TempGrid2d", false); mesh_writer.WriteFilesUsingMesh(mesh); //Convert to quadratic std::string output_dir = mesh_writer.GetOutputDirectory(); TrianglesMeshReader<2,2> quadratic_mesh_reader(output_dir + "TempGrid2d"); quad_mesh_read_back.ConstructFromLinearMeshReader(quadratic_mesh_reader); quad_mesh_constructed.ConstructRegularSlabMesh(1.0, width, height); } TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumNodes(), quad_mesh_read_back.GetNumNodes()); TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumBoundaryNodes(), quad_mesh_read_back.GetNumBoundaryNodes()); TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumVertices(), quad_mesh_read_back.GetNumVertices()); for (unsigned elem=0; elem<quad_mesh_constructed.GetNumElements(); elem++) { Element<2,2>* p_elem_constructed = quad_mesh_constructed.GetElement(elem); Element<2,2>* p_elem_read_back = quad_mesh_read_back.GetElement(elem); TS_ASSERT_EQUALS(p_elem_constructed->GetNumNodes(), p_elem_read_back->GetNumNodes()); for (unsigned i = 0; i < p_elem_constructed->GetNumNodes(); i++) { c_vector<double, 2> loc_read_back; loc_read_back = p_elem_read_back->GetNode(i)->rGetLocation(); c_vector<double, 2> loc_constructed; loc_constructed = p_elem_constructed->GetNode(i)->rGetLocation(); TS_ASSERT_DELTA(loc_read_back[0], loc_constructed[0], 1e-10); TS_ASSERT_DELTA(loc_read_back[1], loc_constructed[1], 1e-10); TS_ASSERT_EQUALS(p_elem_read_back->GetNode(i)->IsBoundaryNode(), p_elem_constructed->GetNode(i)->IsBoundaryNode()); } } // Can't check edges exactly because the linear to quadratic converter doesn't send any boundary information to the // external mesher. (So the edges come back in a different order.) for (unsigned b_elem=0; b_elem<quad_mesh_constructed.GetNumBoundaryElements(); b_elem++) { BoundaryElement<1,2>* p_b_elem_constructed = quad_mesh_constructed.GetBoundaryElement(b_elem); BoundaryElement<1,2>* p_b_elem_read_back = quad_mesh_read_back.GetBoundaryElement(b_elem); TS_ASSERT_EQUALS(p_b_elem_constructed->GetNumNodes(), p_b_elem_read_back->GetNumNodes()); } } void TestConstructionConversionVersusConstruction3d() { QuadraticMesh<3> quad_mesh_read_back; QuadraticMesh<3> quad_mesh_constructed; double width = 1.0; double height = 2.0; double depth = 3.0; { //Three-dimensional cubes TetrahedralMesh<3,3> mesh; mesh.ConstructRegularSlabMesh(1.0, width, height, depth); TrianglesMeshWriter<3,3> mesh_writer("TestQuadraticMesh", "TempGrid3d", false); mesh_writer.WriteFilesUsingMesh(mesh); //Convert to quadratic std::string output_dir = mesh_writer.GetOutputDirectory(); TrianglesMeshReader<3,3> quadratic_mesh_reader(output_dir + "TempGrid3d"); quad_mesh_read_back.ConstructFromLinearMeshReader(quadratic_mesh_reader); quad_mesh_constructed.ConstructRegularSlabMesh(1.0, width, height, depth); } TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumNodes(), quad_mesh_read_back.GetNumNodes()); TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumBoundaryNodes(), quad_mesh_read_back.GetNumBoundaryNodes()); TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumVertices(), quad_mesh_read_back.GetNumVertices()); TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumElements(), quad_mesh_read_back.GetNumElements()); TS_ASSERT_EQUALS(quad_mesh_constructed.GetNumBoundaryElements(), quad_mesh_read_back.GetNumBoundaryElements()); for (unsigned elem=0; elem<quad_mesh_constructed.GetNumElements(); elem++) { Element<3,3>* p_elem_constructed = quad_mesh_constructed.GetElement(elem); Element<3,3>* p_elem_read_back = quad_mesh_read_back.GetElement(elem); TS_ASSERT_EQUALS(p_elem_constructed->GetNumNodes(), p_elem_read_back->GetNumNodes()); for (unsigned i = 0; i < p_elem_constructed->GetNumNodes(); i++) { c_vector<double, 3> loc_read_back; loc_read_back = p_elem_read_back->GetNode(i)->rGetLocation(); c_vector<double, 3> loc_constructed; loc_constructed = p_elem_constructed->GetNode(i)->rGetLocation(); TS_ASSERT_DELTA(loc_read_back[0], loc_constructed[0], 1e-10); TS_ASSERT_DELTA(loc_read_back[1], loc_constructed[1], 1e-10); TS_ASSERT_DELTA(loc_read_back[2], loc_constructed[2], 1e-10); TS_ASSERT_EQUALS(p_elem_read_back->GetNode(i)->IsBoundaryNode(), p_elem_constructed->GetNode(i)->IsBoundaryNode()); } } for (unsigned b_elem=0; b_elem<quad_mesh_constructed.GetNumBoundaryElements(); b_elem++) { BoundaryElement<2,3>* p_b_elem_constructed = quad_mesh_constructed.GetBoundaryElement(b_elem); BoundaryElement<2,3>* p_b_elem_read_back = quad_mesh_read_back.GetBoundaryElement(b_elem); TS_ASSERT_EQUALS(p_b_elem_constructed->GetNumNodes(), p_b_elem_read_back->GetNumNodes()); } } void TestLinearToQuadraticMeshConversion2d() { QuadraticMesh<2> quad_mesh; TrianglesMeshReader<2,2> reader("mesh/test/data/square_128_elements"); quad_mesh.ConstructFromLinearMeshReader(reader); TS_ASSERT_EQUALS(quad_mesh.GetNumNodes(), 289u); TS_ASSERT_EQUALS(quad_mesh.GetNumVertices(), 81u); TS_ASSERT_EQUALS(quad_mesh.GetNumElements(), 128u); TS_ASSERT_EQUALS(quad_mesh.GetNumBoundaryNodes(), 64u); // Output TrianglesMeshWriter<2,2> mesh_writer("TestQuadraticMesh", "converted_square", false); mesh_writer.WriteFilesUsingMesh(quad_mesh); //Compare with // Read in the new mesh to check it worked OutputFileHandler handler("TestQuadraticMesh",false); std::string full_new_mesh = handler.GetOutputDirectoryFullPath() + "converted_square"; // Input again QuadraticMesh<2> quad_mesh_after_conversion; TrianglesMeshReader<2,2> quad_reader(full_new_mesh, 2, 2); quad_mesh_after_conversion.ConstructFromMeshReader(quad_reader); TS_ASSERT_EQUALS(quad_mesh_after_conversion.GetNumNodes(), 17*17u); TS_ASSERT_EQUALS(quad_mesh_after_conversion.GetNumVertices(), 81u); TS_ASSERT_EQUALS(quad_mesh_after_conversion.GetNumElements(), 128u); TS_ASSERT_EQUALS(quad_mesh_after_conversion.GetNumBoundaryNodes(), 64u); } void TestLinearToQuadraticMeshConversion2dNonconvex() { TrianglesMeshReader<2,2> reader("mesh/test/data/l_shape"); TetrahedralMesh<2,2> linear_mesh; linear_mesh.ConstructFromMeshReader(reader); TS_ASSERT_EQUALS(linear_mesh.GetNumNodes(), 8u); TS_ASSERT_EQUALS(linear_mesh.GetNumElements(), 6u); TS_ASSERT_EQUALS(linear_mesh.GetNumBoundaryNodes(), 8u); TS_ASSERT_EQUALS(linear_mesh.GetVolume(), 3.0); TS_ASSERT_EQUALS(linear_mesh.GetSurfaceArea(), 8.0); reader.Reset(); QuadraticMesh<2> quad_mesh; quad_mesh.ConstructFromLinearMeshReader(reader); TS_ASSERT_EQUALS(quad_mesh.GetNumVertices(), 8u); TS_ASSERT_EQUALS(quad_mesh.GetNumElements(), 6u); TS_ASSERT_EQUALS(quad_mesh.GetVolume(), 3.0); TS_ASSERT_EQUALS(quad_mesh.GetSurfaceArea(), 8.0); } /* HOW_TO_TAG Mesh * Convert a linear tetrahedral mesh to quadratic and write back to file. */ void TestLinearToQuadraticMeshConversion3d() { QuadraticMesh<3> quad_mesh; TrianglesMeshReader<3,3> reader("mesh/test/data/cube_136_elements"); quad_mesh.ConstructFromLinearMeshReader(reader); TS_ASSERT_EQUALS(quad_mesh.GetNumNodes(), 285u); TS_ASSERT_EQUALS(quad_mesh.GetNumVertices(), 51u); TS_ASSERT_EQUALS(quad_mesh.GetNumElements(), 136u); TS_ASSERT_EQUALS(quad_mesh.GetNumBoundaryNodes(), 194u); //Output TrianglesMeshWriter<3,3> mesh_writer("TestQuadraticMesh", "converted_cube", false); mesh_writer.WriteFilesUsingMesh(quad_mesh); // read in the new mesh to check it worked OutputFileHandler handler("TestQuadraticMesh", false); std::string full_new_mesh = handler.GetOutputDirectoryFullPath() + "converted_cube"; //Input again QuadraticMesh<3> quad_mesh_after_conversion; TrianglesMeshReader<3,3> quad_reader(full_new_mesh, 2, 2); quad_mesh_after_conversion.ConstructFromMeshReader(quad_reader); TS_ASSERT_EQUALS(quad_mesh_after_conversion.GetNumNodes(), 285u); TS_ASSERT_EQUALS(quad_mesh_after_conversion.GetNumVertices(), 51u); TS_ASSERT_EQUALS(quad_mesh_after_conversion.GetNumElements(), 136u); TS_ASSERT_EQUALS(quad_mesh_after_conversion.GetNumBoundaryNodes(), 194u); } void TestLinearToQuadraticMeshConversion3dNonconvex() { TrianglesMeshReader<3,3> reader("mesh/test/data/l_shape3d"); TetrahedralMesh<3,3> linear_mesh; linear_mesh.ConstructFromMeshReader(reader); TS_ASSERT_EQUALS(linear_mesh.GetNumNodes(), 16u); TS_ASSERT_EQUALS(linear_mesh.GetNumElements(), 18u); // 3 cubes TS_ASSERT_EQUALS(linear_mesh.GetNumBoundaryNodes(), 16u); // All on boundary TS_ASSERT_DELTA(linear_mesh.GetVolume(), 3.0, 1e-15); // 3 cubes TS_ASSERT_DELTA(linear_mesh.GetSurfaceArea(), 14.0, 1e-15); reader.Reset(); QuadraticMesh<3> quad_mesh; quad_mesh.ConstructFromLinearMeshReader(reader); TS_ASSERT_EQUALS(quad_mesh.GetNumVertices(), 16u); TS_ASSERT_EQUALS(quad_mesh.GetNumElements(), 18u); TS_ASSERT_EQUALS(quad_mesh.GetNumNodes(), 63u); TS_ASSERT_EQUALS(quad_mesh.GetNumBoundaryNodes(), 58u); // All on boundary TS_ASSERT_DELTA(quad_mesh.GetVolume(), 3.0, 1e-15); TS_ASSERT_DELTA(quad_mesh.GetSurfaceArea(), 14.0, 1e-15); } void TestQuadraticMesh2dReordered() { // Quadratics mesh - with different ordering QuadraticMesh<2> quad_mesh; TrianglesMeshReader<2,2> mesh_reader1("mesh/test/data/square_128_elements_quadratic_reordered",2,1,false); quad_mesh.ConstructFromMeshReader(mesh_reader1); // Linear mesh TrianglesMeshReader<2,2> mesh_reader("mesh/test/data/square_128_elements"); TetrahedralMesh<2,2> mesh; mesh.ConstructFromMeshReader(mesh_reader); TS_ASSERT_EQUALS(mesh.GetNumNodes(), quad_mesh.GetNumVertices()); for (unsigned i=0; i<mesh.GetNumNodes(); i++) { unsigned quad_index=i; //Quad mesh has a minor permutation: vertex node 4 now appears at index 81 if (i==4) { quad_index=81; } double lin_x = mesh.GetNode(i)->rGetLocation()[0]; double lin_y = mesh.GetNode(i)->rGetLocation()[1]; double quad_x = quad_mesh.GetNode(quad_index)->rGetLocation()[0]; double quad_y = quad_mesh.GetNode(quad_index)->rGetLocation()[1]; TS_ASSERT_DELTA(lin_x, quad_x, 1e-8); TS_ASSERT_DELTA(lin_y, quad_y, 1e-8); } } /** * Check that we can build a QuadraticMesh using the VTK mesh reader. */ void TestBuildQuadraticMeshFromVtkMeshReader(void) { #ifdef CHASTE_VTK VtkMeshReader<3,3> mesh_reader("mesh/test/data/heart_decimation.vtu"); TetrahedralMesh<3,3> tet_mesh; tet_mesh.ConstructFromMeshReader(mesh_reader); mesh_reader.Reset(); QuadraticMesh<3> quad_mesh; quad_mesh.ConstructFromLinearMeshReader(mesh_reader); // Check we have the right number of nodes & elements TS_ASSERT_EQUALS(tet_mesh.GetNumNodes(), 173u); TS_ASSERT_EQUALS(tet_mesh.GetNumElements(), 610u); TS_ASSERT_EQUALS(tet_mesh.GetNumBoundaryElements(), 312u); TS_ASSERT_EQUALS(tet_mesh.GetNumBoundaryNodes(), 158u); TS_ASSERT_EQUALS(quad_mesh.GetNumNodes(), 1110u); TS_ASSERT_EQUALS(quad_mesh.GetNumVertices(), 173u); TS_ASSERT_EQUALS(quad_mesh.GetNumElements(), 610u); TS_ASSERT_EQUALS(quad_mesh.GetNumBoundaryElements(), 312u); TS_ASSERT_EQUALS(quad_mesh.GetNumBoundaryNodes(), 626u); // Check some node co-ordinates TS_ASSERT_DELTA(tet_mesh.GetNode(0)->GetPoint()[0], 0.0963, 1e-4); TS_ASSERT_DELTA(tet_mesh.GetNode(0)->GetPoint()[1], 0.3593, 1e-4); TS_ASSERT_DELTA(tet_mesh.GetNode(0)->GetPoint()[2], 0.9925, 1e-4); TS_ASSERT_DELTA(tet_mesh.GetNode(8)->GetPoint()[0], 1.0969, 1e-4); TS_ASSERT_DELTA(tet_mesh.GetNode(8)->GetPoint()[1], 0.6678, 1e-4); TS_ASSERT_DELTA(tet_mesh.GetNode(8)->GetPoint()[2], 0.7250, 1e-4); TS_ASSERT_DELTA(quad_mesh.GetNode(0)->GetPoint()[0], 0.0963, 1e-4); TS_ASSERT_DELTA(quad_mesh.GetNode(0)->GetPoint()[1], 0.3593, 1e-4); TS_ASSERT_DELTA(quad_mesh.GetNode(0)->GetPoint()[2], 0.9925, 1e-4); TS_ASSERT_DELTA(quad_mesh.GetNode(8)->GetPoint()[0], 1.0969, 1e-4); TS_ASSERT_DELTA(quad_mesh.GetNode(8)->GetPoint()[1], 0.6678, 1e-4); TS_ASSERT_DELTA(quad_mesh.GetNode(8)->GetPoint()[2], 0.7250, 1e-4); //Use ordinary functionality - using the "wrong" method gives back a warning quad_mesh.Clear(); mesh_reader.Reset(); TS_ASSERT_EQUALS(quad_mesh.GetNumNodes(), 0u); TS_ASSERT_EQUALS(Warnings::Instance()->GetNumWarnings(), 0u); quad_mesh.ConstructFromMeshReader(mesh_reader); TS_ASSERT_EQUALS(Warnings::Instance()->GetNumWarnings(), 1u); TS_ASSERT_EQUALS(Warnings::Instance()->GetNextWarningMessage(),"Reading a (linear) tetrahedral mesh and converting it to a QuadraticMesh. This involves making an external library call to Triangle/Tetgen in order to compute internal nodes"); TS_ASSERT_EQUALS(quad_mesh.GetNumNodes(), 1110u); #else std::cout << "This test was not run, as VTK is not enabled." << std::endl; std::cout << "If required please install and alter your hostconfig settings to switch on chaste VTK support." << std::endl; #endif //CHASTE_VTK } void CalculateConnectivityMatrix(Mat& matrix, AbstractTetrahedralMesh<2,2>& rMesh) { PetscTools::SetupMat(matrix, rMesh.GetNumNodes(), rMesh.GetNumNodes(), 17); for (TetrahedralMesh<2,2>::ElementIterator iter = rMesh.GetElementIteratorBegin(); iter != rMesh.GetElementIteratorEnd(); ++iter) { for (unsigned i=0; i<iter->GetNumNodes(); i++) { unsigned global_index1 = iter->GetNodeGlobalIndex(i); for (unsigned j=i+1; j<iter->GetNumNodes(); j++) { unsigned global_index2 = iter->GetNodeGlobalIndex(j); PetscMatTools::SetElement(matrix, global_index1, global_index2, 1.0); PetscMatTools::SetElement(matrix, global_index2, global_index1, 1.0); } } } PetscMatTools::Finalise(matrix); } std::vector<unsigned> CalculateMatrixFill(AbstractTetrahedralMesh<2,2>& rMesh) { //Get some statistics about matrix fill Mat matrix; CalculateConnectivityMatrix(matrix, rMesh); std::vector<unsigned> upper_hist(rMesh.GetNumNodes(), 0.0); double error_sum = 0; PetscInt lo, hi; PetscMatTools::GetOwnershipRange(matrix, lo, hi); for (PetscInt row=lo; row<hi; row++) { PetscInt num_entries; const PetscInt* column_indices; const PetscScalar* values; MatGetRow(matrix, row, &num_entries, &column_indices, &values); for (PetscInt col=0; col<num_entries; col++) { if (column_indices[col] >= row) { error_sum += (column_indices[col] - row)*(column_indices[col] - row); upper_hist[ column_indices[col] - row]++; } } MatRestoreRow(matrix, row, &num_entries, &column_indices, &values); } PetscTools::Destroy(matrix); std::vector<unsigned> global_hist(rMesh.GetNumNodes()); MPI_Allreduce( &upper_hist[0], &global_hist[0], rMesh.GetNumNodes(), MPI_UNSIGNED, MPI_SUM, PETSC_COMM_WORLD); double global_error_sum = 0; MPI_Allreduce( &error_sum, &global_error_sum, 1, MPI_DOUBLE, MPI_SUM, PETSC_COMM_WORLD); return global_hist; } void TestElementsContainedByNodes3d() { QuadraticMesh<3> mesh; double h = 1.0; mesh.ConstructRegularSlabMesh(h, 2.0, 1.0, 1.0); for (unsigned node_index = 0; node_index<mesh.GetNumNodes(); node_index++) { std::set<unsigned> elements = mesh.GetNode(node_index)->rGetContainingElementIndices(); for (std::set<unsigned>::iterator iter = elements.begin(); iter != elements.end(); iter++) { Element<3,3>* p_element = mesh.GetElement(*iter); bool found_node = false; for (unsigned i=0; i<p_element->GetNumNodes(); i++) { unsigned this_node = p_element->GetNodeGlobalIndex(i); if (this_node == node_index) { found_node = true; } } TS_ASSERT(found_node); } std::set<unsigned> boundary_elements = mesh.GetNode(node_index)->rGetContainingBoundaryElementIndices(); for (std::set<unsigned>::iterator iter = boundary_elements.begin(); iter != boundary_elements.end(); iter++) { BoundaryElement<2,3>* p_element = mesh.GetBoundaryElement(*iter); bool found_node = false; for (unsigned i=0; i<p_element->GetNumNodes(); i++) { unsigned this_node = p_element->GetNodeGlobalIndex(i); if (this_node == node_index) { found_node = true; } } TS_ASSERT(found_node); } } } }; #endif // _TESTQUADRATICMESH_HPP_
#include <iostream> #include <QObject> #include <QString> using namespace std; #ifndef PERRO_H #define PERRO_H class Perro : public QObject{ Q_OBJECT public: explicit Perro(QObject* parent = 0); virtual ~Perro(); QString getNombre(); QString getRaza(); int getEdad(); public slots: void setNombre(QString nombre); void setRaza(QString raza); void setEdad(int edad); signals: void nombreChanged(QString nombre); void razaChanged(QString raza); void edadChanged(int edad); private: QString nombre; QString raza; int edad; }; #endif // PERRO_H
#include <iostream> using namespace std; int main() { char ch; cin >> ch; if ('a' <= ch && ch <= 'z') cout << (char)(ch - 'a' + 'A') << endl; else if ('A' <= ch && ch <= 'Z') cout << (char)(ch - 'A' + 'a') << endl; else cout << "none" << endl; }
#include "controlador.h" Controlador::Controlador(QObject *parent) : QObject(parent) { } bool Controlador::siHaVotado(QString cedula) { QFile usuario("Lista de Personas que ya votaron.csv"); QTextStream io; usuario.open(QIODevice::ReadOnly); io.setDevice(&usuario); while(!io.atEnd()) { auto linea = io.readLine(); if(linea == cedula) { return true; //Si ya ha votado } } return false; //No ha votado } bool Controlador::validarCedulaEC(QString cedula) { //Creamos una lista temporal QString temp[10]; int aux; int sumaPar = 0; int sumaImpar = 0; //Recogemos de la cedula los 9 primeros digitos for(int i = 0; i < 9; i++) { //A la lista temporal le vamos ingresando los valores de la cedula uno por uno temp[i] = cedula[i]; //Le damos el valor de la lista temporal, en posicion i, a la variable aux aux = temp[i].toInt(); //Si i + 1 es par if((i+1)%2==0) //Se aumenta a sumaPar sumaPar += aux; //Si no else { //Si al multiplicar el aux por 2 rebasa 9 if(aux * 2 > 9) //Aumentaremos a sumaImpar el aux multiplicado por 2 y restado 9 sumaImpar = sumaImpar + ((aux * 2) - 9); //Si no else //Se aumenta a sumaImpar sumaImpar += aux * 2; } } //Se obtiene el ultimo digito de la cedula int ultimoCedula = cedula.toInt()%10; //Obtenemos el módulo de la suma de los numeros pares e impares int verificador = (sumaPar + sumaImpar)%10; //Si verificador es diferente de cero if(verificador !=0) //De 10 se le resta el verificador verificador = 10 - verificador; return ultimoCedula == verificador? true : false; } QString Controlador::enviarNombre(QString cedula) { QFile usuario("Padron Electoral.csv"); QTextStream io; usuario.open(QIODevice::ReadOnly | QIODevice::Text); io.setDevice(&usuario); while(!io.atEnd()) { auto linea = io.readLine(); auto valores =linea.split(";"); for(int i = 0; i< valores.size(); i++) { if(valores.at(0) == cedula) { return valores.at(1); //Retornamos el nombre de la cedula registrada en el Padron Electoral.csv } else break; } } return "\0"; } void Controlador::guardarVotos(int arauz, int lasso, int nulo, int blanco) { QFile votos("Votos.csv"); QTextStream io; io.setDevice(&votos); votos.open(QIODevice::ReadWrite | QIODevice::Text); io << "Arauz;" << arauz << endl; io << "Lasso;" << lasso << endl; io << "Nulo;" << nulo << endl; io << "Blanco;" << blanco << endl; votos.close(); } void Controlador::cargarVotos(QStack<int> &arauz, QStack<int> &lasso, QStack<int> &nulo, QStack<int> &blanco) { //Crear un objeto QDir a partir del directorio del usuario QDir directorio = QDir::current(); //Agregar al path absoluto del objeto un nombre por defecto del archivo QString pathArchivo = directorio.absolutePath() + "/Votos.csv"; QFile votos(pathArchivo); QTextStream io; io.setDevice(&votos); votos.open(QIODevice::ReadWrite | QIODevice::Text); if(!votos.isOpen()) { QMessageBox::information(0, tr("Aviso"), tr("Error de Apertura")); } io.setDevice(&votos); while(!io.atEnd()) { auto linea = io.readLine(); auto valores =linea.split(";"); int numeroColumnas = valores.size(); for(int i = 0; i< numeroColumnas; i++) { if(valores.at(0) == "Arauz") { arauz.resize(valores.at(1).toInt()); } else if(valores.at(0) == "Lasso") { lasso.resize(valores.at(1).toInt()); } else if(valores.at(0) == "Nulo") { nulo.resize(valores.at(1).toInt()); } else blanco.resize(valores.at(1).toInt()); } } } void Controlador::guardarCedulas(QString cedula) { QFile usuario("Lista de Personas que ya votaron.csv"); QTextStream io; usuario.open(QIODevice::WriteOnly | QIODevice::Append); io.setDevice(&usuario); io << cedula << endl; usuario.close(); } void Controlador::crearArchivos() { //Se verifica si se tiene los archivos necesarios para que funcione el programa QTextStream io; //Comprueba si no existe la carpeta certificados para crearla if(!QDir("Certificados").exists()) QDir().mkdir("Certificados"); //Comprueba si no existe los archivos para crearlos if(!QFile("Fecha.csv").exists()) { QFile fecha("Fecha.csv"); fecha.open(QIODevice::ReadWrite | QIODevice::Text); io.setDevice(&fecha); io << "Fecha;Hora Inicio;Hora Final" << endl; io << QDate::currentDate().toString("dd/MM/yyyy") << ";7:00;23:00"; fecha.close(); } if(!QFile("Votos.csv").exists()) { QFile votos("Votos.csv"); io.setDevice(&votos); votos.open(QIODevice::ReadWrite | QIODevice::Text); io << "Arauz;0" << endl; io << "Lasso;0" << endl; io << "Nulo;0" << endl; io << "Blanco;0" << endl; votos.close(); } if(!QFile("Padron Electoral.csv").exists()) { QFile Padron("Padron Electoral.csv"); io.setDevice(&Padron); Padron.open(QIODevice::ReadWrite | QIODevice::Text); io << "Cedula;Nombre"; Padron.close(); } if(!QFile("Lista de Personas que ya votaron.csv").exists()) { QFile Lista("Lista de Personas que ya votaron.csv"); Lista.open(QIODevice::ReadWrite | QIODevice::Text); Lista.close(); } } bool Controlador::padron(QString cedula) { QFile usuario("Padron Electoral.csv"); QTextStream io; usuario.open(QIODevice::ReadOnly | QIODevice::Text); io.setDevice(&usuario); while(!io.atEnd()) { auto linea = io.readLine(); auto valores =linea.split(";"); int numeroColumnas = valores.size(); for(int i = 0; i< numeroColumnas; i++) { if(valores.at(0) == cedula) { return true; //Si pertenece al Padron Electoral.csv } else break; } } return false; //No pertenece al Padron Electoral.csv }
// // hwCamera.cpp // HamsterWheel // // Created by OilyFing3r on 2014. 9. 2.. // Copyright (c) 2014년 OilyFing3rWorks. All rights reserved. // #include "hwCamera.h" void Camera::lookAt() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(fovy, aspect, zNear, zFar); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(eye.x, eye.y, eye.z, center.x, center.y, center.z, up.x, up.y, up.z); }
#include "omega.h" #include "TH1D.h" #include "plot/root_draw.h" #include "utils/combinatorics.h" #include <string> #include <iostream> #include "TH3.h" #include "base/Logger.h" #include <algorithm> #include <iostream> #include "base/std_ext/math.h" #include "TTree.h" #include "base/std_ext/iterators.h" #include "base/ParticleTypeTree.h" #include "utils/particle_tools.h" #include "utils/matcher.h" #include "APLCON.hpp" #include "expconfig/ExpConfig.h" #include "base/WrapTFile.h" #include "TCanvas.h" #include <cassert> #include "utils/matcher.h" #include "root-addons/analysis_codes/hstack.h" using namespace std; using namespace ant; using namespace ant::analysis; using namespace ant::analysis::physics; using namespace ant::std_ext; void OmegaBase::ProcessEvent(const TEvent& event, manager_t& manager) { const auto& data = mode==DataMode::Reconstructed ? event.Reconstructed() : event.MCTrue(); Analyse(data, event, manager); } double OmegaBase::calcEnergySum(const TParticleList &particles) const { double esum = 0.0; for( const TParticlePtr& p : particles) { if( geo.DetectorFromAngles(p->Theta(), p->Phi()) == Detector_t::Type_t::CB ) { esum += p->Ek(); } } return esum; } TParticleList OmegaBase::getGeoAccepted(const TParticleList &p) const { TParticleList list; for( auto& particle : p) { if( geo.DetectorFromAngles(particle->Theta(), particle->Phi()) != Detector_t::Any_t::None ) list.emplace_back(particle); } return list; } unsigned OmegaBase::geoAccepted(const TCandidateList& cands) const { unsigned n = 0; for( auto& c : cands) { if( geo.DetectorFromAngles(c.Theta, c.Phi) != Detector_t::Any_t::None ) ++n; } return n; } OmegaBase::OmegaBase(const string &name, OptionsPtr opts): Physics(name, opts), mode(DataMode::Reconstructed) { } void OmegaBase::Finish() { } void OmegaBase::ShowResult() { } string to_string(const OmegaBase::DataMode &m) { if(m == OmegaBase::DataMode::MCTrue) { return "MCTrue"; } else { return "Reconstructed"; } } OmegaMCTruePlots::PerChannel_t::PerChannel_t(const string& Title, HistogramFactory& hf): title(Title) { proton_E_theta = hf.makeTH2D(title,"E [MeV]","#theta [#circ]",BinSettings(1000),BinSettings(360,0,180), title+"_e_theta"); } void OmegaMCTruePlots::PerChannel_t::Show() { canvas("Omega per Channel: "+title) << drawoption("colz") << proton_E_theta << endc; } void OmegaMCTruePlots::PerChannel_t::Fill(const TEventData& d) { const auto& protons = d.Particles.Get(ParticleTypeDatabase::Proton); if(!protons.empty()) { const auto& p = protons.at(0); proton_E_theta->Fill(p->Ek(), p->Theta()*TMath::RadToDeg()); } } OmegaMCTruePlots::OmegaMCTruePlots(const std::string& name, OptionsPtr opts): Physics(name, opts) { } void OmegaMCTruePlots::ProcessEvent(const TEvent& event, manager_t&) { const auto& decaystring =utils::ParticleTools::GetProductionChannelString(event.MCTrue().ParticleTree); auto e = channels.find(decaystring); if(e == channels.end()) { channels.insert({decaystring, PerChannel_t(decaystring,HistFac)}); } e = channels.find(decaystring); e->second.Fill(event.MCTrue()); } void OmegaMCTruePlots::Finish() { } void OmegaMCTruePlots::ShowResult() { canvas c("OmegaMCTrue p E Theta"); c << drawoption("colz"); list<TH2D*> hists; for(auto& entry : channels) { hists.push_back(entry.second.proton_E_theta); } hists.sort([](const TH2D* a, const TH2D* b) {return a->GetEntries() > b->GetEntries();}); int i=0; for(auto& h : hists) { c << h; i++; if(i>=9) break; } c << endc; } LorentzVec OmegaMCTree::getGamma1() const { return gamma1_vector; } void OmegaMCTree::setGamma1(const LorentzVec& value) { gamma1_vector = value; } OmegaMCTree::OmegaMCTree(const std::string& name, OptionsPtr opts): Physics(name, opts) { tree=new TTree("omegatree","omgega eta gamma MC true"); tree->Branch("p", &proton_vector); tree->Branch("omega", &omega_vector); tree->Branch("gamma1", &gamma1_vector); tree->Branch("eta", &eta_vector); tree->Branch("gamma2", &gamma2_vector); tree->Branch("gamma3", &gamma3_vector); } OmegaMCTree::~OmegaMCTree() { } void OmegaMCTree::ProcessEvent(const TEvent& event, manager_t&) { if(!event.MCTrue().ParticleTree) return; struct TreeItem_t { const ParticleTypeDatabase::Type& Type; TLorentzVector* LorentzVector; TreeItem_t(const ParticleTypeDatabase::Type& type, TLorentzVector* lv ) : Type(type), LorentzVector(lv) {} // this operator makes Tree::Sort work bool operator<(const TreeItem_t& rhs) const { return Type.Name() < rhs.Type.Name(); } }; auto signal_tree = Tree<TreeItem_t>::MakeNode(ParticleTypeDatabase::BeamProton, (TLorentzVector*) nullptr); signal_tree->CreateDaughter(ParticleTypeDatabase::Proton, &proton_vector); auto omega = signal_tree->CreateDaughter(ParticleTypeDatabase::Omega, &omega_vector); omega->CreateDaughter(ParticleTypeDatabase::Photon, &gamma1_vector); auto eta = omega->CreateDaughter(ParticleTypeDatabase::Eta, &eta_vector); eta->CreateDaughter(ParticleTypeDatabase::Photon, &gamma2_vector); eta->CreateDaughter(ParticleTypeDatabase::Photon, &gamma3_vector); signal_tree->Sort(); auto comparer = [] (const TParticlePtr& p, const TreeItem_t& item) { if(p->Type().Name() == item.Type.Name()) { if(item.LorentzVector) *item.LorentzVector = *p; return true; } return false; }; if(event.MCTrue().ParticleTree->IsEqual(signal_tree, comparer)) tree->Fill(); } void OmegaMCTree::ShowResult() { } template <typename it_type> LorentzVec LVSum(it_type begin, it_type end) { LorentzVec v; while(begin!=end) { v += **begin; ++begin; } return v; } template <typename it_type> LorentzVec LVSumL(it_type begin, it_type end) { LorentzVec v; while(begin!=end) { v += *begin; ++begin; } return v; } #define FASSERT(x) if(!(x)) LOG(ERROR) << "ERROR"; double IM(const TParticlePtr& p1, const TParticlePtr& p2) { return (*p1+*p2).M(); } double getTime(const TParticlePtr& p) { return p->Candidate != nullptr ? p->Candidate->Time : std_ext::NaN; } void OmegaEtaG2::Analyse(const TEventData &data, const TEvent& event, manager_t& manager) { const unsigned nphotons = opt_discard_one ? 4 : 3; const unsigned nCandsMin = nphotons + 1; const unsigned nCandsMax = nCandsMin + 2; if(data.Candidates.size() < nCandsMin || data.Candidates.size() > nCandsMax) return; t.nCandsInput = data.Candidates.size(); TCandidatePtrList cands(data.Candidates.size()); copy(data.Candidates.get_iter().begin(), data.Candidates.get_iter().end(), cands.begin()); sort(cands.begin(), cands.end(), [] (const TCandidatePtr& a, const TCandidatePtr& b) { return a->CaloEnergy > b->CaloEnergy; }); t.CandsUsedE = 0.0; t.CandsunUsedE = 0.0; for(size_t i=0; i<cands.size(); ++i) { if(i<nCandsMin) t.CandsUsedE += cands.at(i)->CaloEnergy; else t.CandsunUsedE += cands.at(i)->CaloEnergy; } cands.resize(nCandsMin); t.Channel = reaction_channels.identify(event.MCTrue().ParticleTree); if(t.Channel == ReactionChannelList_t::other_index) { if(event.MCTrue().ParticleTree!=nullptr) { missed_channels->Fill(utils::ParticleTools::GetDecayString(event.MCTrue().ParticleTree).c_str(), 1.0); } } else { found_channels->Fill(t.Channel); } TH1* steps = stephists.at(t.Channel); steps->Fill("0 Events seen", 1); const auto Esum = data.Trigger.CBEnergySum; if(Esum < cut_ESum) return; steps->Fill("1 CBEsum", 1); TParticleList iphotons; TParticleList iprotons; for(auto p: cands) { if(p->VetoEnergy < .25) { iphotons.emplace_back(make_shared<TParticle>(ParticleTypeDatabase::Photon, p)); } else { iprotons.emplace_back(make_shared<TParticle>(ParticleTypeDatabase::Proton, p)); } } const bool okbefore = (iphotons.size() == nphotons) && (iprotons.size() == 1); const TParticleList protons = FilterProtons(getGeoAccepted(iprotons)); if(protons.size() != 1) return; const TParticleList photons = FilterPhotons(getGeoAccepted(iphotons)); if(photons.size() != nphotons) return; steps->Fill("2 nCands", 1); // event is "clean" if no clusters got rejected t.nCandsClean = okbefore; TParticleList ph; ph.reserve(3); for(auto cobms = utils::makeCombination(photons, 3); !cobms.Done(); ++cobms) { ph.clear(); for(const auto& x : cobms) { ph.emplace_back(x); } AnalyseMain(ph, protons.at(0), data, event, manager); } } void OmegaEtaG2::AnalyseMain(const TParticleList& photons, const TParticlePtr& proton, const TEventData& data, const TEvent& event, manager_t& manager) { TH1* steps = stephists.at(t.Channel); steps->Fill("3 nPhotons nProtons", 1); t.photons().at(0) = *photons.at(0); t.photons().at(1) = *photons.at(1); t.photons().at(2) = *photons.at(2); t.p = *proton; t.p_Time = getTime(proton); t.p_detector = 0; t.p_vetoE = proton->Candidate->VetoEnergy; if(proton->Candidate) { if(proton->Candidate->Detector & Detector_t::Type_t::TAPS) { t.p_detector = 2; const auto& cluster = proton->Candidate->FindCaloCluster(); if(cluster) { t.p_shortE = cluster->ShortEnergy; } } else if(proton->Candidate->Detector & Detector_t::Type_t::CB) { t.p_detector = 1; } } const TParticle ggg(ParticleTypeDatabase::Omega, LVSum(photons.begin(), photons.end())); t.ggg = ggg; const auto gggBoost = -ggg.BoostVector(); t.copl_angle = fabs(vec2::Phi_mpi_pi(proton->Phi() - ggg.Phi() - M_PI)); if(t.copl_angle > cut_Copl) return; steps->Fill("4 Coplanarity", 1); t.CBAvgTime = event.Reconstructed().Trigger.CBTiming; if(!isfinite(t.CBAvgTime)) return; steps->Fill("5 valid CB Avg Time", 1); if(data.TaggerHits.size() > 0) steps->Fill("6 has TaggHits", 1); tagChMult.Fill(data.TaggerHits); for(const TTaggerHit& TagH : data.TaggerHits) { promptrandom.SetTaggerHit(TagH.Time - t.CBAvgTime); if(promptrandom.State() == PromptRandom::Case::Outside) continue; t.TaggW = promptrandom.FillWeight(); t.TaggE = TagH.PhotonEnergy; t.TaggCh = TagH.Channel; t.TaggT = TagH.Time; const LorentzVec beam_target = TagH.GetPhotonBeam() + LorentzVec(0, 0, 0, ParticleTypeDatabase::Proton.Mass()); // make global const TParticle missing(ParticleTypeDatabase::Proton, beam_target - ggg); t.mm = missing; t.p_mm_angle = radian_to_degree(missing.Angle(*proton)); // KinFit { fitter.SetEgammaBeam(TagH.PhotonEnergy); fitter.SetProton(proton); fitter.SetPhotons(photons); auto fitres = fitter.DoFit(); if(fitres.Status != APLCON::Result_Status_t::Success) continue; t.KinFitChi2 = fitres.ChiSquare / fitres.NDoF; t.KinFitProb = fitres.Probability; t.KinFitIterations = unsigned(fitres.NIterations); if(t.KinFitChi2 > opt_kinfit_chi2cut) continue; if(opt_save_after_kinfit) manager.SaveEvent(); t.p_fitted = *fitter.GetFittedProton(); t.photons_fitted().at(0) = *fitter.GetFittedPhotons().at(0); t.photons_fitted().at(1) = *fitter.GetFittedPhotons().at(1); t.photons_fitted().at(2) = *fitter.GetFittedPhotons().at(2); } const TParticle ggg_fitted(ParticleTypeDatabase::Omega, LVSumL(t.photons_fitted().begin(), t.photons_fitted().end())); t.ggg_fitted = ggg_fitted; const auto gggBoost_fitted = -ggg_fitted.BoostVector(); // pi0eta test { // proton: E from Fit, Theta and Phi from measurement // TParticle ctor takes Ek, fitted.E() is total E TParticlePtr proton_guess = make_shared<TParticle>( ParticleTypeDatabase::Proton, t.p_fitted().E()-ParticleTypeDatabase::Proton.Mass(), proton->Theta(), proton->Phi()); const LorentzVec lost_gamma_guess = beam_target - ggg - *proton_guess; pi0eta_fitter.SetEgammaBeam(TagH.PhotonEnergy); // since proton E is unmeasured it makes no difference if // fitted energy is filled in here pi0eta_fitter.SetProton(proton); //photons 0..2, measured for(TParticleList::size_type i=0; i<photons.size(); ++i) { pi0eta_fitter.SetPhoton(i, photons.at(i)); } // unmeasured photon auto g4p = pi0eta_fitter.FitPhotons(3); g4p.Ek.Value = lost_gamma_guess.E; g4p.Ek.Sigma = 0.0; g4p.Theta.Value = lost_gamma_guess.Theta(); g4p.Theta.Sigma = 0.0; g4p.Phi.Value = lost_gamma_guess.Phi(); g4p.Phi.Sigma = 0.0; // execute! const auto fitres = pi0eta_fitter.DoFit(); t.Pi0EtaFitChi2 = fitres.ChiSquare / fitres.NDoF; t.Pi0EtaFitProb = fitres.Probability; t.Pi0EtaFitIterations = unsigned(fitres.NIterations); t.lost_gamma_guess = lost_gamma_guess; t.extra_gamma = LorentzVec::EPThetaPhi(g4p.Ek.Value, g4p.Ek.Value, g4p.Theta.Value, g4p.Phi.Value); } for(const auto& comb : combs) { const auto& g1 = photons.at(comb[0]); const auto& g2 = photons.at(comb[1]); const auto& g3 = photons.at(comb[2]); const auto& combindex = comb[2]; const auto gg = *g1 + *g2; t.ggIM().at(combindex) = gg.M(); const auto g3_boosted = Boost(*g3, gggBoost); t.BachelorE().at(combindex) = g3_boosted.E; } for(const auto& comb : combs) { const auto& g1 = t.photons_fitted().at(comb[0]); const auto& g2 = t.photons_fitted().at(comb[1]); const auto& g3 = t.photons_fitted().at(comb[2]); const auto& combindex = comb[2]; const auto gg = g1 + g2; t.ggIM_fitted().at(combindex) = gg.M(); const auto g3_boosted = Boost(g3, gggBoost_fitted); t.BachelorE_fitted().at(combindex) = g3_boosted.E; t.bachelor_extra().at(combindex) = t.extra_gamma() + g3; } //===== Hypothesis testing with kinematic fitter ====== { // Kin fit: test pi0 hypothesis fitter_pi0.treefitter.SetEgammaBeam(TagH.PhotonEnergy); fitter_pi0.treefitter.SetPhotons(photons); fitter_pi0.treefitter.SetProton(proton); fitter_pi0.HypTestCombis(photons, t.pi0chi2, t.pi0prob, t.pi0_im, t.pi0_omega_im, t.iBestPi0); // Kin fit: test eta hypothesis fitter_eta.treefitter.SetEgammaBeam(TagH.PhotonEnergy); fitter_eta.treefitter.SetPhotons(photons); fitter_eta.treefitter.SetProton(proton); fitter_eta.HypTestCombis(photons, t.etachi2, t.etaprob, t.eta_im, t.eta_omega_im, t.iBestEta); // find most probable hypothesis t.bestHyp = 0; // both fits failed if(t.iBestEta == -1 && t.iBestPi0 == -1) continue; // Pi0 fits failed, but at least one eta fit worked -> eta wins if(t.iBestPi0 == -1) t.bestHyp = 2; // Eta // Eta fits failed, but at least one pi0 fit worked -> pi0 wins else if(t.iBestEta == -1) { t.bestHyp = 1; // Pi0 } // both hypotheses have valid fit results: select lower chi2 else if(t.pi0chi2().at(t.iBestPi0) < t.etachi2().at(t.iBestEta)) { t.bestHyp = 1; // PI0 } else { t.bestHyp = 2; // ETA } if(opt_save_afteretaHyp && t.bestHyp == 2 && t.etaprob().at(t.iBestEta) > 0.03 && (t.iBestPi0 ==-1 || t.pi0prob().at(t.iBestPi0) < 0.03)) manager.SaveEvent(); } TParticleList rec_photons(3); TParticlePtr rec_proton = nullptr; TParticleList true_particles(4); t.ggIM_real = NaN; t.ggIM_comb = {NaN, NaN}; const auto& particletree = event.MCTrue().ParticleTree; if(particletree && (t.Channel == 1 || t.Channel == 2)) { particletree->Map_level([&true_particles] (const TParticlePtr& p, const size_t& level) { if(level == 1) { if(p->Type() == ParticleTypeDatabase::Proton) { FASSERT(true_particles[3] == nullptr); true_particles[3] = p; } } if(p->Type() == ParticleTypeDatabase::Photon) { if(level==2) { FASSERT(true_particles[0]==nullptr); true_particles[0] = p; } else if(level == 3) { if(!true_particles[1]) { true_particles[1] = p; } else { FASSERT(true_particles[2]==nullptr); true_particles[2] = p; } } } }); FASSERT(true_particles[0]!=nullptr); FASSERT(true_particles[1]!=nullptr); FASSERT(true_particles[2]!=nullptr); FASSERT(true_particles[3]!=nullptr); t.p_true = *true_particles[3]; const auto matched = utils::match1to1(true_particles, data.Particles.GetAll(), TParticle::CalcAngle, {0.0, degree_to_radian(15.0)}); if(matched.size() == true_particles.size()) { rec_photons[0] = utils::FindMatched(matched, true_particles[0]); rec_photons[1] = utils::FindMatched(matched, true_particles[1]); rec_photons[2] = utils::FindMatched(matched, true_particles[2]); rec_proton = utils::FindMatched(matched, true_particles[3]); FASSERT(rec_photons[0]!=nullptr); FASSERT(rec_photons[1]!=nullptr); FASSERT(rec_photons[2]!=nullptr); FASSERT(rec_proton !=nullptr); t.p_matched = (rec_proton->Type() == ParticleTypeDatabase::Proton); t.ggIM_real = IM(rec_photons[1], rec_photons[2]); t.ggIM_comb()[0] = IM(rec_photons[0], rec_photons[1]); t.ggIM_comb()[1] = IM(rec_photons[0], rec_photons[2]); } } tree->Fill(); } } size_t OmegaEtaG2::CombIndex(const TParticleList& orig, const MyTreeFitter_t& f) { for(size_t i=0; i<orig.size(); ++i) { if(orig[i] == f.fitted_g_Omega->Get().Leave->Particle) { return i; } } throw std::runtime_error("CombIndex: Photon not found"); } OmegaEtaG2::ReactionChannelList_t OmegaEtaG2::makeChannels() { ReactionChannelList_t m; m.channels[0] = ReactionChannel_t("Data"); m.channels[1] = {ParticleTypeTreeDatabase::Get(ParticleTypeTreeDatabase::Channel::Omega_gEta_3g), kRed}; //sig m.channels[2] = {ParticleTypeTreeDatabase::Get(ParticleTypeTreeDatabase::Channel::Omega_gPi0_3g), kGreen}; //ref m.channels[3] = ReactionChannel_t("Sum MC"); m.channels[4] = ReactionChannel_t("MC BackG"); m.channels[10] = {ParticleTypeTreeDatabase::Get(ParticleTypeTreeDatabase::Channel::Pi0_2g), "#pi^{0}", kYellow}; m.channels[11] = {ParticleTypeTreeDatabase::Get(ParticleTypeTreeDatabase::Channel::TwoPi0_4g), "#pi^{0} #pi^{0}", kOrange}; m.channels[12] = {ParticleTypeTreeDatabase::Get(ParticleTypeTreeDatabase::Channel::ThreePi0_6g), "#pi^{0} #pi^{0} #pi^{0}",kGreen-9}; m.channels[13] = {ParticleTypeTreeDatabase::Get(ParticleTypeTreeDatabase::Channel::Pi0Eta_4g), "#pi^{0} #eta",kBlue}; m.channels[14] = {ParticleTypeTreeDatabase::Get(ParticleTypeTreeDatabase::Channel::Omega_Pi0PiPPiM_2g),"#omega #rightarrow #pi^{0} #pi^{+} #pi^{-}",kMagenta}; m.channels[m.other_index] = ReactionChannel_t(nullptr, "Others", kCyan); return m; } bool OmegaEtaG2::AcceptedPhoton(const TParticlePtr& photon) { if(photon->Candidate->Detector & Detector_t::Type_t::CB) { if(photon_E_cb.Contains(photon->Ek())) { return true; } } else if(photon->Candidate->Detector & Detector_t::Type_t::TAPS) { if(photon_E_taps.Contains(photon->Ek())) { return true; } } return false; } bool OmegaEtaG2::AcceptedProton(const TParticlePtr& proton) { if(proton_theta.Contains(proton->Theta())){ return true; } return false; } TParticleList OmegaEtaG2::FilterPhotons(const TParticleList& list) { TParticleList olist; for(const auto& p : list) { if(AcceptedPhoton(p)) { olist.emplace_back(p); } } return olist; } TParticleList OmegaEtaG2::FilterProtons(const TParticleList& list) { TParticleList olist; for(const auto& p : list) { if(AcceptedProton(p)) { olist.emplace_back(p); } } return olist; } OmegaEtaG2::OmegaEtaG2(const std::string& name, OptionsPtr opts): OmegaBase(name, opts), tree(HistFac.makeTTree("tree")), cut_ESum(opts->Get<double>("CBESum", 550.0)), cut_Copl(degree_to_radian(opts->Get<double>("CoplAngle", 15.0))), photon_E_cb(opts->Get<decltype(photon_E_cb)>("PhotonECB", {50.0, 1600.0})), photon_E_taps(opts->Get<decltype(photon_E_taps)>("PhotonETAPS", {200.0, 1600.0})), proton_theta(degree_to_radian(opts->Get<decltype(proton_theta)>("ProtonThetaRange", {2.0, 45.0}))), model(make_shared<utils::UncertaintyModels::Optimized_Oli1>()), fitter("OmegaEtaG2", 3, model), pi0eta_fitter("OmegaEtaG2_pi0eta", 4, model), fitter_pi0( ParticleTypeTreeDatabase::Get(ParticleTypeTreeDatabase::Channel::Omega_gPi0_3g), ParticleTypeDatabase::Pi0, model ), fitter_eta( ParticleTypeTreeDatabase::Get(ParticleTypeTreeDatabase::Channel::Omega_gEta_3g), ParticleTypeDatabase::Eta, model ), opt_save_after_kinfit(opts->Get("SaveAfterKinfit", false)), opt_kinfit_chi2cut(opts->Get<double>("KinFit_Chi2Cut", 10.0)), opt_discard_one(opts->Get("Use4Discard1", false)), opt_save_afteretaHyp(opts->Get("SaveAfterEtaHyp", false)), tagChMult(HistFac) { promptrandom.AddPromptRange({-5,5}); promptrandom.AddRandomRange({-20, -10}); promptrandom.AddRandomRange({ 10, 20}); t.CreateBranches(tree); missed_channels = HistFac.makeTH1D("Unlisted Channels","","Total Events seen",BinSettings(20),"unlistedChannels"); found_channels = HistFac.makeTH1D("Listed Channels", "","Total Events seen",BinSettings(20),"listedChannels"); for(const auto& c : reaction_channels.channels) { stephists[c.first] = HistFac.makeTH1D("Steps: " + c.second.name, "", "", BinSettings(14), "steps_" + to_string(c.first)); stephists[c.first]->SetLineColor(c.second.color); if(c.first<20) found_channels->GetXaxis()->SetBinLabel(c.first+1,c.second.name.c_str()); } fitter.SetupBranches(t.Tree); pi0eta_fitter.SetupBranches(t.Tree); } OmegaEtaG2::~OmegaEtaG2() { } void OmegaEtaG2::Finish() { hstack* s = HistFac.make<hstack>("steps"); for(auto& c : stephists) { (*s) << c.second; } } OmegaEtaG2::OmegaTree_t::OmegaTree_t() {} decltype(OmegaEtaG2::combs) OmegaEtaG2::combs = {{0,1,2},{0,2,1},{1,2,0}}; OmegaEtaG2::ReactionChannel_t::ReactionChannel_t(const std::shared_ptr<OmegaEtaG2::decaytree_t> &t, const string &n, const int c): name(n), tree(t), color(c) { } OmegaEtaG2::ReactionChannel_t::ReactionChannel_t(const std::shared_ptr<OmegaEtaG2::decaytree_t> &t, const int c): name(utils::ParticleTools::GetDecayString(t)), tree(t), color(c) {} OmegaEtaG2::ReactionChannel_t::ReactionChannel_t(const string &n): name(n) {} OmegaEtaG2::ReactionChannel_t::~ReactionChannel_t() {} unsigned OmegaEtaG2::ReactionChannelList_t::identify(const ant::TParticleTree_t& tree) const { if(!tree) return 0; for(const auto& c : channels) { if(!c.second.tree) continue; if(tree->IsEqual(c.second.tree, utils::ParticleTools::MatchByParticleName)) { return c.first; } } return other_index; } const OmegaEtaG2::ReactionChannelList_t OmegaEtaG2::reaction_channels = OmegaEtaG2::makeChannels(); const unsigned OmegaEtaG2::ReactionChannelList_t::other_index = 1000; OmegaEtaG2::MyTreeFitter_t::MyTreeFitter_t(const ParticleTypeTree& ttree, const ParticleTypeDatabase::Type& mesonT, utils::UncertaintyModelPtr model): treefitter( "treefit_"+mesonT.Name(), ttree, model, [] (const ParticleTypeTree& t) { return utils::TreeFitter::nodesetup_t(1.0, (t->Get() == ParticleTypeDatabase::Omega)); } ) { auto find_daughter = [] (utils::TreeFitter::tree_t& node, const ParticleTypeDatabase::Type& type) { for(const auto& d : node->Daughters()) { if(d->Get().TypeTree->Get() == type) return d; } return utils::TreeFitter::tree_t(nullptr); }; fitted_Omega = treefitter.GetTreeNode(ParticleTypeDatabase::Omega); fitted_g_Omega = find_daughter(fitted_Omega, ParticleTypeDatabase::Photon); fitted_X = find_daughter(fitted_Omega, mesonT); fitted_g1_X = fitted_X->Daughters().front(); fitted_g2_X = fitted_X->Daughters().back(); if(!fitted_Omega || !fitted_g_Omega || !fitted_X || !fitted_g1_X ||!fitted_g1_X ||!fitted_g2_X) throw std::runtime_error("Error initializing OmegaEtaG2::MyTreeFitter_t"); } void OmegaEtaG2::MyTreeFitter_t::HypTestCombis(const TParticleList& photons, doubles& chi2s, doubles& probs, doubles& ggims, doubles& gggims, int& bestIndex) { APLCON::Result_t treefitres; bestIndex = -1; chi2s = { inf, inf , inf}; probs = {-inf, -inf , -inf}; double bestChi2 = inf; while(treefitter.NextFit(treefitres)) { const auto chi2 = treefitres.Status == APLCON::Result_Status_t::Success ? treefitres.ChiSquare : NaN; const auto prob = treefitres.Status == APLCON::Result_Status_t::Success ? treefitres.Probability : NaN; const auto combindex = CombIndex(photons, *this); chi2s.at(combindex) = chi2; probs.at(combindex) = prob; ggims.at(combindex) = fitted_X->Get().LVSum.M(); gggims.at(combindex) = fitted_Omega->Get().LVSum.M(); if( isfinite(chi2) && chi2 < bestChi2 ) { bestIndex = int(combindex); bestChi2 = chi2; } } } TagChMultiplicity::TagChMultiplicity(HistogramFactory& hf) { const auto tagger = ExpConfig::Setup::GetDetector<TaggerDetector_t>(); nchannels = tagger->GetNChannels(); hTagChMult = hf.makeTH1D("Tagger Channel Multiplicity","# hits/event","",BinSettings(10),"tagchmult"); } void TagChMultiplicity::Fill(const std::vector<TTaggerHit>& t) { vector<double> counts(nchannels, 0); for(const auto& thit : t) { counts.at(thit.Channel)++; } for(const auto& m : counts) { hTagChMult->Fill(m); } } AUTO_REGISTER_PHYSICS(OmegaMCTruePlots) AUTO_REGISTER_PHYSICS(OmegaMCTree) AUTO_REGISTER_PHYSICS(OmegaEtaG2)
// The best solution I have found. We do not need a vector to store the '1' in each bit of 32. // Pay attention to the operation of & and |. class Solution { public: int singleNumber(vector<int>& nums) { int res = 0; for(int i = 0; i < 32; i++) { int sum = 0; for(int j = 0; j < nums.size(); j++) { if(nums[j]>>i & 1 == 1) sum++; } sum = sum % 3; if(sum != 0) res = res | sum << i; } return res; } };
#include<opencv2\opencv.hpp> #include"opencv2\highgui\highgui.hpp" #include<iostream> #include<string> using namespace std; using namespace cv; int H_MIN=0; int H_MAX=256; int S_MIN=0; int S_MAX=256; int V_MIN=0; int V_MAX=256; int x,a; int y,n; Mat img_rgb,img_thresh,img_hsv,drawing,output; char* window_name= "Threshold_demo"; char* window_name1 = "Thresholded image"; char* trackbar_hmin= "H_MIN"; char* trackbar_hmax= "H_MAX"; char* trackbar_smin= "S_MIN"; char* trackbar_smax= "S_MAX"; char* trackbar_vmin= "V_MIN"; char* trackbar_vmax= "V_MAX"; void Threshold_Demo(int, void*); void MorphOps(Mat & thresh) { Mat erodeElement = getStructuringElement(MORPH_RECT,Size(3,3)); Mat dilateElement = getStructuringElement(MORPH_RECT,Size(15,15)); erode(thresh,thresh,erodeElement); erode(thresh,thresh,erodeElement); dilate(thresh,thresh,dilateElement); dilate(thresh,img_thresh,dilateElement); } int main(int argc,char *argv[]) { cout<<"\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; cout<<"\t\t AERIAL VIEW OF GOOGLE 2D IMAGE\n"; cout<<"\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; cout<<"\n\n"; cout<<" ...............................\n"; cout<<" Image Content \n "; cout<<" ...............................\n"; cout<<" \t(1)Source Images\n\n \t(2)HSV Image\n\n \t(3)Threshold Demo\n\n \t(4)Thresholded Image\n\n \t(5)Output Image\n\n"; while(true) { cout<<" -------------------------\n"; cout<<" Selection Area \n "; cout<<"-------------------------\n"; cout<<" (1)top rotated image\n (2)side rotated image\n (3)bottom rotated image\n"; cout<<"\nselect one from the above: "; cin>>a; int c; if(a==1) { img_rgb = imread("Capture.PNG"); } else if(a==2) { img_rgb = imread("Capture_ROTATE1.PNG"); } else if(a==3) { img_rgb = imread("Capture_Rotate_a.PNG"); } else { cout<<"sorry you have entered an invalid number."; } if(a>3||a<1) { return -1; } cout<<"\n --------------------------------------\n"; cout<<" Selection of thresholded image \n "; cout<<"--------------------------------------\n"; cout<<" (1)Tennis Cort\n (2)Pool\n (3)Building complex\n"; cout<<"\nselect one from the above: "; cin>>x; if(x>3) { cout<<"sorry you have entered an invalid number."; } if(x>3||x<1) { return -1; } cout<<"\n --------------------------------------\n"; cout<<" New selection \n "; cout<<"--------------------------------------\n"; cout<<" 1.click on the output image\n 2.press enter for the user\n 3.go through derections\n"; cout<<"\n\t\tSee Our Creations\n"; cout<<"\n\t\t****************************************\n"; cout<<"\t\t Thank you \n"; cout<<"\n\t\t****************************************\n"; //namedWindow("source image",WINDOW_AUTOSIZE); //imshow("source image",img_rgb); namedWindow( "Output", CV_WINDOW_AUTOSIZE ); drawing = imread("Contours.PNG"); if (img_rgb.channels()>1) { cvtColor(img_rgb,img_hsv,CV_RGB2HSV); blur(img_hsv,img_hsv,Size(10,10)); } // namedWindow("hsv image",WINDOW_AUTOSIZE); //imshow("hsv image",img_hsv); //namedWindow(window_name, 0); createTrackbar(trackbar_hmin,window_name,&H_MIN,H_MAX,Threshold_Demo); createTrackbar(trackbar_hmax,window_name,&H_MAX,H_MAX,Threshold_Demo); createTrackbar(trackbar_smin,window_name,&S_MIN,S_MAX,Threshold_Demo); createTrackbar(trackbar_smax,window_name,&S_MAX,S_MAX,Threshold_Demo); createTrackbar(trackbar_vmin,window_name,&V_MIN,V_MAX,Threshold_Demo); createTrackbar(trackbar_vmax,window_name,&V_MAX,V_MAX,Threshold_Demo); Threshold_Demo(0, 0); /*while(true) { int c; c = waitKey(20); if((char)c == 27) break; } */ waitKey(0); } return 0; } void Threshold_Demo(int, void*) { /* 0: Binary 1: Binary Inverted 2: Threshold Truncated 3: Threshold to Zero 4: Threshold to Zero Inverted */ /*inRange(img_hsv,Scalar(H_MIN,S_MIN,V_MIN),Scalar(H_MAX,S_MAX,V_MAX),img_thresh); imshow(window_name, img_thresh);*/ if(x==1) { inRange(img_hsv,Scalar(0,89,145),Scalar(58,137,175),img_thresh); //imshow(window_name1, img_thresh); } else if(x==2) { inRange(img_hsv,Scalar(0,69,189),Scalar(38,256,248),img_thresh); //imshow(window_name1, img_thresh); } else if(x==3) { inRange(img_hsv,Scalar(109,85,123),Scalar(161,200,256),img_thresh); //imshow(window_name1, img_thresh); } MorphOps(img_thresh); vector<vector<Point> > contours; vector<Vec4i> hierarchy; findContours(img_thresh, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) ); vector<vector<Point> > contours_poly( contours.size() ); vector<Rect> boundRect( contours.size() ); vector<Point2f>center( contours.size() ); vector<float>radius( contours.size() ); for( int i = 0; i < contours.size(); i++ ) { approxPolyDP( Mat(contours[i]), contours_poly[i], 3, true ); boundRect[i] = boundingRect( Mat(contours_poly[i]) ); minEnclosingCircle( (Mat)contours_poly[i], center[i], radius[i] ); } Mat output = img_rgb.clone(); Mat drawing = Mat::zeros( img_thresh.size(), CV_8UC3 ); for( int i = 0; i< contours.size(); i++ ) { Scalar color = Scalar(255,0,0); drawContours( drawing, contours_poly, i, color, 1, 8, vector<Vec4i>(), 0, Point() ); rectangle( drawing, boundRect[i].tl(), boundRect[i].br(), color, 2, 8, 0 ); /*circle( drawing, center[i], (int)radius[i], color, 2, 8, 0 );*/ drawContours(output, contours_poly, (int)i, color, 1, 8, vector<Vec4i>(), 0, Point() ); rectangle( output, boundRect[i].tl(), boundRect[i].br(), color, 2, 8, 0 ); } //namedWindow( "Contours", CV_WINDOW_AUTOSIZE ); imshow("Output",output); //imshow("Contours", drawing ); //imwrite("Contours.PNG",drawing ); }
#include "SceneCA.h" #include "debug/Debug.h" #include "basic/GlobalInstance.h" #include "graphics/Renderer.h" #include "graphics/Camera.h" #include "graphics/Light.h" #include "utility/Common.h" #include "utility/KeyManager.h" #include "utility/Type.h" SceneCA::SceneCA(BlueCarrot::SceneID scene_id) : SceneRendering(scene_id) { } void SceneCA::Initialize() { SceneRendering::Initialize(); BlueCarrot::graphics::Renderer * renderer = BlueCarrot::GetGlobalInstance()->GetRenderer(); m_CA.Randomize(); AddSceneEntity(&m_CA); } void SceneCA::Finalize() { SceneRendering::Finalize(); } void SceneCA::Update(unsigned int elapsed_time) { SceneRendering::Update(elapsed_time); }
#include<iostream> #include<cstdlib> using namespace std; const int Max = 100; class graph { private: int n; // 정점의 갯수 ( 매트릭스 크기 ) int cost[Max][Max]; // Cost Matrix int distance[Max]; // 정점들의 거리 bool found[Max]; // 방문 정보 public: void init(int vertices); // graph의 초기화, 인자는 정점의 개수 void Shortestpath(int v); // 인자는 정점 void getcost(int matrix[][Max]); // 주어진 cost matrix를 입력받는다 int choose(); void Prim(int v); }; void main() { graph SP; // SP의 생성 // Cost Matrix // int matrix[Max][Max] = { {100,6,1,5,100,100} , {6,100,4,100,3,100} , {1,4,100,5,6,5} , {5,100,5,100,100,2} , {100,3,6,100,100,6} , {100,100,5,2,6,100} }; int select; int n; // 정점의 개수 int start; // Shortest Path의 시작 점을 결정 while(1) { cout << "1.Insert_Vertices 2.Matirx 3.ShortestPath 4.Prim 5.exit :"; cin >> select; switch (select) { case 1: cout << "정점의 개수: "; cin >> n; SP.init(n); cout << endl; break; case 2: cout << "**** COST MATRIX\n"; cout << "\t"; for(int i=0; i<n; i++) cout << i << "\t" ; cout << endl; for(int i=0; i<n; i++) { cout << i << " \t"; for(int j=0; j<n; j++) cout << matrix[i][j] << "\t"; cout << endl; } SP.getcost(matrix); // Cost Matrix를 입력 // cout << endl; break; case 3: cout << "Shortest Path\n"; cout << "Start vertex: "; cin >> start; SP.Shortestpath(start); cout << endl; break; case 4: cout << "Prim's Algorithm\n"; cout << "Start vertex: "; cin >> start; SP.Prim(start); cout << endl << endl; break; case 5: exit(1); } } } //*************** Public 멤버 함수 ***************// int graph::choose() // 강의노트 참조 { int i, min, minpos; min = INT_MAX; minpos = -1; for(i = 0; i < n; i++) if (distance[i] < min && !found[i]) { min = distance[i]; minpos = i; } return minpos; } void graph::Shortestpath(int v) // 강의노트 참조 { int I,u,w; // 초기 distance 설정 (입력받은 v를 토대로) // for (I=0; I<n; I++) { found[I] = false; distance[I] = cost[v][I]; } found[v]=true; // start vertex mark distance[v]=0; // start vertex 0 for(I=0; I<n-1; I++) { u = choose(); // find min value node found[u] = true; // mark that node for(w=0; w<n; w++) // and replace if revised value if (!found[w]) // if not marked if (distance[u]+cost[u][w] < distance[w]) //is smaller than org distance[w] = distance[u] + cost[u][w]; // value for(int i=0; i<n; i++) // 중간 과정 출력 cout << distance[i] << " "; cout << endl; } // 방문자 초기화 // for(int i=0; i<n; i++) found[i] = false; } void graph::Prim(int v) { int u; // 초기 distance 설정 (입력받은 v를 토대로) // for(int i=0; i<n; i++) { distance[i] = cost[v][i]; } cout << v; found[v]=true; distance[v]=0; u = choose(); if(!found[u]) { cout << " -> "; Prim(u); } /* 방문자 초기화 */ for(int i=0; i<n; i++) found[i] = false; } void graph::init(int vertices) { n = vertices; for(int i=0; i<vertices; i++) found[i] = false; } void graph::getcost(int matrix[][Max]) { for(int i=0; i<n; i++) for(int j=0; j<n; j++) cost[i][j] = matrix[i][j]; }
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QDebug> #include <QProcess> #include <QDir> #include <QDebug> #include <QFile> #include <QTextStream> #include <QThread> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <netinet/in.h> #include <net/if.h> #include <unistd.h> #include <arpa/inet.h> #include <QThread> #include <QMessageBox> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { loginCycle = 0; users<<"admin"<<"service"<<"user"; //users.append("hello"); ui->setupUi(this); ui->adminButton->setChecked(true); ui->loginStatus->setVisible(false); ui->userNamecomboBox->addItems(users); ui->userNamecomboBox->setCurrentIndex(0); ui->userNamecomboBox->hide(); ui->statusBar->showMessage("Ethernet IP"); ui->statusBar->addPermanentWidget(ui->ipLabel); getIP(); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_returnButton_clicked() { if(loginCycle == 0){ ui->passwordLineEdit->setFocus(); ui->passwordLineEdit->setText(""); ui->passwordLineEdit->setEchoMode(QLineEdit::EchoMode(2)); loginCycle = 1; }else{ ui->passwordLineEdit->setText(""); ui->userNamecomboBox->setFocus(); //loginCycle = 0; } } void MainWindow::on_backButton_clicked() { if(ui->passwordLineEdit->text().count() >0){ QString str = ui->passwordLineEdit->text(); str.chop(1); ui->passwordLineEdit->setText(str); }else{ qDebug()<<"Not ok"; } } void MainWindow::setNumber(QString str){ QString pstr = ui->passwordLineEdit->text(); pstr += str; ui->passwordLineEdit->setText(pstr); } void MainWindow::on_oneButton_clicked() { setNumber("1"); } void MainWindow::on_twoButton_clicked() { setNumber("2"); } void MainWindow::on_threeButton_clicked() { setNumber("3"); } void MainWindow::on_fourButton_clicked() { setNumber("4"); } void MainWindow::on_fiveButton_clicked() { setNumber("5"); } void MainWindow::on_sixButton_clicked() { setNumber("6"); } void MainWindow::on_sevenButton_clicked() { setNumber("7"); } void MainWindow::on_eightButton_clicked() { setNumber("8"); } void MainWindow::on_nineButton_clicked() { setNumber("9"); } void MainWindow::on_zeroButton_clicked() { setNumber("0"); } void MainWindow::on_loginButton_clicked() { QString admin = "511"; QString service = "711"; QString user = "911"; QString path1 ="/home/launchApps/"; QString path2 =" -platform xcb"; QString qtplugin =" -platform xcb"; if(ui->adminButton->isChecked()){ //if(ui->userNamecomboBox->currentIndex() == 0){ // for comboBox QString adminPath = path1+""+path2; qDebug("admin"); int x = QString::compare(admin, ui->passwordLineEdit->text(), Qt::CaseInsensitive); // if strings are equal x should return 0 if(x== 0){ ui->loginStatus->setVisible(false); qDebug("admin login sucess"); adminD = new adminDialog(); connect(adminD,SIGNAL(closeAll()),this, SLOT(closeAll())); connect(adminD,SIGNAL(showMain()),this, SLOT(showMain())); this->hide(); adminD->show(); }else{ ui->loginStatus->setVisible(true); qDebug("admin login failed"); } } else if(ui->serviceButton->isChecked()){ //else if(ui->userNamecomboBox->currentIndex() == 1){ // for comboBox qDebug("service"); QString path ="/home/launchApps/Apaths/TestAppPath/tfp.txt"; QFile file(path); if(!file.open(QIODevice::ReadOnly| QIODevice::Text)) { qDebug() << "Could not open " << path; return; } QTextStream in(&file); QString stringer = in.readLine(); file.close(); qDebug() << "name_of_file_is = "<<stringer; QString servicePath = path1+stringer+path2; int x = QString::compare(service, ui->passwordLineEdit->text(), Qt::CaseInsensitive); // if strings are equal x should return 0 if(x== 0){ qDebug("service login sucess"); this->hide(); QProcess::execute(servicePath); ui->loginStatus->setVisible(false); this->show(); }else{ ui->loginStatus->setVisible(true); qDebug("service login failed"); } }else if(ui->userButton->isChecked()){ qDebug("user"); QString path ="/home/launchApps/Apaths/ChargerAppPath/chargerFilePath.txt"; QFile file(path); if(!file.open(QIODevice::ReadOnly| QIODevice::Text)) { qDebug() << "Could not open " << path; return; } QTextStream in(&file); QString strig = in.readLine(); file.close(); qDebug() << "name_of_file_is = "<<strig; QString userPath = path1+strig; int x = QString::compare(user, ui->passwordLineEdit->text(), Qt::CaseInsensitive); // if strings are equal x should return 0 if(x== 0){ ui->loginStatus->setVisible(false); qDebug("user login sucess"); this->hide(); QProcess::startDetached(userPath); ui->loginStatus->setVisible(false); this->show(); }else{ ui->loginStatus->setVisible(true); qDebug("user login failed"); } } } void MainWindow::closeAll(){ this->close(); } void MainWindow::getIP(){ int n; struct ifreq ifr; char array[] = "eth0"; n = socket(AF_INET, SOCK_DGRAM, 0); //Type of address to retrieve - IPv4 IP address ifr.ifr_addr.sa_family = AF_INET; //Copy the interface name in the ifreq structure strncpy(ifr.ifr_name , array , IFNAMSIZ - 1); ioctl(n, SIOCGIFADDR, &ifr); //close(n); //display result char ip_addr[100]; strcpy(ip_addr,inet_ntoa(( (struct sockaddr_in *)&ifr.ifr_addr )->sin_addr)); ui->ipLabel->setText(ip_addr); } void MainWindow::showMain(){ ui->loginStatus->setVisible(false); this->show(); }
#pragma once class CResliceControl; class HmyLine3D; class HmyPlane3D; class OperateMprLines : public QObject { Q_OBJECT public: OperateMprLines(QObject *parent,int nImgWndType); ~OperateMprLines(); private: int m_nWndType; //父窗口的类型 bool m_bShow; //是否显示 bool m_bActiveOblique; //是否允许斜切 bool m_bInitLines; //是否初始化过 int m_nNearFactor; //靠近系数 bool m_bMousePressed;//鼠标是否按下 QPoint m_prePt; MoveObject m_moveObject;//移动名称 CResliceControl *m_pResliceControl; private: //每个成分的位置 MprLine *m_pLineAxis1; MprPoint *m_ptA1StartRotate; MprPoint *m_ptA1EndRotate; MprPoint *m_ptA1StartInter; MprPoint *m_ptA1EndInter; MprLine *m_pLineA1SliceTop; MprLine *m_pLineA1SliceBottom; MprLine *m_pLineAxis2; MprPoint *m_ptA2StartRotate; MprPoint *m_ptA2EndRotate; MprPoint *m_ptA2StartInter; MprPoint *m_ptA2EndInter; MprLine *m_pLineA2SliceTop; MprLine *m_pLineA2SliceBottom; MprPoint m_ptPreCenter; MprPoint *m_ptCenter; int m_iPointWidth; float m_fRotateLineRate; private: //rc部分 RECT m_rcImgOnWnd; long m_nImgW; long m_nImgH; double m_dSpacingX; double m_dSpacingY; //颜色部分 QColor m_clrLineAxis1; QColor m_clrLineAxis2; QColor m_clrCenter; //层厚 int m_nHWndSlicePos; int m_nVWndSlicePos; int m_nHImgSlicePos; int m_nVImgSlicePos; public: bool RefreshMprLinesPara(RECT rcImg, int nImgWidth, int nImgHeigh, double dSpacingX, double dSpacingY); void OnMprLinesMousePress(QMouseEvent *event); bool OnMprLinesMouseMove(QMouseEvent *event); void OnMprLinesMouseRelease(QMouseEvent *event); void OnMprLinesPaint(QPainter *painter); public: void SetMprLineShow(bool isShow) { m_bShow = isShow; } void ActiveOblique() { m_bActiveOblique = true; } void DisactiveOblique() { m_bActiveOblique = false; } bool IsMprLineShow() { return m_bShow; } void OutputLineInfo(); //根据新的中心点,设置主线的位置 void OnCenterPointChanged(); //设置主线 void SetManiLinePos(MoveObject object, MprLine *pLine); //设置层厚 void SetSliceLinePos(double nSliceThickm,int nIndex);//0:Axis1, 1:Axis2 //设置control void SetResliceControl(CResliceControl *control) { m_pResliceControl = control; } CResliceControl *GetResliceControl() { return m_pResliceControl; } private: //已知主线,更新两个旋转点的坐标 void UpdateRotatePoint(MprLine *pMainLine, MprPoint *ptStartRotate, MprPoint *ptEndRotate); //根据窗口类型设置线的颜色 void GetLinesColor(); //图像窗口坐标转换 bool ConvertImgToWnd(MprPoint &pt); //将窗口坐标转换为图像坐标 bool ConvertWndToImg(MprPoint &pt); //已知线段p1-p2,求经过线段上一点PubLicPt的、且垂直于此线段的、并且距离此线段nLen的两点:newPt1和newPt2 bool GetVerticalLine(QPoint &p1, QPoint &p2, QPoint &PublicPt, double nLen, QPoint &newPt1, QPoint &newPt2); //已知线段A和B,求交点 bool GetInterPoint(FPOINT pA0, FPOINT pA1, FPOINT pB0, FPOINT pB1, FPOINT &retPt); bool GetInterPoint(QPoint pA0, QPoint pA1, QPoint pB0, QPoint pB1, QPoint &retPt); //鼠标位置激活直线 bool GetPointNearLines(QPoint pt); //鼠标位置激活中间点 bool GetPointNearPoint(QPoint pt); //判断是否为靠近 bool DistanceToLines(MprLine* pLine, QPoint pt); bool DistanceToPoint(MprPoint *ptMpr,QPoint pt, int nDistance); float Dist2(QPoint pt1, QPoint pt2); //移动主直线 bool MoveMainLines(QPoint deltaPt); //移动中心点 bool MoveCenterPt(QPoint pt); //已知直线,求过直线外一点与此直线平行直线 void GetParalleLine(MprLine *pMainLine, MprPoint *pt, MprPoint &pParalleLinePt1, MprPoint &pParalleLinePt2); //移动层厚线 bool MoveSliceLines(QPoint deltaPt); void CalSliceLine(MprPoint *pStart, MprPoint *pEnd, MprLine *pTopSlice, MprLine *pBottomSlice); void CalDistanceOfParalleLine(QPoint pPt, MprLine *pLine, int &fdistance); void CalImageDistance(QPoint pPt, MprLine *pLine, int &fdistance); //移动旋转线 void MoveRotateLine(QPoint pt); //已知矩形内部任意两点,求所在直线与矩形的两个交点 bool GetLineAcrossRc(RECT rc, QPoint p1, QPoint p2, QPoint &retP1, QPoint &retP2); //重新求层厚点 bool ReCalInterPoint(MprLine *pManiLine, MprPoint *pStartInter, MprPoint *pEndInter); //已知线段p1-p2,求与p1距离为nLen的、并且靠近p2的一个点 bool GetInterPtByLength(QPoint &p1, QPoint &p2, double nLen,QPoint &RetPt); //判断此点是否在rc去欲孽 bool IsPointInRc(RECT rc, QPoint pt); //将所有组件的窗口坐标转为图像坐标 void AllCovertWndToImg(); //获得两个轴的序号 int GetAxis1(); int GetAxis2(); //获得平面水平&垂直向量 int GetPlaneAxis1(); int GetPlaneAxis2(); //移动中心时对control的影响 void MoveResliceControlCenter(); //计算旋转 double RotateAxisByPoint(QPoint pt, MoveObject moveObject); void RotateAxisByAngle(double angle, MoveObject moveObject); void RotateVectorAboutVector(double vectorToBeRotated[3], double axis[3], // vector about which we rotate double angle, // angle in radians double output[3]); //计算两个平面的交线 HmyLine3D CalInterSectingLine(HmyPlane3D *target, HmyPlane3D *reference); signals: void MprLinesInfoChange(MprLinesInfo info); };
//////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2006-2010 MStar Semiconductor, Inc. // All rights reserved. // // Unless otherwise stipulated in writing, any and all information contained // herein regardless in any format shall remain the sole proprietary of // MStar Semiconductor Inc. and be kept in strict confidence // (''MStar Confidential Information'') by the recipient. // Any unauthorized act including without limitation unauthorized disclosure, // copying, use, reproduction, sale, distribution, modification, disassembling, // reverse engineering and compiling of the contents of MStar Confidential // Information is unlawful and strictly prohibited. MStar hereby reserves the // rights to any and all damages, losses, costs and expenses resulting therefrom. // //////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // This file is automatically generated by SkinTool [Version:0.2.3][Build:Jun 14 2017 09:17:51] ///////////////////////////////////////////////////////////////////////////// typedef enum { HWND_TENKEY_TRANSPARENT_BG = 1, HWND_TENKEY_BG = 2, HWND_TENKEY_BG_C = 3, HWND_TENKEY_CHANNEL_TITLE = 4, HWND_TENKEY_CHNUMBER = 5, HWND_TENKEY_NUMBER_MAX = 6, } HWND_WINDOW_TENKEY_NUMBER_ID; extern WINDOWDRAWSTYLEDATA _MP_TBLSEG _GUI_WindowsDrawStyleList_Zui_Tenkey_Number[]; //extern WINDOWVARDATA _GUI_WindowsRWDataList_Zui_Tenkey_Number[]; extern WINDOWDATA _MP_TBLSEG _GUI_WindowList_Zui_Tenkey_Number[]; extern WINDOWPOSDATA _MP_TBLSEG _GUI_WindowPositionList_Zui_Tenkey_Number[]; extern WINDOWALPHADATA _MP_TBLSEG _GUI_WindowsAlphaList_Zui_Tenkey_Number[]; #define ZUI_TENKEY_NUMBER_XSTART 20 #define ZUI_TENKEY_NUMBER_YSTART 20 #define ZUI_TENKEY_NUMBER_WIDTH 168 #define ZUI_TENKEY_NUMBER_HEIGHT 64
/* Copyright 2017-2018 All Rights Reserved. * Gyeonghwan Hong (redcarrottt@gmail.com) * * [Contact] * Gyeonghwan Hong (redcarrottt@gmail.com) * * Licensed under the Apache License, Version 2.0(the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "../inc/ControlMessageReceiver.h" #include "../inc/Core.h" #include "../inc/NetworkSwitcher.h" #include "../../common/inc/DebugLog.h" #include <iostream> #include <string.h> #include <string> #include <sys/types.h> #include <thread> #include <unistd.h> #define THREAD_NAME "Control Message Receiving" using namespace sc; void ControlMessageReceiver::start_receiving_thread(void) { this->mReceivingThread = new std::thread( std::bind(&ControlMessageReceiver::receiving_thread_loop, this)); this->mReceivingThread->detach(); } void ControlMessageReceiver::stop_receiving_thread(void) { this->mReceivingThreadOn = false; } void ControlMessageReceiver::receiving_thread_loop(void) { this->mReceivingThreadOn = true; LOG_THREAD_LAUNCH(THREAD_NAME); while (this->mReceivingThreadOn) { this->receiving_thread_loop_internal(); } LOG_THREAD_FINISH(THREAD_NAME); this->mReceivingThreadOn = false; } bool ControlMessageReceiver::receiving_thread_loop_internal(void) { void *message_buffer = NULL; Core::singleton()->receive(&message_buffer, true); if (message_buffer == NULL) { return false; } std::string message((char *)message_buffer); // Find separator location (between first line and other lines) std::size_t separator_pos = message.find('\n'); // Divide the message into first line & other lines std::string first_line(message.substr(0, separator_pos)); std::string other_lines(message.substr(separator_pos + 1)); int control_message_code = std::stoi(first_line); switch (control_message_code) { case CMCode::kCMCodeConnect: case CMCode::kCMCodeSleep: case CMCode::kCMCodeWakeUp: case CMCode::kCMCodeDisconnectAck: { // Normal type int adapter_id = std::stoi(other_lines); this->on_receive_normal_message(control_message_code, adapter_id); break; } case CMCode::kCMCodeDisconnect: { // Disconnect type // Divide the message into second line, third line, fourth line separator_pos = other_lines.find('\n'); std::string second_line(other_lines.substr(0, separator_pos)); std::string third_fourth_line(other_lines.substr(separator_pos + 1)); separator_pos = third_fourth_line.find('\n'); std::string third_line(third_fourth_line.substr(0, separator_pos)); std::string fourth_line(third_fourth_line.substr(separator_pos + 1)); int adapter_id = std::stoi(second_line); uint32_t final_seq_no_control = std::stoul(third_line); uint32_t final_seq_no_data = std::stoul(fourth_line); this->on_receive_disconnect_message(adapter_id, final_seq_no_control, final_seq_no_data); break; } case CMCode::kCMCodePriv: { // Priv type this->on_receive_priv_message(other_lines); break; } case CMCode::kCMCodeRetransmit: { // Retransmit type // Divide the message into second line, third line, fourth line separator_pos = other_lines.find('\n'); std::string second_line(other_lines.substr(0, separator_pos)); std::string third_fourth_line(other_lines.substr(separator_pos + 1)); separator_pos = third_fourth_line.find('\n'); std::string third_line(third_fourth_line.substr(0, separator_pos)); std::string fourth_line(third_fourth_line.substr(separator_pos + 1)); int segment_type = std::stoi(second_line); uint32_t seq_no_start = std::stoul(third_line); uint32_t seq_no_end = std::stoul(fourth_line); this->on_receive_retransmit_request_message(segment_type, seq_no_start, seq_no_end); break; } case CMCode::kCMCodeQueueStatus: { // Queue Status type // Divide the message into second line, third line separator_pos = other_lines.find('\n'); std::string second_line(other_lines.substr(0, separator_pos)); std::string third_line(other_lines.substr(separator_pos + 1)); uint32_t last_seq_no_control = std::stoul(second_line); uint32_t last_seq_no_data = std::stoul(third_line); this->on_receive_queue_status_message(last_seq_no_control, last_seq_no_data); break; } default: { LOG_ERR("Unknown Control Message Code(%d)!\n%s", control_message_code, message.c_str()); break; } } free(message_buffer); return true; } void ControlMessageReceiver::on_receive_normal_message(int control_message_code, int adapter_id) { NetworkSwitcher *ns = NetworkSwitcher::singleton(); switch (control_message_code) { case CMCode::kCMCodeConnect: { #ifdef VERBOSE_CONTROL_MESSAGE_RECEIVER LOG_DEBUG("Receive(Control Msg): Request(Connect %d)", adapter_id); #endif ns->connect_adapter_by_peer(adapter_id); break; } case CMCode::kCMCodeSleep: { #ifdef VERBOSE_CONTROL_MESSAGE_RECEIVER LOG_DEBUG("Receive(Control Msg): Request(Sleep %d)", adapter_id); #endif ns->sleep_adapter_by_peer(adapter_id); break; } case CMCode::kCMCodeWakeUp: { #ifdef VERBOSE_CONTROL_MESSAGE_RECEIVER LOG_DEBUG("Receive(Control Msg): Request(WakeUp %d)", adapter_id); #endif ns->wake_up_adapter_by_peer(adapter_id); break; } case CMCode::kCMCodeDisconnectAck: { #ifdef VERBOSE_CONTROL_MESSAGE_RECEIVER LOG_DEBUG("Receive(Control Msg): Request(DisconnectAck %d)", adapter_id); #endif ServerAdapter *disconnect_adapter = Core::singleton()->find_adapter_by_id((int)adapter_id); if (disconnect_adapter == NULL) { LOG_WARN("Cannot find adapter %d", (int)adapter_id); } else { disconnect_adapter->peer_knows_disconnecting_on_purpose(); } break; } default: { // Never reach here break; } } } void ControlMessageReceiver::on_receive_disconnect_message( int adapter_id, uint32_t final_seq_no_control, uint32_t final_seq_no_data) { #ifdef VERBOSE_CONTROL_MESSAGE_RECEIVER LOG_DEBUG("Receive(Control Msg): Request(Disconnect %d / " "final_seq_no_control=%lu / final_seq_no_data=%lu)", adapter_id, final_seq_no_control, final_seq_no_data); #endif NetworkSwitcher *ns = NetworkSwitcher::singleton(); ns->disconnect_adapter_by_peer(adapter_id, final_seq_no_control, final_seq_no_data); } void ControlMessageReceiver::on_receive_retransmit_request_message( int segment_type, uint32_t seq_no_start, uint32_t seq_no_end) { #ifdef VERBOSE_CONTROL_MESSAGE_RECEIVER LOG_DEBUG("Receive(Control Msg): Request(Retransmit type=%d / " "seq_no=%lu~%lu)", segment_type, seq_no_start, seq_no_end); #endif SegmentManager *sm = SegmentManager::singleton(); sm->retransmit_missing_segments_by_peer(segment_type, seq_no_start, seq_no_end); } void ControlMessageReceiver::on_receive_queue_status_message( uint32_t last_seq_no_control, uint32_t last_seq_no_data) { #ifdef VERBOSE_CONTROL_MESSAGE_RECEIVER LOG_DEBUG( "Receive(Control Msg): Request(Queue Status last_seq_no_control=%d / " "last_seq_no_data=%lu)", last_seq_no_control, last_seq_no_data); #endif SegmentManager *sm = SegmentManager::singleton(); sm->deallocate_sent_segments_by_peer(last_seq_no_control, last_seq_no_data); } void ControlMessageReceiver::on_receive_priv_message(std::string contents) { // Find separator location (between second line and other lines) std::size_t separator_pos = contents.find('\n'); // Divide the message into second line & other lines std::string second_line(contents.substr(0, separator_pos)); std::string priv_message(contents.substr(separator_pos)); int priv_type = std::stoi(second_line); // Notify the priv message for (std::vector<ControlPrivMessageListener *>::iterator it = this->mPrivMessageListeners.begin(); it != this->mPrivMessageListeners.end(); it++) { ControlPrivMessageListener *listener = *it; if (listener != NULL) { listener->on_receive_control_priv_message(priv_type, priv_message); } } }
// // Created by tangzhongliang on 7/15/2016. // #include <jni.h> #include <stdio.h> #include <stdlib.h> #include <opencv2/opencv.hpp> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> #include <vector> #include <opencv2/imgproc/imgproc.hpp> #include <fstream> #include "opencv2/highgui/highgui.hpp" #include <android/bitmap.h> #ifndef IMAGEHANDLE_CPP #define IMAGEHANDLE_CPP #ifdef __cplusplus extern "C"{ #endif using namespace std; using namespace cv; void rotateImageFile(char* pathString,int degree) { Mat src=imread(pathString); Mat dst; if(degree == 180){ flip(src,dst,0);// 转置 flip(dst,src,1);// Y轴翻转 imwrite(pathString,src); } Mat dst2; if(degree == 90){ transpose(src,dst);// 转置 flip(dst,dst2,0);// Y轴翻转 imwrite(pathString,dst2); }else if(degree == -90){ transpose(src,dst);// 转置 flip(dst,dst2,1);// Y轴翻转 imwrite(pathString,dst2); } } Mat rotateImage(Mat& src,int degree) { imwrite("/mnt/sdcard/src.png",src); Mat dst; if(degree == 180){ flip(src,dst,0);// 转置 flip(dst,src,1);// Y轴翻转 setMatSize(dst,src.rows,src.cols); return dst; } Mat dst2; if(degree == 90){ transpose(src,dst);// 转置 flip(dst,dst2,0);// Y轴翻转 imwrite("/mnt/sdcard/temp.png",dst2); setMatSize(dst2,src.cols,src.rows); return dst2; }else if(degree == -90){ transpose(src,dst);// 转置 flip(dst,dst2,1);// Y轴翻转 setMatSize(dst2,src.cols,src.rows); return dst2; } return dst; } void imageCombine(char* targetFile,char* logoFile,int xOffset,int yOffset){ cv::Mat image = cv::imread(targetFile); cv::Mat logo = cv::imread(logoFile); cv::Mat imageROI; imageROI = image(cv::Rect(xOffset,yOffset,logo.cols,logo.rows)); logo.copyTo(imageROI); //cv::namedWindow("result"); //cv::imshow("result",image); imwrite(targetFile,image); //cv::waitKey(); } Mat imageRoi(Mat mat,int left,int top,int width,int height){ Rect rect(left,top,width,height); Mat matRoi(mat,rect); matRoi.cols = width; matRoi.rows = height; //imwrite("/mnt/sdcard/temp.jpg",matRoi); return matRoi; } IplImage* imageROI2(IplImage* res,int left,int top,int right,int bottom){ IplImage* dst; CvRect rect(left,top,right,bottom); dst=cvCreateImage(cvGetSize(res), res->depth, res->nChannels);; cvSetImageROI(res,rect); //提取ROI cvCopy(res,dst,NULL); cvResetImageROI(res); return dst; } #ifdef __cplusplus } #endif #endif
/******************************************************************* * CS 307 Programming Assignment 2 * Author: Benjmin hoang * Desc: traffic simulation * Date: 4/15/2017 * I attest that this program is entirely my own work *******************************************************************/ #include "RoadMap.h" //default constructor RoadMap::RoadMap(void) { } //default destructor RoadMap::~RoadMap(void) { } //all set functions void RoadMap::setRoad(TrafficSimDataParser *parserObject) { //all variables char name[128]; double xStart; double yStart; double xEnd; double yEnd; int intersStart; int intersEnd; double spdLimit; int numLanes; m_iRoadNum = parserObject->getRoadCount(); for (int i = 0; i<m_iRoadNum; i++) { if(parserObject->getRoadData(name, &xStart,&yStart,&xEnd, &yEnd,&intersStart, &intersEnd, &spdLimit, &numLanes)==true) { Road *road = new Road(); road->setName(name); road->setxStart(&xStart); road->setyStart(&yStart); road->setxEnd(&xEnd); road->setyEnd(&yEnd); road->setintersStart(&intersStart); road->setintersEnd(&intersEnd); road->setspdlimit(&spdLimit); road->setnumLanes(&numLanes); road->setNS_EWroad(); //push to vector m_Road_Array.push_back(road); } } } void RoadMap::setIntersection(TrafficSimDataParser *parserObject) { //all variables int id; double xpos; double ypos; char roadN[128]; char roadE[128]; char roadS[128]; char roadW[128]; m_iIntersectionNum = parserObject->getIntersectionCount(); //setup intersection vector for(int i=0; i<m_iIntersectionNum; i++) { if(parserObject->getIntersectionData(&id, &xpos, &ypos, roadN, roadE, roadS, roadW)==true) { Intersection *inters = new Intersection(); inters->setID(&id); inters->setXpos(&xpos); inters->setYpos(&ypos); inters->setroadN(roadN); inters->setroadE(roadE); inters->setroadS(roadS); inters->setroadW(roadW); //push intersection to inters_array m_Inters_Array.push_back(inters); } } //set numlanes for each side of the intersection for(int k =0; k<m_iIntersectionNum; k++) { for(int j = 0; j<m_iRoadNum; j++) { if(m_Inters_Array[k]->getroadN().empty() != true) { if(m_Inters_Array[k]->getroadN().compare(m_Road_Array[j]->getName()) == 0) { //set numlanes for NS/SE direction in intersection m_Inters_Array[k]->setnumlanesNS(m_Road_Array[j]->getnumLanes()); } } if(m_Inters_Array[k]->getroadE().empty() != true) { if(m_Inters_Array[k]->getroadE().compare(m_Road_Array[j]->getName()) == 0) { //set numlanes for NS/SE direction in intersection m_Inters_Array[k]->setnumlanesEW(m_Road_Array[j]->getnumLanes()); } } if(m_Inters_Array[k]->getroadS().empty() != true) { if(m_Inters_Array[k]->getroadS().compare(m_Road_Array[j]->getName()) == 0) { //set numlanes for NS/SE direction in intersection m_Inters_Array[k]->setnumlanesNS(m_Road_Array[j]->getnumLanes()); } } if(m_Inters_Array[k]->getroadW().empty()!=true) { if(m_Inters_Array[k]->getroadW().compare(m_Road_Array[j]->getName()) == 0) { //set numlanes for NS/SE direction in intersection m_Inters_Array[k]->setnumlanesEW(m_Road_Array[j]->getnumLanes()); } } } } /* //print out value testing for(int k =0; k<m_iIntersectionNum; k++) { if(m_Inters_Array[k]->isPointInIntersection( 1, 1) == true) { cout<<"point is on intersection id: "<<k<<endl; } else { cout<<"point is not on intersection id: "<<k<<endl; } cout<<"intersection id: "<<m_Inters_Array[k]->getID()<<endl; cout<<"intersection N: "<<m_Inters_Array[k]->getroadN()<<endl; cout<<"intersection W: "<<m_Inters_Array[k]->getroadW()<<endl; cout<<"intersection E: "<<m_Inters_Array[k]->getroadE()<<endl; cout<<"intersection S: "<<m_Inters_Array[k]->getroadS()<<endl; cout<<"numlanes of intersection NS :"<<m_Inters_Array[k]->getnumlanesNS()<<endl; cout<<"numlanes of intersection EW :"<<m_Inters_Array[k]->getnumelanesEW()<<endl; } */ } void RoadMap::update(int value) { m_TlightManager->update(value); } void RoadMap::printLight() { m_TlightManager->printLight(); } //all get functions Road* RoadMap::getRoad(char *rdID) { for(int k =0; k< m_iRoadNum; k++) { if(m_Road_Array[k]->getName().compare(string(rdID)) == 0) { return m_Road_Array[k]; } } return NULL; } Road * RoadMap::getRoad(double x, double y, double dir) { for(int k =0; k < m_iRoadNum; k++) { if(m_Road_Array[k]->isPointOnRoad(x, y, dir) == true ) { return m_Road_Array[k]; } } return NULL; } Intersection* RoadMap::getIntersection(int id) { for (int k = 0; k < m_iIntersectionNum; k++) { if(m_Inters_Array[k]->getID()==id) { return m_Inters_Array[k]; } } return NULL; } Intersection* RoadMap::getNextIntersection(double x, double y, double dir) { string curRoad = ""; double minDist = 65536.999; curRoad = getRoad(x, y, dir)->getName(); Intersection* nextIntersec = NULL; for (int k = 0; k < m_iIntersectionNum; k++) { double center_x = m_Inters_Array[k]->getXpos(); double center_y = m_Inters_Array[k]->getYpos(); bool checkIntersection_flag = false; if((dir == 0) && (m_Inters_Array[k]->getroadW().compare(curRoad) == 0 ) && (x < center_x)) { checkIntersection_flag = true; } else if((dir == 90) && (m_Inters_Array[k]->getroadS().compare(curRoad) == 0) && (y > center_y)) { checkIntersection_flag = true; } else if((dir == 180) && (m_Inters_Array[k]->getroadE().compare(curRoad) == 0) && (x > center_x)) { checkIntersection_flag = true; } else if((dir == 270) && (m_Inters_Array[k]->getroadN().compare(curRoad) == 0) &&(y < center_y)) { checkIntersection_flag = true; } if(checkIntersection_flag == true) { double dist = sqrt(pow(x- center_x, 2.0) + pow(y - center_y, 2.0)); if(dist < minDist) { minDist = dist; nextIntersec = m_Inters_Array[k]; } } } return nextIntersec; } Intersection* RoadMap::getIntersection(double x, double y) { for (int k = 0; k < m_iIntersectionNum; k++) { if(m_Inters_Array[k]->isPointInIntersection(x,y) == true) { return m_Inters_Array[k]; } } return NULL;// return nothing if not found } void RoadMap::iniTraffic() { m_TlightManager = new TrafficManager(); } int RoadMap::getEW_light() { return m_TlightManager->getEWlight(); } int RoadMap::getNS_light() { return m_TlightManager->getNSlight(); }
//Includes #include <iostream> #include <stdlib.h> #include <signal.h> #include <sys/time.h> #include "../sensors/mbed.h" #include "../controls/pid.h" #include "../util.h" //Defines #define ORIENT_DEADBAND 300 #define ALTITUDE_DEADBAND 3 //Globals MMBED mmbed; IMBED imbed; PID x_regulator; PID y_regulator; PID alt_regulator; SMA<int,int> smax(16), smay(16), smaz(16), ss(16); int orient[3] = {0}; int target_orient[3] = {0};//{-500,300,0}; int m1=0,m2=0,m3=0,m4=0,sonar=0; //Prototypes void get_orient(); void get_motors(); void set_motors(); bool flight_altitude(unsigned short int desired); void flight_stabilize(int *desired); void catchit(int); void killed(int a, void *v); int main() { int istat=0, mstat=0; T_TONDelay setpt_delay = {false,false,15.0,{0}}; T_TONDelay reg_delay = {false,false,0.025,{0}}; srand(time(NULL)); imbed.get_status(istat); mmbed.get_status(mstat); cout << istat + mstat << endl; cout << x_regulator.init(50,0,0,50,5) << endl; cout << y_regulator.init(50,0,0,50,5) << endl; cout << alt_regulator.init(40,10,0,50,15) << endl; signal(SIGINT,&catchit); on_exit(&killed,NULL); //int setpt = rand() % 5500 + 2500; int setpt = 6500; m1 = m2 = m3 = m4 = setpt; set_motors(); while(istat && mstat) { /*if(ton_delay(setpt_delay,true)) { setpt = rand() % 5500 + 2500; m1 = m2 = m3 = m4 = setpt; set_motors(); imbed.get_status(istat); mmbed.get_status(mstat); ton_delay(setpt_delay,false); }*/ if(ton_delay(reg_delay,true)) { get_orient(); get_motors(); flight_stabilize(target_orient); //flight_altitude(1000); cout << sonar << endl; set_motors(); ton_delay(reg_delay,false); } } return 0; } void killed(int a, void *v) { while(m1 != 0 || m2 != 0 || m3 != 0 || m4 != 0) { m1 = m2 = m3 = m4 = 0; set_motors(); usleep(100000); get_motors(); } } void catchit(int) { cout << "STOPPING" << endl; exit(-1); } //Updates orientation vector void get_orient() { imbed.get_data(orient[0],orient[1],orient[2]); orient[0] = smax.filter(orient[0]); orient[1] = smay.filter(orient[1]); orient[2] = smaz.filter(orient[2]); } //Updates global variables with the motor speeds void get_motors() { mmbed.get_data(m1,m2,m3,m4,sonar); //`sonar = ss.filter(sonar); } void set_motors() { mmbed.set_setpoints(m1,m2,m3,m4); } // Run the altitude control system bool flight_altitude(unsigned short int desired) { if(sonar > 40) sonar = 0; if(!inDeadBand(desired,sonar,ALTITUDE_DEADBAND)) { unsigned short int out; if(sonar < desired) { alt_regulator.regulate(desired,sonar,out); m1 += out; m2 += out; m3 += out; m4 += out; } else { alt_regulator.regulate(sonar,desired,out); m1 -= out; m2 -= out; m3 -= out; m4 -= out; } return false; } return true; } // Run the stabilization control system // The desired vector is what orientation we want to be at void flight_stabilize(int *desired) { /* We want maintain some pitch and some yaw * * (1) (2) * \ / +x ^ * ---- | * | | +y <---O +z * ---- * / \ * (4) (3) * * Rotation about x-axis is roll * Rotation about y-axis is pitch * Rotation about z-axis is yaw * * If x is < 0, inc motors 2 & 3, dec motors 1 & 4 * If x is > 0, inc motors 1 & 4, dec motors 2 & 3 * If y is < 0, inc motors 3 & 4, dec motors 1 & 2 * If y is > 0, inc motors 1 & 2, dec motors 3 & 4 * We are going to ignore z for now...but it will mod opposite pairs */ // Predict motor speed changes unsigned short int xd = (unsigned short int)(desired[0] + 9000); unsigned short int xo = (unsigned short int)(orient[0] + 9000); if(!inDeadBand(xd,xo,ORIENT_DEADBAND)) { unsigned short int out; if(xo < xd) { x_regulator.regulate(xd,xo,out); m1 = LIMIT(2500,m1+out,8000); m2 = LIMIT(2500,m2+out,8000); m3 = LIMIT(2500,m3-out,8000); m4 = LIMIT(2500,m4-out,8000); } else { x_regulator.regulate(xo,xd,out); m3 = LIMIT(2500,m3+out,8000); m4 = LIMIT(2500,m4+out,8000); m1 = LIMIT(2500,m1-out,8000); m2 = LIMIT(2500,m2-out,8000); } } unsigned short int yd = (unsigned short int)(desired[1] + 9000); unsigned short int yo = (unsigned short int)(orient[1] + 9000); if(!inDeadBand(yd,yo,ORIENT_DEADBAND)) { unsigned short int out; if(yo < yd) { y_regulator.regulate(yd,yo,out); m1 = LIMIT(2500,m1+out*2,8000); m4 = LIMIT(2500,m4+out*2,8000); m2 = LIMIT(2500,m2-out,8000); m3 = LIMIT(2500,m3-out,8000); } else { y_regulator.regulate(yo,yd,out); m2 = LIMIT(2500,m2+out*2,8000); m3 = LIMIT(2500,m3+out*2,8000); m1 = LIMIT(2500,m1-out,8000); m4 = LIMIT(2500,m4-out,8000); } } }
#include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include <netinet/in.h> #include <netinet/ip.h> #include <arpa/inet.h> #include <unistd.h> #include <stdlib.h> int main(){ int c = socket(AF_INET, SOCK_STREAM, 0); if(c<0){ printf("Error on client socket\n"); } struct sockaddr_in server; memset(&server, 0, sizeof(server)); server.sin_port = htons(1234); server.sin_family = AF_INET; server.sin_addr.s_addr = inet_addr("192.168.0.115 "); char ch, str[256]; printf("Get string: "); fgets(str, 256, stdin); str[strlen(str)-1] = NULL; printf("Get c: "); scanf("%c", &ch); if(connect(c, (struct sockaddr*)&server, sizeof(server)) < 0){ printf("Error on connect\n"); return 1; } int res = send(c, &ch, sizeof(char), 0); if(res != sizeof(char)) printf("Error on send\n"); int len = htonl(strlen(str) + 1); res = send(c, (char*)&len, sizeof(len), 0); if(res != sizeof(len)) printf("Error on sending len\n"); res = send(c, str, sizeof(char) * (strlen(str) + 1), 0); if(res != sizeof(char) * (strlen(str) + 1)) printf("Error on sending string\n"); res = recv(c, (char*)&len, sizeof(len), 0); if(res != sizeof(len)) printf("Error on receiving len\n"); len = ntohl(len); printf("Received %d\n", len); int* arr = (int*)malloc(sizeof(int) * len); for(int i=0;i<len;i+=1){ res = recv(c, (char*)&arr[i], sizeof(int), 0); if(res != sizeof(int)) printf("Error on receiving index\n"); arr[i] = ntohl(arr[i]); } printf("Received indexes: "); for(int i=0;i<len;i+=1) printf("%d ", arr[i]); printf("\n"); close(c); free(arr); return 0; }
class Solution { public: bool isValid(string s) { if(s.empty()) return true; stack<char> m; m.push(s[0]); for(int i = 1; i < s.length(); i++) { if(s[i] == '(' || s[i] == '{' || s[i] == '[') m.push(s[i]); else { if(s[i] == ')') { if(!m.empty() && m.top() == '(') m.pop(); else return false; } else if(s[i] == '}') { if(!m.empty() && m.top() == '{') m.pop(); else return false; } else if(s[i] == ']') { if(!m.empty() && m.top() == '[') m.pop(); else return false; } else ; } } return m.empty(); } }; // What happen if a stack s is empty but we call s.top()? => it is an error! So check s.empty()? before use s.top();