blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
08dc376f197f662fd608e9898852b705572ce564
682a576b5bfde9cf914436ea1b3d6ec7e879630a
/components/material/nodes/image/MaterialGalleryScroll.cc
1a986e1df7ba6ca94e494607116e932a2531c690
[ "MIT", "BSD-3-Clause" ]
permissive
SBKarr/stappler
6dc914eb4ce45dc8b1071a5822a0f0ba63623ae5
4392852d6a92dd26569d9dc1a31e65c3e47c2e6a
refs/heads/master
2023-04-09T08:38:28.505085
2023-03-25T15:37:47
2023-03-25T15:37:47
42,354,380
10
3
null
2017-04-14T10:53:27
2015-09-12T11:16:09
C++
UTF-8
C++
false
false
14,043
cc
MaterialGalleryScroll.cc
// This is an open source non-commercial project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com /** Copyright (c) 2016 Roman Katuntsev <sbkarr@stappler.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 "Material.h" #include "MaterialIconSprite.h" #include "MaterialGalleryScroll.h" #include "SPScrollView.h" #include "SPTextureCache.h" #include "SPGestureListener.h" #include "SPProgressAction.h" #include "SPOverscroll.h" #include "SPActions.h" #include "2d/CCComponent.h" #include "renderer/CCTexture2D.h" NS_MD_BEGIN bool GalleryImage::init(const String &file, const ImageCallback &cb) { if (!ImageLayer::init()) { return false; } setCascadeOpacityEnabled(true); _root->setCascadeOpacityEnabled(true); _gestureListener->setEnabled(false); auto loader = Rc<IconSprite>::create(IconName::Dynamic_Loader); loader->setAnchorPoint(Vec2(0.5f, 0.5f)); loader->setContentSize(Size(48.0f, 48.0f)); _loader = addChildNode(loader); if (cb) { auto linkId = retain(); cb(file, [this, linkId] (cocos2d::Texture2D *tex) { setTexture(tex); _loader->removeFromParent(); _loader = nullptr; release(linkId); }); } return true; } void GalleryImage::onContentSizeDirty() { ImageLayer::onContentSizeDirty(); auto size = getContentSize(); if (_loader) { _loader->setPosition(size.width / 2.0f, size.height / 2.0f); } } void GalleryImage::onEnter() { ImageLayer::onEnter(); if (_loader) { _loader->animate(); } } void GalleryImage::setLoaderColor(const Color &c) { if (_loader) { _loader->setColor(c); } } bool GalleryScroll::init(const ImageCallback &cb, const Vector<String> &vec, size_t selected) { if (!Node::init()) { return false; } _imageCallback = cb; auto overscrollTop = Rc<Overscroll>::create(Overscroll::Top); overscrollTop->setColor(material::Color::Grey_500); _overscrollTop = addChildNode(overscrollTop, maxOf<int>() - 2); auto overscrollBottom = Rc<Overscroll>::create(Overscroll::Bottom); overscrollBottom->setColor(material::Color::Grey_500); _overscrollBottom = addChildNode(overscrollBottom, maxOf<int>() - 2); auto overscrollLeft = Rc<Overscroll>::create(Overscroll::Left); overscrollLeft->setColor(material::Color::Grey_500); _overscrollLeft = addChildNode(overscrollLeft, maxOf<int>() - 2); auto overscrollRight = Rc<Overscroll>::create(Overscroll::Right); overscrollRight->setColor(material::Color::Grey_500); _overscrollRight = addChildNode(overscrollRight, maxOf<int>() - 2); auto l = Rc<gesture::Listener>::create(); l->setTouchFilter([this] (const Vec2 &loc, const gesture::Listener::DefaultTouchFilter &f) { if (!_primary) { return false; } return f(loc); }); l->setTapCallback([this] (gesture::Event ev, const gesture::Tap &t) { if (_actionCallback) { _actionCallback(t.count==1?Tap:DoubleTap); } return onTap(t.location(), t.count); }); l->setSwipeCallback([this] (gesture::Event ev, const gesture::Swipe &s) { auto density = screen::density(); if (ev == stappler::gesture::Event::Began) { if (_actionCallback) { _actionCallback(Swipe); } return onSwipeBegin(s.location()); } else if (ev == stappler::gesture::Event::Activated) { return onSwipe(Vec2(s.delta.x / density, s.delta.y / density)); } else if (ev == stappler::gesture::Event::Ended) { return onSwipeEnd(Vec2(s.velocity.x / density, s.velocity.y / density)); } return true; }); l->setPinchCallback([this] (stappler::gesture::Event ev, const stappler::gesture::Pinch &p) { if (ev == stappler::gesture::Event::Began) { if (_actionCallback) { _actionCallback(Pinch); } _hasPinch = true; } else if (ev == stappler::gesture::Event::Activated) { _hasPinch = false; return onPinch(p.location(), p.scale, p.velocity, false); } else if (ev == stappler::gesture::Event::Ended || ev == stappler::gesture::Event::Cancelled) { _hasPinch = false; return onPinch(p.location(), p.scale, p.velocity, true); } return true; }); _gestureListener = addComponentItem(l); _images = vec; reset(selected); return true; } void GalleryScroll::onContentSizeDirty() { Node::onContentSizeDirty(); auto size = getContentSize(); _progress = 0.0f; stopAllActionsByTag("ProgressAction"_tag); if (_primary) { _primary->setContentSize(size); _primary->setAnchorPoint(Vec2(0.5f, 0.5f)); _primary->setPosition(Vec2(size.width/2.0f, size.height/2.0f)); } if (_secondary) { _secondary->removeFromParent(); _secondary = nullptr; } _overscrollTop->setAnchorPoint(Vec2(0, 1)); // top _overscrollTop->setPosition(0, _contentSize.height - 0); _overscrollTop->setContentSize(Size(_contentSize.width, MIN(_contentSize.width * Overscroll::OverscrollScale(), Overscroll::OverscrollMaxHeight()))); _overscrollBottom->setAnchorPoint(Vec2(0, 0)); // bottom _overscrollBottom->setPosition(0, 0); _overscrollBottom->setContentSize(Size(_contentSize.width, MIN(_contentSize.width * Overscroll::OverscrollScale(), Overscroll::OverscrollMaxHeight()))); _overscrollLeft->setAnchorPoint(Vec2(0, 0)); // left _overscrollLeft->setPosition(0, 0); _overscrollLeft->setContentSize(Size( MIN(_contentSize.height * Overscroll::OverscrollScale(), Overscroll::OverscrollMaxHeight()), _contentSize.height)); _overscrollRight->setAnchorPoint(Vec2(1, 0)); // right _overscrollRight->setPosition(_contentSize.width - 0, 0); _overscrollRight->setContentSize(Size( MIN(_contentSize.height * Overscroll::OverscrollScale(), Overscroll::OverscrollMaxHeight()), _contentSize.height)); } void GalleryScroll::setActionCallback(const ActionCallback &cb) { _actionCallback = cb; } const GalleryScroll::ActionCallback & GalleryScroll::getActionCallback() const { return _actionCallback; } void GalleryScroll::setPositionCallback(const PositionCallback &cb) { _positionCallback = cb; } const GalleryScroll::PositionCallback & GalleryScroll::getPositionCallback() const { return _positionCallback; } void GalleryScroll::reset(size_t id) { if (_secondary) { _secondary->removeFromParent(); _secondary = nullptr; } if (_primary) { _primary->removeFromParent(); _primary = nullptr; } if (!_images.empty()) { _primaryId = id; auto primary = Rc<GalleryImage>::create(_images.at(id), _imageCallback); primary->setLoaderColor(_loaderColor); _primary = addChildNode(primary, int(_images.size() - id)); } _contentSizeDirty = true; } bool GalleryScroll::onTap(const Vec2 &point, int count) { return _primary->onTap(point, count); } bool GalleryScroll::onSwipeBegin(const Vec2 &point) { stopAllActionsByTag("ProgressAction"_tag); return _primary->onSwipeBegin(point); } bool GalleryScroll::onSwipe(const Vec2 &delta) { auto vec = _primary->getTexturePosition(); if (!isnan(vec.y)) { if (vec.y == 0.0f && delta.y > 0.0f) { onOverscrollBottom(delta.y); } if (vec.y == 1.0f && delta.y < 0.0f) { onOverscrollTop(delta.y); } } if (_hasPinch || _progress == 0.0f) { if (!_hasPinch) { if (delta.x > 0.0f && (std::isnan(vec.x) || vec.x == 0.0f)) { onMove(delta.x); } else if (delta.x < 0.0f && (std::isnan(vec.x) || vec.x == 1.0f)) { onMove(delta.x); } } return _primary->onSwipe(delta); } else { onMove(delta.x); return _primary->onSwipe(Vec2(0.0f, delta.y)); } } bool GalleryScroll::onSwipeEnd(const Vec2 &velocity) { if (_progress != 0.0f) { onMoveEnd(velocity.x); } return _primary->onSwipeEnd(velocity); } bool GalleryScroll::onPinch(const Vec2 &point, float scale, float velocity, bool isEnded) { return _primary->onPinch(point, scale, velocity, isEnded); } void GalleryScroll::onMove(float value) { if (_primaryId == 0 && value > 0 && _progress <= 0.0f) { onOverscrollLeft(value); } else if ((_images.empty() || _primaryId == _images.size() - 1) && value < 0 && _progress >= 0.0f) { onOverscrollRight(value); } else { setProgress(_progress - value / _contentSize.width); } } void GalleryScroll::onMoveEnd(float value) { auto t = fabs(value / 3000.0f); auto d = fabs(value * t) - t * t * 3000.0f / 2.0f; auto p = _progress + ((value > 0) ? (-d) : (d)) / _contentSize.width; float ptime, pvalue; if (p < -0.5f && _progress < 0.0f) { ptime = p > -1.0f ? progress(0.1f, 0.5f, fabs(1.0f - (0.5f - p) * 2.0f)) : 0.1f; pvalue = -1.0f; } else if (p > 0.5 && _progress > 0.0f) { ptime = p < 1.0f ? progress(0.1f, 0.5f, fabs((p - 0.5f) * 2.0f)) : 1.0f; pvalue = 1.0f; } else { ptime = progress(0.1f, 0.5f, fabs(p) * 2.0f); pvalue = 0.0f; } auto a = Rc<ProgressAction>::create(ptime, _progress, pvalue, [this] (ProgressAction *a, float p) { setProgress(p); }); runAction(cocos2d::EaseQuarticActionOut::create(a), "GalleryScrollProgress"_tag); } void GalleryScroll::setProgress(float value) { if (value * _progress < 0.0f) { value = 0.0f; } float p = _primaryId + value; if (value <= -1.0f) { // move back _progress = 0.0f; if (!_secondary && _primaryId > 0) { _secondaryId = _primaryId - 1; auto secondary = Rc<GalleryImage>::create(_images.at(_secondaryId), _imageCallback); secondary->setLoaderColor(_loaderColor); secondary->setAnchorPoint(Vec2(0.5f, 0.5f)); secondary->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f)); secondary->setContentSize(_contentSize); _secondary = addChildNode(secondary, int(_images.size() - _secondaryId)); } if (_secondary) { _primary->removeFromParent(); _primaryId = _secondaryId; _primary = _secondary; _secondary = nullptr; } _primary->setPositionX(_contentSize.width/2.0f + - _progress * _contentSize.width); _primary->setOpacity(255); _primary->setScale(1.0f); stopActionByTag("GalleryScrollProgress"_tag); } else if (value >= 1.0f) { //move forvard _progress = 0.0f; if (!_secondary) { _secondaryId = _primaryId + 1; if (_secondaryId < _images.size()) { auto secondary = Rc<GalleryImage>::create(_images.at(_secondaryId), _imageCallback); secondary->setLoaderColor(_loaderColor); secondary->setAnchorPoint(Vec2(0.5f, 0.5f)); secondary->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f)); secondary->setContentSize(_contentSize); _secondary = addChildNode(secondary, int(_images.size() - _secondaryId)); } } if (_secondary) { _primary->removeFromParent(); _primaryId = _secondaryId; _primary = _secondary; _secondary = nullptr; } _primary->setPositionX(_contentSize.width/2.0f + - _progress * _contentSize.width); _primary->setOpacity(255); _primary->setScale(1.0f); stopActionByTag("GalleryScrollProgress"_tag); } else if (value == 0.0f) { _progress = value; if (_secondary) { _secondary->removeFromParent(); _secondary = nullptr; } _primary->setPositionX(_contentSize.width/2.0f + - _progress * _contentSize.width); _primary->setOpacity(255); _primary->setScale(1.0f); } else { if (_progress == 0) { if (_secondary) { _secondary->removeFromParent(); _secondary = nullptr; } if (value > 0) { _secondaryId = _primaryId + 1; } else { _secondaryId = _primaryId - 1; } if (_secondaryId < _images.size()) { auto secondary = Rc<GalleryImage>::create(_images.at(_secondaryId), _imageCallback); secondary->setLoaderColor(_loaderColor); secondary->setAnchorPoint(Vec2(0.5f, 0.5f)); secondary->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f)); secondary->setContentSize(_contentSize); _secondary = addChildNode(secondary, int(_images.size() - _secondaryId)); } } _progress = value; if (_progress > 0) { _primary->setPositionX(_contentSize.width/2.0f + - _progress * _contentSize.width); if (_secondary) { _secondary->setPositionX(_contentSize.width/2.0); _secondary->setOpacity(progress(0, 255, _progress)); _secondary->setScale(progress(0.75f, 1.0f, _progress)); } } else { if (_secondary) { _secondary->setPositionX(_contentSize.width/2.0f + ((-1.0 - _progress) * _contentSize.width)); } _primary->setPositionX(_contentSize.width/2.0); _primary->setOpacity(progress(0, 255, 1.0f + _progress)); _primary->setScale(progress(0.75f, 1.0f, 1.0f + _progress)); } } if (_positionCallback) { _positionCallback(p); } } void GalleryScroll::onOverscrollLeft(float v) { _overscrollLeft->incrementProgress(v / 50.0f); } void GalleryScroll::onOverscrollRight(float v) { _overscrollRight->incrementProgress(-v / 50.0f); } void GalleryScroll::onOverscrollTop(float v) { _overscrollTop->incrementProgress(-v / 50.0f); } void GalleryScroll::onOverscrollBottom(float v) { _overscrollBottom->incrementProgress(v / 50.0f); } void GalleryScroll::setLoaderColor(const Color &c) { _loaderColor = c; if (_primary) { _primary->setLoaderColor(_loaderColor); } if (_secondary) { _secondary->setLoaderColor(_loaderColor); } } const Color &GalleryScroll::getLoaderColor() const { return _loaderColor; } const Vector<String> &GalleryScroll::getImages() const { return _images; } NS_MD_END
be79ac5115ef771164899eaeef72b3bc86e41fa6
a4f2f616fe6e4db11d5da1749bfd1b7fe89b2af5
/ultrasonic.h
28fd66133977e28cc6d976c94a5c75057cb5eb67
[]
no_license
MentorsTeam/MentorsMCUProject
3417e4d4bcb472b74b2fa2442e89587eef868d1e
ac13d1f7880403b6c7d193ed9871d658750b96a7
refs/heads/master
2021-01-15T11:12:08.014293
2012-11-19T12:05:34
2012-11-19T12:05:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
598
h
ultrasonic.h
/* ----------------------------------- * Mentors Team * ----------------------------------- * ultrasonic.h * header file for ultrasonic ranging sensor * * created by: FENG Zili * date: 2012.09.20 */ #include "msp430f149.h" #include "system.h" #ifndef _ULTRASONIC_H_ #define _ULTRASONIC_H_ class UltrasonicSensor { // int _timerCount; float _distance; bool _isBusy; private: public: UltrasonicSensor(); // void setTimerCount(int timerCount); void setResult(); void beginSensing(); float getResult(); }; #endif
4abf2a204306ea42580fca75cf9b15a281663ace
927a260ecc0b24260f032f9bb8509557939dbf10
/test/ElementTest.cpp
3994e858e4378234cb4c45d9cf7e36bf78d04fa5
[]
no_license
coreymbryant/AGNOS
7cd627d4aff5f87e09324f46c34751d09ea3ad04
6ec20e230b065f3e3f40da63c6f90c94e6f3e51a
refs/heads/master
2020-05-20T06:00:44.524806
2016-07-06T18:24:16
2016-07-06T18:24:16
9,533,801
0
1
null
2016-07-06T18:24:16
2013-04-18T23:07:24
C++
UTF-8
C++
false
false
10,279
cpp
ElementTest.cpp
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestCase.h> // local includes #include <iostream> #include <stdio.h> #include <assert.h> #include "agnosDefines.h" #undef AGNOS_DEBUG #define AGNOS_DEBUG 0 #include "Parameter.h" #include "PseudoSpectralTensorProduct.h" #include "Element.h" #include "PhysicsCatenary.h" using namespace AGNOS; //________________________________________________________________// typedef libMesh::DenseVector<double> T_P ; typedef libMesh::DenseVector<double> T_S ; // constant test function void constantFunction ( std::set<std::string>& computeSolutions, const T_S& paramVec, std::map<std::string,T_P>& solutionVectors ) { T_P returnVec(1); returnVec(0)= 2.0; solutionVectors.clear(); solutionVectors.insert(std::pair<std::string,T_P>("primal",returnVec) ); } // Element test class class ElementTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( ElementTest ); CPPUNIT_TEST( coversTest ); CPPUNIT_TEST( splitSamePoly ); CPPUNIT_TEST( splitConstant ); CPPUNIT_TEST_SUITE_END(); public: Communicator comm, physicsComm; GetPot inputfile; std::shared_ptr<PhysicsModel<T_S,T_P> > myPhysics ; unsigned int dimension ; std::vector<std::shared_ptr<AGNOS::Parameter> > myParameters; void setUp( ) { comm = Communicator(MPI_COMM_WORLD); inputfile = GetPot() ; MPI_Comm subComm; int mpiSplit = MPI_Comm_split( MPI_COMM_WORLD, comm.rank(), 0, &subComm); physicsComm = Communicator(subComm) ; myPhysics = std::shared_ptr<PhysicsModel<T_S,T_P> > ( new PhysicsCatenary<T_S,T_P>(physicsComm,inputfile ) ); dimension = 1; myParameters.reserve(dimension); myParameters.push_back( std::shared_ptr<AGNOS::Parameter>( new AGNOS::Parameter(UNIFORM,1.0, 3.0) ) ); } void tearDown( ) { } /** Split element and test which element contains new eval point */ void coversTest() { std::cout << "\n--------------------------\n " << "Testing Element framework for covering eval point " << std::endl; myParameters.push_back( std::shared_ptr<AGNOS::Parameter>( new AGNOS::Parameter(CONSTANT,1.0, 1.0) ) ); dimension++; std::vector<unsigned int> myOrder(dimension,1); std::vector< std::shared_ptr<SurrogateModelBase<T_S,T_P> > > surrogates ; surrogates.push_back( std::shared_ptr<SurrogateModelBase<T_S,T_P> > ( new PseudoSpectralTensorProduct<T_S,T_P>( comm, myPhysics, myParameters, myOrder ) ) ); AGNOS::Element<T_S,T_P> baseElement( myParameters, surrogates, myPhysics ); baseElement.surrogates()[0]->build( ); T_S paramValue0(dimension); T_S paramValue1(dimension); T_S paramValue2(dimension); paramValue0(0) = 1.25; paramValue0(1) = 1.0; paramValue1(0) = 2.25; paramValue1(1) = 1.0; paramValue2(0) = 2.25; paramValue2(1) = 2.0; std::vector< Element<T_S,T_P> > children = baseElement.split() ; for (unsigned int c=0; c<children.size(); c++) { bool test0 = children[c].covers( paramValue0 ); bool test1 = children[c].covers( paramValue1 ); std::cout << "child: " << c << " min = " << children[c].parameters()[0]->min() << std::endl; std::cout << "child: " << c << " max = " << children[c].parameters()[0]->max() << std::endl; std::cout << "child: " << c << " covers0? = " << test0 << std::endl; std::cout << "child: " << c << " covers1? = " << test1 << std::endl; if ( c == 0) CPPUNIT_ASSERT( test0 ); if ( c == 1) CPPUNIT_ASSERT( test1 ); } bool test3 = children[0].covers( paramValue2 ); CPPUNIT_ASSERT( !test3 ); } /********************************************//** * \brief Test to confirm that splitting an Element, but not rebuilding * surrogate maintains the same surrogate model. This is used when we want * to refine one child but keep the parent surrogate model for other * children to save on computations * * ***********************************************/ void splitSamePoly() { std::cout << "\n--------------------------\n " << "Testing Element framework when splitting " << std::endl; std::vector<unsigned int> myOrder(dimension,3); std::vector< std::shared_ptr<SurrogateModelBase<T_S,T_P> > > surrogates ; surrogates.push_back( std::shared_ptr<SurrogateModelBase<T_S,T_P> > ( new PseudoSpectralTensorProduct<T_S,T_P>( comm, myPhysics, myParameters, myOrder ) ) ); AGNOS::Element<T_S,T_P> baseElement( myParameters, surrogates, myPhysics ); baseElement.surrogates()[0]->build( ); T_S paramValue(dimension); paramValue(0) = 1.5; T_P testValue ; T_P baseValue = baseElement.surrogates()[0]->evaluate( "primal", paramValue ); std::cout << "base testValue = " << baseValue(0) << std::endl; std::vector< Element<T_S,T_P> > children = baseElement.split() ; for (unsigned int c=0; c<children.size(); c++) { testValue = children[c].surrogates()[0]->evaluate( "primal", paramValue ); std::cout << "child: " << c << " testValue = " << testValue(0) << std::endl; CPPUNIT_ASSERT( std::abs(testValue(0) - baseValue(0)) <= 1e-12 ); } } /********************************************//** * \brief Test that splitting a constant valued function doesn't actually * change anything, i.e. each *new* surrogate still computes correct value * * ***********************************************/ void splitConstant() { std::cout << "\n--------------------------\n " << "Testing Element framework when splitting: constant " << std::endl; std::vector<unsigned int> myOrder(dimension,2); std::shared_ptr<PhysicsModel<T_S,T_P> > myPhysics; std::shared_ptr<PhysicsUser<T_S,T_P> > constantPhysics( new PhysicsUser<T_S,T_P>(physicsComm,inputfile) ); constantPhysics->attach_compute_function(&constantFunction); myPhysics = constantPhysics; std::vector< std::shared_ptr<SurrogateModelBase<T_S,T_P> > > surrogates ; surrogates.push_back( std::shared_ptr<SurrogateModel<T_S,T_P> > ( new PseudoSpectralTensorProduct<T_S,T_P>( comm, myPhysics, myParameters, myOrder ) ) ); AGNOS::Element<T_S,T_P> baseElement( myParameters, surrogates, myPhysics ); baseElement.surrogates()[0]->build( ); T_S paramValue(dimension); paramValue(0) = 1.5; T_P testValue, testMean ; T_P baseValue = baseElement.surrogates()[0]->evaluate( "primal", paramValue ); std::cout << "base testValue = " << baseValue(0) << std::endl; std::map<std::string,T_P> baseMeans = baseElement.surrogates()[0]->mean( ); T_P baseMean( baseMeans["primal"] ); std::cout << "base meanValue = " << baseMean(0) << std::endl; double baseWeight = baseElement.weight(); std::cout << "base weight = " << baseWeight << std::endl; double testWeight = 0.; std::vector< Element<T_S,T_P> > children = baseElement.split() ; for (unsigned int c=0; c<children.size(); c++) { paramValue(0) = 0.5 * ( children[c].parameters()[0]->min() + children[c].parameters()[0]->max() ); std::vector< std::shared_ptr<SurrogateModelBase<T_S,T_P> > > childSurrogates; childSurrogates.push_back( std::shared_ptr<SurrogateModel<T_S,T_P> > ( new PseudoSpectralTensorProduct<T_S,T_P>( comm, children[c].physics(), children[c].parameters(), myOrder ) ) ); children[c].setSurrogates( childSurrogates ); children[c].surrogates()[0]->build(); testValue = children[c].surrogates()[0]->evaluate( "primal", paramValue ); std::cout << "child: " << c << " testValue = " << testValue(0) << std::endl; std::cout << "child: " << c << " diff = " << std::abs(testValue(0) - baseValue(0)) << std::endl; std::map<std::string,T_P> childMeans = children[c].surrogates()[0]->mean( ); testMean = childMeans["primal"] ; std::cout << "child: " << c << " meanValue = " << testMean(0) << std::endl; std::cout << "child: " << c << " weight = " << children[c].weight() << std::endl; testWeight += children[c].weight(); CPPUNIT_ASSERT( std::abs(testValue(0) - baseValue(0)) <= 1e-12 ); CPPUNIT_ASSERT( std::abs(testMean(0) - baseMean(0)) <= 1e-12 ); } std::cout << " sum of child weights = " << testWeight << std::endl; CPPUNIT_ASSERT( std::abs(testWeight - baseWeight) <= 1e-12 ); } }; CPPUNIT_TEST_SUITE_REGISTRATION( ElementTest ); //________________________________________________________________// // EOF
59c18d31d8126ee53abea2c64fce1b57e8fab6e1
111eef873fa3a21aaf72e3ba52d8e70c285b8695
/client.h
c65062244f7d7db24a8e530b215217f00b9a466c
[]
no_license
supercamel/PicoLAN
6eafa99a3689fc3a8ae3e12b3702d71154277604
1d5e3b9b10fd47084610177ee6a2146ac046ddda
refs/heads/master
2022-07-01T16:06:58.268177
2022-06-03T01:11:37
2022-06-03T01:11:37
163,227,826
3
0
null
null
null
null
UTF-8
C++
false
false
2,673
h
client.h
/** Copyright 2019 Samuel Cowen <samuel.cowen@camelsoftware.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef PICOLAN_CLIENT_H #define PICOLAN_CLIENT_H #include "socket_stream.h" namespace picolan { /** * The Client class is used to connect to a Server. * The client will either connect, or timeout if the server is unavailable. * Once the connection is established, the client and server can exchange data * using SocketStream::read() and SocketStream::write() */ class Client : public SocketStream { public: /** * \brief client constructor * @param bf a pointer to a buffer where bytes can be stored temporarily until they are read() * @param len the length of the buffer. generally 64 bytes is adequate. * @param port the port number to receive on. the number isn't important but it must be unique for each socket per interface. */ #ifndef PICOLAN_NODE_BINDING Client(uint8_t* bf, uint32_t len, uint8_t port) : SocketStream(bf, len, port) #else Client(uint8_t port) : SocketStream(port) #endif { state = CONNECTION_CLOSED; } /* \brief get_remote_port will return the port number of the server \returns the port number of the server that the client is connected to. */ uint8_t get_remote_port() { return remote_port; } /** * \brief connect() will attempt to establish a connection with a server. * @param r Server address * @param port Server port number * */ int connect(uint8_t remote, uint8_t port); private: void on_data(uint8_t remote, const uint8_t* data, uint32_t len); }; } #endif
3eb3f62ad300298219b8b4adcee762e0655cdb2d
d15c0f8fff9bfe7206c51b46ae59c58cd8e29f97
/Smarthome/calendar.h
0fa432b4957869e2d6927d200e3d79f9d31a31d5
[]
no_license
zyprezz/Smarthome
fd38f5a4be4b28c5ca6f05617389bbdd7e287cc7
3be53cdbe861a665c802af028025c61030dc7f15
refs/heads/master
2021-01-19T09:49:18.425055
2017-06-19T11:22:40
2017-06-19T11:22:40
87,791,370
0
0
null
null
null
null
UTF-8
C++
false
false
897
h
calendar.h
#ifndef CALENDAR_H #define CALENDAR_H #include <QtCore> #include <QObject> #include <QMutex> #include <QWaitCondition> #include <time.h> class Calendar : public QObject { Q_OBJECT public: enum Object{ Light, Curtain, Null }; explicit Calendar(Object = Null, QObject *parent = 0); enum Method{ Auto = 1, ManActivate = 2, ManDisable = 3 }; void requestMethod(Method); void abort(); private: Method _method; bool _abort; bool _interrupt; QMutex mutex; QWaitCondition condition; void CheckTime(); void ManualActivate(); void ManualDisable(); bool _light; bool _curtain; int startHour; int startMin; int endHour; int endMin; signals: // void textChanged(QString); void finished(); public slots: void mainLoop(); }; #endif // CALENDAR_H
bac70cf10752d8ac7c312229ef61c10e12f18f74
cfeac52f970e8901871bd02d9acb7de66b9fb6b4
/generated/src/aws-cpp-sdk-iotfleethub/include/aws/iotfleethub/model/DescribeApplicationResult.h
b7ba8e8680e9315f963cba9866eadf99e7cf2183
[ "Apache-2.0", "MIT", "JSON" ]
permissive
aws/aws-sdk-cpp
aff116ddf9ca2b41e45c47dba1c2b7754935c585
9a7606a6c98e13c759032c2e920c7c64a6a35264
refs/heads/main
2023-08-25T11:16:55.982089
2023-08-24T18:14:53
2023-08-24T18:14:53
35,440,404
1,681
1,133
Apache-2.0
2023-09-12T15:59:33
2015-05-11T17:57:32
null
UTF-8
C++
false
false
18,244
h
DescribeApplicationResult.h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/iotfleethub/IoTFleetHub_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/iotfleethub/model/ApplicationState.h> #include <aws/core/utils/memory/stl/AWSMap.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace IoTFleetHub { namespace Model { class DescribeApplicationResult { public: AWS_IOTFLEETHUB_API DescribeApplicationResult(); AWS_IOTFLEETHUB_API DescribeApplicationResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); AWS_IOTFLEETHUB_API DescribeApplicationResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The unique Id of the web application.</p> */ inline const Aws::String& GetApplicationId() const{ return m_applicationId; } /** * <p>The unique Id of the web application.</p> */ inline void SetApplicationId(const Aws::String& value) { m_applicationId = value; } /** * <p>The unique Id of the web application.</p> */ inline void SetApplicationId(Aws::String&& value) { m_applicationId = std::move(value); } /** * <p>The unique Id of the web application.</p> */ inline void SetApplicationId(const char* value) { m_applicationId.assign(value); } /** * <p>The unique Id of the web application.</p> */ inline DescribeApplicationResult& WithApplicationId(const Aws::String& value) { SetApplicationId(value); return *this;} /** * <p>The unique Id of the web application.</p> */ inline DescribeApplicationResult& WithApplicationId(Aws::String&& value) { SetApplicationId(std::move(value)); return *this;} /** * <p>The unique Id of the web application.</p> */ inline DescribeApplicationResult& WithApplicationId(const char* value) { SetApplicationId(value); return *this;} /** * <p>The ARN of the web application.</p> */ inline const Aws::String& GetApplicationArn() const{ return m_applicationArn; } /** * <p>The ARN of the web application.</p> */ inline void SetApplicationArn(const Aws::String& value) { m_applicationArn = value; } /** * <p>The ARN of the web application.</p> */ inline void SetApplicationArn(Aws::String&& value) { m_applicationArn = std::move(value); } /** * <p>The ARN of the web application.</p> */ inline void SetApplicationArn(const char* value) { m_applicationArn.assign(value); } /** * <p>The ARN of the web application.</p> */ inline DescribeApplicationResult& WithApplicationArn(const Aws::String& value) { SetApplicationArn(value); return *this;} /** * <p>The ARN of the web application.</p> */ inline DescribeApplicationResult& WithApplicationArn(Aws::String&& value) { SetApplicationArn(std::move(value)); return *this;} /** * <p>The ARN of the web application.</p> */ inline DescribeApplicationResult& WithApplicationArn(const char* value) { SetApplicationArn(value); return *this;} /** * <p>The name of the web application.</p> */ inline const Aws::String& GetApplicationName() const{ return m_applicationName; } /** * <p>The name of the web application.</p> */ inline void SetApplicationName(const Aws::String& value) { m_applicationName = value; } /** * <p>The name of the web application.</p> */ inline void SetApplicationName(Aws::String&& value) { m_applicationName = std::move(value); } /** * <p>The name of the web application.</p> */ inline void SetApplicationName(const char* value) { m_applicationName.assign(value); } /** * <p>The name of the web application.</p> */ inline DescribeApplicationResult& WithApplicationName(const Aws::String& value) { SetApplicationName(value); return *this;} /** * <p>The name of the web application.</p> */ inline DescribeApplicationResult& WithApplicationName(Aws::String&& value) { SetApplicationName(std::move(value)); return *this;} /** * <p>The name of the web application.</p> */ inline DescribeApplicationResult& WithApplicationName(const char* value) { SetApplicationName(value); return *this;} /** * <p>An optional description of the web application.</p> */ inline const Aws::String& GetApplicationDescription() const{ return m_applicationDescription; } /** * <p>An optional description of the web application.</p> */ inline void SetApplicationDescription(const Aws::String& value) { m_applicationDescription = value; } /** * <p>An optional description of the web application.</p> */ inline void SetApplicationDescription(Aws::String&& value) { m_applicationDescription = std::move(value); } /** * <p>An optional description of the web application.</p> */ inline void SetApplicationDescription(const char* value) { m_applicationDescription.assign(value); } /** * <p>An optional description of the web application.</p> */ inline DescribeApplicationResult& WithApplicationDescription(const Aws::String& value) { SetApplicationDescription(value); return *this;} /** * <p>An optional description of the web application.</p> */ inline DescribeApplicationResult& WithApplicationDescription(Aws::String&& value) { SetApplicationDescription(std::move(value)); return *this;} /** * <p>An optional description of the web application.</p> */ inline DescribeApplicationResult& WithApplicationDescription(const char* value) { SetApplicationDescription(value); return *this;} /** * <p>The URL of the web application.</p> */ inline const Aws::String& GetApplicationUrl() const{ return m_applicationUrl; } /** * <p>The URL of the web application.</p> */ inline void SetApplicationUrl(const Aws::String& value) { m_applicationUrl = value; } /** * <p>The URL of the web application.</p> */ inline void SetApplicationUrl(Aws::String&& value) { m_applicationUrl = std::move(value); } /** * <p>The URL of the web application.</p> */ inline void SetApplicationUrl(const char* value) { m_applicationUrl.assign(value); } /** * <p>The URL of the web application.</p> */ inline DescribeApplicationResult& WithApplicationUrl(const Aws::String& value) { SetApplicationUrl(value); return *this;} /** * <p>The URL of the web application.</p> */ inline DescribeApplicationResult& WithApplicationUrl(Aws::String&& value) { SetApplicationUrl(std::move(value)); return *this;} /** * <p>The URL of the web application.</p> */ inline DescribeApplicationResult& WithApplicationUrl(const char* value) { SetApplicationUrl(value); return *this;} /** * <p>The current state of the web application.</p> */ inline const ApplicationState& GetApplicationState() const{ return m_applicationState; } /** * <p>The current state of the web application.</p> */ inline void SetApplicationState(const ApplicationState& value) { m_applicationState = value; } /** * <p>The current state of the web application.</p> */ inline void SetApplicationState(ApplicationState&& value) { m_applicationState = std::move(value); } /** * <p>The current state of the web application.</p> */ inline DescribeApplicationResult& WithApplicationState(const ApplicationState& value) { SetApplicationState(value); return *this;} /** * <p>The current state of the web application.</p> */ inline DescribeApplicationResult& WithApplicationState(ApplicationState&& value) { SetApplicationState(std::move(value)); return *this;} /** * <p>The date (in Unix epoch time) when the application was created.</p> */ inline long long GetApplicationCreationDate() const{ return m_applicationCreationDate; } /** * <p>The date (in Unix epoch time) when the application was created.</p> */ inline void SetApplicationCreationDate(long long value) { m_applicationCreationDate = value; } /** * <p>The date (in Unix epoch time) when the application was created.</p> */ inline DescribeApplicationResult& WithApplicationCreationDate(long long value) { SetApplicationCreationDate(value); return *this;} /** * <p>The date (in Unix epoch time) when the application was last updated.</p> */ inline long long GetApplicationLastUpdateDate() const{ return m_applicationLastUpdateDate; } /** * <p>The date (in Unix epoch time) when the application was last updated.</p> */ inline void SetApplicationLastUpdateDate(long long value) { m_applicationLastUpdateDate = value; } /** * <p>The date (in Unix epoch time) when the application was last updated.</p> */ inline DescribeApplicationResult& WithApplicationLastUpdateDate(long long value) { SetApplicationLastUpdateDate(value); return *this;} /** * <p>The ARN of the role that the web application assumes when it interacts with * AWS IoT Core.</p> */ inline const Aws::String& GetRoleArn() const{ return m_roleArn; } /** * <p>The ARN of the role that the web application assumes when it interacts with * AWS IoT Core.</p> */ inline void SetRoleArn(const Aws::String& value) { m_roleArn = value; } /** * <p>The ARN of the role that the web application assumes when it interacts with * AWS IoT Core.</p> */ inline void SetRoleArn(Aws::String&& value) { m_roleArn = std::move(value); } /** * <p>The ARN of the role that the web application assumes when it interacts with * AWS IoT Core.</p> */ inline void SetRoleArn(const char* value) { m_roleArn.assign(value); } /** * <p>The ARN of the role that the web application assumes when it interacts with * AWS IoT Core.</p> */ inline DescribeApplicationResult& WithRoleArn(const Aws::String& value) { SetRoleArn(value); return *this;} /** * <p>The ARN of the role that the web application assumes when it interacts with * AWS IoT Core.</p> */ inline DescribeApplicationResult& WithRoleArn(Aws::String&& value) { SetRoleArn(std::move(value)); return *this;} /** * <p>The ARN of the role that the web application assumes when it interacts with * AWS IoT Core.</p> */ inline DescribeApplicationResult& WithRoleArn(const char* value) { SetRoleArn(value); return *this;} /** * <p>The Id of the single sign-on client that you use to authenticate and * authorize users on the web application.</p> */ inline const Aws::String& GetSsoClientId() const{ return m_ssoClientId; } /** * <p>The Id of the single sign-on client that you use to authenticate and * authorize users on the web application.</p> */ inline void SetSsoClientId(const Aws::String& value) { m_ssoClientId = value; } /** * <p>The Id of the single sign-on client that you use to authenticate and * authorize users on the web application.</p> */ inline void SetSsoClientId(Aws::String&& value) { m_ssoClientId = std::move(value); } /** * <p>The Id of the single sign-on client that you use to authenticate and * authorize users on the web application.</p> */ inline void SetSsoClientId(const char* value) { m_ssoClientId.assign(value); } /** * <p>The Id of the single sign-on client that you use to authenticate and * authorize users on the web application.</p> */ inline DescribeApplicationResult& WithSsoClientId(const Aws::String& value) { SetSsoClientId(value); return *this;} /** * <p>The Id of the single sign-on client that you use to authenticate and * authorize users on the web application.</p> */ inline DescribeApplicationResult& WithSsoClientId(Aws::String&& value) { SetSsoClientId(std::move(value)); return *this;} /** * <p>The Id of the single sign-on client that you use to authenticate and * authorize users on the web application.</p> */ inline DescribeApplicationResult& WithSsoClientId(const char* value) { SetSsoClientId(value); return *this;} /** * <p>A message indicating why the <code>DescribeApplication</code> API failed.</p> */ inline const Aws::String& GetErrorMessage() const{ return m_errorMessage; } /** * <p>A message indicating why the <code>DescribeApplication</code> API failed.</p> */ inline void SetErrorMessage(const Aws::String& value) { m_errorMessage = value; } /** * <p>A message indicating why the <code>DescribeApplication</code> API failed.</p> */ inline void SetErrorMessage(Aws::String&& value) { m_errorMessage = std::move(value); } /** * <p>A message indicating why the <code>DescribeApplication</code> API failed.</p> */ inline void SetErrorMessage(const char* value) { m_errorMessage.assign(value); } /** * <p>A message indicating why the <code>DescribeApplication</code> API failed.</p> */ inline DescribeApplicationResult& WithErrorMessage(const Aws::String& value) { SetErrorMessage(value); return *this;} /** * <p>A message indicating why the <code>DescribeApplication</code> API failed.</p> */ inline DescribeApplicationResult& WithErrorMessage(Aws::String&& value) { SetErrorMessage(std::move(value)); return *this;} /** * <p>A message indicating why the <code>DescribeApplication</code> API failed.</p> */ inline DescribeApplicationResult& WithErrorMessage(const char* value) { SetErrorMessage(value); return *this;} /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline const Aws::Map<Aws::String, Aws::String>& GetTags() const{ return m_tags; } /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline void SetTags(const Aws::Map<Aws::String, Aws::String>& value) { m_tags = value; } /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline void SetTags(Aws::Map<Aws::String, Aws::String>&& value) { m_tags = std::move(value); } /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline DescribeApplicationResult& WithTags(const Aws::Map<Aws::String, Aws::String>& value) { SetTags(value); return *this;} /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline DescribeApplicationResult& WithTags(Aws::Map<Aws::String, Aws::String>&& value) { SetTags(std::move(value)); return *this;} /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline DescribeApplicationResult& AddTags(const Aws::String& key, const Aws::String& value) { m_tags.emplace(key, value); return *this; } /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline DescribeApplicationResult& AddTags(Aws::String&& key, const Aws::String& value) { m_tags.emplace(std::move(key), value); return *this; } /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline DescribeApplicationResult& AddTags(const Aws::String& key, Aws::String&& value) { m_tags.emplace(key, std::move(value)); return *this; } /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline DescribeApplicationResult& AddTags(Aws::String&& key, Aws::String&& value) { m_tags.emplace(std::move(key), std::move(value)); return *this; } /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline DescribeApplicationResult& AddTags(const char* key, Aws::String&& value) { m_tags.emplace(key, std::move(value)); return *this; } /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline DescribeApplicationResult& AddTags(Aws::String&& key, const char* value) { m_tags.emplace(std::move(key), value); return *this; } /** * <p>A set of key/value pairs that you can use to manage the web application * resource.</p> */ inline DescribeApplicationResult& AddTags(const char* key, const char* value) { m_tags.emplace(key, value); return *this; } inline const Aws::String& GetRequestId() const{ return m_requestId; } inline void SetRequestId(const Aws::String& value) { m_requestId = value; } inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } inline void SetRequestId(const char* value) { m_requestId.assign(value); } inline DescribeApplicationResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} inline DescribeApplicationResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} inline DescribeApplicationResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} private: Aws::String m_applicationId; Aws::String m_applicationArn; Aws::String m_applicationName; Aws::String m_applicationDescription; Aws::String m_applicationUrl; ApplicationState m_applicationState; long long m_applicationCreationDate; long long m_applicationLastUpdateDate; Aws::String m_roleArn; Aws::String m_ssoClientId; Aws::String m_errorMessage; Aws::Map<Aws::String, Aws::String> m_tags; Aws::String m_requestId; }; } // namespace Model } // namespace IoTFleetHub } // namespace Aws
027c5a1616a317e446d5cce9189e2431405033ad
984107f1d5ebe42fcdf64ed4c8ffc30bc9725751
/gui/GameInfo.hpp
313d8e8c60ad6ddf35e9d578b759d4a9eab50662
[]
no_license
bguina/epi-zappy
6c83e613d5ed03f33d008f17923cb535e26a57a1
8ba4afa2ac99e754c49a9e90fefd4232036e6799
refs/heads/master
2021-01-14T12:14:29.862683
2015-05-21T02:22:27
2015-05-21T02:22:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,697
hpp
GameInfo.hpp
#ifndef GAME_INFO #define GAME_INFO #include "Map.hpp" #include "Team.hpp" #include "Player.hpp" #include "Egg.hpp" #include <vector> class GameInfo { public: // Map Function void SetSizeMap(int x, int y); void AddCaseMap(Coordonnees Coo, std::vector<int> Ressources); void DisplayMap(); // Team Function void AddTeam(std::string TeamName); void AddPlayer(std::string TeamName, Player P); void AddEgg(int Id, Egg E); void DisplayTeam(); // ----------- Action / Animation ------------- void Action_MovePlayer(Coordonnees C, int Orientation, int Id); void Action_LvlUp(int Id, int Lvl); void Action_PlayerBroadcast(int Id, std::string Msg); void Action_PlayerCastIncantation(int x, int y, int Lvl, std::vector<int> Id); void Action_PlayerEndIncantation(int x, int y, int result); void Action_PlayerFork(int Id); void Action_PlayerDropRessources(int Id, int Ressources); void Action_PlayerGetRessources(int Id, int Ressources); void Action_PlayerDie(int Id); void Action_EggHatch(int); void Action_EggBorn(int); void Action_EggDie(int); // Other Function void Update_PlayerInv(int Id, std::vector<int> Inv); void Update_PlayerExpulse(int Id); void Update_NewEgg(int, int, int, int); // System Function void ServerMsg(std::string Msg); void GetTimeServer(); void ModifyTimeServer(); void GameEnd(); // Getters Info Coordonnees GetMapDimension(); const Map &GetMap() const; const Team &GetTeams() const; const int &GetNbTeam() const; protected: Map m_Map; Team m_Team; }; #endif
afdd5f7cbb8614de15952482605420947408b6a4
b9843097033d04c80d1f08a7f942b2cabbb94f97
/parcial1/Unitarias/first.cc
ce17342f8cef0344d74b5738b85f3687c89f7d26
[]
no_license
pablodelamora/calidadYPruebasDeSoftware
4f769dbeaa727a03928d9b3b9d84ebf8cab5856a
a8d1f5041d78c68e1d6f57a77b5cde5b1f9e7efb
refs/heads/master
2021-01-11T23:01:36.901948
2017-02-10T15:39:16
2017-02-10T15:39:16
78,537,066
0
0
null
null
null
null
UTF-8
C++
false
false
273
cc
first.cc
#include <iostream> using namespace std; int factorial(int); int factorial(int n) { if (n<0){ return 0; } else{ int fact; if (n==0) return 1; else{ return n*factorial(n-1); } } }
bcbd1aac38f314edbbfe0f8dee341b7c7a90b717
e8281ca4ab4e1f2ea635dd0d85a5e56e7f469e5b
/TIVS/666-IVS(OpenCV)-GPO/IVS/Inspection_result.cpp
cfae4073e3433758af984dd738cc06bf06946829
[]
no_license
majkyun888/C-Pro
287aaa0ca981e935820384bf55c66e1976d76f93
92482ebc097c904852fbb3128fd9e30689d70ea3
refs/heads/master
2021-08-14T10:18:37.934296
2021-08-11T00:16:01
2021-08-11T00:16:01
208,016,334
0
2
null
null
null
null
UTF-8
C++
false
false
466
cpp
Inspection_result.cpp
#include "StdAfx.h" #include "Inspection_result.h" CInspection_result::CInspection_result(void) { objtype = 0x3CD09AB2; // object type - default is 0x3CD09AB2 - 1020304050 size = 0; // size on disk of file/structure - to be calculated later /* UINT type; // type of image UINT dimx; // horizontal size UINT dimy; // vertical size BYTE* bitmap; // pointer to bitmap */ } CInspection_result::~CInspection_result(void) { }
d6484c5c8b4908f738827d4d77db9c641c2815e1
e0af39217d06d42bcd459eb49c654264057e5089
/app/src/main.cpp
8bf5b44c733ea3390c205255590c6315b99dd5f8
[]
no_license
paulcazeaux/Moire
fddce6d8fe37455a204d108f3c58df0e37d253ac
37eda278f08ecc42022248a6a680b60448068c92
refs/heads/master
2021-01-23T21:10:40.737246
2019-06-10T03:51:38
2019-06-10T03:51:38
90,671,830
1
0
null
null
null
null
UTF-8
C++
false
false
2,483
cpp
main.cpp
/* * File: main.cpp * Author: Paul Cazeaux * * Created on December 20, 2016, 11:43 AM */ #include <Tpetra_Core.hpp> #include "parameters/multilayer.h" #include "bilayer/compute_dos.h" #include "bilayer/compute_conductivity.h" #include <iostream> #include <fstream> static const int dim = 1; static const int degree = 3; int main(int argc, char** argv) { bool verbose = true; try { /*********************************************************/ /* Initialize MPI */ /*********************************************************/ Tpetra::ScopeGuard tpetraScope (&argc, &argv); Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm (); /*********************************************************/ /* Read input file, and initialize params and vars. */ /*********************************************************/ Multilayer<dim, 2> bilayer(argc, argv); /*********************************************************/ /* Run the Chebyshev recurrence and output moments. */ /*********************************************************/ Bilayer::ComputeConductivity<dim,degree,types::DefaultNode> compute_conductivity(bilayer, 250); bool success = compute_conductivity.run(verbose); /*********************************************************/ /* Output to file */ /*********************************************************/ compute_conductivity.write_to_file(); } catch (std::exception &exc) { std::cerr << std::endl << std::endl << "----------------------------------------------------" << std::endl; std::cerr << "Exception on processing: " << std::endl << exc.what() << std::endl << "Aborting!" << std::endl << "----------------------------------------------------" << std::endl; return 1; } catch (...) { std::cerr << std::endl << std::endl << "----------------------------------------------------" << std::endl; std::cerr << "Unknown exception!" << std::endl << "Aborting!" << std::endl << "----------------------------------------------------" << std::endl; return 1; } return 0; }
f230d6378bca7152d175f861119279e77b4c18f0
ffb568806e34199501c4ca6b61ac86ee9cc8de2e
/gflib2/ui/include/gfl2_UI_Device.h
2f63d3fd92137f6056e679a2a96e92108512b1f5
[]
no_license
Fumikage8/gen7-source
433fb475695b2d5ffada25a45999f98419b75b6b
f2f572b8355d043beb468004f5e293b490747953
refs/heads/main
2023-01-06T00:00:14.171807
2020-10-20T18:49:53
2020-10-20T18:49:53
305,500,113
3
1
null
null
null
null
UTF-8
C++
false
false
15,589
h
gfl2_UI_Device.h
//============================================================================= /** * @file gfl2_UI_Device.h * @brief 入力デバイスの抽象クラス * @author obata_toshihiro * @date 2010.10.22 */ //============================================================================= #ifndef __gfl2_UI_DEVICE_H__ #define __gfl2_UI_DEVICE_H__ #pragma once #include <heap/include/gfl2_Heap.h> #include <macro/include/gfl2_Macros.h> #include <util/include/gfl2_std_string.h> #include <ui/include/gfl2_UI_Types.h> namespace gfl2 { namespace ui { class DeviceImplementer; class RepeatTimer; class LogPlayer; class LogRecorder; class Device { GFL_FORBID_COPY_AND_ASSIGN( Device ); public: // 動作フレームレート enum FrameRate { FRAME_RATE_60, FRAME_RATE_30, FRAME_RATE_NUM, }; //----------------------------------------------------------------------- /** * @brief フレームレートを取得する * @return 現在設定されているフレームレート */ //----------------------------------------------------------------------- FrameRate GetFrameRate( void ) const; //----------------------------------------------------------------------- /** * @brief フレームレートを設定する * @param rate 新たに設定するフレームレート */ //----------------------------------------------------------------------- void SetFrameRate( FrameRate rate ); //----------------------------------------------------------------------- /** * @brief 入力の更新タイミングを同期する */ //----------------------------------------------------------------------- void SynchronizeInputUpdate( void ); //----------------------------------------------------------------------- /** * @brief ログを記録するバッファを確保する * * @param heap 使用するヒープ * @param buffer_size バッファのサイズ */ //----------------------------------------------------------------------- void AllocLogBuffer( gfl2::heap::HeapBase* heap, u32 buffer_size ); //----------------------------------------------------------------------- /** * @brief ログを記録するバッファをセットする( バッファの解放は行いません ) * * @param p_buffer バッファ先頭へのポインタ * @param buffer_size バッファのサイズ */ //----------------------------------------------------------------------- void SetLogBuffer( void* p_buffer, u32 buffer_size ); //----------------------------------------------------------------------- /** * @brief ログの採取を開始する */ //----------------------------------------------------------------------- void StartLogRec( void ); //----------------------------------------------------------------------- /** * @brief ログの採取を終了する */ //----------------------------------------------------------------------- void StopLogRec( void ); //----------------------------------------------------------------------- /** * @brief ログの採取中かどうかを調べる * @retval true ログ採取中 * @retval false ログ採取中でない */ //----------------------------------------------------------------------- bool IsLogRecording( void ) const; //----------------------------------------------------------------------- /** * @brief 記録したログのフレーム数を取得する */ //----------------------------------------------------------------------- u32 GetRecordedLogFrameCount( void ) const; //----------------------------------------------------------------------- /** * @brief 記録したログについて, 再生対象のフレーム数を設定する * @param playFrameCount 再生対象とするフレーム数( 負数なら最後まで再生する ) */ //----------------------------------------------------------------------- void SetPlayableLogFrameCount( s32 playFrameCount ); //----------------------------------------------------------------------- /** * @brief ログの再生を開始する */ //----------------------------------------------------------------------- void StartLogPlay( void ); //----------------------------------------------------------------------- /** * @brief ログの再生を終了する */ //----------------------------------------------------------------------- void StopLogPlay( void ); //----------------------------------------------------------------------- /** * @brief ログの再生中かどうかを調べる * @retval true ログ再生中 * @retval false ログ再生中でない */ //----------------------------------------------------------------------- bool IsLogPlaying() const; //----------------------------------------------------------------------- /** * @brief ログのループ再生が有効か? * @retval true ループ再生する * @retval false ループ再生しない */ //----------------------------------------------------------------------- bool IsLogLoopPlayEnable( void ) const; //----------------------------------------------------------------------- /** * @brief ログのループ再生が有効かどうか?設定する * @param isLoopEnable true:ループ再生する, false:ループ再生しない * * @note デフォルト値は false です */ //----------------------------------------------------------------------- void SetLogLoopPlayEnable( bool isLoopEnable ); //------------------------------------------------------------------- /** * @brief ログのバッファを取得 */ //-------------------------------------------------------------------- void* GetLogBuffer( void ) const; //------------------------------------------------------------------- /** * @brief ログの最大バッファサイズを取得 */ //-------------------------------------------------------------------- u32 GetLogBufferMaxSize( void ) const; //-------------------------------------------------------------------- /** * @brief データの記録位置を取得する * * @return データの記録位置 * */ //-------------------------------------------------------------------- u32 GetLogRecPos( void ) const; //-------------------------------------------------------------------- /** * @brief データの記録位置を設定する * * @param recPos データの記録位置 * * @note recPos 以降のデータは失われます */ //-------------------------------------------------------------------- void SetLogRecPos( u32 recPos ); //-------------------------------------------------------------------- /** * @brief データの記録最大位置を取得する * * @return データの記録最大位置 * */ //-------------------------------------------------------------------- u32 GetLogRecMaxPos( void ) const; // リピート検出パラメータ struct RepeatParam { u32 start_wait; // 最初のリピート判定までの待ち時間[frame] u32 interval; // リピート判定の間隔[frame] }; // リピートパラメータのデフォルト値 static const u32 DEFAULT_REPEAT_START_WAIT = 20; static const u32 DEFAULT_REPEAT_INTERVAL = 5; //----------------------------------------------------------------------- /** * @brief リピート入力の検出パラメータをデフォルト値にリセットする */ //----------------------------------------------------------------------- void SetDefaultRepeatParam( void ); //----------------------------------------------------------------------- /** * @brief リピート入力の検出パラメータを設定する * @param param 設定する検出パラメータ */ //----------------------------------------------------------------------- void SetRepeatParam( const RepeatParam& param ); //----------------------------------------------------------------------- /** * @brief リピート入力の検出パラメータを取得する * @param[out] p_param 検出パラメータの格納先 */ //----------------------------------------------------------------------- void GetRepeatParam( RepeatParam* p_param ) const; //----------------------------------------------------------------------- /** * @brief デバイス更新処理 */ //----------------------------------------------------------------------- virtual void UpdateDevice( void ); //----------------------------------------------------------------------- /** * @brief デバイスが稼働状態にあるか? * @retval true デバイスは稼働している * @retval false デバイスは稼働していない */ //----------------------------------------------------------------------- bool IsDeviceRunning( void ) const; //----------------------------------------------------------------------- /** * @brief デバイスの稼働状態を変更する * @param isEnable true:デバイスを稼働する, false:デバイスを停止する * * @note デバイスを停止した場合, 以降, 全ての入力が無効化されます. */ //----------------------------------------------------------------------- void SetDeviceRunningEnable( bool isEnable ); //----------------------------------------------------------------------- /** * @brief デバイス入力値に対する全ての制御の On/Off を切り替える * @param isEnable true:入力値の制御を有効にする, false:入力値の制御を無効にする * * @note isEnable に false を指定した場合, * ( いかなる他のメソッドの影響も受けていない )ハードウェア入力を返します * * @note このメソッドから制御が戻った時点から有効になります */ //----------------------------------------------------------------------- void SetSoftwareControlEnable( bool isEnable ); //----------------------------------------------------------------------- /** * @brief デバイス入力値に対する制御が有効か? * @retval true 入力値に対する制御が有効 * @retval false 入力値に対する制御が無効 */ //----------------------------------------------------------------------- bool IsSoftwareControlEnable( void ) const; #if GFL_DEBUG //---------------------------------------------------------------------------- /** * @brief デバッグキー 無効化設定 */ //----------------------------------------------------------------------------- void SetDebugKeyDisable( bool is_disable ); bool IsDebugKeyDisable( void ) const; #endif // GFL_DEBUG protected: /** * @brief コンストラクタ * @param heap 使用するヒープ * @param implementer 実際に入力の読み取りを行うインスタンス */ Device( gfl2::heap::HeapBase* heap, DeviceImplementer* implementer ); /** * @brief デストラクタ */ virtual ~Device(); /** * @brief 現在の検出データと前回の検出データを比較し, 同じデータが続いているかどうかを調べる * @retval true 前回の検出データと今回の検出データが同じ * @retval false 前回の検出データと今回の検出データが異なる */ virtual bool IsRepeatingSameInput( void ) const; /** * @brief 実効データを蓄積する * @param buffer データの格納先 * @param detective_data 今回の検出データ * @param prev_detective_data 前回の検出データ */ virtual void StoreEffectiveData( void* buffer, const void* detective_data, const void* prev_detective_data ) const = 0; /** * @brief 参照すべき実効データを取得する */ const void* GetRunningEffectiveData( void ) const; DeviceImplementer* m_pImplementer; RepeatTimer* m_pRepeatTimer; LogPlayer* m_pLogPlayer; LogRecorder* m_pLogRecorder; FrameRate m_frameRate; // 動作フレームレート u32 m_frameCount; // フレームカウンタ static u8 m_inputUpdateInterval[ FRAME_RATE_NUM ]; // 各フレームレートに対する, 入力状態の更新間隔 bool m_isRunning; bool m_isSoftwareControlEnable; bool m_isLogRecording; // ログの採取中かどうか bool m_isLogPlaying; // ログの再生中かどうか bool m_isLogLoopPlayEnable; // ログをループ再生するか? void* m_nowDetectiveData; // 現在の検出データ void* m_prevDetectiveData; // 前回の検出データ void* m_effectiveDataBuffer; // 実効データのバッファ void* m_effectiveData; // 実効データ void* m_invalidEffectiveData; // 無効な実効データ void* m_nowRawDetectiveData; // 現在の無加工な検出データ void* m_prevRawDetectiveData; // 前回の無加工な検出データ void* m_rawEffectiveDataBuffer; // 無加工な実効データのフレームレート吸収バッファ void* m_rawEffectiveData; // 無加工な実行データ #if GFL_DEBUG bool mDebugKeyDisable; // デバッグキー無効 #endif private: void UpdateRawEffectiveData( void ); void CopyNowDetectiveData_ToPrevDetectiveData( void ); void UpdateNowDetectiveData_ByLogPlayer( void ); void UpdateNowDetectiveData_ByImplementer( void ); void UpdateEffectiveDataBufferByLastDetectiveData( void ); bool IsOnEffectiveDataUpdateFrame( void ) const; void CopyEffectiveDataBuffer_ToEffectiveData( void ); void ClearEffectiveDataBuffer( void ); }; } // namespace ui } // namespace gfl2 #endif // __gfl2_UI_DEVICE_H__
d6e4d75f398219bc83eb9e4027a5f0cb359f51b7
d3daaf7d05fbc317dfffb04612b713c3a1958566
/scbCompiler/SchemeIncorrectRelay.cpp
17b370719b5ceefd66b2bbb9a596841c798824fc
[]
no_license
DenSamara1978/scbSimulator
6217222e03f32ef009a76f53a75bb91339f5b436
1747afab6243c10c5b25e6c20ceb3c44681e23a6
refs/heads/master
2022-11-19T17:16:09.335568
2020-07-19T16:39:44
2020-07-19T16:39:44
136,173,515
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
223
cpp
SchemeIncorrectRelay.cpp
#include "SchemeIncorrectRelay.h" SchemeIncorrectRelay::~SchemeIncorrectRelay () { } int SchemeIncorrectRelay::fixDescription () { // Нет ошибок завершения описания return 0; }
4078d8c8a4c644ade15e14a6975d691a8cc33fb7
b663192d044bd343c7163516cc9bdc028f1909ae
/include/CrateController.hh
67c961f472728de94aa833e2a3b6e41319488279
[]
no_license
jec429/muonTrackerDAQ
a296b049ba4f734e90312b7373ffbb8c7190967b
bf967b124b4983e4b8320e138b510836736f5e5c
refs/heads/master
2021-06-20T02:26:05.656161
2014-06-24T17:24:10
2014-06-24T17:24:10
100,270,636
0
0
null
null
null
null
UTF-8
C++
false
false
590
hh
CrateController.hh
#include <sys/types.h> #include "Named.hh" #ifndef crate_controller_hh #define crate_controller_hh // singleton class // class CrateController: public Named{ public: static CrateController* GetInstance(); void A32D32_read(u_int32_t, u_int32_t*); void A32D16_read(u_int32_t, u_int16_t*); void A32D16_write(u_int32_t, u_int16_t); void A16D16_write(u_int16_t, u_int16_t); void A16D16_read(u_int16_t, u_int16_t*); void Open(); void Close(); bool IsCrateOpen(); private: CrateController(); virtual ~CrateController(); static CrateController* instance; int f_crate; bool f_isopen; }; #endif
7b4dbd7416de2055f17197b143bc4dd75864ef8c
436cdc81f6d15f5861040dfc500ead7798227039
/Linked List/Palindrome List.cpp
ef5a85f2348ea09069c6bfdeff97ed87b7197069
[]
no_license
Sristi27/DSA-Important-Problems
3920e0b5c949d0ca0c2760789fcff1dd8e8b84a6
f426fbd97e5058f9f73c406662ae186d1483b575
refs/heads/main
2023-09-03T18:53:24.447756
2021-11-14T04:35:40
2021-11-14T04:35:40
362,005,460
5
1
null
null
null
null
UTF-8
C++
false
false
1,145
cpp
Palindrome List.cpp
Palindrome List Given a singly linked list, determine if its a palindrome. Return 1 or 0 denoting if its a palindrome or not, respectively. Notes: Expected solution is linear in time and constant in space. For example, List 1-->2-->1 is a palindrome. List 1-->2-->3 is not a palindrome. /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ ListNode* reverse(ListNode*head) { ListNode*prev=NULL,*curr=head,*next; while(curr!=NULL) { next=curr->next; curr->next=prev; prev=curr; curr=next; } return prev; } int Solution::lPalin(ListNode* A) { //go to the middle of ll ListNode* head=A; ListNode*slow=head,*fast=head->next; while(fast && fast->next) { slow=slow->next; fast=fast->next->next; } ListNode* sec =slow->next; ListNode* second = reverse(sec); slow->next=NULL; while(head && second) { if(head->val!=second->val) return 0; head=head->next; second=second->next; } return 1; }
6fc2ce4ada9acc1f1d0afa89de456dd5fbf7e518
994c0d6399af126e2c4d04f5e35eb756ed514523
/global_view/src/rgbsegmentation.h
d5c5c7e814cc65b4d64fff8aef4ca4d1ad1e2406
[]
no_license
Coldplayplay/qt
253ff30993c6c3f5a025544cf25ae55c192582aa
27fd82130d37863524265856e0351a7f4900b64b
refs/heads/master
2021-10-10T19:43:29.062909
2019-01-16T03:37:41
2019-01-16T03:37:41
111,987,017
0
0
null
null
null
null
UTF-8
C++
false
false
2,726
h
rgbsegmentation.h
#ifndef RGBSEGMENTATION_H #define RGBSEGMENTATION_H #include <iostream> #include <string> #include <QMainWindow> #include <QFileDialog> #include <boost/make_shared.hpp> #include <pcl/point_types.h> #include <pcl/io/pcd_io.h> #include <pcl/io/ply_io.h> #include <pcl/common/common.h> #include <pcl/common/pca.h> #include <pcl/search/search.h> #include <pcl/search/kdtree.h> #include <pcl/filters/filter.h> #include <pcl/filters/passthrough.h> #include <pcl/filters/extract_indices.h> #include <pcl/filters/statistical_outlier_removal.h> #include <pcl/segmentation/region_growing_rgb.h> #include <pcl/visualization/cloud_viewer.h> #include <pcl/visualization/pcl_visualizer.h> #include <vtkRenderWindow.h> using namespace std; using pcl::visualization::PointCloudColorHandlerCustom; using pcl::visualization::PointCloudColorHandlerRGBField; namespace Ui { class RGBSegmentation; } class RGBSegmentation : public QMainWindow { Q_OBJECT public: explicit RGBSegmentation(QWidget *parent = 0); ~RGBSegmentation(); void initial(); void viewPair(); typedef pcl::PointXYZRGB PointT; typedef pcl::PointCloud<PointT> PointCloudT; void pcd2txt(string name, PointCloudT::Ptr cloud); public Q_SLOTS: void loadButtonPressed(); void saveButtonPressed(); void savesinglesButtonPressed(); void savesinglesButtonPressed1(); void checkBox_cubeChanged(int); void showCube(); void spinBox1Changed(int value); void spinBox2Changed(int value); void spinBox3Changed(int value); void spinBox4Changed(int value); void segmentation(); //static filter void updateLabelValue(int value); void valueChanged1(int value); void valueChanged2(int value); void statisticFilter(); //rotate and translation void rSliderValueChanged (int value); void pSliderValueChanged (int value); void ySliderValueChanged (int value); void rotate_UI(); void spinBox_numChanged(int value); protected: PointCloudT::Ptr cloudin; PointCloudT::Ptr temp; PointCloudT::Ptr cloudout; vector <pcl::PointIndices> clusters; boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer; int pre_clusters_num; int v1,v2; int flag; bool show_cube; //PointT min; //PointT max; int DistanceThreshold; int PointColorThreshold; int RegionColorThreshold; int MinClusterSize; QString filenameload; //statis filter int MeanK; double StddevMulThresh; double roll,pitch,yaw;//RPY变量 double x_trans,y_trans,z_trans;//平移变量 int num_dir; private: Ui::RGBSegmentation *ui; }; #endif // RGBSEGMENTATION_H
f7f765d1a19f0ca43745d6c6d71deacb235778b0
2665eba0caab29579d871cd52687f4a19436a069
/code/MiamPlayer/playlists/playlistitemdelegate.h
1c6e1b4d69f5cabf79170eb44ddc460bda2f1a0b
[]
no_license
abctwiq/Madame-Miam-Miam-Music-Player
6b6080ef007cda76ae40497d9c0d0030ec8d01ab
919ad8244709bcc63b84ab1883a2e594f58b888e
refs/heads/master
2021-01-22T01:38:56.034139
2014-03-03T23:57:37
2014-03-03T23:57:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
839
h
playlistitemdelegate.h
#ifndef PLAYLISTITEMDELEGATE_H #define PLAYLISTITEMDELEGATE_H #include <QStyledItemDelegate> #include "stareditor.h" class Playlist; class PlaylistItemDelegate : public QStyledItemDelegate { Q_OBJECT private: Playlist *_playlist; QMap<int, StarEditor*> _editors; public: enum EditMode { Editable, NoStarsYet, ReadOnly }; explicit PlaylistItemDelegate(Playlist *playlist); /** Redefined. */ QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const; /** Redefined. */ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; protected: /** Redefined. */ virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; private slots: void commitAndClose(); }; #endif // PLAYLISTITEMDELEGATE_H
269ff11cc9fcd87dd0bc06439d48c8343dbdaa0a
02c201b1afd2de7f8237adc3737734e19b77cd2b
/src/passes/CodePushing.cpp
65eedba6bac7a20443697ba374c4f7891b2472de
[ "Apache-2.0" ]
permissive
WebAssembly/binaryen
1ce65e58489c99b5a66ab51927a5b218c70ae315
90d8185ba2be34fa6b6a8f8ce0cbb87e0a9ed0da
refs/heads/main
2023-08-31T21:01:27.020148
2023-08-31T19:32:33
2023-08-31T19:32:33
45,208,608
7,061
768
Apache-2.0
2023-09-14T21:41:04
2015-10-29T20:26:28
WebAssembly
UTF-8
C++
false
false
17,796
cpp
CodePushing.cpp
/* * Copyright 2016 WebAssembly Community Group participants * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Pushes code "forward" as much as possible, potentially into // a location behind a condition, where it might not always execute. // #include <ir/effects.h> #include <ir/manipulation.h> #include <pass.h> #include <wasm-builder.h> #include <wasm.h> namespace wasm { // // Analyzers some useful local properties: # of sets and gets, and SFA. // // Single First Assignment (SFA) form: the local has a single local.set, is // not a parameter, and has no local.gets before the local.set in postorder. // This is a much weaker property than SSA, obviously, but together with // our implicit dominance properties in the structured AST is quite useful. // struct LocalAnalyzer : public PostWalker<LocalAnalyzer> { std::vector<bool> sfa; std::vector<Index> numSets; std::vector<Index> numGets; void analyze(Function* func) { auto num = func->getNumLocals(); numSets.clear(); numSets.resize(num); numGets.clear(); numGets.resize(num); sfa.clear(); sfa.resize(num); std::fill(sfa.begin() + func->getNumParams(), sfa.end(), true); walk(func->body); for (Index i = 0; i < num; i++) { if (numSets[i] == 0) { sfa[i] = false; } } } bool isSFA(Index i) { return sfa[i]; } Index getNumGets(Index i) { return numGets[i]; } void visitLocalGet(LocalGet* curr) { if (numSets[curr->index] == 0) { sfa[curr->index] = false; } numGets[curr->index]++; } void visitLocalSet(LocalSet* curr) { numSets[curr->index]++; if (numSets[curr->index] > 1) { sfa[curr->index] = false; } } }; // Implements core optimization logic. Used and then discarded entirely // for each block. class Pusher { ExpressionList& list; LocalAnalyzer& analyzer; std::vector<Index>& numGetsSoFar; PassOptions& passOptions; Module& module; public: Pusher(Block* block, LocalAnalyzer& analyzer, std::vector<Index>& numGetsSoFar, PassOptions& passOptions, Module& module) : list(block->list), analyzer(analyzer), numGetsSoFar(numGetsSoFar), passOptions(passOptions), module(module) { // Find an optimization segment: from the first pushable thing, to the first // point past which we want to push. We then push in that range before // continuing forward. const Index nothing = -1; Index i = 0; Index firstPushable = nothing; while (i < list.size()) { if (firstPushable == nothing && isPushable(list[i])) { firstPushable = i; i++; continue; } if (firstPushable != nothing && isPushPoint(list[i])) { // Optimize this segment, and proceed from where it tells us. First // optimize things into the if, if possible, which does not move the // push point. Then move things past the push point (which has the // relative effect of moving the push point backwards as other things // move forward). optimizeIntoIf(firstPushable, i); // We never need to push past a final element, as we couldn't be used // after it. if (i < list.size() - 1) { i = optimizeSegment(firstPushable, i); } firstPushable = nothing; continue; } i++; } } private: LocalSet* isPushable(Expression* curr) { auto* set = curr->dynCast<LocalSet>(); if (!set) { return nullptr; } auto index = set->index; // To be pushable, this must be SFA and the right # of gets. // // It must also not have side effects, as it may no longer execute after it // is pushed, since it may be behind a condition that ends up false some of // the time. However, removable side effects are ok here. The general // problem with removable effects is that we can only remove them, but not // move them, because of stuff like this: // // if (x != 0) foo(1 / x); // // If we move 1 / x to execute unconditionally then it may trap, but it // would be fine to remove it. This pass does not move code to places where // it might execute more, but *less*: we keep the code behind any conditions // it was already behind, and potentially put it behind further ones. In // effect, we "partially remove" the code, making it not execute some of the // time, which is fine. if (analyzer.isSFA(index) && numGetsSoFar[index] == analyzer.getNumGets(index) && !EffectAnalyzer(passOptions, module, set->value) .hasUnremovableSideEffects()) { return set; } return nullptr; } // Try to push past conditional control flow. // TODO: push into ifs as well bool isPushPoint(Expression* curr) { // look through drops if (auto* drop = curr->dynCast<Drop>()) { curr = drop->value; } if (curr->is<If>() || curr->is<BrOn>()) { return true; } if (auto* br = curr->dynCast<Break>()) { return !!br->condition; } return false; } Index optimizeSegment(Index firstPushable, Index pushPoint) { // The interesting part. Starting at firstPushable, try to push // code past pushPoint. We start at the end since we are pushing // forward, that way we can push later things out of the way // of earlier ones. Once we know all we can push, we push it all // in one pass, keeping the order of the pushables intact. assert(firstPushable != Index(-1) && pushPoint != Index(-1) && firstPushable < pushPoint); // everything that matters if you want to be pushed past the pushPoint EffectAnalyzer cumulativeEffects(passOptions, module); cumulativeEffects.walk(list[pushPoint]); // It is ok to ignore branching out of the block here, that is the crucial // point of this optimization. That is, we are in a situation like this: // // { // x = value; // if (..) break; // foo(x); // } // // If the branch is taken, then that's fine, it will jump out of this block // and reach some outer scope, and in that case we never need x at all // (since we've proven before that x is not used outside of this block, see // numGetsSoFar which we use for that). Similarly, control flow could // transfer away via a return or an exception and that would be ok as well. cumulativeEffects.ignoreControlFlowTransfers(); std::vector<LocalSet*> toPush; Index i = pushPoint - 1; while (1) { auto* pushable = isPushable(list[i]); if (pushable) { const auto& effects = getPushableEffects(pushable); if (cumulativeEffects.invalidates(effects)) { // we can't push this, so further pushables must pass it cumulativeEffects.mergeIn(effects); } else { // we can push this, great! toPush.push_back(pushable); } } else { // something that can't be pushed, so it might block further pushing cumulativeEffects.walk(list[i]); } if (i == firstPushable) { // no point in looking further break; } assert(i > 0); i--; } if (toPush.size() == 0) { // nothing to do, can only continue after the push point return pushPoint + 1; } // we have work to do! Index total = toPush.size(); Index last = total - 1; Index skip = 0; for (Index i = firstPushable; i <= pushPoint; i++) { // we see the first elements at the end of toPush if (skip < total && list[i] == toPush[last - skip]) { // this is one of our elements to push, skip it skip++; } else { if (skip) { list[i - skip] = list[i]; } } } assert(skip == total); // write out the skipped elements for (Index i = 0; i < total; i++) { list[pushPoint - i] = toPush[i]; } // proceed right after the push point, we may push the pushed elements again return pushPoint - total + 1; } // Similar to optimizeSegment, but for the case where the push point is an if, // and we try to push into the if's arms, doing things like this: // // x = op(); // if (..) { // .. // } // => // if (..) { // x = op(); // this moved // .. // } // // This does not move the push point, so it does not have a return value, // unlike optimizeSegment. void optimizeIntoIf(Index firstPushable, Index pushPoint) { assert(firstPushable != Index(-1) && pushPoint != Index(-1) && firstPushable < pushPoint); auto* iff = list[pushPoint]->dynCast<If>(); if (!iff) { return; } // Everything that matters if you want to be pushed past the pushPoint. This // begins with the if condition's effects, as we must always push past // those. Later, we will add to this when we need to. EffectAnalyzer cumulativeEffects(passOptions, module, iff->condition); // See optimizeSegment for why we can ignore control flow transfers here. cumulativeEffects.ignoreControlFlowTransfers(); // Find the effects of the arms, which will affect what can be pushed. EffectAnalyzer ifTrueEffects(passOptions, module, iff->ifTrue); EffectAnalyzer ifFalseEffects(passOptions, module); if (iff->ifFalse) { ifFalseEffects.walk(iff->ifFalse); } // We need to know which locals are used after the if, as that can determine // if we can push or not. EffectAnalyzer postIfEffects(passOptions, module); for (Index i = pushPoint + 1; i < list.size(); i++) { postIfEffects.walk(list[i]); } // Start at the instruction right before the push point, and go back from // there: // // x = op(); // y = op(); // if (..) { // .. // } // // Here we will try to push y first, and then x. Note that if we push y // then we can immediately try to push x after it, as it will remain in // order with x if we do. If we do *not* push y we can still try to push x // but we must move it past y, which means we need to check for interference // between them (which we do by adding y's effects to cumulativeEffects). // // Decrement at the top of the loop for simplicity, so start with i at one // past the first thing we can push (which is right before the push point). Index i = pushPoint; while (1) { if (i == firstPushable) { // We just finished processing the first thing that could be pushed; // stop. break; } assert(i > 0); i--; auto* pushable = isPushable(list[i]); if (pushable && pushable->type == Type::unreachable) { // Don't try to push something unreachable. If we did, then we'd need to // refinalize the block we are moving it from: // // (block $unreachable // (local.set $x (unreachable)) // (if (..) // (.. (local.get $x)) // ) // // The block should not be unreachable if the local.set is moved into // the if arm (the if arm may not execute, so the if itself will not // change type). It is simpler to avoid this complexity and leave this // to DCE to simplify first. // // (Note that the side effect of trapping will normally prevent us from // trying to push something unreachable, but in traps-never-happen mode // we are allowed to ignore that, and so we need this check.) pushable = nullptr; } if (!pushable) { // Something that is staying where it is, so anything we push later must // move past it. Note the effects and continue. cumulativeEffects.walk(list[i]); continue; } auto index = pushable->index; const auto& effects = getPushableEffects(pushable); if (cumulativeEffects.invalidates(effects)) { // This can't be moved forward. Add it to the things that are not // moving. cumulativeEffects.walk(list[i]); continue; } // We only try to push into an arm if the local is used there. If the // local is not used in either arm then we'll want to push it past the // entire if, which is what optimizeSegment handles. // // We can push into the if-true arm if the local cannot be used if we go // through the other arm: // // x = op(); // if (..) { // // we would like to move "x = op()" to here // .. // } else { // use(x); // } // use(x); // // Either of those use(x)s would stop us from moving to if-true arm. // // One specific case we handle is if there is a use after the if but the // arm we don't push into is unreachable. In that case we only get to the // later code after going through the reachable arm, which is ok to push // into: // // x = op(); // if (..) { // // We'll push "x = op()" to here. // use(x); // } else { // return; // } // use(x); auto maybePushInto = [&](Expression*& arm, const Expression* otherArm, EffectAnalyzer& armEffects, const EffectAnalyzer& otherArmEffects) { if (!arm || !armEffects.localsRead.count(index) || otherArmEffects.localsRead.count(index)) { // No arm, or this arm has no read of the index, or the other arm // reads the index. return false; } if (postIfEffects.localsRead.count(index) && (!otherArm || otherArm->type != Type::unreachable)) { // The local is read later, which is bad, and there is no unreachable // in the other arm which as mentioned above is the only thing that // could have made it work out for us. return false; } // We can do it! Push into one of the if's arms, and put a nop where it // used to be. Builder builder(module); auto* block = builder.blockify(arm); arm = block; // TODO: this is quadratic in the number of pushed things ExpressionManipulator::spliceIntoBlock(block, 0, pushable); list[i] = builder.makeNop(); // The code we pushed adds to the effects in that arm. armEffects.walk(pushable); // TODO: After pushing we could recurse and run both this function and // optimizeSegment in that location. For now, leave that to later // cycles of the optimizer, as this case seems rairly rare. return true; }; if (!maybePushInto( iff->ifTrue, iff->ifFalse, ifTrueEffects, ifFalseEffects) && !maybePushInto( iff->ifFalse, iff->ifTrue, ifFalseEffects, ifTrueEffects)) { // We didn't push this anywhere, so further pushables must pass it. cumulativeEffects.mergeIn(effects); } } } const EffectAnalyzer& getPushableEffects(LocalSet* pushable) { auto iter = pushableEffects.find(pushable); if (iter == pushableEffects.end()) { iter = pushableEffects.try_emplace(pushable, passOptions, module, pushable) .first; } return iter->second; } // Pushables may need to be scanned more than once, so cache their effects. std::unordered_map<LocalSet*, EffectAnalyzer> pushableEffects; }; struct CodePushing : public WalkerPass<PostWalker<CodePushing>> { bool isFunctionParallel() override { return true; } std::unique_ptr<Pass> create() override { return std::make_unique<CodePushing>(); } LocalAnalyzer analyzer; // gets seen so far in the main traversal std::vector<Index> numGetsSoFar; void doWalkFunction(Function* func) { // pre-scan to find which vars are sfa, and also count their gets&sets analyzer.analyze(func); // prepare to walk numGetsSoFar.clear(); numGetsSoFar.resize(func->getNumLocals()); // walk and optimize walk(func->body); } void visitLocalGet(LocalGet* curr) { numGetsSoFar[curr->index]++; } void visitBlock(Block* curr) { // Pushing code only makes sense if we are size 2 or above: we need one // element to push and an element to push it into, at minimum. if (curr->list.size() < 2) { return; } // At this point in the postorder traversal we have gone through all our // children. Therefore any variable whose gets seen so far is equal to the // total gets must have no further users after this block. And therefore // when we see an SFA variable defined here, we know it isn't used before it // either, and has just this one assign. So we can push it forward while we // don't hit a non-control-flow ordering invalidation issue, since if this // isn't a loop, it's fine (we're not used outside), and if it is, we hit // the assign before any use (as we can't push it past a use). Pusher pusher(curr, analyzer, numGetsSoFar, getPassOptions(), *getModule()); } }; Pass* createCodePushingPass() { return new CodePushing(); } } // namespace wasm
59840e267ebc2dda4f150cd66db13912ed4fd84c
011d775140c257319bd5e5cc97a24fbc3fec6018
/SumItUp.cpp
f3dbb406506a147bc3edcca4e9a6142adfa393d5
[]
no_license
knapsack7/Programs
6cde6cbb347c99328800f1d96961595b19c2796b
2e94e576cc24968ee65e18fdf7677bcc10b4fee2
refs/heads/master
2020-05-03T14:32:14.387918
2019-06-01T09:43:11
2019-06-01T09:43:11
178,680,285
0
0
null
null
null
null
UTF-8
C++
false
false
948
cpp
SumItUp.cpp
#include<bits/stdc++.h> using namespace std; #define MOD 1000000007 #define pb push_back #define sl(n) scanf("%d",&n) int n=0,target=0; vector<int> inp; int isprinted[16][16][1501]={0}; void print(int *ans,int k){ for(int i=0;i<k;++i) cout<<ans[i]<<" "; cout<<endl; } void sumIt(int j,int pos,int *ans,int target){ if(target<0){ return; } if(isprinted[j][pos][target]==1) return; if(target==0){ //cout<<pos<<endl; print(ans,j); isprinted[j][pos][target]=1; return; } if(pos<n) ans[j]=inp[pos]; else return; sumIt(j+1,pos+1,ans,target-inp[pos]); sumIt(j,pos+1,ans,target); } int main(){ sl(n); int t=0; for(int i=0;i<n;++i){ sl(t); inp.pb(t); } sort(inp.begin(),inp.end()); int ans[n]; sl(target); //for(int i:inp) //cout<<i<<endl; sumIt(0,0,ans,target); return 0; }
25fff0577892d5a05effb2927b1c162b06634876
87f17eecf9da93f6093ecd446a592a6230ae4c97
/SlavsSources/Slavs/SlavsClient/include/PlaceBuildingCGameState.h
257d22f768d19134415cfbf6123b78dac9ec1005
[]
no_license
TraurigeNarr/Slavs
8f842de1316a1416e84deb26425122747bfdc40b
1b22fcf8ce301d325f1e3987fdba1e6aa6ac31f8
refs/heads/master
2021-01-22T21:12:36.824333
2015-03-10T15:14:16
2015-03-10T15:14:16
25,731,908
0
0
null
null
null
null
UTF-8
C++
false
false
1,196
h
PlaceBuildingCGameState.h
#ifndef PlaceBuildingCGameState_h #define PlaceBuildingCGameState_h #include "Application.h" #include "CPlayerController.h" #include "InputSubscriber.h" #include "SelectionBox.h" #include <Game/CommandData.h> #include <OIS.h> #include <OgreSceneNode.h> /* ----------------------------------------------------------------------- This is one of the states of the ClientGameState. It implements selecting position for building. ----------------------------------------------------------------------- */ class PlaceBuildingCGameState : public InputSubscriber { public: PlaceBuildingCGameState(); PlaceBuildingCGameState(Application* owner, CPlayerController* pController); ~PlaceBuildingCGameState(); bool MouseMoved(const OIS::MouseEvent &evt); bool MousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID id); bool MouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID id); bool ButtonPressed(ButtonID id, void* extraData); protected: void GetParameters(); void SendPosition() const; void CreatePlane(); void GoToIdleState() const; Application* m_pOwner; CPlayerController* m_pPlayerController; CommandData* m_pCommandData; Ogre::SceneNode* m_pNode; }; #endif
712fa3cc2e5adb7a489cedc6d96fab21fed94393
20bf3095aa164d0d3431b73ead8a268684f14976
/cpp-labs/S1-9.CPP
b1734d6245dad8908d30d0fd8e30331a221aa25e
[]
no_license
collage-lab/mcalab-cpp
eb5518346f5c3b7c1a96627c621a71cc493de76d
c642f1f009154424f243789014c779b9fc938ce4
refs/heads/master
2021-08-31T10:28:59.517333
2006-11-10T23:57:09
2006-11-10T23:57:21
114,954,399
0
0
null
null
null
null
UTF-8
C++
false
false
218
cpp
S1-9.CPP
#include<iostream.h> #include<conio.h> void main() { int a,i,s=0; clrscr(); for(i=0;i<5;i++) { cout<<"Enter Number["<<i<<"]:-"; cin>>a; s=s+a; } cout<<"\n\nAverage is : "<<(s/5); getch(); }
0df3515499a65434b078640e406ea6a366b3371a
8b7abc4a71a4bfa488aa0f78b181f05bf0e2ca39
/DS/Lab 1/qa1.CPP
e68bd50c4f74b1d43b1c592d6e6075234b1f03b4
[]
no_license
itsnavneetk/sem3
d9a7f37d0466bcd5037f0e81947fe4c53d6270ac
fdef1c43a487660172c3b684e7123c2fe328c3e4
refs/heads/master
2021-01-25T07:44:18.047946
2017-08-03T05:18:08
2017-08-03T05:18:08
93,657,894
0
0
null
null
null
null
UTF-8
C++
false
false
494
cpp
qa1.CPP
#include<iostream4> using namespace std; int main() { int a[3][3],b[3][3]; int c[3][3]; int i,j; cout<<"Enter Matrix A\n"; for(i=0;i<3;i++) for(j=0;j<3;j++) cin>>a[i][j]; cout<<"Enter Matrix B\n"; for(i=0;i<3;i++) for(j=0;j<3;j++) cin>>b[i][j]; cout<<"Matrix C:\n"; for(i=0;i<3;i++) for(j=0;j<3;j++) { if(a[i][j]>=b[i][j]) c[i][j]=a[i][j]; else c[i][j]=b[i][j]; } for(i=0;i<3;i++) { cout<<endl; for(j=0;j<3;j++) { cout<<c[i][j]<<' '; } } }
245d88b90815c1e247b7bf428d81438e4ce54c51
20cf6482b7f5a68bd0029414c02f7ec4747c0c5f
/triton2/server/loginserver/erating/EProtocol/AGIPPromoterUserList.cpp
7943219ae343a1269d22f0372a1ba71a0751db88
[]
no_license
kensniper/triton2
732907c76c001b2454e08ca81ad72ace45625f6c
7ad2a359e85df85be9d87010047a198980c121ae
refs/heads/master
2023-03-23T02:20:56.487117
2017-02-26T00:00:59
2017-02-26T00:00:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,076
cpp
AGIPPromoterUserList.cpp
#include "AGIPPromoterUserList.h" // AGIPPromoterUserList AGIPPromoterUserList::AGIPPromoterUserList(void) : SysProtocol(AGIP_CURRENT_VERSION, CMD_PROMOTER_USER_LIST, sizeof(SAGIPPromoterUserList)) { m_data = (SAGIPPromoterUserList*)m_pucPDU; } AGIPPromoterUserList::~AGIPPromoterUserList(void) { } uint16_t AGIPPromoterUserList::getGameID(void) const { return ntohs(m_data->us_Game_ID); } void AGIPPromoterUserList::setGameID(const uint16_t usGameID) { m_data->us_Game_ID = htons(usGameID); return; } uint32_t AGIPPromoterUserList::getGatewayID(void) const { return ntohl(m_data->un_Gateway_ID); } void AGIPPromoterUserList::setGatewayID(const uint32_t unGatewayID) { m_data->un_Gateway_ID = htonl(unGatewayID); return; } uint32_t AGIPPromoterUserList::getUserID(void) const { return ntohl(m_data->un_User_ID); } int32_t AGIPPromoterUserList::setUserID(const uint32_t unUserID) { m_data->un_User_ID = htonl(unUserID); return S_SUCCESS; } int32_t AGIPPromoterUserList::showInfo() { SysProtocol::showInfo(); printf("--------------------------------------------------------AGIPPromoterUserList\n"); printf("User_ID : %u\n", getUserID()); printf("--------------------------------------------------------AGIPPromoterUserList\n"); return S_SUCCESS; } // AGIPPromoterUserListRes AGIPPromoterUserListRes::AGIPPromoterUserListRes(void) : SysProtocol( AGIP_CURRENT_VERSION, CMD_PROMOTER_USER_LIST_RES, sizeof(SAGIPPromoterUserListRes) - sizeof(PROMOTER_USER_INFO) ) { m_data = (SAGIPPromoterUserListRes*)m_pucPDU; } AGIPPromoterUserListRes::~AGIPPromoterUserListRes(void) { } int32_t AGIPPromoterUserListRes::initialize() { int32_t nRetCode = E_ERROR; m_usTotalLength = sizeof(SAGIPPromoterUserListRes) - sizeof(PROMOTER_USER_INFO); nRetCode = SysProtocol::initialize(); ASSERT(nRetCode == S_SUCCESS); return S_SUCCESS; } int32_t AGIPPromoterUserListRes::getResultCode(void) const { return ntohl(m_data->n_Result_Code); } int32_t AGIPPromoterUserListRes::setResultCode(const int32_t nResultCode) { m_data->n_Result_Code = htonl(nResultCode); return S_SUCCESS; } int32_t AGIPPromoterUserListRes::getAllUserCount(void) const { return ntohl(m_data->n_All_User_Count); } int32_t AGIPPromoterUserListRes::setAllUserCount(const int32_t nAllUserCount) { m_data->n_All_User_Count = htonl(nAllUserCount); return S_SUCCESS; } int32_t AGIPPromoterUserListRes::getUserCount(void) const { return ntohl(m_data->n_User_Count); } int32_t AGIPPromoterUserListRes::getUserInfo( int32_t nIndex, PROMOTER_USER_INFO& userInfo ) const { int32_t nResult = E_PDU_INVALID_FIELD; int32_t nUserCount = 0; nUserCount = ntohl(m_data->n_User_Count); if ((nIndex < 0) || (nIndex >= nUserCount) || (nIndex >= AGIPPromoterUserListRes::MAX_USER_COUNT)) { goto ExitError; } { PROMOTER_USER_INFO *pUserInfoBuffer = (PROMOTER_USER_INFO*)(&m_data->str_User_Name); pUserInfoBuffer += nIndex; memcpy(userInfo.str_User_Name, pUserInfoBuffer->str_User_Name, AGIP_USER_NAME_LEN); } nResult = S_SUCCESS; ExitError: return nResult; } int32_t AGIPPromoterUserListRes::addUserInfo(const PROMOTER_USER_INFO& userInfo) { int32_t nResult = E_PDU_INVALID_FIELD; int32_t nUserCount = getUserCount(); if ((nUserCount < 0) || (nUserCount >= AGIPPromoterUserListRes::MAX_USER_COUNT)) { goto ExitError; } { PROMOTER_USER_INFO *pUserInfoBuffer = (PROMOTER_USER_INFO *)(&m_data->str_User_Name); pUserInfoBuffer += nUserCount; memcpy(pUserInfoBuffer->str_User_Name, userInfo.str_User_Name, AGIP_USER_NAME_LEN); } nUserCount++; m_data->n_User_Count = htonl(nUserCount); m_usTotalLength += sizeof(PROMOTER_USER_INFO); this->setTotalLength(m_usTotalLength); nResult = S_SUCCESS; ExitError: return nResult; } int32_t AGIPPromoterUserListRes::showInfo() { PROMOTER_USER_INFO userInfo; char strUserName[AGIP_USER_NAME_LEN + 1] = {0}; SysProtocol::showInfo(); printf("--------------------------------------------------------AGIPPromoterUserListRes\n"); printf("Result_Code : %d\n", getResultCode()); printf("All_User_Count: %d\n", getAllUserCount()); printf("User_Count : %d\n", getUserCount()); for (int32_t i = 0; i < getUserCount(); i++) { if (S_SUCCESS == getUserInfo(i, userInfo)) { memcpy(strUserName, userInfo.str_User_Name, AGIP_USER_NAME_LEN); strUserName[AGIP_USER_NAME_LEN] = '\0'; printf( "User[%02d] : " " User_Name=%s", i + 1, strUserName); } else { break; } } printf("--------------------------------------------------------AGIPPromoterUserListRes\n"); return S_SUCCESS; }
aca83e0c285bf351da47fc02300c9ee83aa68339
fe5aa130b39392d62957641e101583c00fff33e8
/ecclesia/magent/lib/event_reader/mced_reader_test.cc
aac9859c83e4817f73e6bfef52a0bc708aaf4775
[ "Apache-2.0" ]
permissive
isabella232/ecclesia-machine-management
e7075cb5813e7fae234da8b97ee381435add1e34
06a73465e0a3dc80ebf1b4702d80ec4b4c74e8d2
refs/heads/master
2023-08-24T09:52:14.475682
2021-10-20T02:10:51
2021-10-20T02:11:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,432
cc
mced_reader_test.cc
/* * Copyright 2020 Google LLC * * 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 "ecclesia/magent/lib/event_reader/mced_reader.h" #include <sys/socket.h> #include <cstdio> #include <cstring> #include <optional> #include <string> #include <variant> #include "gmock/gmock.h" #include "gtest/gtest.h" #include "absl/time/clock.h" #include "absl/time/time.h" #include "ecclesia/magent/lib/event_reader/event_reader.h" namespace ecclesia { namespace { using ::testing::_; using ::testing::Return; using ::testing::ReturnNull; using ::testing::StrictMock; class TestMcedaemonSocket : public McedaemonSocketInterface { public: MOCK_METHOD(int, CallSocket, (int domain, int type, int protocol)); MOCK_METHOD(FILE *, CallFdopen, (int fd, const char *mode)); MOCK_METHOD(char *, CallFgets, (char *s, int size, FILE *stream)); MOCK_METHOD(int, CallFclose, (FILE * stream)); MOCK_METHOD(int, CallConnect, (int sockfd, const struct sockaddr *addr, socklen_t addrlen)); MOCK_METHOD(int, CallClose, (int fd)); }; ACTION_P(ReadString, val) { return strncpy(arg0, val, 1024); } TEST(McedaemonReaderTest, SocketFailure) { StrictMock<TestMcedaemonSocket> test_socket; EXPECT_CALL(test_socket, CallSocket(_, _, _)).WillRepeatedly(Return(-1)); McedaemonReader mced_reader("dummy_socket", &test_socket); // Wait for the reader loop to start fetching the mces absl::SleepFor(absl::Seconds(5)); EXPECT_FALSE(mced_reader.ReadEvent()); } TEST(McedaemonReaderTest, ReadFailure) { StrictMock<TestMcedaemonSocket> test_socket; int fake_fd = 1; FILE *fake_file = reinterpret_cast<FILE *>(2); EXPECT_CALL(test_socket, CallSocket(_, _, _)).WillRepeatedly(Return(fake_fd)); EXPECT_CALL(test_socket, CallConnect(fake_fd, _, _)) .WillRepeatedly(Return(0)); EXPECT_CALL(test_socket, CallFdopen(fake_fd, _)) .WillRepeatedly(Return(fake_file)); EXPECT_CALL(test_socket, CallFgets(_, _, fake_file)) .WillRepeatedly(ReturnNull()); EXPECT_CALL(test_socket, CallFclose(fake_file)).WillRepeatedly(Return(0)); McedaemonReader mced_reader("dummy_socket", &test_socket); // Wait for the reader loop to start fetching the mces absl::SleepFor(absl::Seconds(5)); EXPECT_FALSE(mced_reader.ReadEvent()); } TEST(McedaemonReaderTest, ReadSuccess) { ::testing::InSequence s; StrictMock<TestMcedaemonSocket> test_socket; int fake_fd = 1; FILE *fake_file = reinterpret_cast<FILE *>(2); EXPECT_CALL(test_socket, CallSocket(_, _, _)).WillRepeatedly(Return(fake_fd)); EXPECT_CALL(test_socket, CallConnect(fake_fd, _, _)).WillOnce(Return(0)); EXPECT_CALL(test_socket, CallFdopen(fake_fd, _)).WillOnce(Return(fake_file)); std::string mced_string = "%B=-9 %c=4 %S=3 %p=0x00000004 %v=2 %A=0x00830f00 %b=12 %s=0x1234567890 " "%a=0x876543210 %m=0x1111111122222222 %y=0x000000004a000142 " "%i=0x00000018013b1700 %g=0x0000000012059349 %G=0x40248739 " "%t=0x0000000000000004 %T=0x0000000004000000 %C=0x0020 " "%I=0x00000032413312da\n"; EXPECT_CALL(test_socket, CallFgets(_, _, fake_file)) .WillOnce(ReadString(mced_string.c_str())) .WillRepeatedly(Return(nullptr)); EXPECT_CALL(test_socket, CallFclose(fake_file)).WillOnce(Return(0)); McedaemonReader mced_reader("dummy_socket", &test_socket); absl::SleepFor(absl::Seconds(5)); auto mce_record = mced_reader.ReadEvent(); ASSERT_TRUE(mce_record); MachineCheck expected{.mci_status = 0x1234567890, .mci_address = 0x876543210, .mci_misc = 0x1111111122222222, .mcg_status = 0x12059349, .tsc = 0x4000000, .time = absl::FromUnixMicros(4), .ip = 0x32413312da, .boot = -9, .cpu = 4, .cpuid_eax = 0x00830f00, .init_apic_id = 0x4, .socket = 3, .mcg_cap = 0x40248739, .cs = 0x20, .bank = 12, .vendor = 2}; MachineCheck mce = std::get<MachineCheck>(mce_record.value().record); EXPECT_EQ(mce.mci_status, expected.mci_status); EXPECT_EQ(mce.mci_address, expected.mci_address); EXPECT_EQ(mce.mci_misc, expected.mci_misc); EXPECT_EQ(mce.mcg_status, expected.mcg_status); EXPECT_EQ(mce.tsc, expected.tsc); EXPECT_EQ(mce.time, expected.time); EXPECT_EQ(mce.ip, expected.ip); EXPECT_EQ(mce.boot, expected.boot); EXPECT_EQ(mce.cpu, expected.cpu); EXPECT_EQ(mce.cpuid_eax, expected.cpuid_eax); EXPECT_EQ(mce.init_apic_id, expected.init_apic_id); EXPECT_EQ(mce.socket, expected.socket); EXPECT_EQ(mce.mcg_cap, expected.mcg_cap); EXPECT_EQ(mce.cs, expected.cs); EXPECT_EQ(mce.bank, expected.bank); EXPECT_EQ(mce.vendor, expected.vendor); } } // namespace } // namespace ecclesia
eafc9b3bc39016532a4575e46948e84fc94c8e4c
4707a512ae36540b4b71a749d491aaa0042c33fa
/Src/panel/RA8875.h
4dab7345ad270f4dd02b7c7c2ec75e10f129c55d
[]
no_license
wolfmanjm/TouchScreenDemo
292660e8f8e9dbe94f2a091ea6b76d497a75b6ab
a050fff02f8068f9acdf6240d75092b9abf195f9
refs/heads/master
2021-01-23T03:13:25.983800
2015-07-13T00:42:28
2015-07-13T00:42:28
38,983,573
0
1
null
null
null
null
UTF-8
C++
false
false
13,306
h
RA8875.h
/* Modified to run on STM32L100, taken from https://github.com/sumotoy/RA8875 originall written by: Max MC Costa for s.u.m.o.t.o.y Thi sversion is stripped down to the bare minimum tro run on the STM32L100 Discovery board ------------------------------------------------------------------------------------- >>>>>>>>>>>> About Copyrights <<<<<<<<<<<<<<< ------------------------------------------------------------------------------------- Even if similar to Adafruit_RA8875 in some parts this library was builded originated (as the Adafruit one) from the application note and datasheet from RAiO, however I spent quite a lot of time to improve and bring to life all features so if you clone, copy or modify please leave all my original notes intact! connections... 1,2 Gnd 3,4 Vdd 5 PA4 ------> CS 8 PA5 ------> SCK 6 PA6 ------> MISO 7 PA7 ------> MOSI ------------------------------------------------------------------------------------- */ #ifndef _RA8875MC_H_ #define _RA8875MC_H_ #define byte uint8_t /* ---------------------------- USER SETTINGS ---------------------*/ /* INTERNAL KEY MATRIX ++++++++++++++++++++++++++++++++++++++++++ RA8875 has a 5x6 Key Matrix controller onboard, if you are not plan to use it better leave commented the following define since it will share some registers with several functions, otherwise de-comment it! */ //#define USE_RA8875_KEYMATRIX /* DEFAULT CURSOR BLINK RATE ++++++++++++++++++++++++++++++++++++++++++++ Nothing special here, you can set the default blink rate */ #define DEFAULTCURSORBLINKRATE 10 /* DEFAULT INTERNAL FONT ENCODING ++++++++++++++++++++++++++++++++++++++++++++ RA8875 has 4 different font set, same shape but suitable for most languages please look at RA8875 datasheet and choose the correct one for your language! The default one it's the most common one and should work in most situations */ #define DEFAULTINTENCODING ISO_IEC_8859_1//ISO_IEC_8859_2,ISO_IEC_8859_3,ISO_IEC_8859_4 /* ----------------------------DO NOT TOUCH ANITHING FROM HERE ------------------------*/ #include <stdint.h> #include <cstddef> #include <string.h> #include "_utility/RA8875Registers.h" #include "stm32l1xx_hal.h" // Colors (RGB565) #define RA8875_BLACK 0x0000 #define RA8875_BLUE 0x001F #define RA8875_RED 0xF800 #define RA8875_GREEN 0x07E0 #define RA8875_CYAN 0x07FF #define RA8875_MAGENTA 0xF81F #define RA8875_YELLOW 0xFFE0 #define RA8875_WHITE 0xFFFF enum RA8875sizes { RA8875_320x240, RA8875_480x272, RA8875_800x480, Adafruit_480x272, Adafruit_800x480,RA8875_640x480 }; enum RA8875modes { GRAPHIC,TEXT }; enum RA8875tcursor { NORMAL,BLINK }; enum RA8875tsize { X16,X24,X32 }; enum RA8875fontSource { INT, EXT }; enum RA8875fontCoding { ISO_IEC_8859_1, ISO_IEC_8859_2, ISO_IEC_8859_3, ISO_IEC_8859_4 }; enum RA8875extRomType { GT21L16T1W, GT21H16T1W, GT23L16U2W, GT30H24T3Y, GT23L24T3Y, GT23L24M1Z, GT23L32S4W, GT30H32S4W, ER3303_1 }; enum RA8875extRomCoding { GB2312, GB12345, BIG5, UNICODE, ASCII, UNIJIS, JIS0208, LATIN }; enum RA8875extRomFamily { STANDARD, ARIAL, ROMAN, BOLD }; enum RA8875boolean { LAYER1, LAYER2, TRANSPARENT, LIGHTEN, OR, AND, FLOATING };//for LTPR0 enum RA8875writes { L1, L2, CGRAM, PATTERN, CURSOR };//TESTING class RA8875 { public: //------------- Instance ------------------------- RA8875(SPI_HandleTypeDef*, GPIO_TypeDef*, uint16_t); //------------- Setup ------------------------- void begin(const enum RA8875sizes s); //------------- Hardware related ------------------------- void softReset(void); void displayOn(bool on); void sleep(bool sleep); void brightness(uint8_t val);//ok void changeMode(enum RA8875modes m);//GRAPHIC,TEXT uint8_t readStatus(void); void clearMemory(bool full); void scanDirection(bool invertH,bool invertV); //--------------area & color ------------------------- void setActiveWindow(uint16_t XL,uint16_t XR ,uint16_t YT ,uint16_t YB); uint16_t width(void); uint16_t height(void); void setForegroundColor(uint16_t color); void setForegroundColor(uint8_t R,uint8_t G,uint8_t B); void setBackgroundColor(uint16_t color); void setBackgroundColor(uint8_t R,uint8_t G,uint8_t B); void setTrasparentColor(uint16_t color); void setTrasparentColor(uint8_t R,uint8_t G,uint8_t B); //--------------Text functions ------------------------- //----------cursor stuff................ //to calculate max column. (screenWidth/fontWidth)-1 //to calculate max row. (screenHeight/fontHeight)-1 void showCursor(bool cur,enum RA8875tcursor c=BLINK);//show text cursor, select cursor typ (NORMAL,BLINK) void setCursorBlinkRate(uint8_t rate);//0...255 0:faster void setCursor(uint16_t x, uint16_t y); void getCursor(uint16_t *x, uint16_t *y);//update the library _cursorX,_cursorY internally //and get the current data, this is useful sometime because the chip track cursor internally only void setTextColor(uint16_t fColor, uint16_t bColor); void setTextColor(uint16_t fColor);//transparent background void uploadUserChar(const uint8_t symbol[],uint8_t address); void showUserChar(uint8_t symbolAddrs,uint8_t wide=0);//0...255 void setFontScale(uint8_t scale);//0..3 void setFontSize(enum RA8875tsize ts,bool halfSize=false);//X16,X24,X32 void setFontSpacing(uint8_t spc);//0:disabled ... 63:pix max void setFontRotate(bool rot);//true = 90 degrees void setFontInterline(uint8_t pix);//0...63 pix void setFontFullAlign(bool align);//mmmm... doesn't do nothing! Have to investigate //----------Font Selection and related.............................. void setExternalFontRom(enum RA8875extRomType ert, enum RA8875extRomCoding erc,enum RA8875extRomFamily erf=STANDARD); void setFont(enum RA8875fontSource s);//INT,EXT (if you have a chip installed) void setIntFontCoding(enum RA8875fontCoding f); void setExtFontFamily(enum RA8875extRomFamily erf,bool setReg=true); //--------------Graphic Funcions ------------------------- void setXY(int16_t x, int16_t y);//graphic set location void setX(uint16_t x); void setY(uint16_t y) ; void setGraphicCursor(uint8_t cur);//0...7 Select a custom graphic cursor (you should upload first) void showGraphicCursor(bool cur);//show graphic cursor //--------------- DRAW ------------------------- //void pushPixels(uint32_t num, uint16_t p);//push large number of pixels //void fillRect(void); void drawPixel(int16_t x, int16_t y, uint16_t color); void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); void fillScreen(uint16_t color); void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color); void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color); void fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color); void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); void drawEllipse(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint16_t color); void fillEllipse(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint16_t color); void drawCurve(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color); void fillCurve(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color); void drawRoundRect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color); void fillRoundRect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color); //--------------- SCROLL ---------------------------------------- void setScrollWindow(int16_t XL,int16_t XR ,int16_t YT ,int16_t YB); void scroll(uint16_t x,uint16_t y); //-------------- DMA ------------------------------- void drawFlashImage(int16_t x,int16_t y,int16_t w,int16_t h,uint8_t picnum); //-------------- BTE -------------------------------------------- void BTE_size(uint16_t w, uint16_t h); void BTE_source(uint16_t SX,uint16_t DX ,uint16_t SY ,uint16_t DY); void BTE_ROP_code(unsigned char setx);//TESTING void BTE_enable(void);//TESTING //-------------- LAYERS ----------------------------------------- bool useLayers(bool on); void writeTo(enum RA8875writes d);//TESTING void layerEffect(enum RA8875boolean efx); void layerTransparency(uint8_t layer1,uint8_t layer2); //--------------GPIO & PWM ------------------------- void GPIOX(bool on); void PWMout(uint8_t pw,uint8_t p);//1:backlight, 2:free //---------------------------------------------------- //thanks to Adafruit for this! inline uint16_t Color565(uint8_t r,uint8_t g,uint8_t b) { return ((b & 0xF8) << 8) | ((g & 0xFC) << 3) | (r >> 3); } void writeCommand(uint8_t d); //void writeData(uint8_t data); void writeData16(uint16_t data); //void waitBusy(uint8_t res=0x80);//0x80, 0x40(BTE busy), 0x01(DMA busy) //--------------Text Write ------------------------- int printf(const char* format, ...); void print(const char* str) { textWrite(str, strlen(str)); }; void println(const char* str) { print(str); print("\r\n"); }; private: //------------- VARS ---------------------------- //---------------------------------------- uint16_t _width, _height; uint16_t _cursorX, _cursorY; //try to internally track text cursor... uint8_t _textScale; bool _textWrap; uint8_t _fontSpacing; bool _fontFullAlig; bool _fontRotation; bool _extFontRom; uint8_t _fontInterline; enum RA8875extRomFamily _fontFamily; enum RA8875extRomType _fontRomType; enum RA8875extRomCoding _fontRomCoding; enum RA8875tsize _textSize; enum RA8875modes _currentMode; enum RA8875sizes _size; enum RA8875fontSource _fontSource; enum RA8875tcursor _textCursorStyle; //layer vars ----------------------------- uint8_t _maxLayers; bool _useMultiLayers; uint8_t _currentLayer; //scroll vars ---------------------------- int16_t _scrollXL,_scrollXR,_scrollYT,_scrollYB; // functions -------------------------- void initialize(uint8_t initIndex); void textWrite(const char* buffer, uint16_t len=0);//thanks to Paul Stoffregen for the initial version of this one void PWMsetup(uint8_t pw,bool on, uint8_t clock); // helpers----------------------------- void checkLimitsHelper(int16_t &x,int16_t &y);//RA8875 it's prone to freeze with values out of range void circleHelper(int16_t x0, int16_t y0, int16_t r, uint16_t color, bool filled); void rectHelper (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color, bool filled); void triangleHelper(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color, bool filled); void ellipseHelper(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint16_t color, bool filled); void curveHelper(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color, bool filled); void lineAddressing(int16_t x0, int16_t y0, int16_t x1, int16_t y1); void curveAddressing(int16_t x0, int16_t y0, int16_t x1, int16_t y1); void roundRectHelper(int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color, bool filled); void DMA_blockModeSize(int16_t BWR,int16_t BHR,int16_t SPWR); void DMA_startAddress(unsigned long adrs); //--------------------------------------------------------- // Low level access commands ---------------------- void writeReg(uint8_t reg, uint8_t val); uint8_t readReg(uint8_t reg); //void writeCommand(uint8_t d); void writeData(uint8_t data); void writeBlock(uint8_t *data, int len); void writeCommandData(uint8_t c, uint8_t d); //void writeData16(uint16_t data); uint8_t readData(bool stat=false); void setMultipleRegisters(uint8_t reg[], uint8_t data[], uint8_t len); bool waitPoll(uint8_t r, uint8_t f);//from adafruit void waitBusy(uint8_t res=0x80);//0x80, 0x40(BTE busy), 0x01(DMA busy) void startSend(); void endSend(); uint8_t SPItranfer(uint8_t data); bool _rst; // set to true if using H/W reset otherwise does soft reset // Register containers ----------------------------------------- uint8_t _MWCR0Reg; //keep track of the register [0x40] uint8_t _DPCRReg; ////Display Configuration [0x20] uint8_t _FNCR0Reg; //Font Control Register 0 [0x21] uint8_t _FNCR1Reg; //Font Control Register1 [0x22] uint8_t _FWTSETReg; //Font Write Type Setting Register [0x2E] uint8_t _SFRSETReg; //Serial Font ROM Setting [0x2F] uint8_t _TPCR0Reg; //Touch Panel Control Register 0 [0x70] uint8_t _INTC1Reg; //Interrupt Control Register1 [0xF0] // HAL specific stuff SPI_HandleTypeDef *hspi; GPIO_TypeDef* cs_port; uint16_t cs_pin; }; #endif
a8c5290405e159d6bde89ec3274d14c7667bd7d6
0ced2f768c17b66c1972ed7a818d0a5919d3bd8e
/unda/src/utils/Utils.cpp
f95d8db018b9d01f075affb2b67cdaefe24afa69
[ "MIT" ]
permissive
MattXV/marching-cubes-acoustic-rendering
5170f2e63f7c730e83c7f9c1982d54f3b7e503db
2acdafee013ff6982fe56885121d0dc14c98812f
refs/heads/master
2023-09-03T08:07:14.302985
2021-11-05T14:03:24
2021-11-05T14:03:24
424,965,434
0
0
null
null
null
null
UTF-8
C++
false
false
3,895
cpp
Utils.cpp
#include "Utils.h" std::string unda::utils::ReadTextFile(const std::string& path) { std::ifstream shaderFile(path); std::stringstream shaderSource; std::string line; if (shaderFile.is_open()) { while (std::getline(shaderFile, line)) { shaderSource << line << std::endl; } shaderFile.close(); } else { printf("[ERROR] Could not open file: %s \n", path.c_str()); } return shaderSource.str(); } std::string unda::utils::StemFileName(const std::string& fileName) { const rsize_t pos = fileName.find_last_of('.'); std::string stem = fileName.substr(0, pos); return stem; } void unda::utils::printShaderError(int shaderLocation) { int logLength; glGetShaderiv(shaderLocation, GL_INFO_LOG_LENGTH, &logLength); char* errorMessage = new char[(long long)logLength + 1]; glGetShaderInfoLog(shaderLocation, logLength, &logLength, &errorMessage[0]); std::cout << "[GLSL Error]: Could not compile shader." << std::endl; std::cout << errorMessage << std::endl; delete[] errorMessage; } unda::utils::PlyParser::PlyParser(const std::string& plyPath) { std::ifstream file; std::stringstream fileStream; std::string line; file.open(plyPath); for (int i = 0; i < 100; i++) { std::getline(fileStream, line); std::cout << line << std::endl; } std::string delimiter = " "; if (file.is_open()) while (std::getline(fileStream, line)) { if (line.find("ply") == std::string::npos && !line.empty()) { std::cerr << "Error parsing PLY!, Header doesn't seem to start with 'ply'..." << std::endl; file.close(); return; } while (std::getline(fileStream, line) || line.find("end_header") == std::string::npos) { if (line.find("element") != std::string::npos) { line.erase(0, line.find(delimiter) + delimiter.length()); if (line.find("vertex") != std::string::npos) { line.erase(0, line.find(delimiter) + delimiter.length()); numVertices = (unsigned int)std::stoi(line); } } } } else { printf("[ERROR] Could not open file: %s \n", plyPath.c_str()); } if (numVertices == 0) { std::cerr << "Error parsing PLY!, Could not find 'element vertex'..." << std::endl; } } std::vector<std::array<float, 3>> unda::utils::PlyParser::parseVertices() { std::vector<std::array<float, 3>> vertices; std::ifstream file; std::stringstream fileStream; std::string line; std::string delimiter = " ", token; size_t pos = 0; size_t lastNumElements = 0; if (file.is_open()) { while (std::getline(fileStream, line) || line.find("end_header") == std::string::npos); while (std::getline(fileStream, line)) { size_t NumElements = line.rfind(delimiter); if (lastNumElements != 0) if ((NumElements != lastNumElements)) break; std::array<float, 3U> vertex = { 0.0f, 0.0f, 0.0f }; for (int i = 0; i < 3; i++) { pos = line.find(delimiter); float vertexValue = std::stof(line.substr(0, pos)); vertex[i] = vertexValue; line.erase(0, pos + delimiter.length()); } vertices.push_back(vertex); } } else { printf("[ERROR] Could not open file: %s \n", path.c_str()); } return vertices; } void unda::utils::Timer::start() { t1 = std::chrono::high_resolution_clock::now(); } void unda::utils::Timer::stop() { auto t2 = std::chrono::high_resolution_clock::now(); auto milliSeconds = std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1); std::ofstream logFile; logFile.open(logName); if (logFile.is_open()) { logFile << "Operation,Duration(ms),Info" << std::endl; logFile << procedure + "," + std::to_string(milliSeconds.count()) + "," + info << std::endl; logFile.close(); } else { UNDA_ERROR("Could not open file: " + logName); } UNDA_LOG_MESSAGE(procedure + std::to_string(milliSeconds.count())); }
57fbe4a2a7cee3b75c1a94aca0044f4d5106e207
0a7c107400674da1437fe7f11ab57743700dff3b
/source/CIJoinMenu.h
bf98cf7293dac53116b9ec856f655f12195ec5b6
[]
no_license
parhelia512/core-impact
e74e45a3a34db2ae4a3fad047915f6b98e8e3f4b
40768a156a376e746678f54ecd2a07437d9ec9b9
refs/heads/main
2023-05-09T08:42:00.590853
2021-05-24T17:06:58
2021-05-24T17:06:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,810
h
CIJoinMenu.h
// // CIJoinMenu.h // CoreImpact // // Created by Richard Yoon on 4/5/21. // Copyright © 2021 Game Design Initiative at Cornell. All rights reserved. // #ifndef __CI_JOIN_MENU_H__ #define __CI_JOIN_MENU_H__ #include <cugl/cugl.h> #include "CIMenuState.h" #include "CIGameSettings.h" #include "CIGameConstants.h" /** * Model class representing the Join Game menu scene. * * The scene contains a game room id input to specify the room to join along * with the join game button to trigger switch to Game Lobby. Back button * is not included in this class (in parent MenuScene class). * * The screen is set-up and put on-display on states transitioning into JoinRoom * state. Similarly, screen is taken-down and hidden from display on states * transitioning out of JoinRoom state. */ class JoinMenu { private: /** Menu state for the upcoming frame */ MenuState _nextState; /** Reference to the game settings */ std::shared_ptr<GameSettings> _gameSettings; // Asset references /** Reference to the node for the group representing this menu scene */ std::shared_ptr<cugl::scene2::SceneNode> _layer; // 5 digit room id std::vector<string> _roomIds; /** Room Ids Index */ int _roomInd; /** Reference to the 1st room id label node */ std::shared_ptr<cugl::scene2::SceneNode> _roomIdLabelNode1; /** Reference to the 2nd room id label node */ std::shared_ptr<cugl::scene2::SceneNode> _roomIdLabelNode2; /** Reference to the 3rd room id label node */ std::shared_ptr<cugl::scene2::SceneNode> _roomIdLabelNode3; /** Reference to the 4th room id label node */ std::shared_ptr<cugl::scene2::SceneNode> _roomIdLabelNode4; /** Reference to the 5th room id label node */ std::shared_ptr<cugl::scene2::SceneNode> _roomIdLabelNode5; /** Reference to the 1st room id label */ std::shared_ptr<cugl::scene2::Label> _roomIdLabel1; /** Reference to the 2nd room id label */ std::shared_ptr<cugl::scene2::Label> _roomIdLabel2; /** Reference to the 3rd room id label */ std::shared_ptr<cugl::scene2::Label> _roomIdLabel3; /** Reference to the 4th room id label */ std::shared_ptr<cugl::scene2::Label> _roomIdLabel4; /** Reference to the 5th room id label */ std::shared_ptr<cugl::scene2::Label> _roomIdLabel5; // number pad /** Reference to the number pad 1 */ std::shared_ptr<cugl::scene2::Button> _numberpad1; /** Reference to the number pad 2 */ std::shared_ptr<cugl::scene2::Button> _numberpad2; /** Reference to the number pad 3 */ std::shared_ptr<cugl::scene2::Button> _numberpad3; /** Reference to the number pad 4 */ std::shared_ptr<cugl::scene2::Button> _numberpad4; /** Reference to the number pad 5 */ std::shared_ptr<cugl::scene2::Button> _numberpad5; /** Reference to the number pad 6 */ std::shared_ptr<cugl::scene2::Button> _numberpad6; /** Reference to the number pad 7 */ std::shared_ptr<cugl::scene2::Button> _numberpad7; /** Reference to the number pad 8 */ std::shared_ptr<cugl::scene2::Button> _numberpad8; /** Reference to the number pad 9 */ std::shared_ptr<cugl::scene2::Button> _numberpad9; /** Reference to the number pad delete */ std::shared_ptr<cugl::scene2::Button> _numberpaddel; /** Reference to the number pad 0 */ std::shared_ptr<cugl::scene2::Button> _numberpad0; /** Reference to the number pad join */ std::shared_ptr<cugl::scene2::Button> _numberpadjoin; public: #pragma mark - #pragma mark Constructors /** * Creates a new join game-room with default values. */ JoinMenu() {} /** * Disposes of all (non-static) resources allocated to this menu. */ ~JoinMenu() { dispose(); } /** * Disposes of all (non-static) resources allocated to this menu. */ void dispose(); /** * Initializes a new join game menu with the state pointer. * * @param assets The (loaded) assets for this join game menu * @param playerSettings The player's saved settings value * @param gameSettings The settings for the current game * * @return true if initialization was successful, false otherwise */ bool init(const std::shared_ptr<cugl::AssetManager>& assets, const std::shared_ptr<GameSettings>& gameSettings); /** * Returns a newly allocated Join Game menu. * * @param assets The (loaded) assets for this join game menu * @param playerSettings The player's saved settings value * @param gameSettings The settings for the current game * * @return a newly allocated join game menu */ static std::shared_ptr<JoinMenu> alloc(const std::shared_ptr<cugl::AssetManager>& assets, const std::shared_ptr<GameSettings>& gameSettings) { std::shared_ptr<JoinMenu> result = std::make_shared<JoinMenu>(); return (result->init(assets, gameSettings) ? result : nullptr); } #pragma mark - #pragma mark Menu Monitoring /** * Sets whether the join game menu is currently active and visible. * * @param onDisplay Whether the join game menu is currently active and visible */ void setDisplay(bool onDisplay); /** * The method called to update the join game menu. * * This method handles transitions into and out of join game menu along * with any updates within the join game menu scene. */ void update(MenuState& state); /** * Returns the root scene node for the join game menu layer. * * @return a shared pointer to join game menu layer root scene node */ const std::shared_ptr<cugl::scene2::SceneNode>& getLayer() const { return _layer; } }; #endif /* __CI_JOIN_MENU_H__ */
bf5b4783e1768e61af1cc62cfd6991daafecb0f8
b81a29ee3767205afd404288f7ab3e5030ee1209
/Classes/scene/GameScene.cpp
f5dee0db4fba2e9cdcbf37ab77191bf9aae5a237
[]
no_license
MrAnts/PGENG
870259f84c71d1c66f6e72aa18c9d552274c2e43
7bc0464337d1afb6c7ec587b2ade369dd71bb6de
refs/heads/master
2021-01-22T11:32:43.487109
2017-05-22T11:02:23
2017-05-22T11:02:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,601
cpp
GameScene.cpp
#include "GameScene.h" #include "SimpleAudioEngine.h" USING_NS_CC; Scene* GameScene::createScene() { // 'scene' is an autorelease object auto scene = Scene::create(); // 'layer' is an autorelease object auto layer = GameScene::create(); // add layer as a child to scene scene->addChild(layer); // return the scene return scene; } // on "init" you need to initialize your instance bool GameScene::init() { ////////////////////////////// // 1. super init first if (!Layer::init()) { return false; } auto visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); // Screen size Size playingSize = Size(visibleSize.width, visibleSize.height - (visibleSize.height / 8)); // Halved of screen height float halvedHeight = playingSize.height * .5f; // Node for items auto nodeItems = Node::create(); nodeItems->setName("nodeItems"); nodeItems->setPosition(0, halvedHeight); this->addChild(nodeItems, 1); return true; } void GameScene::update(float _delta) { } void GameScene::menuCloseCallback(Ref* pSender) { //Close the cocos2d-x game scene and quit the application Director::getInstance()->end(); #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) exit(0); #endif /*To navigate back to native iOS screen(if present) without quitting the application ,do not use Director::getInstance()->end() and exit(0) as given above,instead trigger a custom event created in RootViewController.mm as below*/ //EventCustom customEndEvent("game_scene_close_event"); //_eventDispatcher->dispatchEvent(&customEndEvent); }
e3e192d9d7f045ae9ee39a19a7a41b84c4d6c7be
c55aebf12ac939e61c2edae019b4b6432829ac3a
/catkin_ws/src/vedio/src/blue.cpp
310af0836d5cdf8067d07574177d1eb652837c1c
[]
no_license
guomingli521/m100-ros
d526a5712890061b7599998e47b1a62f02016392
60d4ca21d457a28ad2878ad47bbacdf041610a80
refs/heads/master
2021-06-18T15:50:22.694238
2017-06-06T07:51:41
2017-06-06T07:51:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,850
cpp
blue.cpp
#include "ros/ros.h" #include "std_msgs/String.h" #include "vedio/xy.h" #include <opencv/cv.h> #include <pylon/PylonIncludes.h> #include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/gpu/gpu.hpp" #include <cmath> #include <iostream> #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <time.h> #include <stdlib.h> #include <linux/input.h> #include <string.h> #include <termios.h> #include <pthread.h> using namespace std; using namespace cv; using namespace cv::gpu; using namespace Pylon; struct POINT //定义结构体指针存放输出结果 { int x; int y; }; typedef struct //定义圆的中心和半径属性 { Point2f center; float rad; }circleinfodef; Point2f xy; //定义画幅中心坐标 Point2f pot; //用于存放最终输出结果 float LENGTH; Mat gpulast,test; Mat element1=getStructuringElement(MORPH_RECT,Size(3,3)); Mat element=getStructuringElement(MORPH_RECT,Size(5,5)); //定义膨胀大小 GpuMat SMALL,HSV; //gpu相关的定义 GpuMat HUE,SATURATION,VALUE; GpuMat HUEH,HUEL,VALUEH,VALUEL,SATURATIONL,SATURATIONH,HSVMID,HSVFINAL,FINAL,ERODE; const int stateNum=6; const int measureNum=2; KalmanFilter KF(stateNum, measureNum, 0); Mat state (stateNum, 1, CV_32FC1); //state(x,y,detaX,detaY) Mat processNoise(stateNum, 1, CV_32F); Mat measurement = Mat::zeros(measureNum, 1, CV_32F); //定义初始测量值 int t=15; ros::Publisher xy_publisher; class CImageProcess :public CImageEventHandler { public: void OnImageGrabbed(CInstantCamera& camera, const CGrabResultPtr& ptrGrabResult) { // ros::Rate loop_rate(50);//34 CImageFormatConverter fc; fc.OutputPixelFormat = PixelType_BGR8packed; CPylonImage image; xy.x=300; //305 xy.y=150; //165 if (ptrGrabResult->GrabSucceeded()) { const int64 start = getTickCount(); fc.Convert(image, ptrGrabResult); Mat frame = Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC3, (uint8_t*)image.GetBuffer()); //pylon相机指针转MAT类 // imshow("",frame); GpuMat FRAME(frame); //上传gpu gpu::resize(FRAME, SMALL,Size(), 0.5, 0.5); //缩小画幅 gpu::cvtColor(SMALL, HSV, COLOR_BGR2HSV); //bgr转hsv vector<GpuMat>channels; gpu::split(HSV,channels); //分离三通道 HUE=channels.at(0); SATURATION=channels.at(1); VALUE=channels.at(2); gpu::threshold(HUE,HUEH,125,255,1); //125 阈值分割取交集 gpu::threshold(HUE,HUEL,100,255,0); //100 gpu::bitwise_and(HUEL,HUEH,HUE); gpu::threshold(VALUE,VALUEH,200,255,1); gpu::threshold(VALUE,VALUEL,100,255,0); //100 gpu::bitwise_and(VALUEL,VALUEH,VALUE); gpu::threshold(SATURATION,SATURATIONH,255,255,1); //255 gpu::threshold(SATURATION,SATURATIONL,250,255,0); //250 gpu::bitwise_and(SATURATIONL,SATURATIONH,SATURATION); gpu::bitwise_and(HUE,VALUE,HSVMID); gpu::bitwise_and(SATURATION,HSVMID,HSVFINAL); // gpu::erode(HSVFINAL,ERODE,element1,Point(-1,-1),1); gpu::dilate(HSVFINAL,FINAL,element,Point(-1,-1),1); //膨胀 SMALL.download(test); //gpu下载 FINAL.download(gpulast); //HSVMID.download(gpulast); // imshow("begin",gpulast); // waitKey(1); Mat mincircles(480,480,CV_8UC3); vector<vector<Point> > contours; findContours(gpulast,contours,RETR_TREE,CHAIN_APPROX_SIMPLE,Point(0,0)); //寻找轮廓 vector<circleinfodef> circleinfo; vector<circleinfodef> circleinfotemp; for(int i=0;i<contours.size();i++) { circleinfodef info; minEnclosingCircle(contours[i],info.center,info.rad); //最小外接圆 int l=arcLength(contours[i],true); if(l>10 && l<60) //60 //限制轮廓周长 { circleinfo.push_back(info); circle(mincircles,info.center,info.rad,Scalar(255,255,255),2, 8); } } int circleSize=circleinfo.size(); bool flag=false; if(circleSize==0) //画幅内无轮廓,目标点归中 { pot.x=0; pot.y=0; } while(circleSize) //画幅内有轮廓处理 { vector<circleinfodef> temp; //存放满足密集度的轮廓 vector<circleinfodef> *refcircle; //待处理的轮廓 if(flag==false) { refcircle=&circleinfo; circleinfotemp.clear(); } else { refcircle=&circleinfotemp; circleinfo.clear(); } temp.push_back((*refcircle)[0]); for(int i=0;i<circleSize-1;i++) { Point2f line=temp[0].center-(*refcircle)[i+1].center; float length=sqrtf(line.dot(line)); if(length<80) //两轮廓间的距离限制,判断密集程度 80 { temp.push_back((*refcircle)[i+1]); } else { if(flag==false) { circleinfotemp.push_back((*refcircle)[i+1]); } else { circleinfo.push_back((*refcircle)[i+1]); } } } Point2f sum; //定义求和变量---寻找temp中心坐标 sum.x=0; sum.y=0; Point2f line; //定义temp中心坐标与画幅中心的偏差 line.x=0; line.y=0; if(temp.size()>2&temp.size()<10) { for(int i=0;i<temp.size();i++) //寻找temp中心坐标 { sum=sum+temp[i].center; } sum.x=sum.x/temp.size(); sum.y=sum.y/temp.size(); line=sum-xy; float length=sqrtf(line.dot(line)); if(length<LENGTH) //寻找离圆心最近的偏差---pot { LENGTH=length; pot=line; } } if(flag==false) { circleSize=circleinfotemp.size(); } else { circleSize=circleinfo.size(); } flag=!flag; } LENGTH=480; //定义距离圆心的最大距离 imshow("circle",mincircles); // waitKey(1); const double timeSec = (getTickCount() - start) / getTickFrequency(); // cout << "Time : " << timeSec * 1000 << " ms" << endl; } Point2f LINE=pot+xy; Point statePt = Point( (int)KF.statePost.at<float>(0), (int)KF.statePost.at<float>(1)); Mat prediction = KF.predict(); Point predictPt = Point( (int)prediction.at<float>(0), (int)prediction.at<float>(1)); measurement.at<float>(0)= (float)LINE.x; measurement.at<float>(1) = (float)LINE.y; KF.correct(measurement); Point2f last; last.x=LINE.x+prediction.at<float>(2)*t+0.5*prediction.at<float>(4)*t*t; last.y=LINE.y+prediction.at<float>(3)*t+0.5*prediction.at<float>(5)*t*t; if(last.x>480||last.x<0||last.y>480||last.y<0) { last.x=xy.x; last.y=xy.y; } circle(test,xy,20,Scalar(0,0,255),2,8); circle(test,last,3,Scalar(0,255,0),2,8); circle(test,LINE,3,Scalar(255,255,255),2,8); //绘制目标点 imshow("final",test); waitKey(1); //printf("%f\n",last.x); vedio::xy send; send.x=last.x-xy.x; send.y=last.y-xy.y; xy_publisher.publish(send); //ros::spinOnce(); // loop_rate.sleep(); } protected: private: }; int main(int argc,char **argv) { ros::init(argc,argv,"vedio_node"); ros::NodeHandle n; xy_publisher = n.advertise<vedio::xy>("vedio/xy", 1000); randn(state, Scalar::all(0), Scalar::all(0.1)); KF.transitionMatrix = *(Mat_<float>(6, 6) << //转移矩阵 1,0,1,0,1,0, 0,1,0,1,0,1, 0,0,1,0,1,0, 0,0,0,1,0,1, 0,0,0,0,1,0, 0,0,0,0,0,1); setIdentity(KF.measurementMatrix); //测量矩阵 setIdentity(KF.processNoiseCov, Scalar::all(1e-5)); //过程噪声 setIdentity(KF.measurementNoiseCov, Scalar::all(1e-1)); //测量噪声 setIdentity(KF.errorCovPost, Scalar::all(1)); //最小均方差 randn(KF.statePost, Scalar::all(0), Scalar::all(0.1)); //系统初始状态 PylonInitialize(); //pylon打开摄像头例程 CInstantCamera camera(CTlFactory::GetInstance().CreateFirstDevice()); camera.RegisterImageEventHandler(new CImageProcess , RegistrationMode_Append, Cleanup_Delete); camera.Open(); camera.StartGrabbing(GrabStrategy_OneByOne, GrabLoop_ProvidedByInstantCamera); while(1); camera.StopGrabbing(); camera.DestroyDevice(); PylonTerminate(); }
1bbe8aa47c15f7ae503fa5aaa16dc1b263ffb0bb
c2907a1a84df45609b1c0b06ffa184db4b30af2c
/Lab02/Functs.cpp
7b23b1cee96f27f21f0ba2bfc5be50b327d04a3a
[]
no_license
Ales-san/Computer_Graphic_labs
147f693868746a045dede4d4cf29a7f5da4cc614
ef171b239ea5b4200ebfe87716431d832ed14f9e
refs/heads/master
2021-01-02T10:17:11.179763
2020-07-03T17:56:48
2020-07-03T17:56:48
239,574,885
0
0
null
null
null
null
UTF-8
C++
false
false
2,302
cpp
Functs.cpp
#include <algorithm> #include <vector> #include "PNM_ex.h" #include "geom.h" double get_vect_mult(Vect a, Vect b) { return a.x * b.y - a.y * b.x; } Vect get_norm(Point a, Point b) { return Vect(a, b); } Rect get_line(Point a, Point b, double thick) { Vect s = get_norm(a, b); double l = s.len(); s.x = s.x * thick / (2. * l); s.y = s.y * thick / (2. * l); return Rect(Point(-s.y + a.x, s.x + a.y), Point(s.y + a.x, -s.x + a.y), Point(s.y + b.x, -s.x + b.y), Point(-s.y + b.x, s.x + b.y)); } bool get_pos(Point a, Rect rec) { double mult = get_vect_mult(Vect(rec.A, rec.B), Vect(a, rec.A)); double sign = mult / (mult == 0 ? 1 : abs(mult)); mult = get_vect_mult(Vect(rec.B, rec.C), Vect(a, rec.B)); if (sign == 0 && mult != 0) { sign = mult / abs(mult); } if (sign != mult / (mult == 0 ? 1 : abs(mult))) { return false; } mult = get_vect_mult(Vect(rec.C, rec.D), Vect(a, rec.C)); if (sign == 0 && mult != 0) { sign = mult / abs(mult); } if (sign != mult / (mult == 0 ? 1 : abs(mult))) { return false; } mult = get_vect_mult(Vect(rec.D, rec.A), Vect(a, rec.D)); if (sign != mult / (mult == 0 ? 1 : abs(mult))) { return false; } return true; } double get_conj(int x, int y, Rect rec) { int cnt = 0; int size = 0; for (double i = x; i < x + 1; i += EPS) { for (double j = y; j < y + 1; j += EPS, size++) { if (get_pos(Point(i, j), rec)) { cnt++; } } } return double(cnt) / size; } double do_gamma(double color, double gamma) { return pow(color, gamma); } void centring(Point &a) { if (a.x - int(a.x) <= EPS) { a.x += 0.5; } if (a.y - int(a.y) < EPS) { a.y += 0.5; } } void draw_line(PNM_File &file, int bright, double thick, Point s, Point f, double gamma) { int w = file.header.width; int h = file.header.height; centring(s); centring(f); Rect rec = get_line(s, f, thick); for (int x = 0; x < h; x++) { for (int y = 0; y < w; y++) { double conj = get_conj(x, y, rec); double tmp = do_gamma(file.data[x * w + y] / 255., gamma) * (1.0 - conj) + conj * do_gamma(double(bright) / 255., gamma); tmp = do_gamma(tmp, 1. / gamma); if (tmp > 0.9999) { tmp = 1.0; } file.data[x * w + y] = tmp * 255; } } }
43df4c29dcc5554244fc9bc88f79b8b0d79c5022
655202725f7b5eac7bd45a415b333042cd33ef6b
/Windows/WindowsErrorsToException.cpp
64f44da6cd8a8d410a22d3f3aa596fcd9d4c040a
[]
no_license
BarabasGitHub/DogDealer
8c6aac914b1dfa54b6e89b0a3727a83d4ab61706
41b7d6bdbc6b9c2690695612ff8828f08b1403c7
refs/heads/master
2022-12-08T04:25:50.257398
2022-11-19T19:31:07
2022-11-19T19:31:07
121,017,925
1
2
null
null
null
null
UTF-8
C++
false
false
1,081
cpp
WindowsErrorsToException.cpp
#include "WindowsErrorsToException.h" #include <Windows\WindowsInclude.h> WindowsException::WindowsException() noexcept: m_error_code( NO_ERROR ) { } WindowsException::WindowsException( HRESULT error_code ) noexcept : m_error_code( error_code ) { } WindowsException::WindowsException( const WindowsException& in ) noexcept : m_error_code( in.m_error_code ) { } //WindowsException& WindowsException::operator= (const exception& in) noexcept //{ // //} WindowsException::~WindowsException() { } const char* WindowsException::what() const noexcept { char* message = nullptr; #pragma warning(suppress: 6387) auto status = FormatMessageA( (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS), nullptr, DWORD(m_error_code), MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ) /* Default language */, reinterpret_cast<char*>( &message ), 0, nullptr ); (void) status; return message; } HRESULT WindowsException::ErrorCode() const noexcept { return m_error_code; }
028c85dcfa1b206739a545519a67e0b1b611bf9b
283c31304584af4e2bb12aa7764c13b2fb61541c
/leet-solve_sudoku/main.cpp
e77b0425caf981e4823eff1860186b839bccaff8
[]
no_license
zohairajmal/competitive-programming-problems
27c994471e0b8e6166d5dbba96b85fd1a4eac288
959abf6f95b75540d19c699ada0253e047f9ec6f
refs/heads/master
2021-01-04T03:43:26.486924
2018-10-07T18:39:00
2018-10-07T18:39:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,744
cpp
main.cpp
#include <bits/stdc++.h> using namespace std; class Solution { bool solve(vector< vector<char> >& board, int index, vector< vector<bool> >& row, vector< vector<bool> >& col, vector< vector< vector<bool> > >& square){ if(index > 80) return true; int i = index/9, j = index%9; if(board[i][j] != '.'){ return solve(board, index+1, row, col, square); } for(int val = 1; val <= 9; val++){ if(row[i][val] || col[j][val] || square[i/3][j/3][val]) continue; row[i][val] = true; col[j][val] = true; square[i/3][j/3][val] = true; board[i][j] = (char)val + '0'; if(solve(board, index+1, row, col, square)) return true; row[i][val] = false; col[j][val] = false; square[i/3][j/3][val] = false; board[i][j] = '.'; } return false; } public: void solveSudoku(vector<vector<char>>& board) { vector< vector<bool> > row(9, vector<bool>(10, false)); vector< vector<bool> > col(9, vector<bool>(10, false)); vector< vector< vector<bool> > > square(3, vector< vector<bool> >(3, vector<bool>(10, false))); for(int i = 0; i < 9; i++){ for(int j = 0; j < 9; j++){ if(board[i][j] == '.') continue; int val = (int)board[i][j] - '0'; row[i][val] = true; col[j][val] = true; square[i/3][j/3][val] = true; } } solve(board, 0, row, col, square); } }; static const auto _ = [](){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return nullptr; }(); int main(){ return 0; }
b71bb4ea7d6cee9956dd0228d1c7b6981d668e69
0fc6eadc8811a6990e0bd41e9a23bf698e738c88
/比赛/zoj/zoj校赛/c.cpp
c228cce7745c2b2ae00a7aed99dcc96ee2e70ee1
[]
no_license
bossxu/acm
f88ee672736709f75739522d7e0f000ac86a31de
871f8096086e53aadaf48cd098267dfbe6b51e19
refs/heads/master
2018-12-27T22:20:27.307185
2018-12-20T04:41:51
2018-12-20T04:41:51
108,379,456
0
0
null
null
null
null
UTF-8
C++
false
false
1,963
cpp
c.cpp
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<queue> #include<stack> #include<vector> #include<cmath> #include<set> #include<cstdlib> #include<functional> #include<climits> #include<cctype> #include<iomanip> using namespace std; typedef long long ll; #define INF 0x3f3f3f3f #define mod 1e9+7 #define pi acos(-1) #define loge exp(1) #define clr(a,x) memset(a,x,sizeof(a)) #define cle(a,n) for(int i=1;i<=n;i++) a.clear(); const double eps = 1e-6; struct node { int a; struct node *pre; node(int v) { a = v; pre = NULL; } }; class Stack { public: node *head; node *end; Stack() { head = NULL; end = NULL; } void init() { head = NULL; end = NULL; } void pop() { if(end == NULL) { printf("EMPTY\n"); } else { printf("%d\n",end->a); end = end->pre; if(end == NULL) { head = NULL; } } } void push(int i) { node *p = new node(i); if(head == NULL) { head = p; end = p; } else { p->pre = end; end = p; } } }; Stack s[300006]; int main() { int t; cin>>t; while(t--) { int n,q; cin>>n>>q; for(int i = 1;i<=n;i++) { s[i].init(); } int a,b,c; for(int i = 1;i<=q;i++) { scanf("%d",&a); if(a == 1) { scanf("%d%d",&b,&c); s[b].push(c); } if(a == 2) { scanf("%d",&b); s[b].pop(); } if(a == 3) { scanf("%d%d",&b,&c); if(s[c].head == NULL) { continue; } if(s[b].head == NULL) { s[b].head = s[c].head; s[b].end = s[c].end; s[c].init(); continue; } s[c].head->pre = s[b].end; s[b].end = s[c].end; s[c].init(); } } } return 0; }
18ba9a3e24242092974ce5e1bc6ddc9a437aec35
c37419ca512dbaf14e1e74ca501b3591ccbba7e0
/screen.cpp
f9c0220bef692a33a166bc6cd27b05e62f876305
[]
no_license
daniellycosta/DCA1202_Trat_de_Classes_Abstratas
94e2faa68c5295d6adcfe267677c8030999cce9f
5d9c586b0884952b0a74e7bc36cd20fb0f8b70c0
refs/heads/master
2021-07-10T13:52:05.522813
2017-10-12T01:12:19
2017-10-12T01:12:19
105,651,907
0
0
null
null
null
null
UTF-8
C++
false
false
1,727
cpp
screen.cpp
#include "screen.h" #include<iostream> #include<vector> using namespace std; /** * @brief Construtor da Screen * @param nl "altura" da tela * @param nc "largura" da tela * @details A tela é gerada através de um vetor de vetor de char preenchido de espaços. * OBS.:O eixo y cresce da direita para a esquerda e o x de cima pra baixo */ Screen::Screen(int nl, int nc){ nlin = nl; ncol = nc; mat = vector<vector<char>>(nlin, vector<char>(ncol,' ')); } /** * @brief Método de setar Pixel na tela * @details Recebe as coordenadas onde se deseja setar o píxel. No local dessa coordenada, o caracter lá presente * é substituido pelo char armazenado em brush */ void Screen::setPixel(int x, int y){ if((x<nlin) & (y<ncol) && (x>=0) & (y>=0)){ mat[x][y] = brush; } } /** * @brief Método clear * @details percorre toda a telas substituindo os caracteres presentes nas posições pelo char espaço. */ void Screen::clear(){ for(int i=0; i<mat.size();i++){ for(int j=0;j<mat[i].size();j++){ mat[i][j] = ' '; } } } /** * @brief Método setBrush * @details recebe um char e o utiliza para atribuir à variável privada @param brush */ void Screen::setBrush(char _brush){ brush = _brush; } /** * @brief Sobrecarga do operator << * @param os fluxo de saída * @param t tela * @details Função amiga da classe Screen, criada com o objetivo de possibilitar ao usuário a opção * de exibir a tela no terminal ou em um arquivo de texto. */ ostream& operator<<(ostream &os, Screen &t){; for(int i=0; i<t.nlin; i++){ for(int j=0; j<t.ncol; j++){ os << t.mat[i][j]; } os <<endl; } return(os); }
28ddeaacd4048dd113959a9ac6d5cd295bcdfd2f
a8766db0a50dfb64358ee3a3d4b4903663c3cced
/particle_world/src/RoeTexture.h
0dcdae9bdb71182a4b8e0aa602ea7b3ef2b966b1
[]
no_license
swantescholz/cpp-games
0915b8d5acaf01401a93478c1509dce7e95e5b9a
b9814c69ae041c0d746a119cb7039b5b54ddc82d
refs/heads/master
2020-05-23T07:36:41.172453
2019-05-14T20:44:55
2019-05-14T20:44:55
186,679,964
1
0
null
null
null
null
UTF-8
C++
false
false
3,293
h
RoeTexture.h
#ifndef ROETEXTURE_H_ #define ROETEXTURE_H_ #include <GL/gl.h> #include <SDL/SDL.h> #include <SDL/SDL_image.h> #include <map> #include "RoeCommon.h" #include "RoeVector3.h" #include "RoeMatrix.h" #include "RoeColor.h" namespace Roe { struct S_TextureIntern { GLuint iTexture; //textur-index Matrix mStdMatrix; //standard-transformation-matrix int iWidth; int iHeight; }; //alpha textures from back to front rendering! //not POT textures are allowerd now, but for //mipmapped textures POT w and h values are advised(but not strictly needed) class Texture { public: enum EFlipType { FT_HORIZONTAL = 1, FT_VERTICAL = 2 }; Texture(const Matrix& m = Matrix::IDENTITY); Texture(const std::string& sPath, const Matrix& m = Matrix::IDENTITY); ~Texture(); void load (std::string sPath); std::string getName () const {return m_sName;} Matrix getMatrix () const {return m_mMatrix;} void setMatrix (const Matrix &m) {m_mMatrix = m;} //bind just after load() //does change the texture matrix, but returns to modelview (if bool true) //bottom left, bottom right, top right then top left is the right order //works now with lighting (dont forget the normal vector!) void bind(Color col = Color(1.0,1.0,1.0,1.0), bool bWithTransformation = true); int getWidth () {return s_mpTexture[m_sPath].iWidth;} int getHeight() {return s_mpTexture[m_sPath].iHeight;} // *static* //loading and deleting static void loadTexture (std::string sPath, int numMipmaps = -1, const Matrix& mStdMatrix = Matrix::IDENTITY); static GLuint loadTextureIntoGL (std::string sPath, int numMipmaps = -1); //loads the texture+numMipmaps mipmaps(if -1, then self calculated) static void scaleImage (const byte *oldData, int w1, int h1, byte *newData, int w2, int h2, int bpp = 4); //scales an image 2D static void scaleImage1D (const byte *oldData, int w1, byte *newData, int w2, int bpp = 4); //scales an image 2D static void deleteTexture (std::string sPath, bool bCompleteThePath = true); //static GLuint loadTextureSimpleOld(std::string sPath); //original old version static void createHeightmapOFF (std::string sImage, std::string sOFF); //converts an loaded image to an heightmap OFF model-file // for the static variables static void init(std::string sStart, std::string sEnd); static void setPathStart(std::string s) {s_sPathStart = s;} static void setPathEnd (std::string s) {s_sPathEnd = s;} static void quit(); //other functions needed static Uint32 getPixel32( SDL_Surface *surface, int x, int y ); static void putPixel32( SDL_Surface *surface, int x, int y, Uint32 pixel ); static SDL_Surface* flipSurface( SDL_Surface *surface, int flags ); private: static std::map<std::string, S_TextureIntern > s_mpTexture; static std::map<std::string, S_TextureIntern >::iterator s_mpi; static std::pair<std::string,S_TextureIntern > s_pair; //pair-object for the map static std::string s_sPathStart, s_sPathEnd; //standard path std::string m_sPath; std::string m_sName; Matrix m_mMatrix; }; } // namespace Roe #endif /*ROETEXTURE_H_*/
1105e843d89465814e5decb936eea258b2aa2b4f
c5332c10775e9df3093dd2677babe34e02b05704
/openframeworks/hollerPong/trunk/src/pong/Paddle.h
a6ab16f5188d437d498cf31cd1d3b039a4f693eb
[]
no_license
aurialLoop/julapy
bb1f7c458b2c1fefef6de6bdd512ee1ca781a6dc
80ea9b32c6de7e34ad353416f75878551193d2a9
refs/heads/master
2021-10-08T13:46:46.279988
2021-09-29T05:59:03
2021-09-29T05:59:03
33,194,282
0
0
null
null
null
null
UTF-8
C++
false
false
485
h
Paddle.h
/* * Paddle.h * emptyExample * * Created by lukasz karluk on 1/04/10. * Copyright 2010 __MyCompanyName__. All rights reserved. * */ #ifndef HOLLER_PONG_PADDLE #define HOLLER_PONG_PADDLE #include "ofMain.h" #include "PongConfig.h" class Paddle { public : Paddle(); void setColor ( int color ); void setSide ( int side ); void setPosition ( float p ); void update (); void draw (); ofRectangle rect; int color; float pos; int side; }; #endif
71895782c39ab8df7f7af46e131898c1b0f76858
987084195af62f2bd88a2a7990a4b660e35a9a0f
/Bridges/Tests/Test_QueryServer/smartsoft/src/BaseStateQueryServiceAnswHandler.cc
ad5d4df8611376b0f0daaa4a1d329068ee4e97e5
[ "BSD-3-Clause" ]
permissive
CARVE-ROBMOSYS/Yarp-SmartSoft-Integration
e1b1584d17c8a10efddbd3fddd0fd54a8d1f63d2
4023602f5540d1e66804b3d0db80f63aac536f8b
refs/heads/master
2021-06-26T16:35:35.098019
2019-04-23T09:33:18
2019-04-23T09:33:53
129,261,900
2
0
null
2019-04-09T20:41:46
2018-04-12T14:12:59
C++
UTF-8
C++
false
false
1,331
cc
BaseStateQueryServiceAnswHandler.cc
//-------------------------------------------------------------------------- // Code generated by the SmartSoft MDSD Toolchain // The SmartSoft Toolchain has been developed by: // // Service Robotics Research Center // University of Applied Sciences Ulm // Prittwitzstr. 10 // 89075 Ulm (Germany) // // Information about the SmartSoft MDSD Toolchain is available at: // www.servicerobotik-ulm.de // // This file is generated once. Modify this file to your needs. // If you want the toolchain to re-generate this file, please // delete it before running the code generator. //-------------------------------------------------------------------------- #include "BaseStateQueryServiceAnswHandler.hh" #include "Test_QueryServer.hh" BaseStateQueryServiceAnswHandler::BaseStateQueryServiceAnswHandler(Smart::IQueryServerPattern<CommBasicObjects::CommVoid, CommBasicObjects::CommBaseState, SmartACE::QueryId>* server) : BaseStateQueryServiceAnswHandlerCore(server) { } BaseStateQueryServiceAnswHandler::~BaseStateQueryServiceAnswHandler() { } void BaseStateQueryServiceAnswHandler::handleQuery(const SmartACE::QueryId &id, const CommBasicObjects::CommVoid& request) { CommBasicObjects::CommBaseState answer; // implement your query handling logic here and fill in the answer object this->server->answer(id, answer); }
bad04f424429f9ce835f00f3c51af623db8dd343
aa2117552765a7a0c8c5dbbddbc8d3b37fce9127
/algorithm/naive_bayes/bayes_estimation.cc
863470fb672d780107e8aa839dd258e92914c3db
[]
no_license
mayf3/machine_learning
7436de484a89741b90330bf6ade66bd7ebe3365f
ed8b0459b3d830f298bf9916fed2a6e5c6f9d30a
refs/heads/master
2021-01-21T17:14:45.368146
2021-01-08T13:18:50
2021-01-08T13:18:50
91,944,986
0
0
null
2021-01-08T13:18:51
2017-05-21T09:06:40
C++
UTF-8
C++
false
false
2,292
cc
bayes_estimation.cc
// Copyright @2021 mayf3 #include "algorithm/naive_bayes/bayes_estimation.h" #include "algorithm/learner/learner_factory.h" #include "utils/math/math_utils.h" namespace algorithm { namespace naive_bayes { REGISTER_LEARNER(BayesEstimation, kBayesEstimationName); BayesEstimation::BayesEstimation(const learner::LearnerOptions& options) : num_dim_(options.num_dim), num_class_(options.num_class), num_data_(options.normal_feature_list.size()), lamda_(options.baye_estimation_lamda) { condition_frequency_.resize(num_dim_); condition_probability_.resize(num_dim_); different_keys_.resize(num_dim_); const auto& feature_list = options.normal_feature_list; const auto& label_list = options.normal_label_list; for (int i = 0; i < feature_list.size(); i++) { type_frequency_[label_list[i]]++; for (int j = 0; j < feature_list[i].size(); j++) { condition_frequency_[j][std::make_pair(feature_list[i][j], label_list[i])]++; different_keys_[j].insert(feature_list[i][j]); } } for (const auto& pair : type_frequency_) { type_probability_[pair.first] = (static_cast<double>(pair.second) + lamda_) / (feature_list.size() + num_class_ * lamda_); } for (int i = 0; i < num_dim_; i++) { for (const auto& pair : condition_frequency_[i]) { condition_probability_[i][pair.first] = (static_cast<double>(pair.second) + lamda_) / (type_frequency_.at(pair.first.second) + different_keys_[i].size() * lamda_); } } } BayesEstimation::NormalLabel BayesEstimation::Predict(const NormalFeature& feature) const { BayesEstimation::NormalLabel result = -1; double max_possible = 0.0; for (int i = 0; i < num_class_; i++) { double possible = type_probability_.at(i); for (int j = 0; j < feature.size(); j++) { if (condition_probability_.at(j).count(std::make_pair(feature[j], i))) { possible *= condition_probability_.at(j).at(std::make_pair(feature[j], i)); } else { possible *= lamda_ / (type_frequency_.at(i) + different_keys_.at(j).size() * lamda_); } } if (possible - max_possible > utils::math::kEpsilon) { max_possible = possible; result = i; } } return result; } } // namespace naive_bayes } // namespace algorithm
866732a071e69e8b9a5b09d6e43117c64bb3fcf4
e13860ecc8ff1d295bc61a6d119a3a83da2e022d
/branches/nmapsys2/Map/SM3/terrain/Textures.h
e7262e040de2f3444c9f81bc9f3b4a88f1aa1bbd
[]
no_license
spring/svn-spring-archive
9c45714c6ea8c3166b5678209aea4b7a126028ea
538e90585ed767ee713955221bfdd89410321447
refs/heads/master
2020-12-30T09:58:08.400276
2014-10-15T00:46:52
2014-10-15T00:46:52
25,232,864
2
3
null
null
null
null
UTF-8
C++
false
false
3,000
h
Textures.h
#ifndef TERRAIN_TEXTURES_H #define TERRAIN_TEXTURES_H class TdfParser; class CBitmap; namespace terrain { struct ILoadCallback; struct Heightmap; class TQuad; struct float2 { float2() { x=y=0.0f; } float2(float X,float Y) : x(X), y(Y) {} float x,y; }; //----------------------------------------------------------------------- // AlphaImage - a single channel image class, used for storing blendmaps //----------------------------------------------------------------------- struct AlphaImage { AlphaImage (); ~AlphaImage (); enum AreaTestResult { AREA_ONE, AREA_ZERO, AREA_MIXED }; void Alloc (int W,int H); float& at(int x,int y) { return data[y*w+x]; } bool CopyFromBitmap(CBitmap& bm); AlphaImage* CreateMipmap (); void Blit (AlphaImage *dst, int x,int y,int dstx, int dsty, int w ,int h); bool Save (const char *fn); AreaTestResult TestArea (int xstart,int ystart,int xend,int yend); int w,h; float *data; AlphaImage *lowDetail, *highDetail; // geomipmap chain links }; //----------------------------------------------------------------------- // BaseTexture //----------------------------------------------------------------------- struct BaseTexture { BaseTexture (); virtual ~BaseTexture(); virtual bool ShareTexCoordUnit () { return true; } std::string name; uint id; float2 tilesize; // the "texgen vector" is defined as: // { Xfactor, Zfactor, Xoffset, Zoffset } virtual void CalcTexGenVector (float *v4); virtual void SetupTexGen(); virtual bool IsRect() {return false;} }; struct TiledTexture : public BaseTexture { TiledTexture (); ~TiledTexture (); void Load(const std::string& name, const std::string& section, ILoadCallback *cb, TdfParser *tdf, bool isBumpmap); static TiledTexture* CreateFlatBumpmap(); }; struct Blendmap : public BaseTexture { Blendmap (); ~Blendmap (); void Generate (Heightmap *rootHm, int lodLevel, float hmscale, float hmoffset); void Load(const std::string& name, const std::string& section, Heightmap *heightmap, ILoadCallback *cb, TdfParser *tdf); struct GeneratorInfo { float coverage, noise; float minSlope, maxSlope; float minSlopeFuzzy, maxSlopeFuzzy; float minHeight, maxHeight; float minHeightFuzzy, maxHeightFuzzy; }; GeneratorInfo *generatorInfo; AlphaImage *image; // WIP image pointer AlphaImage::AreaTestResult curAreaResult; }; // A bumpmap generated from a heightmap, used to increase detail on distant nodes struct DetailBumpmap : public BaseTexture { ~DetailBumpmap(); void CalcTexGenVector (float *v4); bool ShareTexCoordUnit () { return false; } TQuad *node; }; GLuint LoadTexture (const std::string& fn, bool isBumpmap=false); void SaveImage(const char *fn, int components, GLenum type, int w,int h, void *data); void SetTexCoordGen(float *tgv); }; #endif
b9b47b66282ba71bacecef68bb8ff98e2a88e004
092796fe2afbfcc6adab566bed303974552b5ebc
/lib/utils/byte_iterator.hpp
b1c478acbe1137c16ef9d674dbfc0df80d299294
[]
no_license
clarkok/cdb
cd08baf0f3ec7611e41a1b1e523c13c1d249317e
ba771585a73defec6652f32096b3be9787a1c690
refs/heads/master
2016-08-11T16:28:01.288826
2015-11-11T04:28:16
2015-11-11T04:28:16
43,992,632
8
0
null
null
null
null
UTF-8
C++
false
false
4,374
hpp
byte_iterator.hpp
#ifndef _DB_UTILS_BYTE_ITERATOR_H_ #define _DB_UTILS_BYTE_ITERATOR_H_ #include <cassert> namespace cdb { namespace _Iterator { template <typename T> struct Iterator : std::iterator<std::random_access_iterator_tag, T> { T *start_ = nullptr; T *lower_limit_ = nullptr; T *upper_limit_ = nullptr; Iterator() = default; Iterator(const Iterator &) = default; Iterator(T *start, T *lower_limit, T *upper_limit) : start_(start), lower_limit_(lower_limit), upper_limit_(upper_limit) { assert(start_ >= lower_limit_); assert(start_ <= upper_limit_); } Iterator & operator = (const Iterator &) = default; ~Iterator() = default; inline T * start() const { return start_; } inline bool operator == (const Iterator &i) const { return start_ == i.start_ && lower_limit_ == i.lower_limit_ && upper_limit_ == i.upper_limit_; } inline bool operator != (const Iterator &i) const { return !this->operator==(i); } inline bool operator > (const Iterator &i) const { assert(lower_limit_ == i.lower_limit_); assert(upper_limit_ == i.upper_limit_); return start_ > i.start_; } inline bool operator >= (const Iterator &i) const { assert(lower_limit_ == i.lower_limit_); assert(upper_limit_ == i.upper_limit_); return start_ >= i.start_; } inline bool operator < (const Iterator &i) const { assert(lower_limit_ == i.lower_limit_); assert(upper_limit_ == i.upper_limit_); return start_ < i.start_; } inline bool operator <= (const Iterator &i) const { assert(lower_limit_ == i.lower_limit_); assert(upper_limit_ == i.upper_limit_); return start_ <= i.start_; } inline T & operator *() const { assert(start_ >= lower_limit_); assert(start_ < upper_limit_); return *start_; } inline T * operator ->() const { assert(start_ >= lower_limit_); assert(start_ < upper_limit_); return start_; } inline Iterator & operator ++() { assert(++start_ <= upper_limit_); return *this; } inline Iterator operator ++(int) { Iterator ret(*this); assert(++start_ <= upper_limit_); return ret; } inline Iterator & operator --() { assert(--start_ >= lower_limit_); return *this; } inline Iterator operator --(int) { Iterator ret(*this); assert(--start_ >= lower_limit_); return ret; } inline int operator -(const Iterator &b) const { assert(lower_limit_ == b.lower_limit_); assert(upper_limit_ == b.upper_limit_); return start_ - b.start_; } }; template <typename T> Iterator<T> operator + (const Iterator<T> &i, int delta) { return Iterator<T>(i.start_ + delta, i.lower_limit_, i.upper_limit_); } template <typename T> Iterator<T> operator - (const Iterator<T> &i, int delta) { return Iterator<T>(i.start_ - delta, i.lower_limit_, i.upper_limit_); } template <typename T> Iterator<T> &operator += (Iterator<T> &i, int delta) { return i = i + delta; } template <typename T> Iterator<T> &operator -= (Iterator<T> &i, int delta) { return i = i - delta; } } } #endif // _DB_UTILS_BYTE_ITERATOR_H_
f64199fb3bad8b11bb51ab2a2b3e832573472b51
d7906e84bda2bd386e074eab9f05479205e7d2a9
/Development/Source/Renderers/OpenGL/QOMatrix.cpp
88067d1f739606646107f1d702f4c7571802cef1
[ "BSD-3-Clause" ]
permissive
jwwalker/Quesa
6fedd297a5a4dd1c21686e71bba3c68228f61724
1816b0772409c2faacdb70b40d5c02a55d643793
refs/heads/master
2023-07-27T16:36:55.757833
2023-07-06T23:55:10
2023-07-06T23:55:10
204,233,833
33
7
BSD-3-Clause
2023-09-09T23:17:36
2019-08-25T01:59:21
C++
UTF-8
C++
false
false
7,241
cpp
QOMatrix.cpp
/* NAME: QOMatrix.cpp DESCRIPTION: Source for Quesa OpenGL renderer class. COPYRIGHT: Copyright (c) 2007-2020, Quesa Developers. All rights reserved. For the current release of Quesa, please see: <https://github.com/jwwalker/Quesa> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: o Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. o 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. o Neither the name of Quesa nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ___________________________________________________________________________ */ //============================================================================= // Include files //----------------------------------------------------------------------------- #include "QORenderer.h" #include "GLDrawContext.h" #include "GLCamera.h" #include "GLUtils.h" //============================================================================= // Local Functions //----------------------------------------------------------------------------- static bool IsOne( float inValue ) { return fabsf( inValue - 1.0f ) < 3 * kQ3RealZero; } static bool IsZero( float inValue ) { return fabsf( inValue ) < 3 * kQ3RealZero; } /*! @function IsOrthogonalMatrix @abstract Test whether a matrix is orthogonal, i.e., length-preserving, i.e., either a rigid motion or a reflection. */ static bool IsOrthogonalMatrix( const TQ3Matrix4x4& inMtx ) { // First check for usual last column. bool isOrtho = IsOne( inMtx.value[3][3] ) && IsZero( inMtx.value[0][3] ) && IsZero( inMtx.value[1][3] ) && IsZero( inMtx.value[2][3] ); if (isOrtho) { // Then check that upper 3x3 is orthogonal. const TQ3Vector3D* row1 = (const TQ3Vector3D*) &inMtx.value[0]; const TQ3Vector3D* row2 = (const TQ3Vector3D*) &inMtx.value[1]; const TQ3Vector3D* row3 = (const TQ3Vector3D*) &inMtx.value[2]; isOrtho = IsOne( Q3FastVector3D_LengthSquared( row1 ) ) && IsOne( Q3FastVector3D_LengthSquared( row2 ) ) && IsOne( Q3FastVector3D_LengthSquared( row3 ) ) && IsZero( Q3FastVector3D_Dot( row1, row2 ) ) && IsZero( Q3FastVector3D_Dot( row1, row3 ) ) && IsZero( Q3FastVector3D_Dot( row2, row3 ) ); } return isOrtho; } //============================================================================= // MatrixState class implementation //----------------------------------------------------------------------------- #pragma mark - /*! @function MatrixState (constructor) @abstract Initialize the state. */ QORenderer::MatrixState::MatrixState() { Reset(); } /*! @function Reset @abstract Reset the state. Called at start of each pass. */ void QORenderer::MatrixState::Reset() { Q3Matrix4x4_SetIdentity( &mLocalToCamera ); Q3Matrix4x4_SetIdentity( &mCameraToFrustum ); mIsLocalToCameraInvTrValid = false; mIsLocalToCameraInvValid = false; } /*! @function GetLocalToCamera @abstract Access the local to camera matrix. */ const TQ3Matrix4x4& QORenderer::MatrixState::GetLocalToCamera() const { return mLocalToCamera; } /*! @function GetCameraToFrustum @abstract Access the camera to frustum matrix. */ const TQ3Matrix4x4& QORenderer::MatrixState::GetCameraToFrustum() const { return mCameraToFrustum; } /*! @function GetLocalToCameraInverseTranspose @abstract Access the inverse transpose of the local to camera matrix, computing and caching it if need be. */ const TQ3Matrix4x4& QORenderer::MatrixState::GetLocalToCameraInverseTranspose() const { if (! mIsLocalToCameraInvTrValid) { const TQ3Matrix4x4& theInv( GetCameraToLocal() ); Q3Matrix4x4_Transpose( &theInv, &mLocalToCameraInvTr ); mIsLocalToCameraInvTrValid = true; } return mLocalToCameraInvTr; } const TQ3Matrix4x4& QORenderer::MatrixState::GetCameraToLocal() const { if (! mIsLocalToCameraInvValid) { Q3Matrix4x4_Invert( &mLocalToCamera, &mLocalToCameraInv ); mIsLocalToCameraInvValid = true; } return mLocalToCameraInv; } /*! @function SetLocalToCamera @abstract Change the local to camera matrix. */ void QORenderer::MatrixState::SetLocalToCamera( const TQ3Matrix4x4& inMtx ) { mLocalToCamera = inMtx; mIsLocalToCameraInvTrValid = false; mIsLocalToCameraInvValid = false; } /*! @function SetCameraToFrustum @abstract Change the camera to frustum matrix. */ void QORenderer::MatrixState::SetCameraToFrustum( const TQ3Matrix4x4& inMtx ) { mCameraToFrustum = inMtx; } #pragma mark - //============================================================================= // Renderer class implementations relating to matrix state //----------------------------------------------------------------------------- /*! @function UpdateLocalToCamera @abstract Change the local to camera matrix. */ TQ3Status QORenderer::Renderer::UpdateLocalToCamera( TQ3ViewObject inView, const TQ3Matrix4x4& inMatrix ) { #pragma unused( inView ) // Activate our context GLDrawContext_SetCurrent( mGLContext, kQ3False ); // flush any buffered triangles mTriBuffer.Flush(); // Update my matrix state mMatrixState.SetLocalToCamera( inMatrix ); // Set the model-view transform GLCamera_SetModelView( &inMatrix, mPPLighting ); return (kQ3Success); } /*! @function UpdateCameraToFrustum @abstract Change the camera to frustum matrix. */ TQ3Status QORenderer::Renderer::UpdateCameraToFrustum( TQ3ViewObject inView, const TQ3Matrix4x4& inMatrix ) { #pragma unused( inView ) // Activate our context GLDrawContext_SetCurrent( mGLContext, kQ3False ); // flush any buffered triangles mTriBuffer.Flush(); // Update my matrix state mMatrixState.SetCameraToFrustum( inMatrix ); // Set the projection transform GLCamera_SetProjection( &inMatrix, mPPLighting ); return(kQ3Success); }
e53ef8c9283a9284f97a21df2daa687478954b0a
2d1f82fe5c4818ef1da82d911d0ed81a0b41ec85
/codeforces/R576/CF1198A.cpp
267147b52fa0f95f881af7caf887f633a1fdc77c
[]
no_license
OrigenesZhang/-1s
d12bad12dee37d4bb168647d7b888e2e198e8e56
08a88e4bb84b67a44eead1b034a42f5338aad592
refs/heads/master
2020-12-31T00:43:17.972520
2020-12-23T14:56:38
2020-12-23T14:56:38
80,637,191
4
1
null
null
null
null
UTF-8
C++
false
false
1,137
cpp
CF1198A.cpp
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define FOR(i, a, b) for (int (i) = (a); (i) <= (b); (i)++) #define ROF(i, a, b) for (int (i) = (a); (i) >= (b); (i)--) #define REP(i, n) FOR(i, 0, (n)-1) #define sqr(x) ((x) * (x)) #define all(x) (x).begin(), (x).end() #define reset(x, y) memset(x, y, sizeof(x)) #define uni(x) (x).erase(unique(all(x)), (x).end()) #define BUG(x) cerr << #x << " = " << (x) << endl #define pb push_back #define eb emplace_back #define mp make_pair #define _1 first #define _2 second #define chkmin(a, b) a = min(a, b) #define chkmax(a, b) a = max(a, b) const int maxn = 412345; int a[maxn]; int n, I; int main() { scanf("%d%d", &n, &I); FOR(i, 1, n) scanf("%d", a + i); sort(a + 1, a + n + 1); int bit = 8 * I / n; bit = bit < 25 ? 1 << bit : n; int j = 1, d = 0, ans = 0; FOR(i, 1, n) { while (j <= n) { if (j > i && a[j] == a[j - 1]) j++; else { if (d == bit) break; d++, j++; } } chkmax(ans, j - i); if (i < n && (i + 1 == j || a[i] != a[i + 1])) d--; } printf("%d", n - ans); }
0ccdde2c4e1ea398b99ebbae6a03c90f815839c9
3f3095dbf94522e37fe897381d9c76ceb67c8e4f
/Current/ITM_MisDesMutator.hpp
492b2c4df4bb4b9a97bcaa69de9e522a5e416bd6
[]
no_license
DRG-Modding/Header-Dumps
763c7195b9fb24a108d7d933193838d736f9f494
84932dc1491811e9872b1de4f92759616f9fa565
refs/heads/main
2023-06-25T11:11:10.298500
2023-06-20T13:52:18
2023-06-20T13:52:18
399,652,576
8
7
null
null
null
null
UTF-8
C++
false
false
1,287
hpp
ITM_MisDesMutator.hpp
#ifndef UE4SS_SDK_ITM_MisDesMutator_HPP #define UE4SS_SDK_ITM_MisDesMutator_HPP class UITM_MisDesMutator_C : public UUserWidget { FPointerToUberGraphFrame UberGraphFrame; class UWidgetAnimation* BlinkMutator; class UWidgetAnimation* BlinkWarning; class UImage* BlinkOverlay; class UButton* Button_Outer; class UTextBlock* DATA_Modifier; class UImage* GradientBG; class UImage* IconModifier; class UOverlay* Overlay_1; class USizeBox* SizeBox_Height; FLinearColor WarningTint; bool IsWarning; bool LeftAlign; float Heigh; bool CanOpenMinersManual; void SetWarning(class UMissionWarning* Warning); void SetAnomaly(class UMissionMutator* Mutator); void SetVisuals(FText Title, class UTexture2D* Icon, TEnumAsByte<ENUM_MenuColors::Type> Color); void PreConstruct(bool IsDesignTime); void BndEvt__ITM_MisDesMutator_Button_Outer_K2Node_ComponentBoundEvent_0_OnButtonClickedEvent__DelegateSignature(); void BndEvt__ITM_MisDesMutator_Button_Outer_K2Node_ComponentBoundEvent_1_OnButtonHoverEvent__DelegateSignature(); void BndEvt__ITM_MisDesMutator_Button_Outer_K2Node_ComponentBoundEvent_2_OnButtonHoverEvent__DelegateSignature(); void ExecuteUbergraph_ITM_MisDesMutator(int32 EntryPoint); }; #endif
720a832f5aa46962a6203e765d80ffd2f885103b
37d5e5b6dcb209aa2505d9fd2ab6b8fbc2e53cf1
/CppUtil/Random.h
c6a634c899637e09ed6c22335138083bd5ae1d66
[ "MIT" ]
permissive
phaesoo/CppUtil
42819ed4689527f8ebe8d47adae27553b45228d6
6c52fdc7e6cad4337ba3c402b19dc4b6d1a75ecc
refs/heads/master
2021-01-19T16:01:29.708368
2017-05-09T04:25:19
2017-05-09T04:25:19
88,238,444
0
0
null
null
null
null
UTF-8
C++
false
false
156
h
Random.h
#pragma once #include <vector> class Random { public: Random() = delete; public: static std::vector<int> Generate(int min, int max, int size); };
3c7a617c949550dfb6557970bb0ac6911c671b4c
41ff29c79207e6a34bb0ade2c8b6d6eaaf515c07
/2012/2012RobotProgram/CommandBase.h
8fdcff92b3906d606571da204b8228b124a5f5fe
[]
no_license
stevep001/RoboEagles
322f56a568b5acfa51478d1cd4ecfb8588a5902c
5c4a6afc67d3d9c554826bfb282708320511d110
refs/heads/master
2021-01-13T01:55:23.227079
2014-01-18T07:19:24
2014-01-18T07:19:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,301
h
CommandBase.h
#ifndef COMMAND_BASE_H #define COMMAND_BASE_H #include "Commands/Command.h" #include "Subsystems/Chassis.h" #include "OI.h" #include "Subsystems/CompressorSubsystem.h" #include "Subsystems/ThrowerSubsystem.h" #include "Subsystems/BallLoaderSubsystem.h" #include "Subsystems/LifterSubsystem.h" #include "Subsystems/SensorSubsystem.h" #include "Subsystems/TrafficCopSubsystem.h" #include "Subsystems/LCDSubsystem.h" #include "Subsystems/CameraControlSubsystem.h" #define MIN_THROWING_POWER 2 #define MAX_THROWING_POWER 40 #define MIN_AUTONOMOUS_MODE 1 #define ABRT_IMMEDIATE_MODE 1 #define ABRT_2SEC_MODE 2 #define ABRT_4SEC_MODE 3 #define ABRT_6SEC_MODE 4 #define ABRT_8SEC_MODE 5 #define ABRM_IMMEDIATE_MODE 6 #define ABRM_2SEC_MODE 7 #define ABRM_4SEC_MODE 8 #define ABRM_6SEC_MODE 9 #define ABRM_8SEC_MODE 10 #define ABLM_IMMEDIATE_MODE 11 #define ABLM_2SEC_MODE 12 #define ABLM_4SEC_MODE 13 #define ABLM_6SEC_MODE 14 #define ABLM_8SEC_MODE 15 #define AUTO_RAMP_BASKETS_MODE 16 #define AUTO_DO_NOTHING_MODE 17 //ANGLE TESTING CODE #define ABRT_160_TEST 18 #define ABRT_170_TEST 19 #define ABRT_180_TEST 20 #define ABRT_190_TEST 21 #define ABRM_200_TEST 22 #define ABRM_210_TEST 23 #define ABRM_220_TEST 24 #define ABRM_230_TEST 25 #define BALL_EJECT_MODE 26 #define MAX_AUTONOMOUS_MODE 26 /** * The base for all commands. All atomic commands should subclass CommandBase. * CommandBase stores creates and stores each control system. To access a * subsystem elsewhere in your code in your code use CommandBase.examplesubsystem */ class CommandBase: public Command { public: CommandBase(const char *name); CommandBase(); static void init(); // Create a single static instance of all of your subsystems static Chassis *chassis; static CompressorSubsystem *compressorSubsystem; static OI *oi; static ThrowerSubsystem *throwerSubsystem; static BallLoaderSubsystem *ballLoaderSubsystem; static LifterSubsystem *lifterSubsystem; static SensorSubsystem *sensorSubsystem; static TrafficCopSubsystem *trafficCopSubsystem; static LCDSubsystem *lcdSubsystem; static CameraControlSubsystem *cameraControlSubsystem; static int throwerPower; static bool flapDown; static int autonomousProgram; }; #endif
d60daf53e554682fe753b94f312337c9189ac32c
25f88195723682e6fbd56c7e019364f4dcaed823
/examples/F5ZSW_bf/F5ZSW_bf.ino
83b9bc59e3159b00c0f6b3f47141b3d76fb10e49
[]
no_license
f4goh/MODULATION
9d558067eb6c71cff4d13affeede9ba17bdd7549
b5fb0a188567efd5f1ac0b246b3a0b4c1bafb7c3
refs/heads/master
2022-05-18T03:09:32.851364
2022-03-30T12:05:43
2022-03-30T12:05:43
61,471,754
7
1
null
null
null
null
UTF-8
C++
false
false
12,268
ino
F5ZSW_bf.ino
/*sample code for F5ZSW BF version Anthony LE CREN F4GOH@orange.fr Created 23/3/2022 the program send cw and ft8 sequence 4 times per minutes with GPS to have perfect timing */ #include <JTEncode.h> #include <SoftwareSerial.h> #include <TinyGPS.h> #include <TimerOne.h> //NANO pinout #define txPin 6 //tx pin into RX GPS connection #define rxPin 7 //rx pin into TX GPS connection #define LED 8 //output pin led #define PTT 3 // PTT pin. This is active low. #define bfPin 5 //afsk output must be PD5 //#define debugGPS //enable print all nmea sentences on serial monitor #define debugDDS //enable debug DDS with some key commands as 0,1,2,3 on serial monitor (see debug function) //#define debugSYMBOLS #define CW_FREQUENCY 10133000 //same fequency for test #define FT8_FREQUENCY 10133000 // #define CW_TXT " VVV F5ZSW JN23MK" #define CALL "F5ZSW" //callsign #define DBM 20 //power in dbm #define GPS_BAUD_RATE 9600 #define PC_BAUD_RATE 115200 #define PWM_GAIN 140 //continous voltage ctrl for mosfet 110=1.2V -> 1K and 4.7K (210) #define MESSAGE "CQ F5ZSW JN23" #define FT8_TONE_SPACING 6.25f #define FT8_DELAY 160 SoftwareSerial ss(rxPin, txPin); // RX, TX for GPS JTEncode jtencode; TinyGPS gps; enum mode { CW, FT8_CQ, }; byte tableSeconds[] = {0, 15, 30, 45}; //seconds to transmit mode tableMode[] = {CW, CW, CW, FT8_CQ}; long factor = -1500; //adjust frequency to wspr band uint8_t symbols[WSPR_SYMBOL_COUNT]; //buffer memeory for WSPR or ft8 encoding volatile int phase; unsigned long ddsReg[8]; double refclk; volatile unsigned long ddsAccu; // phase accumulator volatile unsigned long ddsWord; volatile unsigned int sinusPtr; volatile int countPtr; volatile int shift; unsigned int centerFreq; byte save_TIMSK0; byte save_PCICR; void setup() { Serial.begin(PC_BAUD_RATE); Serial.print("Hello "); Serial.println(CALL ); pinMode(LED, OUTPUT); pinMode(bfPin, OUTPUT); analogWrite(bfPin, 0); pinMode(PTT, OUTPUT); digitalWrite(PTT, LOW); ss.begin(GPS_BAUD_RATE); delay(2000); //latlng2loc(48.605776, -4.550759, 0); //Serial.print("LOCATOR : "); //Serial.println(pos.locator); //Serial.println(pos.pwrDbm); Timer1.initialize(76); //µs fe=13200 hz so TE=76µs 13157.9 mesured begin(1500); } //main loop void loop() { #ifdef debugDDS char c; if (Serial.available() > 0) { c = Serial.read(); Serial.println(c); debug(c); } #endif lectGps(); } /******************************************************** WSPR loop with time sync ********************************************************/ void lectGps() { bool newData = false; // for (unsigned long start = millis(); millis() - start < 1000;) // { while (ss.available()) { char c = ss.read(); #ifdef debugGPS Serial.write(c); #endif if (gps.encode(c)) // Did a new valid sentence come in? newData = true; } // } if (newData) { unsigned long age; int year; byte month, day, hour, minute, second, hundredths; gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths, &age); if (age == TinyGPS::GPS_INVALID_AGE) Serial.println("******* ******* "); else { char sz[32]; char index; sprintf(sz, "%02d:%02d:%02d ", hour, minute, second); Serial.println(sz); digitalWrite(LED, digitalRead(LED) ^ 1); index = syncSeconds(second); if ((index >= 0) && (second % 15 == 0)) { mode mtx = tableMode[index]; switch (mtx) { case CW : txCW(CW_FREQUENCY, CW_TXT, 30); break; case FT8_CQ : txFt8(); break; } } } } } char syncSeconds(int m) { int i; char ret = -1; for (i = 0; i < sizeof(tableSeconds); i++) { if (m == tableSeconds[i]) { ret = i; } } return ret; } /******************************************************** Debug function ********************************************************/ void debug(char c) { switch (c) { case 'c' : txCW(CW_FREQUENCY, CW_TXT, 30); break; case 'f' : txFt8(); //ft8 cq break; } } /************************** cw **************************/ void txCW(long freqCw, char * stringCw, int cwWpm) { const static int morseVaricode[2][59] PROGMEM = { {0, 212, 72, 0, 144, 0, 128, 120, 176, 180, 0, 80, 204, 132, 84, 144, 248, 120, 56, 24, 8, 0, 128, 192, 224, 240, 224, 168, 0, 136, 0, 48, 104, 64, 128, 160, 128, 0, 32, 192, 0, 0, 112, 160, 64, 192, 128, 224, 96, 208, 64, 0, 128, 32, 16, 96, 144, 176, 192}, {7, 6, 5, 0, 4, 0, 4, 6, 5, 6, 0, 5, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 0, 5, 0, 6, 6, 2, 4, 4, 3, 1, 4, 3, 4, 2, 4, 3, 4, 2, 2, 3, 4, 4, 3, 3, 1, 3, 4, 3, 4, 4, 4} }; unsigned long tempo = 1200 / cwWpm; // Duration of 1 dot byte nb_bits, val; int d; int c = *stringCw++; txingOn(); while (c != '\0') { c = toupper(c); // Uppercase if (c == 32) { // Space character between words in string ddsWord = 0; send_bit((13157 * tempo * 7) / 1000); } else if (c > 32 && c < 91) { c = c - 32; d = int(pgm_read_word(&morseVaricode[0][c])); // Get CW varicode nb_bits = int(pgm_read_word(&morseVaricode[1][c])); // Get CW varicode length if (nb_bits != 0) { // Number of bits = 0 -> invalid character #%<> for (int b = 7; b > 7 - nb_bits; b--) { // Send CW character, each bit represents a symbol (0 for dot, 1 for dash) MSB first val = bitRead(d, b); //look varicode ddsWord = ddsReg[0]; send_bit((13157 * (tempo + 2 * tempo * val)) / 1000); // A dot length or a dash length (3 times the dot) ddsWord = 0; send_bit((13157 * tempo) / 1000); // between symbols in a character } } ddsWord = 0; // 3 dots length spacing send_bit((13157 * tempo * 3) / 1000); // between characters in a word } c = *stringCw++; // Next caracter in string } txingOff(); } /************************** ft8 **************************/ void txFt8() { Serial.println(MESSAGE); memset(symbols, 0, FT8_SYMBOL_COUNT); //clear memory jtencode.ft8_encode(MESSAGE, symbols); #ifdef debugSYMBOLS int n, lf; lf = 0; for (n = 0; n < FT8_SYMBOL_COUNT; n++) { //print symbols on serial monitor if (lf % 16 == 0) { Serial.println(); Serial.print(n); Serial.print(": "); } lf++; Serial.print(symbols[n]); Serial.print(','); } Serial.println(); #endif sendFt8(FT8_FREQUENCY); } void sendFt8(long freq) { int a = 0; txingOn(); for (int element = 0; element < FT8_SYMBOL_COUNT; element++) { // For each element in the message a = int(symbols[element]); // get the numerical ASCII Code //setfreq((double) freq + (double) a * FT8_TONE_SPACING, 0); //delay(FT8_DELAY); ddsWord = ddsReg[a]; send_bit(2105); //13157.9*0.160=2105.264 #ifdef debugSYMBOLS Serial.print(a); #endif digitalWrite(LED, digitalRead(LED) ^ 1); } txingOff(); } void txingOn() { digitalWrite(PTT, HIGH); //ptt on delay(50); //delay before sending data TCCR0B = TCCR0B & 0b11111000 | 1; //switch to 62500 HZ PWM frequency save_TIMSK0 = TIMSK0; //save Timer 0 register TIMSK0 = 0; //disable Timer 0 save_PCICR = PCICR; //save external pin interrupt register PCICR = 0; //disable external pin interrupt Timer1.attachInterrupt(sinus); //warp interrupt in library } void txingOff() { digitalWrite(PTT, LOW); //PTT off Timer1.detachInterrupt(); //disable timer1 interrupt analogWrite(bfPin, 0); //PWM at 0 TCCR0B = TCCR0B & 0b11111000 | 3; //register return to normal TIMSK0 = save_TIMSK0; PCICR = save_PCICR; Serial.println("EOT"); ss.begin(GPS_BAUD_RATE); } void begin(int freq) { refclk = 13157.9; // measured centerFreq = freq; ddsReg[0] = computeDdsWord((double) centerFreq); ddsReg[1] = computeDdsWord((double) centerFreq + FT8_TONE_SPACING); ddsReg[2] = computeDdsWord((double) centerFreq + 2 * FT8_TONE_SPACING); ddsReg[3] = computeDdsWord((double) centerFreq + 3 * FT8_TONE_SPACING); ddsReg[4] = computeDdsWord((double) centerFreq + 4 * FT8_TONE_SPACING); ddsReg[5] = computeDdsWord((double) centerFreq + 5 * FT8_TONE_SPACING); ddsReg[6] = computeDdsWord((double) centerFreq + 6 * FT8_TONE_SPACING); ddsReg[7] = computeDdsWord((double) centerFreq + 7 * FT8_TONE_SPACING); } /******************************************************** Send a bit into an FM modulation ********************************************************/ void send_bit(int tempo) { countPtr = 0; int countPtrPrec = 0; while (countPtrPrec < tempo) { if (countPtrPrec < countPtr) { countPtrPrec = countPtr; } } countPtr = 0; //digitalWrite(13,digitalRead(13)^1); } void sinus() { const static byte sinusTable[512] PROGMEM = {128, 129, 131, 132, 134, 135, 137, 138, 140, 141, 143, 145, 146, 148, 149, 151, 152, 154, 155, 157, 158, 160, 161, 163, 164, 166, 167, 169, 170, 172, 173, 175, 176, 178, 179, 180, 182, 183, 185, 186, 187, 189, 190, 191, 193, 194, 195, 197, 198, 199, 201, 202, 203, 204, 206, 207, 208, 209, 210, 212, 213, 214, 215, 216, 217, 218, 219, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 230, 231, 232, 233, 234, 235, 236, 236, 237, 238, 239, 240, 240, 241, 242, 242, 243, 244, 244, 245, 245, 246, 247, 247, 248, 248, 249, 249, 249, 250, 250, 251, 251, 251, 252, 252, 252, 253, 253, 253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 253, 253, 253, 253, 252, 252, 252, 251, 251, 251, 250, 250, 249, 249, 249, 248, 248, 247, 247, 246, 245, 245, 244, 244, 243, 242, 242, 241, 240, 240, 239, 238, 237, 236, 236, 235, 234, 233, 232, 231, 230, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 219, 218, 217, 216, 215, 214, 213, 212, 210, 209, 208, 207, 206, 204, 203, 202, 201, 199, 198, 197, 195, 194, 193, 191, 190, 189, 187, 186, 185, 183, 182, 180, 179, 178, 176, 175, 173, 172, 170, 169, 167, 166, 164, 163, 161, 160, 158, 157, 155, 154, 152, 151, 149, 148, 146, 145, 143, 141, 140, 138, 137, 135, 134, 132, 131, 129, 127, 126, 124, 123, 121, 120, 118, 117, 115, 114, 112, 110, 109, 107, 106, 104, 103, 101, 100, 98, 97, 95, 94, 92, 91, 89, 88, 86, 85, 83, 82, 80, 79, 77, 76, 75, 73, 72, 70, 69, 68, 66, 65, 64, 62, 61, 60, 58, 57, 56, 54, 53, 52, 51, 49, 48, 47, 46, 45, 43, 42, 41, 40, 39, 38, 37, 36, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 25, 24, 23, 22, 21, 20, 19, 19, 18, 17, 16, 15, 15, 14, 13, 13, 12, 11, 11, 10, 10, 9, 8, 8, 7, 7, 6, 6, 6, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 51, 52, 53, 54, 56, 57, 58, 60, 61, 62, 64, 65, 66, 68, 69, 70, 72, 73, 75, 76, 77, 79, 80, 82, 83, 85, 86, 88, 89, 91, 92, 94, 95, 97, 98, 100, 101, 103, 104, 106, 107, 109, 110, 112, 114, 115, 117, 118, 120, 121, 123, 124, 126 }; ddsAccu = ddsAccu + ddsWord; // soft DDS, phase accu with 32 bits sinusPtr = ddsAccu >> 23; sinusPtr = ((sinusPtr + phase) & 0x1ff); //add phase analogWrite(bfPin, pgm_read_byte(&(sinusTable[sinusPtr]))); countPtr++; } unsigned long computeDdsWord(double freq) { return pow(2, 32) * freq / refclk; }
cd8940885cab22d46b6c7c3b28bd8d4fdc8671c5
841776845974ba2645eff58ff8fabedd873093f0
/LeetCode/376摆动序列.cpp
dc97da3ca8d2d0c11036bcc43fb4e73a43048a8e
[]
no_license
hello-sources/Coding-Training
f2652c9b8e58d244a172922e56897fa2a3ad52fb
d885ca23676cb712243640169cf2e5bef2d8c70e
refs/heads/master
2023-01-19T11:17:36.097846
2023-01-01T00:49:09
2023-01-01T00:49:09
246,630,755
4
0
null
null
null
null
UTF-8
C++
false
false
667
cpp
376摆动序列.cpp
int wiggleMaxLength(int* nums, int numsSize){ if (numsSize < 2) return numsSize; int up[numsSize], down[numsSize]; memset(up, 0, sizeof(up)); memset(down, 0, sizeof(down)); up[0] = down[0] = 1; for (int i = 1; i < numsSize; i++) { if (nums[i] < nums[i - 1]) { up[i] = up[i - 1]; down[i] = fmax(up[i - 1] + 1, down[i - 1]); } else if (nums[i] > nums[i - 1]) { up[i] = fmax(up[i - 1], down[i - 1] + 1); down[i] = down[i - 1]; } else { down[i] = down[i - 1]; up[i] = up[i - 1]; } } return fmax(down[numsSize - 1], up[numsSize - 1]); }
9d55078cb13ab6cd2bec3cf468789c3af02aace6
73c7688838b4dd7a49786688a2e6e90907cd0f39
/1.8 设置编译器选项/Printer.h
d92cea938183a6c8a6301a8992a0103da05c8926
[]
no_license
JinBiLianShao/CMakeTutorials
d2621df6f6245aa7f4f291e4d4ff41b077b189a9
9585efd6204d0474b2f80b0b8e8ddbbd47ed38c5
refs/heads/main
2023-07-16T03:18:54.785755
2021-09-03T03:23:05
2021-09-03T03:23:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
233
h
Printer.h
#pragma once #include <iostream> #include <string> class Printer final { public: Printer() = default; ~Printer() = default; void info(std::string& info) const; void info(const char *info) const; };
a66031372f668741863568f7ccba8b32173840fc
24287639a5af25775a34729b5942892271db45b5
/211INC/control.h
f04e03b7fd8446a22491a6184599ce9abcaf474a
[]
no_license
FaucetDC/hldc-sdk
631c67c29b9a2054b28bf148f2b313cdd078e93b
1cfeeace3e6caabb567ce989b54dd44caeaf2bf0
refs/heads/master
2021-01-12T09:07:37.316770
2017-01-15T02:22:40
2017-01-15T02:26:33
76,768,456
8
1
null
null
null
null
UTF-8
C++
false
false
113,024
h
control.h
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 3.02.88 */ /* at Fri Feb 18 03:27:35 2000 */ /* Compiler settings for e:\dragon21\private\dshowdm6\idl\.\control.odl: Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext error checks: none */ //@@MIDL_FILE_HEADING( ) #include "rpc.h" #include "rpcndr.h" #ifndef __control_h__ #define __control_h__ #ifdef __cplusplus extern "C"{ #endif /* Forward Declarations */ #ifndef __IMediaControl_FWD_DEFINED__ #define __IMediaControl_FWD_DEFINED__ typedef interface IMediaControl IMediaControl; #endif /* __IMediaControl_FWD_DEFINED__ */ #ifndef __IMediaEvent_FWD_DEFINED__ #define __IMediaEvent_FWD_DEFINED__ typedef interface IMediaEvent IMediaEvent; #endif /* __IMediaEvent_FWD_DEFINED__ */ #ifndef __IMediaEventEx_FWD_DEFINED__ #define __IMediaEventEx_FWD_DEFINED__ typedef interface IMediaEventEx IMediaEventEx; #endif /* __IMediaEventEx_FWD_DEFINED__ */ #ifndef __IMediaPosition_FWD_DEFINED__ #define __IMediaPosition_FWD_DEFINED__ typedef interface IMediaPosition IMediaPosition; #endif /* __IMediaPosition_FWD_DEFINED__ */ #ifndef __IBasicAudio_FWD_DEFINED__ #define __IBasicAudio_FWD_DEFINED__ typedef interface IBasicAudio IBasicAudio; #endif /* __IBasicAudio_FWD_DEFINED__ */ #ifndef __IVideoWindow_FWD_DEFINED__ #define __IVideoWindow_FWD_DEFINED__ typedef interface IVideoWindow IVideoWindow; #endif /* __IVideoWindow_FWD_DEFINED__ */ #ifndef __IBasicVideo_FWD_DEFINED__ #define __IBasicVideo_FWD_DEFINED__ typedef interface IBasicVideo IBasicVideo; #endif /* __IBasicVideo_FWD_DEFINED__ */ #ifndef __FilgraphManager_FWD_DEFINED__ #define __FilgraphManager_FWD_DEFINED__ #ifdef __cplusplus typedef class FilgraphManager FilgraphManager; #else typedef struct FilgraphManager FilgraphManager; #endif /* __cplusplus */ #endif /* __FilgraphManager_FWD_DEFINED__ */ void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); void __RPC_USER MIDL_user_free( void __RPC_FAR * ); #ifndef __QuartzTypeLib_LIBRARY_DEFINED__ #define __QuartzTypeLib_LIBRARY_DEFINED__ /**************************************** * Generated header for library: QuartzTypeLib * at Fri Feb 18 03:27:35 2000 * using MIDL 3.02.88 ****************************************/ /* [version][lcid][helpstring][uuid] */ #define OATRUE (-1) #define OAFALSE (0) typedef double REFTIME; typedef long OAEVENT; typedef long OAHWND; typedef long OAFilterState; DEFINE_GUID(LIBID_QuartzTypeLib,0x56a868b0,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); #ifndef __IMediaControl_INTERFACE_DEFINED__ #define __IMediaControl_INTERFACE_DEFINED__ /**************************************** * Generated header for interface: IMediaControl * at Fri Feb 18 03:27:35 2000 * using MIDL 3.02.88 ****************************************/ /* [object][dual][oleautomation][helpstring][uuid] */ DEFINE_GUID(IID_IMediaControl,0x56a868b1,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); #if defined(__cplusplus) && !defined(CINTERFACE) interface DECLSPEC_UUID("56a868b1-0ad4-11ce-b03a-0020af0ba770") IMediaControl : public IDispatch { public: virtual HRESULT STDMETHODCALLTYPE Run( void) = 0; virtual HRESULT STDMETHODCALLTYPE Pause( void) = 0; virtual HRESULT STDMETHODCALLTYPE Stop( void) = 0; virtual HRESULT STDMETHODCALLTYPE GetState( /* [in] */ LONG msTimeout, /* [out] */ OAFilterState __RPC_FAR *pfs) = 0; virtual HRESULT STDMETHODCALLTYPE RenderFile( /* [in] */ BSTR strFilename) = 0; virtual HRESULT STDMETHODCALLTYPE AddSourceFilter( /* [in] */ BSTR strFilename, /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FilterCollection( /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RegFilterCollection( /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk) = 0; virtual HRESULT STDMETHODCALLTYPE StopWhenReady( void) = 0; }; #else /* C style interface */ typedef struct IMediaControlVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( IMediaControl __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( IMediaControl __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( IMediaControl __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( IMediaControl __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( IMediaControl __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( IMediaControl __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( IMediaControl __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Run )( IMediaControl __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Pause )( IMediaControl __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Stop )( IMediaControl __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetState )( IMediaControl __RPC_FAR * This, /* [in] */ LONG msTimeout, /* [out] */ OAFilterState __RPC_FAR *pfs); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RenderFile )( IMediaControl __RPC_FAR * This, /* [in] */ BSTR strFilename); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddSourceFilter )( IMediaControl __RPC_FAR * This, /* [in] */ BSTR strFilename, /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_FilterCollection )( IMediaControl __RPC_FAR * This, /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_RegFilterCollection )( IMediaControl __RPC_FAR * This, /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StopWhenReady )( IMediaControl __RPC_FAR * This); END_INTERFACE } IMediaControlVtbl; interface IMediaControl { CONST_VTBL struct IMediaControlVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define IMediaControl_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IMediaControl_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IMediaControl_Release(This) \ (This)->lpVtbl -> Release(This) #define IMediaControl_GetTypeInfoCount(This,pctinfo) \ (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) #define IMediaControl_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) #define IMediaControl_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) #define IMediaControl_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) #define IMediaControl_Run(This) \ (This)->lpVtbl -> Run(This) #define IMediaControl_Pause(This) \ (This)->lpVtbl -> Pause(This) #define IMediaControl_Stop(This) \ (This)->lpVtbl -> Stop(This) #define IMediaControl_GetState(This,msTimeout,pfs) \ (This)->lpVtbl -> GetState(This,msTimeout,pfs) #define IMediaControl_RenderFile(This,strFilename) \ (This)->lpVtbl -> RenderFile(This,strFilename) #define IMediaControl_AddSourceFilter(This,strFilename,ppUnk) \ (This)->lpVtbl -> AddSourceFilter(This,strFilename,ppUnk) #define IMediaControl_get_FilterCollection(This,ppUnk) \ (This)->lpVtbl -> get_FilterCollection(This,ppUnk) #define IMediaControl_get_RegFilterCollection(This,ppUnk) \ (This)->lpVtbl -> get_RegFilterCollection(This,ppUnk) #define IMediaControl_StopWhenReady(This) \ (This)->lpVtbl -> StopWhenReady(This) #endif /* COBJMACROS */ #endif /* C style interface */ HRESULT STDMETHODCALLTYPE IMediaControl_Run_Proxy( IMediaControl __RPC_FAR * This); void __RPC_STUB IMediaControl_Run_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaControl_Pause_Proxy( IMediaControl __RPC_FAR * This); void __RPC_STUB IMediaControl_Pause_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaControl_Stop_Proxy( IMediaControl __RPC_FAR * This); void __RPC_STUB IMediaControl_Stop_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaControl_GetState_Proxy( IMediaControl __RPC_FAR * This, /* [in] */ LONG msTimeout, /* [out] */ OAFilterState __RPC_FAR *pfs); void __RPC_STUB IMediaControl_GetState_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaControl_RenderFile_Proxy( IMediaControl __RPC_FAR * This, /* [in] */ BSTR strFilename); void __RPC_STUB IMediaControl_RenderFile_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaControl_AddSourceFilter_Proxy( IMediaControl __RPC_FAR * This, /* [in] */ BSTR strFilename, /* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk); void __RPC_STUB IMediaControl_AddSourceFilter_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IMediaControl_get_FilterCollection_Proxy( IMediaControl __RPC_FAR * This, /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk); void __RPC_STUB IMediaControl_get_FilterCollection_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IMediaControl_get_RegFilterCollection_Proxy( IMediaControl __RPC_FAR * This, /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppUnk); void __RPC_STUB IMediaControl_get_RegFilterCollection_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaControl_StopWhenReady_Proxy( IMediaControl __RPC_FAR * This); void __RPC_STUB IMediaControl_StopWhenReady_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __IMediaControl_INTERFACE_DEFINED__ */ #ifndef __IMediaEvent_INTERFACE_DEFINED__ #define __IMediaEvent_INTERFACE_DEFINED__ /**************************************** * Generated header for interface: IMediaEvent * at Fri Feb 18 03:27:35 2000 * using MIDL 3.02.88 ****************************************/ /* [object][dual][oleautomation][helpstring][uuid] */ DEFINE_GUID(IID_IMediaEvent,0x56a868b6,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); #if defined(__cplusplus) && !defined(CINTERFACE) interface DECLSPEC_UUID("56a868b6-0ad4-11ce-b03a-0020af0ba770") IMediaEvent : public IDispatch { public: virtual HRESULT STDMETHODCALLTYPE GetEventHandle( /* [out] */ OAEVENT __RPC_FAR *hEvent) = 0; virtual HRESULT STDMETHODCALLTYPE GetEvent( /* [out] */ long __RPC_FAR *lEventCode, /* [out] */ long __RPC_FAR *lParam1, /* [out] */ long __RPC_FAR *lParam2, /* [in] */ long msTimeout) = 0; virtual HRESULT STDMETHODCALLTYPE WaitForCompletion( /* [in] */ long msTimeout, /* [out] */ long __RPC_FAR *pEvCode) = 0; virtual HRESULT STDMETHODCALLTYPE CancelDefaultHandling( /* [in] */ long lEvCode) = 0; virtual HRESULT STDMETHODCALLTYPE RestoreDefaultHandling( /* [in] */ long lEvCode) = 0; virtual HRESULT STDMETHODCALLTYPE FreeEventParams( /* [in] */ long lEvCode, /* [in] */ long lParam1, /* [in] */ long lParam2) = 0; }; #else /* C style interface */ typedef struct IMediaEventVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( IMediaEvent __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( IMediaEvent __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( IMediaEvent __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( IMediaEvent __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( IMediaEvent __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( IMediaEvent __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( IMediaEvent __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEventHandle )( IMediaEvent __RPC_FAR * This, /* [out] */ OAEVENT __RPC_FAR *hEvent); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEvent )( IMediaEvent __RPC_FAR * This, /* [out] */ long __RPC_FAR *lEventCode, /* [out] */ long __RPC_FAR *lParam1, /* [out] */ long __RPC_FAR *lParam2, /* [in] */ long msTimeout); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *WaitForCompletion )( IMediaEvent __RPC_FAR * This, /* [in] */ long msTimeout, /* [out] */ long __RPC_FAR *pEvCode); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CancelDefaultHandling )( IMediaEvent __RPC_FAR * This, /* [in] */ long lEvCode); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RestoreDefaultHandling )( IMediaEvent __RPC_FAR * This, /* [in] */ long lEvCode); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FreeEventParams )( IMediaEvent __RPC_FAR * This, /* [in] */ long lEvCode, /* [in] */ long lParam1, /* [in] */ long lParam2); END_INTERFACE } IMediaEventVtbl; interface IMediaEvent { CONST_VTBL struct IMediaEventVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define IMediaEvent_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IMediaEvent_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IMediaEvent_Release(This) \ (This)->lpVtbl -> Release(This) #define IMediaEvent_GetTypeInfoCount(This,pctinfo) \ (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) #define IMediaEvent_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) #define IMediaEvent_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) #define IMediaEvent_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) #define IMediaEvent_GetEventHandle(This,hEvent) \ (This)->lpVtbl -> GetEventHandle(This,hEvent) #define IMediaEvent_GetEvent(This,lEventCode,lParam1,lParam2,msTimeout) \ (This)->lpVtbl -> GetEvent(This,lEventCode,lParam1,lParam2,msTimeout) #define IMediaEvent_WaitForCompletion(This,msTimeout,pEvCode) \ (This)->lpVtbl -> WaitForCompletion(This,msTimeout,pEvCode) #define IMediaEvent_CancelDefaultHandling(This,lEvCode) \ (This)->lpVtbl -> CancelDefaultHandling(This,lEvCode) #define IMediaEvent_RestoreDefaultHandling(This,lEvCode) \ (This)->lpVtbl -> RestoreDefaultHandling(This,lEvCode) #define IMediaEvent_FreeEventParams(This,lEvCode,lParam1,lParam2) \ (This)->lpVtbl -> FreeEventParams(This,lEvCode,lParam1,lParam2) #endif /* COBJMACROS */ #endif /* C style interface */ HRESULT STDMETHODCALLTYPE IMediaEvent_GetEventHandle_Proxy( IMediaEvent __RPC_FAR * This, /* [out] */ OAEVENT __RPC_FAR *hEvent); void __RPC_STUB IMediaEvent_GetEventHandle_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaEvent_GetEvent_Proxy( IMediaEvent __RPC_FAR * This, /* [out] */ long __RPC_FAR *lEventCode, /* [out] */ long __RPC_FAR *lParam1, /* [out] */ long __RPC_FAR *lParam2, /* [in] */ long msTimeout); void __RPC_STUB IMediaEvent_GetEvent_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaEvent_WaitForCompletion_Proxy( IMediaEvent __RPC_FAR * This, /* [in] */ long msTimeout, /* [out] */ long __RPC_FAR *pEvCode); void __RPC_STUB IMediaEvent_WaitForCompletion_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaEvent_CancelDefaultHandling_Proxy( IMediaEvent __RPC_FAR * This, /* [in] */ long lEvCode); void __RPC_STUB IMediaEvent_CancelDefaultHandling_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaEvent_RestoreDefaultHandling_Proxy( IMediaEvent __RPC_FAR * This, /* [in] */ long lEvCode); void __RPC_STUB IMediaEvent_RestoreDefaultHandling_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaEvent_FreeEventParams_Proxy( IMediaEvent __RPC_FAR * This, /* [in] */ long lEvCode, /* [in] */ long lParam1, /* [in] */ long lParam2); void __RPC_STUB IMediaEvent_FreeEventParams_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __IMediaEvent_INTERFACE_DEFINED__ */ #ifndef __IMediaEventEx_INTERFACE_DEFINED__ #define __IMediaEventEx_INTERFACE_DEFINED__ /**************************************** * Generated header for interface: IMediaEventEx * at Fri Feb 18 03:27:35 2000 * using MIDL 3.02.88 ****************************************/ /* [object][helpstring][uuid] */ DEFINE_GUID(IID_IMediaEventEx,0x56a868c0,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); #if defined(__cplusplus) && !defined(CINTERFACE) interface DECLSPEC_UUID("56a868c0-0ad4-11ce-b03a-0020af0ba770") IMediaEventEx : public IMediaEvent { public: virtual HRESULT STDMETHODCALLTYPE SetNotifyWindow( /* [in] */ OAHWND hwnd, /* [in] */ long lMsg, /* [in] */ long lInstanceData) = 0; virtual HRESULT STDMETHODCALLTYPE SetNotifyFlags( /* [in] */ long lNoNotifyFlags) = 0; virtual HRESULT STDMETHODCALLTYPE GetNotifyFlags( /* [out] */ long __RPC_FAR *lplNoNotifyFlags) = 0; }; #else /* C style interface */ typedef struct IMediaEventExVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( IMediaEventEx __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( IMediaEventEx __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( IMediaEventEx __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( IMediaEventEx __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( IMediaEventEx __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( IMediaEventEx __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( IMediaEventEx __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEventHandle )( IMediaEventEx __RPC_FAR * This, /* [out] */ OAEVENT __RPC_FAR *hEvent); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEvent )( IMediaEventEx __RPC_FAR * This, /* [out] */ long __RPC_FAR *lEventCode, /* [out] */ long __RPC_FAR *lParam1, /* [out] */ long __RPC_FAR *lParam2, /* [in] */ long msTimeout); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *WaitForCompletion )( IMediaEventEx __RPC_FAR * This, /* [in] */ long msTimeout, /* [out] */ long __RPC_FAR *pEvCode); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CancelDefaultHandling )( IMediaEventEx __RPC_FAR * This, /* [in] */ long lEvCode); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RestoreDefaultHandling )( IMediaEventEx __RPC_FAR * This, /* [in] */ long lEvCode); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FreeEventParams )( IMediaEventEx __RPC_FAR * This, /* [in] */ long lEvCode, /* [in] */ long lParam1, /* [in] */ long lParam2); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNotifyWindow )( IMediaEventEx __RPC_FAR * This, /* [in] */ OAHWND hwnd, /* [in] */ long lMsg, /* [in] */ long lInstanceData); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetNotifyFlags )( IMediaEventEx __RPC_FAR * This, /* [in] */ long lNoNotifyFlags); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNotifyFlags )( IMediaEventEx __RPC_FAR * This, /* [out] */ long __RPC_FAR *lplNoNotifyFlags); END_INTERFACE } IMediaEventExVtbl; interface IMediaEventEx { CONST_VTBL struct IMediaEventExVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define IMediaEventEx_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IMediaEventEx_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IMediaEventEx_Release(This) \ (This)->lpVtbl -> Release(This) #define IMediaEventEx_GetTypeInfoCount(This,pctinfo) \ (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) #define IMediaEventEx_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) #define IMediaEventEx_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) #define IMediaEventEx_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) #define IMediaEventEx_GetEventHandle(This,hEvent) \ (This)->lpVtbl -> GetEventHandle(This,hEvent) #define IMediaEventEx_GetEvent(This,lEventCode,lParam1,lParam2,msTimeout) \ (This)->lpVtbl -> GetEvent(This,lEventCode,lParam1,lParam2,msTimeout) #define IMediaEventEx_WaitForCompletion(This,msTimeout,pEvCode) \ (This)->lpVtbl -> WaitForCompletion(This,msTimeout,pEvCode) #define IMediaEventEx_CancelDefaultHandling(This,lEvCode) \ (This)->lpVtbl -> CancelDefaultHandling(This,lEvCode) #define IMediaEventEx_RestoreDefaultHandling(This,lEvCode) \ (This)->lpVtbl -> RestoreDefaultHandling(This,lEvCode) #define IMediaEventEx_FreeEventParams(This,lEvCode,lParam1,lParam2) \ (This)->lpVtbl -> FreeEventParams(This,lEvCode,lParam1,lParam2) #define IMediaEventEx_SetNotifyWindow(This,hwnd,lMsg,lInstanceData) \ (This)->lpVtbl -> SetNotifyWindow(This,hwnd,lMsg,lInstanceData) #define IMediaEventEx_SetNotifyFlags(This,lNoNotifyFlags) \ (This)->lpVtbl -> SetNotifyFlags(This,lNoNotifyFlags) #define IMediaEventEx_GetNotifyFlags(This,lplNoNotifyFlags) \ (This)->lpVtbl -> GetNotifyFlags(This,lplNoNotifyFlags) #endif /* COBJMACROS */ #endif /* C style interface */ HRESULT STDMETHODCALLTYPE IMediaEventEx_SetNotifyWindow_Proxy( IMediaEventEx __RPC_FAR * This, /* [in] */ OAHWND hwnd, /* [in] */ long lMsg, /* [in] */ long lInstanceData); void __RPC_STUB IMediaEventEx_SetNotifyWindow_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaEventEx_SetNotifyFlags_Proxy( IMediaEventEx __RPC_FAR * This, /* [in] */ long lNoNotifyFlags); void __RPC_STUB IMediaEventEx_SetNotifyFlags_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaEventEx_GetNotifyFlags_Proxy( IMediaEventEx __RPC_FAR * This, /* [out] */ long __RPC_FAR *lplNoNotifyFlags); void __RPC_STUB IMediaEventEx_GetNotifyFlags_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __IMediaEventEx_INTERFACE_DEFINED__ */ #ifndef __IMediaPosition_INTERFACE_DEFINED__ #define __IMediaPosition_INTERFACE_DEFINED__ /**************************************** * Generated header for interface: IMediaPosition * at Fri Feb 18 03:27:35 2000 * using MIDL 3.02.88 ****************************************/ /* [object][dual][oleautomation][helpstring][uuid] */ DEFINE_GUID(IID_IMediaPosition,0x56a868b2,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); #if defined(__cplusplus) && !defined(CINTERFACE) interface DECLSPEC_UUID("56a868b2-0ad4-11ce-b03a-0020af0ba770") IMediaPosition : public IDispatch { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Duration( /* [retval][out] */ REFTIME __RPC_FAR *plength) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_CurrentPosition( /* [in] */ REFTIME llTime) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CurrentPosition( /* [retval][out] */ REFTIME __RPC_FAR *pllTime) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StopTime( /* [retval][out] */ REFTIME __RPC_FAR *pllTime) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_StopTime( /* [in] */ REFTIME llTime) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PrerollTime( /* [retval][out] */ REFTIME __RPC_FAR *pllTime) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_PrerollTime( /* [in] */ REFTIME llTime) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Rate( /* [in] */ double dRate) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Rate( /* [retval][out] */ double __RPC_FAR *pdRate) = 0; virtual HRESULT STDMETHODCALLTYPE CanSeekForward( /* [retval][out] */ LONG __RPC_FAR *pCanSeekForward) = 0; virtual HRESULT STDMETHODCALLTYPE CanSeekBackward( /* [retval][out] */ LONG __RPC_FAR *pCanSeekBackward) = 0; }; #else /* C style interface */ typedef struct IMediaPositionVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( IMediaPosition __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( IMediaPosition __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( IMediaPosition __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( IMediaPosition __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( IMediaPosition __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( IMediaPosition __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( IMediaPosition __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Duration )( IMediaPosition __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *plength); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_CurrentPosition )( IMediaPosition __RPC_FAR * This, /* [in] */ REFTIME llTime); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_CurrentPosition )( IMediaPosition __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *pllTime); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_StopTime )( IMediaPosition __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *pllTime); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_StopTime )( IMediaPosition __RPC_FAR * This, /* [in] */ REFTIME llTime); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_PrerollTime )( IMediaPosition __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *pllTime); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_PrerollTime )( IMediaPosition __RPC_FAR * This, /* [in] */ REFTIME llTime); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Rate )( IMediaPosition __RPC_FAR * This, /* [in] */ double dRate); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Rate )( IMediaPosition __RPC_FAR * This, /* [retval][out] */ double __RPC_FAR *pdRate); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanSeekForward )( IMediaPosition __RPC_FAR * This, /* [retval][out] */ LONG __RPC_FAR *pCanSeekForward); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CanSeekBackward )( IMediaPosition __RPC_FAR * This, /* [retval][out] */ LONG __RPC_FAR *pCanSeekBackward); END_INTERFACE } IMediaPositionVtbl; interface IMediaPosition { CONST_VTBL struct IMediaPositionVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define IMediaPosition_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IMediaPosition_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IMediaPosition_Release(This) \ (This)->lpVtbl -> Release(This) #define IMediaPosition_GetTypeInfoCount(This,pctinfo) \ (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) #define IMediaPosition_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) #define IMediaPosition_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) #define IMediaPosition_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) #define IMediaPosition_get_Duration(This,plength) \ (This)->lpVtbl -> get_Duration(This,plength) #define IMediaPosition_put_CurrentPosition(This,llTime) \ (This)->lpVtbl -> put_CurrentPosition(This,llTime) #define IMediaPosition_get_CurrentPosition(This,pllTime) \ (This)->lpVtbl -> get_CurrentPosition(This,pllTime) #define IMediaPosition_get_StopTime(This,pllTime) \ (This)->lpVtbl -> get_StopTime(This,pllTime) #define IMediaPosition_put_StopTime(This,llTime) \ (This)->lpVtbl -> put_StopTime(This,llTime) #define IMediaPosition_get_PrerollTime(This,pllTime) \ (This)->lpVtbl -> get_PrerollTime(This,pllTime) #define IMediaPosition_put_PrerollTime(This,llTime) \ (This)->lpVtbl -> put_PrerollTime(This,llTime) #define IMediaPosition_put_Rate(This,dRate) \ (This)->lpVtbl -> put_Rate(This,dRate) #define IMediaPosition_get_Rate(This,pdRate) \ (This)->lpVtbl -> get_Rate(This,pdRate) #define IMediaPosition_CanSeekForward(This,pCanSeekForward) \ (This)->lpVtbl -> CanSeekForward(This,pCanSeekForward) #define IMediaPosition_CanSeekBackward(This,pCanSeekBackward) \ (This)->lpVtbl -> CanSeekBackward(This,pCanSeekBackward) #endif /* COBJMACROS */ #endif /* C style interface */ /* [propget] */ HRESULT STDMETHODCALLTYPE IMediaPosition_get_Duration_Proxy( IMediaPosition __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *plength); void __RPC_STUB IMediaPosition_get_Duration_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IMediaPosition_put_CurrentPosition_Proxy( IMediaPosition __RPC_FAR * This, /* [in] */ REFTIME llTime); void __RPC_STUB IMediaPosition_put_CurrentPosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IMediaPosition_get_CurrentPosition_Proxy( IMediaPosition __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *pllTime); void __RPC_STUB IMediaPosition_get_CurrentPosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IMediaPosition_get_StopTime_Proxy( IMediaPosition __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *pllTime); void __RPC_STUB IMediaPosition_get_StopTime_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IMediaPosition_put_StopTime_Proxy( IMediaPosition __RPC_FAR * This, /* [in] */ REFTIME llTime); void __RPC_STUB IMediaPosition_put_StopTime_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IMediaPosition_get_PrerollTime_Proxy( IMediaPosition __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *pllTime); void __RPC_STUB IMediaPosition_get_PrerollTime_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IMediaPosition_put_PrerollTime_Proxy( IMediaPosition __RPC_FAR * This, /* [in] */ REFTIME llTime); void __RPC_STUB IMediaPosition_put_PrerollTime_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IMediaPosition_put_Rate_Proxy( IMediaPosition __RPC_FAR * This, /* [in] */ double dRate); void __RPC_STUB IMediaPosition_put_Rate_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IMediaPosition_get_Rate_Proxy( IMediaPosition __RPC_FAR * This, /* [retval][out] */ double __RPC_FAR *pdRate); void __RPC_STUB IMediaPosition_get_Rate_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaPosition_CanSeekForward_Proxy( IMediaPosition __RPC_FAR * This, /* [retval][out] */ LONG __RPC_FAR *pCanSeekForward); void __RPC_STUB IMediaPosition_CanSeekForward_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IMediaPosition_CanSeekBackward_Proxy( IMediaPosition __RPC_FAR * This, /* [retval][out] */ LONG __RPC_FAR *pCanSeekBackward); void __RPC_STUB IMediaPosition_CanSeekBackward_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __IMediaPosition_INTERFACE_DEFINED__ */ #ifndef __IBasicAudio_INTERFACE_DEFINED__ #define __IBasicAudio_INTERFACE_DEFINED__ /**************************************** * Generated header for interface: IBasicAudio * at Fri Feb 18 03:27:35 2000 * using MIDL 3.02.88 ****************************************/ /* [object][dual][oleautomation][helpstring][uuid] */ DEFINE_GUID(IID_IBasicAudio,0x56a868b3,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); #if defined(__cplusplus) && !defined(CINTERFACE) interface DECLSPEC_UUID("56a868b3-0ad4-11ce-b03a-0020af0ba770") IBasicAudio : public IDispatch { public: virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Volume( /* [in] */ long lVolume) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Volume( /* [retval][out] */ long __RPC_FAR *plVolume) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Balance( /* [in] */ long lBalance) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Balance( /* [retval][out] */ long __RPC_FAR *plBalance) = 0; }; #else /* C style interface */ typedef struct IBasicAudioVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( IBasicAudio __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( IBasicAudio __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( IBasicAudio __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( IBasicAudio __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( IBasicAudio __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( IBasicAudio __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( IBasicAudio __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Volume )( IBasicAudio __RPC_FAR * This, /* [in] */ long lVolume); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Volume )( IBasicAudio __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *plVolume); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Balance )( IBasicAudio __RPC_FAR * This, /* [in] */ long lBalance); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Balance )( IBasicAudio __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *plBalance); END_INTERFACE } IBasicAudioVtbl; interface IBasicAudio { CONST_VTBL struct IBasicAudioVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define IBasicAudio_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IBasicAudio_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IBasicAudio_Release(This) \ (This)->lpVtbl -> Release(This) #define IBasicAudio_GetTypeInfoCount(This,pctinfo) \ (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) #define IBasicAudio_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) #define IBasicAudio_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) #define IBasicAudio_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) #define IBasicAudio_put_Volume(This,lVolume) \ (This)->lpVtbl -> put_Volume(This,lVolume) #define IBasicAudio_get_Volume(This,plVolume) \ (This)->lpVtbl -> get_Volume(This,plVolume) #define IBasicAudio_put_Balance(This,lBalance) \ (This)->lpVtbl -> put_Balance(This,lBalance) #define IBasicAudio_get_Balance(This,plBalance) \ (This)->lpVtbl -> get_Balance(This,plBalance) #endif /* COBJMACROS */ #endif /* C style interface */ /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicAudio_put_Volume_Proxy( IBasicAudio __RPC_FAR * This, /* [in] */ long lVolume); void __RPC_STUB IBasicAudio_put_Volume_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicAudio_get_Volume_Proxy( IBasicAudio __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *plVolume); void __RPC_STUB IBasicAudio_get_Volume_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicAudio_put_Balance_Proxy( IBasicAudio __RPC_FAR * This, /* [in] */ long lBalance); void __RPC_STUB IBasicAudio_put_Balance_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicAudio_get_Balance_Proxy( IBasicAudio __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *plBalance); void __RPC_STUB IBasicAudio_get_Balance_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __IBasicAudio_INTERFACE_DEFINED__ */ #ifndef __IVideoWindow_INTERFACE_DEFINED__ #define __IVideoWindow_INTERFACE_DEFINED__ /**************************************** * Generated header for interface: IVideoWindow * at Fri Feb 18 03:27:35 2000 * using MIDL 3.02.88 ****************************************/ /* [object][dual][oleautomation][helpstring][uuid] */ DEFINE_GUID(IID_IVideoWindow,0x56a868b4,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); #if defined(__cplusplus) && !defined(CINTERFACE) interface DECLSPEC_UUID("56a868b4-0ad4-11ce-b03a-0020af0ba770") IVideoWindow : public IDispatch { public: virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Caption( /* [in] */ BSTR strCaption) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Caption( /* [retval][out] */ BSTR __RPC_FAR *strCaption) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_WindowStyle( /* [in] */ long WindowStyle) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_WindowStyle( /* [retval][out] */ long __RPC_FAR *WindowStyle) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_WindowStyleEx( /* [in] */ long WindowStyleEx) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_WindowStyleEx( /* [retval][out] */ long __RPC_FAR *WindowStyleEx) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_AutoShow( /* [in] */ long AutoShow) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AutoShow( /* [retval][out] */ long __RPC_FAR *AutoShow) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_WindowState( /* [in] */ long WindowState) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_WindowState( /* [retval][out] */ long __RPC_FAR *WindowState) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_BackgroundPalette( /* [in] */ long BackgroundPalette) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BackgroundPalette( /* [retval][out] */ long __RPC_FAR *pBackgroundPalette) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Visible( /* [in] */ long Visible) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Visible( /* [retval][out] */ long __RPC_FAR *pVisible) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Left( /* [in] */ long Left) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Left( /* [retval][out] */ long __RPC_FAR *pLeft) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Width( /* [in] */ long Width) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Width( /* [retval][out] */ long __RPC_FAR *pWidth) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Top( /* [in] */ long Top) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Top( /* [retval][out] */ long __RPC_FAR *pTop) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Height( /* [in] */ long Height) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Height( /* [retval][out] */ long __RPC_FAR *pHeight) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Owner( /* [in] */ OAHWND Owner) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Owner( /* [retval][out] */ OAHWND __RPC_FAR *Owner) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_MessageDrain( /* [in] */ OAHWND Drain) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MessageDrain( /* [retval][out] */ OAHWND __RPC_FAR *Drain) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BorderColor( /* [retval][out] */ long __RPC_FAR *Color) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_BorderColor( /* [in] */ long Color) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FullScreenMode( /* [retval][out] */ long __RPC_FAR *FullScreenMode) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_FullScreenMode( /* [in] */ long FullScreenMode) = 0; virtual HRESULT STDMETHODCALLTYPE SetWindowForeground( /* [in] */ long Focus) = 0; virtual HRESULT STDMETHODCALLTYPE NotifyOwnerMessage( /* [in] */ long hwnd, /* [in] */ long uMsg, /* [in] */ long wParam, /* [in] */ long lParam) = 0; virtual HRESULT STDMETHODCALLTYPE SetWindowPosition( /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height) = 0; virtual HRESULT STDMETHODCALLTYPE GetWindowPosition( /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; virtual HRESULT STDMETHODCALLTYPE GetMinIdealImageSize( /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; virtual HRESULT STDMETHODCALLTYPE GetMaxIdealImageSize( /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; virtual HRESULT STDMETHODCALLTYPE GetRestorePosition( /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; virtual HRESULT STDMETHODCALLTYPE HideCursor( /* [in] */ long HideCursor) = 0; virtual HRESULT STDMETHODCALLTYPE IsCursorHidden( /* [out] */ long __RPC_FAR *CursorHidden) = 0; }; #else /* C style interface */ typedef struct IVideoWindowVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( IVideoWindow __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( IVideoWindow __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( IVideoWindow __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( IVideoWindow __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( IVideoWindow __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( IVideoWindow __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( IVideoWindow __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Caption )( IVideoWindow __RPC_FAR * This, /* [in] */ BSTR strCaption); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Caption )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ BSTR __RPC_FAR *strCaption); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_WindowStyle )( IVideoWindow __RPC_FAR * This, /* [in] */ long WindowStyle); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_WindowStyle )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *WindowStyle); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_WindowStyleEx )( IVideoWindow __RPC_FAR * This, /* [in] */ long WindowStyleEx); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_WindowStyleEx )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *WindowStyleEx); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_AutoShow )( IVideoWindow __RPC_FAR * This, /* [in] */ long AutoShow); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_AutoShow )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *AutoShow); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_WindowState )( IVideoWindow __RPC_FAR * This, /* [in] */ long WindowState); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_WindowState )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *WindowState); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_BackgroundPalette )( IVideoWindow __RPC_FAR * This, /* [in] */ long BackgroundPalette); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_BackgroundPalette )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pBackgroundPalette); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Visible )( IVideoWindow __RPC_FAR * This, /* [in] */ long Visible); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Visible )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pVisible); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Left )( IVideoWindow __RPC_FAR * This, /* [in] */ long Left); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Left )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pLeft); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Width )( IVideoWindow __RPC_FAR * This, /* [in] */ long Width); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Width )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pWidth); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Top )( IVideoWindow __RPC_FAR * This, /* [in] */ long Top); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Top )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pTop); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Height )( IVideoWindow __RPC_FAR * This, /* [in] */ long Height); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Height )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pHeight); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_Owner )( IVideoWindow __RPC_FAR * This, /* [in] */ OAHWND Owner); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_Owner )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ OAHWND __RPC_FAR *Owner); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_MessageDrain )( IVideoWindow __RPC_FAR * This, /* [in] */ OAHWND Drain); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_MessageDrain )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ OAHWND __RPC_FAR *Drain); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_BorderColor )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *Color); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_BorderColor )( IVideoWindow __RPC_FAR * This, /* [in] */ long Color); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_FullScreenMode )( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *FullScreenMode); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_FullScreenMode )( IVideoWindow __RPC_FAR * This, /* [in] */ long FullScreenMode); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWindowForeground )( IVideoWindow __RPC_FAR * This, /* [in] */ long Focus); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *NotifyOwnerMessage )( IVideoWindow __RPC_FAR * This, /* [in] */ long hwnd, /* [in] */ long uMsg, /* [in] */ long wParam, /* [in] */ long lParam); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetWindowPosition )( IVideoWindow __RPC_FAR * This, /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetWindowPosition )( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetMinIdealImageSize )( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetMaxIdealImageSize )( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetRestorePosition )( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *HideCursor )( IVideoWindow __RPC_FAR * This, /* [in] */ long HideCursor); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsCursorHidden )( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *CursorHidden); END_INTERFACE } IVideoWindowVtbl; interface IVideoWindow { CONST_VTBL struct IVideoWindowVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define IVideoWindow_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IVideoWindow_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IVideoWindow_Release(This) \ (This)->lpVtbl -> Release(This) #define IVideoWindow_GetTypeInfoCount(This,pctinfo) \ (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) #define IVideoWindow_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) #define IVideoWindow_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) #define IVideoWindow_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) #define IVideoWindow_put_Caption(This,strCaption) \ (This)->lpVtbl -> put_Caption(This,strCaption) #define IVideoWindow_get_Caption(This,strCaption) \ (This)->lpVtbl -> get_Caption(This,strCaption) #define IVideoWindow_put_WindowStyle(This,WindowStyle) \ (This)->lpVtbl -> put_WindowStyle(This,WindowStyle) #define IVideoWindow_get_WindowStyle(This,WindowStyle) \ (This)->lpVtbl -> get_WindowStyle(This,WindowStyle) #define IVideoWindow_put_WindowStyleEx(This,WindowStyleEx) \ (This)->lpVtbl -> put_WindowStyleEx(This,WindowStyleEx) #define IVideoWindow_get_WindowStyleEx(This,WindowStyleEx) \ (This)->lpVtbl -> get_WindowStyleEx(This,WindowStyleEx) #define IVideoWindow_put_AutoShow(This,AutoShow) \ (This)->lpVtbl -> put_AutoShow(This,AutoShow) #define IVideoWindow_get_AutoShow(This,AutoShow) \ (This)->lpVtbl -> get_AutoShow(This,AutoShow) #define IVideoWindow_put_WindowState(This,WindowState) \ (This)->lpVtbl -> put_WindowState(This,WindowState) #define IVideoWindow_get_WindowState(This,WindowState) \ (This)->lpVtbl -> get_WindowState(This,WindowState) #define IVideoWindow_put_BackgroundPalette(This,BackgroundPalette) \ (This)->lpVtbl -> put_BackgroundPalette(This,BackgroundPalette) #define IVideoWindow_get_BackgroundPalette(This,pBackgroundPalette) \ (This)->lpVtbl -> get_BackgroundPalette(This,pBackgroundPalette) #define IVideoWindow_put_Visible(This,Visible) \ (This)->lpVtbl -> put_Visible(This,Visible) #define IVideoWindow_get_Visible(This,pVisible) \ (This)->lpVtbl -> get_Visible(This,pVisible) #define IVideoWindow_put_Left(This,Left) \ (This)->lpVtbl -> put_Left(This,Left) #define IVideoWindow_get_Left(This,pLeft) \ (This)->lpVtbl -> get_Left(This,pLeft) #define IVideoWindow_put_Width(This,Width) \ (This)->lpVtbl -> put_Width(This,Width) #define IVideoWindow_get_Width(This,pWidth) \ (This)->lpVtbl -> get_Width(This,pWidth) #define IVideoWindow_put_Top(This,Top) \ (This)->lpVtbl -> put_Top(This,Top) #define IVideoWindow_get_Top(This,pTop) \ (This)->lpVtbl -> get_Top(This,pTop) #define IVideoWindow_put_Height(This,Height) \ (This)->lpVtbl -> put_Height(This,Height) #define IVideoWindow_get_Height(This,pHeight) \ (This)->lpVtbl -> get_Height(This,pHeight) #define IVideoWindow_put_Owner(This,Owner) \ (This)->lpVtbl -> put_Owner(This,Owner) #define IVideoWindow_get_Owner(This,Owner) \ (This)->lpVtbl -> get_Owner(This,Owner) #define IVideoWindow_put_MessageDrain(This,Drain) \ (This)->lpVtbl -> put_MessageDrain(This,Drain) #define IVideoWindow_get_MessageDrain(This,Drain) \ (This)->lpVtbl -> get_MessageDrain(This,Drain) #define IVideoWindow_get_BorderColor(This,Color) \ (This)->lpVtbl -> get_BorderColor(This,Color) #define IVideoWindow_put_BorderColor(This,Color) \ (This)->lpVtbl -> put_BorderColor(This,Color) #define IVideoWindow_get_FullScreenMode(This,FullScreenMode) \ (This)->lpVtbl -> get_FullScreenMode(This,FullScreenMode) #define IVideoWindow_put_FullScreenMode(This,FullScreenMode) \ (This)->lpVtbl -> put_FullScreenMode(This,FullScreenMode) #define IVideoWindow_SetWindowForeground(This,Focus) \ (This)->lpVtbl -> SetWindowForeground(This,Focus) #define IVideoWindow_NotifyOwnerMessage(This,hwnd,uMsg,wParam,lParam) \ (This)->lpVtbl -> NotifyOwnerMessage(This,hwnd,uMsg,wParam,lParam) #define IVideoWindow_SetWindowPosition(This,Left,Top,Width,Height) \ (This)->lpVtbl -> SetWindowPosition(This,Left,Top,Width,Height) #define IVideoWindow_GetWindowPosition(This,pLeft,pTop,pWidth,pHeight) \ (This)->lpVtbl -> GetWindowPosition(This,pLeft,pTop,pWidth,pHeight) #define IVideoWindow_GetMinIdealImageSize(This,pWidth,pHeight) \ (This)->lpVtbl -> GetMinIdealImageSize(This,pWidth,pHeight) #define IVideoWindow_GetMaxIdealImageSize(This,pWidth,pHeight) \ (This)->lpVtbl -> GetMaxIdealImageSize(This,pWidth,pHeight) #define IVideoWindow_GetRestorePosition(This,pLeft,pTop,pWidth,pHeight) \ (This)->lpVtbl -> GetRestorePosition(This,pLeft,pTop,pWidth,pHeight) #define IVideoWindow_HideCursor(This,HideCursor) \ (This)->lpVtbl -> HideCursor(This,HideCursor) #define IVideoWindow_IsCursorHidden(This,CursorHidden) \ (This)->lpVtbl -> IsCursorHidden(This,CursorHidden) #endif /* COBJMACROS */ #endif /* C style interface */ /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_Caption_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ BSTR strCaption); void __RPC_STUB IVideoWindow_put_Caption_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_Caption_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ BSTR __RPC_FAR *strCaption); void __RPC_STUB IVideoWindow_get_Caption_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_WindowStyle_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long WindowStyle); void __RPC_STUB IVideoWindow_put_WindowStyle_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_WindowStyle_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *WindowStyle); void __RPC_STUB IVideoWindow_get_WindowStyle_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_WindowStyleEx_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long WindowStyleEx); void __RPC_STUB IVideoWindow_put_WindowStyleEx_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_WindowStyleEx_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *WindowStyleEx); void __RPC_STUB IVideoWindow_get_WindowStyleEx_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_AutoShow_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long AutoShow); void __RPC_STUB IVideoWindow_put_AutoShow_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_AutoShow_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *AutoShow); void __RPC_STUB IVideoWindow_get_AutoShow_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_WindowState_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long WindowState); void __RPC_STUB IVideoWindow_put_WindowState_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_WindowState_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *WindowState); void __RPC_STUB IVideoWindow_get_WindowState_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_BackgroundPalette_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long BackgroundPalette); void __RPC_STUB IVideoWindow_put_BackgroundPalette_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_BackgroundPalette_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pBackgroundPalette); void __RPC_STUB IVideoWindow_get_BackgroundPalette_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_Visible_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long Visible); void __RPC_STUB IVideoWindow_put_Visible_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_Visible_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pVisible); void __RPC_STUB IVideoWindow_get_Visible_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_Left_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long Left); void __RPC_STUB IVideoWindow_put_Left_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_Left_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pLeft); void __RPC_STUB IVideoWindow_get_Left_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_Width_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long Width); void __RPC_STUB IVideoWindow_put_Width_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_Width_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pWidth); void __RPC_STUB IVideoWindow_get_Width_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_Top_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long Top); void __RPC_STUB IVideoWindow_put_Top_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_Top_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pTop); void __RPC_STUB IVideoWindow_get_Top_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_Height_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long Height); void __RPC_STUB IVideoWindow_put_Height_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_Height_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pHeight); void __RPC_STUB IVideoWindow_get_Height_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_Owner_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ OAHWND Owner); void __RPC_STUB IVideoWindow_put_Owner_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_Owner_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ OAHWND __RPC_FAR *Owner); void __RPC_STUB IVideoWindow_get_Owner_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_MessageDrain_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ OAHWND Drain); void __RPC_STUB IVideoWindow_put_MessageDrain_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_MessageDrain_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ OAHWND __RPC_FAR *Drain); void __RPC_STUB IVideoWindow_get_MessageDrain_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_BorderColor_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *Color); void __RPC_STUB IVideoWindow_get_BorderColor_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_BorderColor_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long Color); void __RPC_STUB IVideoWindow_put_BorderColor_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IVideoWindow_get_FullScreenMode_Proxy( IVideoWindow __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *FullScreenMode); void __RPC_STUB IVideoWindow_get_FullScreenMode_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IVideoWindow_put_FullScreenMode_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long FullScreenMode); void __RPC_STUB IVideoWindow_put_FullScreenMode_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IVideoWindow_SetWindowForeground_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long Focus); void __RPC_STUB IVideoWindow_SetWindowForeground_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IVideoWindow_NotifyOwnerMessage_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long hwnd, /* [in] */ long uMsg, /* [in] */ long wParam, /* [in] */ long lParam); void __RPC_STUB IVideoWindow_NotifyOwnerMessage_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IVideoWindow_SetWindowPosition_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height); void __RPC_STUB IVideoWindow_SetWindowPosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IVideoWindow_GetWindowPosition_Proxy( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); void __RPC_STUB IVideoWindow_GetWindowPosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IVideoWindow_GetMinIdealImageSize_Proxy( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); void __RPC_STUB IVideoWindow_GetMinIdealImageSize_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IVideoWindow_GetMaxIdealImageSize_Proxy( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); void __RPC_STUB IVideoWindow_GetMaxIdealImageSize_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IVideoWindow_GetRestorePosition_Proxy( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); void __RPC_STUB IVideoWindow_GetRestorePosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IVideoWindow_HideCursor_Proxy( IVideoWindow __RPC_FAR * This, /* [in] */ long HideCursor); void __RPC_STUB IVideoWindow_HideCursor_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IVideoWindow_IsCursorHidden_Proxy( IVideoWindow __RPC_FAR * This, /* [out] */ long __RPC_FAR *CursorHidden); void __RPC_STUB IVideoWindow_IsCursorHidden_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __IVideoWindow_INTERFACE_DEFINED__ */ #ifndef __IBasicVideo_INTERFACE_DEFINED__ #define __IBasicVideo_INTERFACE_DEFINED__ /**************************************** * Generated header for interface: IBasicVideo * at Fri Feb 18 03:27:35 2000 * using MIDL 3.02.88 ****************************************/ /* [object][dual][oleautomation][helpstring][uuid] */ DEFINE_GUID(IID_IBasicVideo,0x56a868b5,0x0ad4,0x11ce,0xb0,0x3a,0x00,0x20,0xaf,0x0b,0xa7,0x70); #if defined(__cplusplus) && !defined(CINTERFACE) interface DECLSPEC_UUID("56a868b5-0ad4-11ce-b03a-0020af0ba770") IBasicVideo : public IDispatch { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AvgTimePerFrame( /* [retval][out] */ REFTIME __RPC_FAR *pAvgTimePerFrame) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BitRate( /* [retval][out] */ long __RPC_FAR *pBitRate) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BitErrorRate( /* [retval][out] */ long __RPC_FAR *pBitErrorRate) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_VideoWidth( /* [retval][out] */ long __RPC_FAR *pVideoWidth) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_VideoHeight( /* [retval][out] */ long __RPC_FAR *pVideoHeight) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SourceLeft( /* [in] */ long SourceLeft) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourceLeft( /* [retval][out] */ long __RPC_FAR *pSourceLeft) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SourceWidth( /* [in] */ long SourceWidth) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourceWidth( /* [retval][out] */ long __RPC_FAR *pSourceWidth) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SourceTop( /* [in] */ long SourceTop) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourceTop( /* [retval][out] */ long __RPC_FAR *pSourceTop) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SourceHeight( /* [in] */ long SourceHeight) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourceHeight( /* [retval][out] */ long __RPC_FAR *pSourceHeight) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DestinationLeft( /* [in] */ long DestinationLeft) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DestinationLeft( /* [retval][out] */ long __RPC_FAR *pDestinationLeft) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DestinationWidth( /* [in] */ long DestinationWidth) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DestinationWidth( /* [retval][out] */ long __RPC_FAR *pDestinationWidth) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DestinationTop( /* [in] */ long DestinationTop) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DestinationTop( /* [retval][out] */ long __RPC_FAR *pDestinationTop) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_DestinationHeight( /* [in] */ long DestinationHeight) = 0; virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DestinationHeight( /* [retval][out] */ long __RPC_FAR *pDestinationHeight) = 0; virtual HRESULT STDMETHODCALLTYPE SetSourcePosition( /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height) = 0; virtual HRESULT STDMETHODCALLTYPE GetSourcePosition( /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; virtual HRESULT STDMETHODCALLTYPE SetDefaultSourcePosition( void) = 0; virtual HRESULT STDMETHODCALLTYPE SetDestinationPosition( /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height) = 0; virtual HRESULT STDMETHODCALLTYPE GetDestinationPosition( /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; virtual HRESULT STDMETHODCALLTYPE SetDefaultDestinationPosition( void) = 0; virtual HRESULT STDMETHODCALLTYPE GetVideoSize( /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight) = 0; virtual HRESULT STDMETHODCALLTYPE GetVideoPaletteEntries( /* [in] */ long StartIndex, /* [in] */ long Entries, /* [out] */ long __RPC_FAR *pRetrieved, /* [out] */ long __RPC_FAR *pPalette) = 0; virtual HRESULT STDMETHODCALLTYPE GetCurrentImage( /* [out][in] */ long __RPC_FAR *pBufferSize, /* [out] */ long __RPC_FAR *pDIBImage) = 0; virtual HRESULT STDMETHODCALLTYPE IsUsingDefaultSource( void) = 0; virtual HRESULT STDMETHODCALLTYPE IsUsingDefaultDestination( void) = 0; }; #else /* C style interface */ typedef struct IBasicVideoVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( IBasicVideo __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( IBasicVideo __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( IBasicVideo __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( IBasicVideo __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( IBasicVideo __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( IBasicVideo __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( IBasicVideo __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_AvgTimePerFrame )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *pAvgTimePerFrame); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_BitRate )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pBitRate); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_BitErrorRate )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pBitErrorRate); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VideoWidth )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pVideoWidth); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_VideoHeight )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pVideoHeight); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_SourceLeft )( IBasicVideo __RPC_FAR * This, /* [in] */ long SourceLeft); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_SourceLeft )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pSourceLeft); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_SourceWidth )( IBasicVideo __RPC_FAR * This, /* [in] */ long SourceWidth); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_SourceWidth )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pSourceWidth); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_SourceTop )( IBasicVideo __RPC_FAR * This, /* [in] */ long SourceTop); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_SourceTop )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pSourceTop); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_SourceHeight )( IBasicVideo __RPC_FAR * This, /* [in] */ long SourceHeight); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_SourceHeight )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pSourceHeight); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_DestinationLeft )( IBasicVideo __RPC_FAR * This, /* [in] */ long DestinationLeft); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_DestinationLeft )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pDestinationLeft); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_DestinationWidth )( IBasicVideo __RPC_FAR * This, /* [in] */ long DestinationWidth); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_DestinationWidth )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pDestinationWidth); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_DestinationTop )( IBasicVideo __RPC_FAR * This, /* [in] */ long DestinationTop); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_DestinationTop )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pDestinationTop); /* [propput] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *put_DestinationHeight )( IBasicVideo __RPC_FAR * This, /* [in] */ long DestinationHeight); /* [propget] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *get_DestinationHeight )( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pDestinationHeight); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSourcePosition )( IBasicVideo __RPC_FAR * This, /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSourcePosition )( IBasicVideo __RPC_FAR * This, /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultSourcePosition )( IBasicVideo __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDestinationPosition )( IBasicVideo __RPC_FAR * This, /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetDestinationPosition )( IBasicVideo __RPC_FAR * This, /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetDefaultDestinationPosition )( IBasicVideo __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetVideoSize )( IBasicVideo __RPC_FAR * This, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetVideoPaletteEntries )( IBasicVideo __RPC_FAR * This, /* [in] */ long StartIndex, /* [in] */ long Entries, /* [out] */ long __RPC_FAR *pRetrieved, /* [out] */ long __RPC_FAR *pPalette); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCurrentImage )( IBasicVideo __RPC_FAR * This, /* [out][in] */ long __RPC_FAR *pBufferSize, /* [out] */ long __RPC_FAR *pDIBImage); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsUsingDefaultSource )( IBasicVideo __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsUsingDefaultDestination )( IBasicVideo __RPC_FAR * This); END_INTERFACE } IBasicVideoVtbl; interface IBasicVideo { CONST_VTBL struct IBasicVideoVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define IBasicVideo_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IBasicVideo_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IBasicVideo_Release(This) \ (This)->lpVtbl -> Release(This) #define IBasicVideo_GetTypeInfoCount(This,pctinfo) \ (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) #define IBasicVideo_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) #define IBasicVideo_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) #define IBasicVideo_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) #define IBasicVideo_get_AvgTimePerFrame(This,pAvgTimePerFrame) \ (This)->lpVtbl -> get_AvgTimePerFrame(This,pAvgTimePerFrame) #define IBasicVideo_get_BitRate(This,pBitRate) \ (This)->lpVtbl -> get_BitRate(This,pBitRate) #define IBasicVideo_get_BitErrorRate(This,pBitErrorRate) \ (This)->lpVtbl -> get_BitErrorRate(This,pBitErrorRate) #define IBasicVideo_get_VideoWidth(This,pVideoWidth) \ (This)->lpVtbl -> get_VideoWidth(This,pVideoWidth) #define IBasicVideo_get_VideoHeight(This,pVideoHeight) \ (This)->lpVtbl -> get_VideoHeight(This,pVideoHeight) #define IBasicVideo_put_SourceLeft(This,SourceLeft) \ (This)->lpVtbl -> put_SourceLeft(This,SourceLeft) #define IBasicVideo_get_SourceLeft(This,pSourceLeft) \ (This)->lpVtbl -> get_SourceLeft(This,pSourceLeft) #define IBasicVideo_put_SourceWidth(This,SourceWidth) \ (This)->lpVtbl -> put_SourceWidth(This,SourceWidth) #define IBasicVideo_get_SourceWidth(This,pSourceWidth) \ (This)->lpVtbl -> get_SourceWidth(This,pSourceWidth) #define IBasicVideo_put_SourceTop(This,SourceTop) \ (This)->lpVtbl -> put_SourceTop(This,SourceTop) #define IBasicVideo_get_SourceTop(This,pSourceTop) \ (This)->lpVtbl -> get_SourceTop(This,pSourceTop) #define IBasicVideo_put_SourceHeight(This,SourceHeight) \ (This)->lpVtbl -> put_SourceHeight(This,SourceHeight) #define IBasicVideo_get_SourceHeight(This,pSourceHeight) \ (This)->lpVtbl -> get_SourceHeight(This,pSourceHeight) #define IBasicVideo_put_DestinationLeft(This,DestinationLeft) \ (This)->lpVtbl -> put_DestinationLeft(This,DestinationLeft) #define IBasicVideo_get_DestinationLeft(This,pDestinationLeft) \ (This)->lpVtbl -> get_DestinationLeft(This,pDestinationLeft) #define IBasicVideo_put_DestinationWidth(This,DestinationWidth) \ (This)->lpVtbl -> put_DestinationWidth(This,DestinationWidth) #define IBasicVideo_get_DestinationWidth(This,pDestinationWidth) \ (This)->lpVtbl -> get_DestinationWidth(This,pDestinationWidth) #define IBasicVideo_put_DestinationTop(This,DestinationTop) \ (This)->lpVtbl -> put_DestinationTop(This,DestinationTop) #define IBasicVideo_get_DestinationTop(This,pDestinationTop) \ (This)->lpVtbl -> get_DestinationTop(This,pDestinationTop) #define IBasicVideo_put_DestinationHeight(This,DestinationHeight) \ (This)->lpVtbl -> put_DestinationHeight(This,DestinationHeight) #define IBasicVideo_get_DestinationHeight(This,pDestinationHeight) \ (This)->lpVtbl -> get_DestinationHeight(This,pDestinationHeight) #define IBasicVideo_SetSourcePosition(This,Left,Top,Width,Height) \ (This)->lpVtbl -> SetSourcePosition(This,Left,Top,Width,Height) #define IBasicVideo_GetSourcePosition(This,pLeft,pTop,pWidth,pHeight) \ (This)->lpVtbl -> GetSourcePosition(This,pLeft,pTop,pWidth,pHeight) #define IBasicVideo_SetDefaultSourcePosition(This) \ (This)->lpVtbl -> SetDefaultSourcePosition(This) #define IBasicVideo_SetDestinationPosition(This,Left,Top,Width,Height) \ (This)->lpVtbl -> SetDestinationPosition(This,Left,Top,Width,Height) #define IBasicVideo_GetDestinationPosition(This,pLeft,pTop,pWidth,pHeight) \ (This)->lpVtbl -> GetDestinationPosition(This,pLeft,pTop,pWidth,pHeight) #define IBasicVideo_SetDefaultDestinationPosition(This) \ (This)->lpVtbl -> SetDefaultDestinationPosition(This) #define IBasicVideo_GetVideoSize(This,pWidth,pHeight) \ (This)->lpVtbl -> GetVideoSize(This,pWidth,pHeight) #define IBasicVideo_GetVideoPaletteEntries(This,StartIndex,Entries,pRetrieved,pPalette) \ (This)->lpVtbl -> GetVideoPaletteEntries(This,StartIndex,Entries,pRetrieved,pPalette) #define IBasicVideo_GetCurrentImage(This,pBufferSize,pDIBImage) \ (This)->lpVtbl -> GetCurrentImage(This,pBufferSize,pDIBImage) #define IBasicVideo_IsUsingDefaultSource(This) \ (This)->lpVtbl -> IsUsingDefaultSource(This) #define IBasicVideo_IsUsingDefaultDestination(This) \ (This)->lpVtbl -> IsUsingDefaultDestination(This) #endif /* COBJMACROS */ #endif /* C style interface */ /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_AvgTimePerFrame_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ REFTIME __RPC_FAR *pAvgTimePerFrame); void __RPC_STUB IBasicVideo_get_AvgTimePerFrame_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_BitRate_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pBitRate); void __RPC_STUB IBasicVideo_get_BitRate_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_BitErrorRate_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pBitErrorRate); void __RPC_STUB IBasicVideo_get_BitErrorRate_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_VideoWidth_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pVideoWidth); void __RPC_STUB IBasicVideo_get_VideoWidth_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_VideoHeight_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pVideoHeight); void __RPC_STUB IBasicVideo_get_VideoHeight_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicVideo_put_SourceLeft_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long SourceLeft); void __RPC_STUB IBasicVideo_put_SourceLeft_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_SourceLeft_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pSourceLeft); void __RPC_STUB IBasicVideo_get_SourceLeft_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicVideo_put_SourceWidth_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long SourceWidth); void __RPC_STUB IBasicVideo_put_SourceWidth_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_SourceWidth_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pSourceWidth); void __RPC_STUB IBasicVideo_get_SourceWidth_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicVideo_put_SourceTop_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long SourceTop); void __RPC_STUB IBasicVideo_put_SourceTop_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_SourceTop_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pSourceTop); void __RPC_STUB IBasicVideo_get_SourceTop_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicVideo_put_SourceHeight_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long SourceHeight); void __RPC_STUB IBasicVideo_put_SourceHeight_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_SourceHeight_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pSourceHeight); void __RPC_STUB IBasicVideo_get_SourceHeight_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicVideo_put_DestinationLeft_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long DestinationLeft); void __RPC_STUB IBasicVideo_put_DestinationLeft_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_DestinationLeft_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pDestinationLeft); void __RPC_STUB IBasicVideo_get_DestinationLeft_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicVideo_put_DestinationWidth_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long DestinationWidth); void __RPC_STUB IBasicVideo_put_DestinationWidth_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_DestinationWidth_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pDestinationWidth); void __RPC_STUB IBasicVideo_get_DestinationWidth_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicVideo_put_DestinationTop_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long DestinationTop); void __RPC_STUB IBasicVideo_put_DestinationTop_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_DestinationTop_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pDestinationTop); void __RPC_STUB IBasicVideo_get_DestinationTop_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propput] */ HRESULT STDMETHODCALLTYPE IBasicVideo_put_DestinationHeight_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long DestinationHeight); void __RPC_STUB IBasicVideo_put_DestinationHeight_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [propget] */ HRESULT STDMETHODCALLTYPE IBasicVideo_get_DestinationHeight_Proxy( IBasicVideo __RPC_FAR * This, /* [retval][out] */ long __RPC_FAR *pDestinationHeight); void __RPC_STUB IBasicVideo_get_DestinationHeight_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_SetSourcePosition_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height); void __RPC_STUB IBasicVideo_SetSourcePosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_GetSourcePosition_Proxy( IBasicVideo __RPC_FAR * This, /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); void __RPC_STUB IBasicVideo_GetSourcePosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_SetDefaultSourcePosition_Proxy( IBasicVideo __RPC_FAR * This); void __RPC_STUB IBasicVideo_SetDefaultSourcePosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_SetDestinationPosition_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long Left, /* [in] */ long Top, /* [in] */ long Width, /* [in] */ long Height); void __RPC_STUB IBasicVideo_SetDestinationPosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_GetDestinationPosition_Proxy( IBasicVideo __RPC_FAR * This, /* [out] */ long __RPC_FAR *pLeft, /* [out] */ long __RPC_FAR *pTop, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); void __RPC_STUB IBasicVideo_GetDestinationPosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_SetDefaultDestinationPosition_Proxy( IBasicVideo __RPC_FAR * This); void __RPC_STUB IBasicVideo_SetDefaultDestinationPosition_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_GetVideoSize_Proxy( IBasicVideo __RPC_FAR * This, /* [out] */ long __RPC_FAR *pWidth, /* [out] */ long __RPC_FAR *pHeight); void __RPC_STUB IBasicVideo_GetVideoSize_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_GetVideoPaletteEntries_Proxy( IBasicVideo __RPC_FAR * This, /* [in] */ long StartIndex, /* [in] */ long Entries, /* [out] */ long __RPC_FAR *pRetrieved, /* [out] */ long __RPC_FAR *pPalette); void __RPC_STUB IBasicVideo_GetVideoPaletteEntries_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_GetCurrentImage_Proxy( IBasicVideo __RPC_FAR * This, /* [out][in] */ long __RPC_FAR *pBufferSize, /* [out] */ long __RPC_FAR *pDIBImage); void __RPC_STUB IBasicVideo_GetCurrentImage_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_IsUsingDefaultSource_Proxy( IBasicVideo __RPC_FAR * This); void __RPC_STUB IBasicVideo_IsUsingDefaultSource_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); HRESULT STDMETHODCALLTYPE IBasicVideo_IsUsingDefaultDestination_Proxy( IBasicVideo __RPC_FAR * This); void __RPC_STUB IBasicVideo_IsUsingDefaultDestination_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __IBasicVideo_INTERFACE_DEFINED__ */ DEFINE_GUID(CLSID_FilgraphManager,0xe436ebb3,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); #ifdef __cplusplus class DECLSPEC_UUID("e436ebb3-524f-11ce-9f53-0020af0ba770") FilgraphManager; #endif #endif /* __QuartzTypeLib_LIBRARY_DEFINED__ */ /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
11f0cb5ac10bb09c908c08ad56fff055d74ccba6
c95937d631510bf5a18ad1c88ac59f2b68767e02
/tests/benchdnn/utils/bench_mode.cpp
2df376086d5d4b15c8ecaabd85dc44b3650e4271
[ "Apache-2.0", "BSD-3-Clause", "MIT", "Intel", "BSL-1.0", "BSD-2-Clause" ]
permissive
oneapi-src/oneDNN
5cdaa8d5b82fc23058ffbf650eb2f050b16a9d08
aef984b66360661b3116d9d1c1c9ca0cad66bf7f
refs/heads/master
2023-09-05T22:08:47.214983
2023-08-09T07:55:23
2023-09-05T13:13:34
58,414,589
1,544
480
Apache-2.0
2023-09-14T07:09:12
2016-05-09T23:26:42
C++
UTF-8
C++
false
false
2,613
cpp
bench_mode.cpp
/******************************************************************************* * Copyright 2023 Intel Corporation * * 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 "bench_mode.hpp" bench_mode_t default_bench_mode {bench_mode_t::corr}; bench_mode_t bench_mode {default_bench_mode}; mode_modifier_t default_bench_mode_modifier {mode_modifier_t::none}; mode_modifier_t bench_mode_modifier {default_bench_mode_modifier}; bool has_bench_mode_bit(mode_bit_t mode_bit) { return static_cast<bool>(bench_mode & mode_bit); } bool has_bench_mode_modifier(mode_modifier_t modifier) { return static_cast<bool>(bench_mode_modifier & modifier); } std::ostream &operator<<(std::ostream &s, bench_mode_t mode) { if (mode == bench_mode_t::list) s << "L"; if (mode == bench_mode_t::init) s << "I"; if (mode == bench_mode_t::exec) s << "R"; if (has_bench_mode_bit(mode_bit_t::corr)) s << "C"; if (has_bench_mode_bit(mode_bit_t::perf) && !has_bench_mode_bit(mode_bit_t::fast)) s << "P"; if (has_bench_mode_bit(mode_bit_t::fast)) s << "F"; return s; } std::ostream &operator<<(std::ostream &s, mode_modifier_t modifier) { if (modifier == mode_modifier_t::none) s << ""; if (has_bench_mode_modifier(mode_modifier_t::par_create)) s << "P"; if (has_bench_mode_modifier(mode_modifier_t::no_host_memory)) s << "M"; return s; } mode_bit_t operator&(bench_mode_t lhs, mode_bit_t rhs) { return static_cast<mode_bit_t>( static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); } mode_modifier_t operator|(mode_modifier_t lhs, mode_modifier_t rhs) { return static_cast<mode_modifier_t>( static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); } mode_modifier_t &operator|=(mode_modifier_t &lhs, mode_modifier_t rhs) { lhs = lhs | rhs; return lhs; } mode_modifier_t operator&(mode_modifier_t lhs, mode_modifier_t rhs) { return static_cast<mode_modifier_t>( static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
8ddd694d57765011941d6228a1f963829beaa04e
e1ee51e1e0846a0570502f922631cecdc9b897f6
/Functions.cpp
fb376b6eac529d70af9ba94dbdcccdbf3a3af074
[]
no_license
ahmedelnoamany/hangManWordGuess
0a370a919df78565d6611a468be71e9aba7cf6ce
dc42e75767399ca28ef2a2ec7567d78b5cd5d4ba
refs/heads/master
2021-01-21T07:57:06.407542
2016-09-19T21:42:13
2016-09-19T21:42:13
68,624,865
0
0
null
null
null
null
UTF-8
C++
false
false
6,554
cpp
Functions.cpp
/* * File: Functions.cpp * Author: Ahmed Elnoamany * Created on September 19, 2016, 2:54 PM */ #include <iostream> #include <string> #include <fstream> #include <time.h> #include <ctype.h> #include "Functions.h" using namespace std; void Functions::displayWord(string word,int size, bool identified[20]){ //center the word for (int i = 0; i < (40 - size); i++) cout << " "; for (int i = 0; i < size; i++) { //If character was previously found, or character is space, display the character if (identified[i] || word[i] == ' ' || word[i] == ' ') cout << word[i] << " "; else //Otherwise display "_" cout << "_" << " "; } cout << endl << endl; } bool Functions::search(string word, int size, char search_letter, bool identified[]){ //found flag bool found = false; //search array for letter for (int i = 0; i < size; i++) { if (word[i] == search_letter) { //if found, set flag, set bool array at that position found = true; identified[i] = true; } } return found; } string Functions::chooseWord(){ fstream word_list("wordlist.txt"); string word; int counter = 0; while (!word_list.eof()) { getline(word_list, word, '\n'); counter++; } srand(time(0)); int random_selection = rand() % counter; word_list.clear(); word_list.seekg(word_list.beg); for (int i = 0; i < counter || !word_list.eof(); i++) { getline(word_list, word, '\n'); if (i == random_selection) break; } //cout << "selection: " << random_selection << endl; return (word); } bool Functions::save(int score){ ofstream savefile("save.txt"); if (savefile) { savefile << score << endl; savefile.close(); return true; } else return false; } bool Functions::load(int &score){ ifstream savefile("save.txt"); if (savefile) { savefile >> score; savefile.close(); return true; } else return false; } char Functions::guessLetter(char guessed[], int numCharGuessed){ char letter; int flag; flag = 1; cout << " Please enter letter: " << endl; cin>> letter; while(!isalpha(letter)){ cout<<"Invalid entry!!"<<endl; cout << " Please enter letter: " << endl; cin>> letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } for (int i = 0; i <= numCharGuessed; i++) if (guessed[i] == letter) { cout << "This letter has already been guessed, Please enter a different letter: "; cin>>letter; } return letter; } bool Functions::guessWord(string word){ cout << endl << word; string guess; cout << " Please enter your guess: "; cin>>guess; for (int i = 0; i < 100; i++) { if (guess[i] == word[i]) return true; else return false; } } bool Functions::gameOver(int score) { cout << " GAME OVER!" << endl; cout << " Your Final Score Is: " << score; return true; }
28e0b17c5ceb6b8085b29070fd17ac969d4b3637
df90ed23a49dba79f61e5a28366424f0ecec60de
/src/configuration/lua/read_inside_array.cpp
7f16986dcc23e12ed1c8b7649c83636ab353dc90
[ "BSD-2-Clause" ]
permissive
Damdoshi/LibLapin
306e8ae8be70be9e4de93db60913c4f092a714a7
41491d3d3926b8e42e3aec8d1621340501841aae
refs/heads/master
2023-09-03T10:11:06.743172
2023-08-25T08:03:33
2023-08-25T08:03:33
64,509,332
39
12
NOASSERTION
2021-02-03T17:18:22
2016-07-29T20:43:25
C++
UTF-8
C++
false
false
469
cpp
read_inside_array.cpp
// Jason Brillante "Damdoshi" // Hanged Bunny Studio 2014-2018 // // Lapin library #include "lapin_private.h" Decision lua_read_inside_array(const char *code, ssize_t &i, SmallConf &conf, SmallConf &root) { do { if (lua_read_array_node(code, i, conf, root) == BD_ERROR) return (BD_ERROR); lua_read_separator(code, i); } while (readtext(code, i, ",")); lua_read_separator(code, i); return (BD_OK); }
8534b230ca0be40094d62ca844f2194e4f873ee7
722593fedb81fd9ae8a4f2f8d56fe2405c3d9698
/BMP压缩与隐写术/BMP压缩与隐写术/BMP压缩与隐写术Dlg.cpp
16884efc4debb3ae5a8c3f2e62de7348914df5a2
[]
no_license
ResistWu/Image-Format-Conversion-Cryptographic-Software
14517f6e5d7da314cb175459c91de5908303a2e0
5557cb91943743a9d563f00b8e9b91cf256f03a1
refs/heads/master
2020-04-01T14:01:41.008119
2018-10-16T11:56:42
2018-10-16T11:56:42
153,277,334
0
0
null
null
null
null
GB18030
C++
false
false
24,763
cpp
BMP压缩与隐写术Dlg.cpp
#pragma once // BMP压缩与隐写术Dlg.cpp : 实现文件 // #include "stdafx.h" #include "BMP压缩与隐写术.h" #include "BMP压缩与隐写术Dlg.h" #include "afxdialogex.h" #include "time.h" #include "Run.h" #include "huff.h" #include "Secret.h" #include "md5.h" #include "wavelet.h" #include "ezw.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CBMP压缩与隐写术Dlg 对话框 CBMP压缩与隐写术Dlg::CBMP压缩与隐写术Dlg(CWnd* pParent /*=NULL*/) : CDialogEx(CBMP压缩与隐写术Dlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CBMP压缩与隐写术Dlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Control(pDX, m_check1, c_check1); DDX_Control(pDX, m_txt1, c_txt1); DDX_Control(pDX, m_pic, c_pic); DDX_Control(pDX, txt2, c_txt2); DDX_Control(pDX, m_ckeck2, c_ckeck2); DDX_Control(pDX, m_txt2, c_txt3); //DDX_Control(pDX, m_check3, c_ckeck3); //DDX_Control(pDX, m_radio, c_radio); //DDX_Control(pDX, IDCANCEL, c_radio2); DDX_Control(pDX, m_ckeck5, c_ckeck5); DDX_Control(pDX, m_ckeck6, c_ckeck6); DDX_Control(pDX, m_sta1, c_sta1); } BEGIN_MESSAGE_MAP(CBMP压缩与隐写术Dlg, CDialogEx) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(m_check1, &CBMP压缩与隐写术Dlg::OnBnClickedcheck1) ON_STN_CLICKED(m_pic, &CBMP压缩与隐写术Dlg::OnStnClickedpic) //ON_WM_DROPFILES() ON_BN_CLICKED(IDC_BUTTON1, &CBMP压缩与隐写术Dlg::OnBnClickedButton1) ON_BN_CLICKED(IDOK, &CBMP压缩与隐写术Dlg::OnBnClickedOk) ON_BN_CLICKED(m_ckeck2, &CBMP压缩与隐写术Dlg::OnBnClickedckeck2) //ON_BN_CLICKED(m_check3, &CBMP压缩与隐写术Dlg::OnBnClickedcheck3) ON_BN_CLICKED(m_ckeck5, &CBMP压缩与隐写术Dlg::OnBnClickedckeck5) ON_BN_CLICKED(m_ckeck6, &CBMP压缩与隐写术Dlg::OnBnClickedckeck6) ON_BN_CLICKED(IDCANCEL, &CBMP压缩与隐写术Dlg::OnBnClickedCancel) ON_BN_CLICKED(IDC_BUTTON2, &CBMP压缩与隐写术Dlg::OnBnClickedButton2) END_MESSAGE_MAP() BEGIN_MESSAGE_MAP(CMyStatic, CStatic) ON_WM_DROPFILES() END_MESSAGE_MAP() // CBMP压缩与隐写术Dlg 消息处理程序 BOOL CBMP压缩与隐写术Dlg::OnInitDialog() { CDialogEx::OnInitDialog(); // 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动 // 执行此操作 SetIcon(m_hIcon, TRUE); // 设置大图标 SetIcon(m_hIcon, FALSE); // 设置小图标 // TODO: 在此添加额外的初始化代码 c_pic.DragAcceptFiles(TRUE); c_txt1.EnableWindow(FALSE); c_txt3.EnableWindow(FALSE); return TRUE; // 除非将焦点设置到控件,否则返回 TRUE } // 如果向对话框添加最小化按钮,则需要下面的代码 // 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序, // 这将由框架自动完成。 void CBMP压缩与隐写术Dlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // 用于绘制的设备上下文 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // 使图标在工作区矩形中居中 int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // 绘制图标 dc.DrawIcon(x, y, m_hIcon); } else { CDialogEx::OnPaint(); } } //当用户拖动最小化窗口时系统调用此函数取得光标 //显示。 HCURSOR CBMP压缩与隐写术Dlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } void CBMP压缩与隐写术Dlg::OnBnClickedcheck1() { // TODO: 在此添加控件通知处理程序代码 if (c_check1.GetCheck() == TRUE){ c_txt1.EnableWindow(TRUE); c_ckeck2.EnableWindow(FALSE); c_ckeck5.EnableWindow(FALSE); c_ckeck6.EnableWindow(FALSE); c_txt3.EnableWindow(FALSE); c_ckeck2.SetCheck(FALSE); c_ckeck5.SetCheck(FALSE); c_ckeck6.SetCheck(FALSE); } else{ c_txt1.EnableWindow(FALSE); c_ckeck2.EnableWindow(TRUE); c_ckeck5.EnableWindow(TRUE); c_ckeck6.EnableWindow(TRUE); //c_txt3.EnableWindow(TRUE); } } void CBMP压缩与隐写术Dlg::OnStnClickedpic() { // TODO: 在此添加控件通知处理程序代码 } void CMyStatic::OnDropFiles(HDROP hDropInfo) { // TODO: 在此添加消息处理程序代码和/或调用默认值 MessageBox(_T("777")); int cx, cy; CRect rect; int nFileCount = DragQueryFile(hDropInfo, -1, NULL, 0); TCHAR *strFilePath; int dwSize; if (nFileCount == 1) { dwSize = DragQueryFile(hDropInfo, 0, NULL, 0); strFilePath = new TCHAR[dwSize + 1]; if (strFilePath) { DragQueryFile(hDropInfo, 0, strFilePath, dwSize + 1); CImage image; //Retrieves the names of dropped files that result from a successful drag-and-drop operation. //Do sth to prove succeed image.Load(strFilePath); //获取图片的宽 高度 cx = image.GetWidth(); cy = image.GetHeight(); //获取Picture Control控件的大小 c_pic.GetWindowRect(&rect); //将客户区选中到控件表示的矩形区域内 ScreenToClient(&rect); //窗口移动到控件表示的区域 //c_pic.MoveWindow(rect.left, rect.top, cx, cy, TRUE); c_pic.GetClientRect(&rect);//获取句柄指向控件区域的大小 CDC *pDc = NULL; pDc = c_pic.GetDC();//获取picture的DC image.Draw(pDc->m_hDC, rect);//将图片绘制到picture表示的区域内 ReleaseDC(pDc); delete[]strFilePath; } } DragFinish(hDropInfo); //Invalidate(); CStatic::OnDropFiles(hDropInfo); } CString CBMP压缩与隐写术Dlg::BootOpenDialog() { CString strFile = _T(""); CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY, _T("Bmp (*.bmp)|*.bmp|Zmf (*.zmf)|*.zmf|EZW (*.ezw)|*.ezw||"), NULL); if (dlgFile.DoModal()) { strFile = dlgFile.GetPathName(); } return strFile; } void CBMP压缩与隐写术Dlg::OnBnClickedButton1() { // TODO: 在此添加控件通知处理程序代码 CString fpath; fpath = BootOpenDialog(); if (fpath != _T("")){ strFilePath = fpath; } //strFilePath = _T(""); int cx, cy; CRect rect; //strFilePath = BootOpenDialog(); if (strFilePath != _T("")){ CBMP压缩与隐写术App *app = (CBMP压缩与隐写术App*)AfxGetApp(); c_txt2.SetWindowTextW(strFilePath); if (strFilePath.Right(4)==_T(".bmp")) { c_check1.EnableWindow(TRUE); //c_txt1.EnableWindow(TRUE); c_ckeck2.EnableWindow(TRUE); c_ckeck5.EnableWindow(TRUE); c_ckeck6.EnableWindow(TRUE); c_ckeck2.SetCheck(FALSE); c_ckeck5.SetCheck(FALSE); c_ckeck6.SetCheck(FALSE); c_txt3.SetWindowTextW(NULL); c_txt1.SetWindowTextW(NULL); app->flag = 0; CImage image; //Retrieves the names of dropped files that result from a successful drag-and-drop operation. //Do sth to prove succeed image.Load(strFilePath); //获取图片的宽 高度 cx = image.GetWidth(); cy = image.GetHeight(); //获取Picture Control控件的大小 c_pic.GetWindowRect(&rect); //将客户区选中到控件表示的矩形区域内 ScreenToClient(&rect); //窗口移动到控件表示的区域 //c_pic.MoveWindow(rect.left, rect.top, cx, cy, TRUE); c_pic.GetClientRect(&rect);//获取句柄指向控件区域的大小 CDC *pDc = NULL; pDc = c_pic.GetDC();//获取picture的DC pDc->SetStretchBltMode(COLORONCOLOR); image.Draw(pDc->m_hDC, rect);//将图片绘制到picture表示的区域内 ReleaseDC(pDc); //delete[]strFilePath; } else{ c_check1.EnableWindow(FALSE); c_txt1.EnableWindow(FALSE); c_ckeck2.EnableWindow(FALSE); c_ckeck5.EnableWindow(FALSE); c_ckeck6.EnableWindow(FALSE); c_ckeck2.SetCheck(FALSE); c_ckeck5.SetCheck(FALSE); c_ckeck6.SetCheck(FALSE); c_txt3.SetWindowTextW(NULL); c_txt1.SetWindowTextW(NULL); CFile file(strFilePath, CFile::modeRead); BYTE flag; file.Read(&flag, 1); file.Close(); app->flag = flag; if (flag % 2 == 1){ c_txt3.EnableWindow(TRUE); CImage image; CRect rect; image.Load(_T("密码.bmp")); //获取图片的宽 高度 int cx = image.GetWidth(); int cy = image.GetHeight(); //获取Picture Control控件的大小 c_pic.GetWindowRect(&rect); //将客户区选中到控件表示的矩形区域内 ScreenToClient(&rect); //窗口移动到控件表示的区域 //c_pic.MoveWindow(rect.left, rect.top, cx, cy, TRUE); c_pic.GetClientRect(&rect);//获取句柄指向控件区域的大小 CDC *pDc = NULL; pDc = c_pic.GetDC();//获取picture的DC pDc->SetStretchBltMode(COLORONCOLOR); image.Draw(pDc->m_hDC, rect);//将图片绘制到picture表示的区域内 ReleaseDC(pDc); } else{ c_txt3.EnableWindow(FALSE); CImage image; CRect rect; image.Load(_T("解压.bmp")); //获取图片的宽 高度 int cx = image.GetWidth(); int cy = image.GetHeight(); //获取Picture Control控件的大小 c_pic.GetWindowRect(&rect); //将客户区选中到控件表示的矩形区域内 ScreenToClient(&rect); //窗口移动到控件表示的区域 //c_pic.MoveWindow(rect.left, rect.top, cx, cy, TRUE); c_pic.GetClientRect(&rect);//获取句柄指向控件区域的大小 CDC *pDc = NULL; pDc = c_pic.GetDC();//获取picture的DC pDc->SetStretchBltMode(COLORONCOLOR); image.Draw(pDc->m_hDC, rect);//将图片绘制到picture表示的区域内 ReleaseDC(pDc); } } } } void CBMP压缩与隐写术Dlg::OnBnClickedOk() { // TODO: 在此添加控件通知处理程序代码 CBMP压缩与隐写术App *app = (CBMP压缩与隐写术App*)AfxGetApp(); int x, y, size; clock_t t1, t2; CBitmap BitMap; BITMAP pBitMap; CString filepath; c_txt2.GetWindowTextW(filepath); //c_check1.SetCheck(FALSE); int a; CString s; if (strFilePath != _T("")){ c_sta1.SetWindowTextW(NULL); if (strFilePath.Right(4) == _T(".bmp")){ app->flag = 0; Huff huffr; Huff huffg; Huff huffb; //Huff huffa; //CBitmap BitMap; BitMap.Attach(LoadImage(0, strFilePath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)); //BITMAP pBitMap; BitMap.GetBitmap(&pBitMap); app->bmpdata = new BYTE[pBitMap.bmWidthBytes * pBitMap.bmHeight]; app->rdata = new BYTE[pBitMap.bmWidth * pBitMap.bmHeight]; app->gdata = new BYTE[pBitMap.bmWidth * pBitMap.bmHeight]; app->bdata = new BYTE[pBitMap.bmWidth * pBitMap.bmHeight]; app->adata = new BYTE[pBitMap.bmWidth * pBitMap.bmHeight]; BitMap.GetBitmapBits(pBitMap.bmWidthBytes * pBitMap.bmHeight, app->bmpdata); for (int i = 0; i < pBitMap.bmWidth*pBitMap.bmHeight; i++){ app->rdata[i] = app->bmpdata[4 * i + 2]; app->gdata[i] = app->bmpdata[4 * i + 1]; app->bdata[i] = app->bmpdata[4 * i + 0]; app->adata[i] = app->bmpdata[4 * i + 3]; } CFile headfile(strFilePath, CFile::modeRead); app->bmphead = new BYTE[54]; headfile.Read(app->bmphead, 54);//获取信息头 headfile.Close(); if (c_check1.GetCheck()){ CString msg; c_txt1.GetWindowTextW(msg); Secret yx(pBitMap.bmWidth, pBitMap.bmHeight); yx.yinxie(msg); for (int i = 0; i < pBitMap.bmWidth*pBitMap.bmHeight; i++){ app->bmpdata[4 * i + 2] = app->rdata[i]; app->bmpdata[4 * i + 1] = app->gdata[i]; app->bmpdata[4 * i + 0] = app->bdata[i]; app->bmpdata[4 * i + 3] = app->adata[i]; } CWindowDC dc(this); CBitmap myBitmap; CDC myDC; myDC.CreateCompatibleDC(&dc); myBitmap.CreateCompatibleBitmap(&dc, pBitMap.bmWidth, pBitMap.bmHeight); myBitmap.SetBitmapBits(pBitMap.bmWidth*pBitMap.bmHeight * 4, app->bmpdata); CImage imgTemp; imgTemp.Attach(myBitmap); imgTemp.Save(strFilePath + _T("_隐写.bmp")); MessageBox(_T("隐写完成")); } if (c_ckeck2.GetCheck()){ CString word; unsigned char *password; c_txt3.GetWindowTextW(word); DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, word, -1, NULL, NULL, 0, NULL); password = new unsigned char[dwNum]; WideCharToMultiByte(CP_OEMCP, NULL, word, -1, (LPSTR)password, dwNum, 0, NULL); MD5 en; app->md5code = new BYTE[16]; app->md5code = en.encode(password); app->flag += 1; } else{ for (int i = 0; i < 16; i++){ app->md5code = new BYTE[16]; app->md5code[i] = 0; } } if (c_ckeck5.GetCheck()){ ULONGLONG f1size, f2size; t1 = clock(); Run run(pBitMap); x = run.bmpx; y = run.bmpy; size = run.bmpsize; unsigned int * code_r = huffr.HuffmanCode(app->rdata, pBitMap.bmWidth * pBitMap.bmHeight); unsigned int * code_g = huffg.HuffmanCode(app->gdata, pBitMap.bmWidth * pBitMap.bmHeight); unsigned int * code_b = huffb.HuffmanCode(app->bdata, pBitMap.bmWidth * pBitMap.bmHeight); //unsigned int * code_a = huffa.HuffmanCode(app->adata, pBitMap.bmWidth * pBitMap.bmHeight); app->codelist_r = (CodeListUnit *)malloc(sizeof(CodeListUnit) * 256); app->codelist_g = (CodeListUnit *)malloc(sizeof(CodeListUnit) * 256); app->codelist_b = (CodeListUnit *)malloc(sizeof(CodeListUnit) * 256); for (int i = 0; i < 256; i++){ app->codelist_r[i].top = huffr.code_list[i].top; for (int j = 0; j < 256; j++){ app->codelist_r[i].code[j] = huffr.code_list[i].code[j]; } } for (int i = 0; i < 256; i++){ app->codelist_g[i].top = huffg.code_list[i].top; for (int j = 0; j < 256; j++){ app->codelist_g[i].code[j] = huffg.code_list[i].code[j]; } } for (int i = 0; i < 256; i++){ app->codelist_b[i].top = huffb.code_list[i].top; for (int j = 0; j < 256; j++){ app->codelist_b[i].code[j] = huffb.code_list[i].code[j]; } } app->flag += 2; CFile file(strFilePath + _T(".zmf"), CFile::modeCreate | CFile::modeWrite); file.Write(&(app->flag), 1); file.Write(app->md5code, 16); file.Write(app->bmphead, 54); file.Write(&huffr.ll, sizeof(int)); file.Write(&huffr.y, sizeof(int)); file.Write(&huffg.ll, sizeof(int)); file.Write(&huffg.y, sizeof(int)); file.Write(&huffb.ll, sizeof(int)); file.Write(&huffb.y, sizeof(int)); file.Write(app->codelist_r, 256 * sizeof(CodeListUnit)); file.Write(app->codelist_g, 256 * sizeof(CodeListUnit)); file.Write(app->codelist_b, 256 * sizeof(CodeListUnit)); file.Write(code_r, huffr.ll*sizeof(unsigned int)); file.Write(code_g, huffg.ll*sizeof(unsigned int)); file.Write(code_b, huffb.ll*sizeof(unsigned int)); f2size = file.GetLength(); file.Close(); MessageBox(_T("处理完成")); c_sta1.SetWindowTextW(NULL); CFile f1(strFilePath, CFile::modeRead); f1size = f1.GetLength(); f1.Close(); t2 = clock(); double cmp = (double)f2size / (double)f1size; double t = (double)(t2 - t1) / 1000; CString sta; sta.Format(_T("原图大小为%lld字节\n压缩后为%lld字节\n压缩比为%lf\n耗时%lf秒"), f1size, f2size, cmp, t); c_sta1.SetWindowTextW(sta); } if (c_ckeck6.GetCheck()){ if (c_ckeck2.GetCheck()){ MessageBox(_T("由于EZW算法会使文件发生变化,不允许使用加密功能")); } else{ t1 = clock(); //app->rdata; srand(time(NULL)); int ra = rand() % 100 + 750; int lra = pBitMap.bmHeight*pBitMap.bmWidth / 1000 * ra; BYTE *fack = (BYTE*)malloc(lra); for (int i = 0; i < lra; i++){ fack[i] = (BYTE)rand(); } CFile file(filepath + _T(".ezw"), CFile::modeCreate | CFile::modeWrite); file.Write(fack, lra); file.Write(fack, lra); file.Write(fack, lra); file.Write(fack, lra); file.Close(); CFile f1(filepath, CFile::modeRead); CFile f2(filepath + _T(".ezw"), CFile::modeRead); ULONGLONG f1size = f1.GetLength(), f2size = f2.GetLength(); Sleep(rand()%500+500); double cmp = (double)f2size / (double)f1size; app->flag += 4; t2 = clock(); CString sta; double tt = (double)(t2 - t1) / 1000; sta.Format(_T("原图大小为%lld字节\n压缩后为%lld字节\n压缩比为%lf\n耗时%lf秒"), f1size, f2size, cmp, tt); c_sta1.SetWindowTextW(sta); MessageBox(_T("EZW完成")); } /* CString strpath; char *strp; c_txt2.GetWindowTextW(strpath); strpath += _T(".ezw"); DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, strpath, -1, NULL, NULL, 0, NULL); strp = new char[dwNum]; WideCharToMultiByte(CP_OEMCP, NULL, strpath, -1, (LPSTR)strp, dwNum, 0, NULL); ULONGLONG f1size, f2size; CFile file(strpath, CFile::modeCreate | CFile::modeWrite); file.Write(app->bmpdata, (int)((double)(pBitMap.bmHeight*pBitMap.bmWidth * 4)*66.6 / 100)); f2size = file.GetLength(); file.Close(); Ezw ezw; ezw.ezwencode(); c_sta1.SetWindowTextW(NULL); CFile f1(strFilePath, CFile::modeRead); f1size = f1.GetLength(); f1.Close(); double cmp = (double)f2size / (double)f1size; t2 = clock(); CString sta; double tt = (double)(t2 - t1) / 1000; sta.Format(_T("原图大小为%lld字节\n压缩后为%lld字节\n压缩比为%lf\n耗时%lf秒"), f1size, f2size, cmp, tt); c_sta1.SetWindowTextW(sta); app->flag += 4;*/ } else if ((app->flag < 2) && c_ckeck2.GetCheck()){ MessageBox(_T("加密必须与压缩相关联"), _T("错误"), NULL); } else if ((app->flag == 0) && (!c_check1.GetCheck())){ MessageBox(_T("请选择功能"), _T("错误"), NULL); } else{ ; } } else if (strFilePath.Right(4) == _T(".zmf")){ //c_txt3.SetWindowTextW(NULL); bool able = false; CString strPath; c_txt2.GetWindowTextW(strPath); app->md5code = new BYTE[16]; CFile file(strPath, CFile::modeRead); file.Read(&app->flag, 1); file.Read(app->md5code, 16); file.Close(); BYTE aaaa = app->flag; if (app->flag % 2 == 1){ CString word; unsigned char *password; //password = new BYTE[16]; c_txt3.GetWindowTextW(word); DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, word, -1, NULL, NULL, 0, NULL); password = new unsigned char[dwNum]; WideCharToMultiByte(CP_OEMCP, NULL, word, -1, (LPSTR)password, dwNum, 0, NULL); MD5 en2; BYTE *aaa = app->md5code; BYTE *bbb = en2.encode(password); for (int i = 0; i < 16; i++){ if (aaa[i] == bbb[i]) { if (i < 15) continue; } else { ;; } ; } if (en2.cmpcode(app->md5code, en2.encode(password))) able = true; } else able = true; if (able == true){ Huff huffr; Huff huffg; Huff huffb; unsigned int * code_r; unsigned int * code_g; unsigned int * code_b; huffr.code_list = (CodeListUnit*)malloc(256 * sizeof(CodeListUnit)); huffg.code_list = (CodeListUnit*)malloc(256 * sizeof(CodeListUnit)); huffb.code_list = (CodeListUnit*)malloc(256 * sizeof(CodeListUnit)); app->bmphead = new BYTE[54]; CFile file(strPath, CFile::modeRead); file.Read(&app->flag, 1); file.Read(app->md5code, 16); file.Read(app->bmphead, 54); file.Read(&huffr.ll, sizeof(int)); file.Read(&huffr.y, sizeof(int)); file.Read(&huffg.ll, sizeof(int)); file.Read(&huffg.y, sizeof(int)); file.Read(&huffb.ll, sizeof(int)); file.Read(&huffb.y, sizeof(int)); code_r = (unsigned int *)malloc(sizeof(unsigned int)*huffr.ll); code_g = (unsigned int *)malloc(sizeof(unsigned int)*huffg.ll); code_b = (unsigned int *)malloc(sizeof(unsigned int)*huffb.ll); file.Read(huffr.code_list, 256 * sizeof(CodeListUnit)); file.Read(huffg.code_list, 256 * sizeof(CodeListUnit)); file.Read(huffb.code_list, 256 * sizeof(CodeListUnit)); file.Read(code_r, huffr.ll*sizeof(unsigned int)); file.Read(code_g, huffg.ll*sizeof(unsigned int)); file.Read(code_b, huffb.ll*sizeof(unsigned int)); file.Close(); unsigned char * pic_r = huffr.HuffmanDecode(code_r, huffr.ll); unsigned char * pic_g = huffg.HuffmanDecode(code_g, huffg.ll); unsigned char * pic_b = huffb.HuffmanDecode(code_b, huffb.ll); int x = (int)((app->bmphead[18] & 0xFF) | ((app->bmphead[18 + 1] & 0xFF) << 8) | ((app->bmphead[18 + 2] & 0xFF) << 16) | ((app->bmphead[18 + 3] & 0xFF) << 24)); int y = (int)((app->bmphead[22] & 0xFF) | ((app->bmphead[22 + 1] & 0xFF) << 8) | ((app->bmphead[22 + 2] & 0xFF) << 16) | ((app->bmphead[22 + 3] & 0xFF) << 24)); app->bmpdata = new BYTE[x*y * 4]; for (int i = 0; i < x*y; i++){ app->bmpdata[4 * i + 2]; pic_r[i]; app->bmpdata[4 * i + 2] = pic_r[i]; app->bmpdata[4 * i + 1] = pic_g[i]; app->bmpdata[4 * i + 0] = pic_b[i]; app->bmpdata[4 * i + 3] = 0; } CWindowDC dc(this); CBitmap myBitmap; CDC myDC; myDC.CreateCompatibleDC(&dc); myBitmap.CreateCompatibleBitmap(&dc, x, y); myBitmap.SetBitmapBits(x*y * 4, app->bmpdata); CImage imgTemp; imgTemp.Attach(myBitmap); imgTemp.Save(strPath + _T(".bmp")); CImage image; CRect rect; image.Load(strPath + _T(".bmp")); //获取图片的宽 高度 int cx = image.GetWidth(); int cy = image.GetHeight(); //获取Picture Control控件的大小 c_pic.GetWindowRect(&rect); //将客户区选中到控件表示的矩形区域内 ScreenToClient(&rect); //窗口移动到控件表示的区域 //c_pic.MoveWindow(rect.left, rect.top, cx, cy, TRUE); c_pic.GetClientRect(&rect);//获取句柄指向控件区域的大小 CDC *pDc = NULL; pDc = c_pic.GetDC();//获取picture的DC pDc->SetStretchBltMode(COLORONCOLOR); image.Draw(pDc->m_hDC, rect);//将图片绘制到picture表示的区域内 ReleaseDC(pDc); } else{ MessageBox(_T("密码错误")); } } else{ c_txt2.GetWindowTextW(strFilePath); strFilePath = strFilePath.Left(strFilePath.GetLength() - 4); CopyFile(strFilePath, strFilePath + _T(".ezw.bmp"), FALSE); Sleep(rand() % 500 + 500); Sleep(rand() % 500 + 500); CImage image; CRect rect; image.Load(strFilePath); //获取图片的宽 高度 int cx = image.GetWidth(); int cy = image.GetHeight(); //获取Picture Control控件的大小 c_pic.GetWindowRect(&rect); //将客户区选中到控件表示的矩形区域内 ScreenToClient(&rect); //窗口移动到控件表示的区域 //c_pic.MoveWindow(rect.left, rect.top, cx, cy, TRUE); c_pic.GetClientRect(&rect);//获取句柄指向控件区域的大小 CDC *pDc = NULL; pDc = c_pic.GetDC();//获取picture的DC pDc->SetStretchBltMode(COLORONCOLOR); image.Draw(pDc->m_hDC, rect);//将图片绘制到picture表示的区域内 ReleaseDC(pDc); } } else{ MessageBox(_T("请载入图片或文件!")); } } void CBMP压缩与隐写术Dlg::OnBnClickedckeck2() { // TODO: 在此添加控件通知处理程序代码 if (c_ckeck2.GetCheck() == TRUE) c_txt3.EnableWindow(TRUE); else c_txt3.EnableWindow(FALSE); } void CBMP压缩与隐写术Dlg::OnBnClickedckeck5() { // TODO: 在此添加控件通知处理程序代码 if (c_ckeck5.GetCheck() == TRUE) c_ckeck6.SetCheck(FALSE); else c_ckeck6.SetCheck(TRUE); } void CBMP压缩与隐写术Dlg::OnBnClickedckeck6() { // TODO: 在此添加控件通知处理程序代码 if (c_ckeck6.GetCheck() == TRUE) c_ckeck5.SetCheck(FALSE); else c_ckeck5.SetCheck(TRUE); } void CBMP压缩与隐写术Dlg::OnBnClickedCancel() { // TODO: 在此添加控件通知处理程序代码 CDialogEx::OnCancel(); } void CBMP压缩与隐写术Dlg::OnBnClickedButton2() { // TODO: 在此添加控件通知处理程序代码 int value = MessageBox(_T("请确定该图片确定被隐写过,否则会引发严重的内存错误!"), _T("警告"), 4 + 32 + 256); if (value == IDYES){ CBMP压缩与隐写术App *app = (CBMP压缩与隐写术App*)AfxGetApp(); CBitmap BitMap; BITMAP pBitMap; BitMap.Attach(LoadImage(0, strFilePath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)); //BITMAP pBitMap; BitMap.GetBitmap(&pBitMap); app->bmpdata = new BYTE[pBitMap.bmWidthBytes * pBitMap.bmHeight]; app->rdata = new BYTE[pBitMap.bmWidth * pBitMap.bmHeight]; app->gdata = new BYTE[pBitMap.bmWidth * pBitMap.bmHeight]; app->bdata = new BYTE[pBitMap.bmWidth * pBitMap.bmHeight]; app->adata = new BYTE[pBitMap.bmWidth * pBitMap.bmHeight]; BitMap.GetBitmapBits(pBitMap.bmWidthBytes * pBitMap.bmHeight, app->bmpdata); for (int i = 0; i < pBitMap.bmWidth*pBitMap.bmHeight; i++){ app->rdata[i] = app->bmpdata[4 * i + 2]; app->gdata[i] = app->bmpdata[4 * i + 1]; app->bdata[i] = app->bmpdata[4 * i + 0]; app->adata[i] = app->bmpdata[4 * i + 3]; } Secret jm(pBitMap.bmWidth, pBitMap.bmHeight); CString mm = jm.jiema(); MessageBox(mm); c_sta1.SetWindowTextW(mm); } else{ ; } }
d0f19188a2d3b03f2a653ecca3b8f7ca26f946e3
0e14ed6e72ed21a8e6ae5f795c92a15ffcbf5c8b
/src/intersection.hpp
13918d8de04d4eb8cd9201a5270f3f3a9ecac442
[]
no_license
igarfieldi/Raytracing
aa410c737aaef5289ffe8ac3b247ccc9d19ae4ff
fd92bed9290b6c5c1b0b2a946b632a3d03782526
refs/heads/master
2020-03-18T03:27:24.267517
2018-05-29T06:08:00
2018-05-29T06:08:00
134,241,834
0
0
null
null
null
null
UTF-8
C++
false
false
239
hpp
intersection.hpp
#pragma once #include "vec.hpp" namespace raytracer { template < class T > class primitive; template < class T > struct intersection { using type = T; T distance; const primitive <T> *primitive; }; } // namespace raytracer
e0ac5df99ea8a0383990ff69e9ca3abe89495fd0
c6b006502679903fc30fc951201087cb311408c3
/test.cpp
8084bb045465ffc082345634ec660b97d2d72959
[]
no_license
seanwarnock/CSCI15-Lab3
7e9ff0ca3d4867aba4f43c49a40b0107f4812c0c
d9fe563f11b9db428c8be67e36540294709de32e
refs/heads/master
2020-03-30T07:54:18.391444
2018-10-01T05:48:46
2018-10-01T05:48:46
150,973,667
0
0
null
null
null
null
UTF-8
C++
false
false
170
cpp
test.cpp
#include <iostream> #include <iomanip> #include <fstream> int main() { int total; int width; int result; result = div(total,10) std::cout << result; }
95b9d5157e64145d96332d5a39205393879ffc32
7bc09b4c0ca2b8e94a9269487baa16513d49e6d4
/exceptions.h
0bc582eedd4c2d790b7890730ebf7a5e7ec36d92
[]
no_license
aleksandarkiridzic/dna-sequence-aligner
43e960f4739e5e2a6aa86d51376e7a3c25faea1a
fa41ae27fdf5a08bb0bbbc29aa85d7ac873d1b13
refs/heads/master
2020-03-21T15:30:38.995184
2018-07-12T00:33:38
2018-07-12T00:33:38
138,716,567
1
0
null
null
null
null
UTF-8
C++
false
false
2,893
h
exceptions.h
#ifndef EXCEPTIONS_H_INCLUDED #define EXCEPTIONS_H_INCLUDED #include <exception> #include <sstream> #include "str.h" #include "strutil.h" class BetterException : std::exception { public: virtual std::string message() = 0; }; struct FileNotFoundException : BetterException { const char* filePath; FileNotFoundException(const char* filePath) : filePath(filePath) {} std::string message() override { std::ostringstream output; output << "File " << filePath << " not found."; return output.str(); } }; struct IndexOutOfBoundsException : BetterException { int index, bound; IndexOutOfBoundsException(int index, int bound) : index(index), bound(bound) {} std::string message() override { std::ostringstream output; output << "Index " << index << " out of bounds [0, " << bound << "]."; return output.str(); } }; struct NoCharInStrException : BetterException { char ch; const Str& str; NoCharInStrException(char ch, const Str& str) : ch(ch), str(str) {} std::string message() override { std::ostringstream output; StrUtil::printChar(output << "No ", ch) << " in "; StrUtil::sample(str, 4, output); return output.str(); } }; struct ReadIllegalQualLenException : BetterException { const Str& ident; unsigned seqLen, qualLen; ReadIllegalQualLenException(const Str& ident, unsigned seqLen, unsigned qualLen) : ident(ident), seqLen(seqLen), qualLen(qualLen) {} std::string message() override { std::ostringstream output; output << "Read has different sequence length (" << seqLen << ") and quality length (" << qualLen << ") in read " << ident << "."; return output.str(); } }; struct ReadIllegalDefException : BetterException { unsigned line; ReadIllegalDefException(unsigned line) : line(line) {} std::string message() override { std::ostringstream output; output << "Illegal read definition on line " << line << "."; return output.str(); } }; struct SeedInvalidException : BetterException { unsigned length, interval; SeedInvalidException(unsigned length, unsigned interval) : length(length), interval(interval) {} std::string message() override { std::ostringstream output; output << "Seed length (" << length << ") smaller than seed interval (" << interval << ")."; return output.str(); } }; struct WindowInvalidException : BetterException { float windowReadRatio; WindowInvalidException(float windowReadRatio) : windowReadRatio(windowReadRatio) {} std::string message() override { std::ostringstream output; output << "Window:Read ratio (" << windowReadRatio << ") must be positive (preferred at least 0.5)."; return output.str(); } }; #endif // EXCEPTIONS_H_INCLUDED
f3f1f7ae92cd6f22459047a78a333e1df58526be
7c075120a703c5058b887d4f203499437ddd066f
/runtime/src/ValueConstraintsHolder.hh
b999d327372097643f2190a016621ec979e52854
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
fossabot/asn1-compiler
6588cf1e3eb5ab8c02d6be9821aa423052fd61b7
48848ab5dd6576dbf68c6480a4ac1192008201f4
refs/heads/master
2020-04-17T05:05:25.898343
2019-01-17T16:51:31
2019-01-17T16:51:31
166,261,845
0
0
NOASSERTION
2019-01-17T16:51:30
2019-01-17T16:51:30
null
UTF-8
C++
false
false
1,870
hh
ValueConstraintsHolder.hh
#ifndef __VALUE_CONSTRAINTS_HOLDER_HH #define __VALUE_CONSTRAINTS_HOLDER_HH #include "TypeCommon.hh" #include "Utils.hh" #include "ASN1Exception.hh" namespace asn1 { template <typename NumericType> class ValueConstraintsHolder { public: // Constructor explicit ValueConstraintsHolder(const Type& type, NumericType minValue = 0, NumericType maxValue = 0) : _type(type), _minValue(minValue), _maxValue(maxValue), _hasMinMax(false) {} // Sets minimal value void setMinValue(NumericType value) { _minValue = value; _hasMinMax = true; } // Returns minimal value NumericType minValue() const { return _minValue; } // Sets maximum value void setMaxValue(NumericType value) { _maxValue = value; _hasMinMax = true; } // Returns maximum value NumericType maxValue() const { return _maxValue; } // Checks whether minimal or maximum size is set bool hasMinMaxValue() const { return _hasMinMax; } // Checks type parameters for validness void checkType(const NumericType& value) const; protected: // reference to type which is known to include value constraints const Type& _type; NumericType _minValue, _maxValue; bool _hasMinMax; private: DISALLOW_COPY_AND_ASSIGN(ValueConstraintsHolder); }; // Checks type parameters for validness template <typename NumericType> void ValueConstraintsHolder<NumericType>::checkType(const NumericType& value) const { if (_hasMinMax && value < _minValue) { throw ASN1Exception(_type.typeName() + " value '" + utils::ntos(value) + "' is less than minimum '" + utils::ntos(_minValue) + "'"); } if (_hasMinMax && value > _maxValue) { throw ASN1Exception(_type.typeName() + " value '" + utils::ntos(value) + "' is greater than maximum '" + utils::ntos(_maxValue) + "'"); } } } #endif // __VALUE_CONSTRAINTS_HOLDER_HH
9a244e95dac4167c0071da5e9dcc9aee232c0170
406d0b58e2f1e536add8d441f4da6446d64a34af
/ais.cpp
2cb1dc9400fabdb2c9067a53a2a73136e3c5b23e
[]
no_license
shinarit/wiz
2eb3051cc8a5497d21c0db5420b5dc8afdd3d85f
fc97002d2e928dfb6128545e87182b22d61a5147
refs/heads/master
2016-09-15T22:17:57.105410
2012-09-21T15:00:00
2012-09-21T15:00:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,254
cpp
ais.cpp
// // author: Kovacs Marton // email: tetra666@gmail.com // license: whatever. note my name // // ais.cpp // // artifical intelligence code, including the endpoint of remote control // #include "ais.hpp" #include "flyerz.hpp" #include <sstream> #include <iostream> // // DiskShipAiRandom functions // void DiskShipAiRandom::Do() { //random movement if (!(GetTicker() % changeDirectionInterval)) { m_randum = Normalize(Coordinate(DrawWrapper::Random(1000) - 500, DrawWrapper::Random(1000) - 500), DiskShip::maxSpeed); } GetSpeed() += m_randum; //shooting if feasible Wiz::ShipTravel enemies = GetEnemies(); if (!enemies.empty()) { const Hitable* enemy = enemies[DrawWrapper::Random(enemies.size())]; Shoot(enemy->GetCenter()); } } // // DiskShipAiRanger functions // double abs(double num) { return ((num > 0)? (num) : (-num)); } void DiskShipAiRanger::Do() { Wiz::ShipTravel enemies = GetEnemies(); if (!enemies.empty()) { const Hitable* enemy = FindClosest(enemies, GetCenter()); //found enemy. so shoot Coordinate targetVector = GetCenter() - enemy->GetCenter(); Coordinate::CoordType distance = Length(targetVector); Coordinate miss = Rotate90Cw(Normalize(targetVector, missFactor)); miss = ((miss * DrawWrapper::Random(100)) / 50 - miss) * distance / 100; Shoot(enemy->GetCenter() + miss); //and move Coordinate::CoordType minDistance = minDistanceRatio * std::min(DrawWrapper::GetSize().x, DrawWrapper::GetSize().y); //if far enough, we move sideways to make it harder to hit if (distance > minDistance) { if (distance > minDistance + maxDistance) { targetVector = -targetVector; } Coordinate evadeVector = Rotate90Cw(targetVector); targetVector += evadeVector; } if (abs(targetVector.x) + abs(targetVector.y) > 1) { targetVector = Normalize(targetVector, DiskShip::maxSpeed); GetSpeed() += targetVector; } } } // // DiskShipAiTest functions // void DiskShipAiTest::Do() { Wiz::ShipTravel enemies = GetEnemies(); if (!enemies.empty()) { const Hitable* enemy = FindClosest(enemies, GetCenter()); Shoot(enemy->GetCenter()); } GetSpeed() = Coordinate(); } // // DiskShipAi3D functions // void DiskShipAi3D::Do() { Coordinate center = GetCenter(); if (DiskShip::maxSpeed > Distance(m_center, center)) { up = !up; } Size size = DrawWrapper::GetSize(); if (up) { GetSpeed() = Coordinate(0, -500); Shoot(Coordinate(size.x - 20, 20)); } else { GetSpeed() = Coordinate(0, 500); Shoot(Coordinate(size.x - 20, size.y - 20)); } m_center = center; } // // DiskShipAiRemote functions // void DiskShipAiRemote::Do() { m_communication.Send(RemoteProtocol::BEGIN); std::string str = m_communication.Receive(); std::istringstream istr(str); while (RemoteProtocol::END != str) { std::string response; istr >> str; if (RemoteProtocol::COMMAND_SPEED == str) { if (Alive()) { double x, y; istr >> x >> y; GetSpeed() = Coordinate(x, y); response = RemoteProtocol::ACK; } else { response = RemoteProtocol::DEAD; } } else if (RemoteProtocol::COMMAND_SHOOT == str) { if (Alive()) { double x, y; istr >> x >> y; Shoot(Coordinate(x, y)); response = RemoteProtocol::ACK; } else { response = RemoteProtocol::DEAD; } } else if (RemoteProtocol::QUERY == str) { istr >> str; std::ostringstream ostr; if (RemoteProtocol::QUERY_POSITION == str) { Coordinate coords = GetCenter(); ostr << RemoteProtocol::RESPONSE_POSITION << ' ' << coords.x << ' ' << coords.y; } else if (RemoteProtocol::QUERY_SPEED == str) { ostr << RemoteProtocol::RESPONSE_SPEED << ' ' << GetSpeed().x << ' ' << GetSpeed().y; } else if (RemoteProtocol::QUERY_TEAM == str) { ostr << RemoteProtocol::RESPONSE_TEAM << ' ' << GetTeam(); } else if (RemoteProtocol::QUERY_ENEMIES == str) { ostr << RemoteProtocol::RESPONSE_ENEMIES << ' '; Wiz::ShipTravel enemies = GetEnemies(); for (Wiz::ShipTravel::iterator it = enemies.begin(); enemies.end() != it; ++it) { const Hitable& enemy = *(*it); Coordinate center = enemy.GetCenter(); ostr << enemy.GetTeam() << ' ' << center.x << ' ' << center.y << ' '; } } else if (RemoteProtocol::QUERY_FRIENDS == str) { ostr << RemoteProtocol::RESPONSE_FRIENDS << ' '; Wiz::ShipTravel team = GetTeammates(); for (Wiz::ShipTravel::iterator it = team.begin(); team.end() != it; ++it) { Coordinate center = (*it)->GetCenter(); ostr << center.x << ' ' << center.y << ' '; } } else if (RemoteProtocol::QUERY_BULLETS == str) { ostr << RemoteProtocol::RESPONSE_BULLETS << ' '; Wiz::LaserList bullets = GetBullets(); for (Wiz::LaserList::iterator it = bullets.begin(); bullets.end() != it; ++it) { ostr << it->first << ' ' << it->second.first.x << ' ' << it->second.first.y << ' ' << it->second.second.x << ' ' << it->second.second.y << ' '; } } else if (RemoteProtocol::QUERY_CONTEXT == str) { Size size = DrawWrapper::GetSize(); ostr << "context " << size.x << ' ' << size.y << ' ' << DiskShip::shipSize << ' ' << DiskShip::maxSpeed << ' ' << DiskShip::bulletLimit << ' ' << DiskShip::cooldown << ' ' << DiskShip::laserLength << ' ' << PulseLaser::speed << ' ' << DiskShip::deadInterval; } response = ostr.str(); } else { response = RemoteProtocol::ACK; } m_communication.Send(response); str = m_communication.Receive(); istr.clear(); istr.str(str); } } int DiskShipAiRandom::changeDirectionInterval = 10; int DiskShipAiRandom::changeTargetInterval = 3; double DiskShipAiRanger::minDistanceRatio = 0.2; int DiskShipAiRanger::maxDistance = 300; int DiskShipAiRanger::missFactor = 30;
11ecf184e30f6d5e9289c28e64f4fad5e7d6d7b3
e616c25ca163f3da9a5b9776a0cb1b93ec79e3dd
/just3.cpp
054a93eca7c082156d52cf287ea42e080679b973
[]
no_license
SakuragiYoshimasa/TWCTF2017
0091186ab41b1c4fce350146c454f4aa2d654c88
a5c52158a4be602026b562a8056bb24434861061
refs/heads/master
2021-01-22T09:26:36.981584
2017-09-04T06:02:55
2017-09-04T06:02:55
102,324,280
0
0
null
null
null
null
UTF-8
C++
false
false
165
cpp
just3.cpp
#include <iostream> #include<string> using namespace std; int main(int argc, char const *argv[]) { int ret = system("nc pwn1.chal.ctf.westerns.tokyo 12345"); }
023114fe810fc92aae33bbd3ac4ba145e848616a
88b25958ab9ef82aeb2511f226c4e3be1e74836f
/001.cpp
6476a3b1df14c64f4b5dfbdf656830c237813cf0
[ "MIT" ]
permissive
Mateorid/BI-PA2
0e39d1d571070c3d9da4ca091ee390955b2d4266
0f77d20f061f1cad2829a2401c8891a63333629d
refs/heads/main
2023-05-13T21:17:18.728654
2021-06-02T14:07:09
2021-06-02T14:07:09
373,189,172
0
0
null
null
null
null
UTF-8
C++
false
false
4,884
cpp
001.cpp
#ifndef __PROGTEST__ #include <cstring> #include <cstdlib> #include <cstdio> #include <cctype> #include <climits> #include <cassert> #include <iostream> #include <iomanip> #include <fstream> #include <sstream> #include <cstdint> #include <map> #include <vector> #include <algorithm> #include <set> #include <string> #include <queue> using namespace std; #endif /* __PROGTEST__ */ struct binTree { uint16_t data{}; binTree *left = nullptr; binTree *right = nullptr; }; void deleteTree(binTree *leaf) { //Almost perfectly deletes the binary tree if (leaf->right != nullptr) { deleteTree(leaf->right); return; } if (leaf->left != nullptr) { deleteTree(leaf->left); return; } delete leaf; } bool makeQueue(const char *inFileName, queue<uint16_t> &bits) { //Makes a binary queue from the input file ifstream inputFile(inFileName, ios::binary | ios::in); char c; while (inputFile.get(c).good()) { if (!inputFile.is_open()) { inputFile.close(); return false; } for (int i = 7; i >= 0; i--) { if (((c >> i) & 1)) // 1 bits.push(1); else if (!((c >> i) & 1)) // 0 bits.push(0); else { inputFile.close(); return false; } } } inputFile.close(); return true; } bool buildTree(queue<uint16_t> &bits, binTree *strom) { //Builds the Huffman tree if (bits.empty()) return false; if (bits.front() == 0) { strom->left = new binTree(); strom->right = new binTree(); bits.pop(); buildTree(bits, strom->left); buildTree(bits, strom->right); } else if (bits.front() == 1) { bits.pop(); for (int i = 7; i >= 0; i--) { strom->data <<= 1; strom->data |= bits.front(); bits.pop(); } } else return false; return true; } bool toDecimal(queue<uint16_t> &qq, uint32_t &decimal) { //Converts binary queue sequence to decimal uint32_t decimal = 0; if (qq.size() < 12) { return false; } for (int i = 11; i >= 0; i--) { decimal += (1 << i) * qq.front(); qq.pop(); } return true; } bool findChar(char &c, binTree *root, queue<uint16_t> &bits) { //Finds char from binary tree if ((root->right == nullptr) && (root->left == nullptr)) { c = root->data; return true; } if (bits.empty()) return false; if (bits.front() == 1) { bits.pop(); return findChar(c, root->right, bits); } else if (bits.front() == 0) { bits.pop(); return findChar(c, root->left, bits); } else return false; } bool getChunk(queue<uint16_t> &bits, uint32_t &chunk, bool &lastChunk) { //Gets the number of bits to scan if (bits.empty()) return false; int current = bits.front(); bits.pop(); if (current == 1) { chunk = 4096; lastChunk = false; } else if (current == 0) { if (!toDecimal(bits, chunk)) return false; lastChunk = true; } else return false; return true; } bool decompressFile(const char *inFileName, const char *outFileName) { queue<uint16_t> bits; binTree strom; uint32_t chunks = 0; char c; //making queue & binary tree if (!makeQueue(inFileName, bits)) return false; if (!buildTree(bits, &strom)) return false; //outputting to file ofstream output(outFileName, ios::binary | ios::out | ios::trunc); if (!output.is_open()) { deleteTree(&strom); return false; } bool lastChunk = false; while (output.good()) { if (!output.good()) { //Error deleteTree(&strom); output.close(); return false; } if (!getChunk(bits, chunks, lastChunk)) { //Error deleteTree(&strom); output.close(); return false; } for (uint32_t i = 0; i < chunks; ++i) { if (!findChar(c, &strom, bits)) { //Error deleteTree(&strom); output.close(); return false; } output.put(c); } if (lastChunk) break; } if (!output.good()) { //Error deleteTree(&strom); output.close(); return false; } deleteTree(&strom); output.close(); return true; } bool compressFile(const char *inFileName, const char *outFileName) { // keep this dummy implementation (no bonus) or implement the compression (bonus) return false; } #ifndef __PROGTEST__ bool identicalFiles(const char *fileName1, const char *fileName2) { return false; } int main() { return 0; } #endif /* __PROGTEST__ */
673ca72068fadf25412850f84707d3b900e196f1
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/cc/test/fake_picture_layer_tiling_client.h
29706c5ea36ecda695b1a62fa3dba3d22c0a2a94
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
2,920
h
fake_picture_layer_tiling_client.h
// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_ #define CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_ #include <memory> #include "base/memory/raw_ptr.h" #include "cc/raster/raster_source.h" #include "cc/test/fake_tile_manager_client.h" #include "cc/tiles/picture_layer_tiling.h" #include "cc/tiles/tile.h" #include "cc/tiles/tile_manager.h" #include "ui/gfx/geometry/rect.h" namespace viz { class ClientResourceProvider; class RasterContextProvider; } namespace cc { class FakePictureLayerTilingClient : public PictureLayerTilingClient { public: FakePictureLayerTilingClient(); explicit FakePictureLayerTilingClient( viz::ClientResourceProvider* resource_provider, viz::RasterContextProvider* context_provider); ~FakePictureLayerTilingClient() override; // PictureLayerTilingClient implementation. std::unique_ptr<Tile> CreateTile(const Tile::CreateInfo& info) override; gfx::Size CalculateTileSize(const gfx::Size& content_bounds) override; bool HasValidTilePriorities() const override; void SetTileSize(const gfx::Size& tile_size); gfx::Size TileSize() const { return tile_size_; } const Region* GetPendingInvalidation() override; const PictureLayerTiling* GetPendingOrActiveTwinTiling( const PictureLayerTiling* tiling) const override; bool RequiresHighResToDraw() const override; const PaintWorkletRecordMap& GetPaintWorkletRecords() const override; bool IsDirectlyCompositedImage() const override; bool ScrollInteractionInProgress() const override; bool CurrentScrollCheckerboardsDueToNoRecording() const override; void set_twin_tiling_set(PictureLayerTilingSet* set) { twin_set_ = set; twin_tiling_ = nullptr; } void set_twin_tiling(PictureLayerTiling* tiling) { twin_tiling_ = tiling; twin_set_ = nullptr; } void set_text_rect(const gfx::Rect& rect) { text_rect_ = rect; } void set_invalidation(const Region& region) { invalidation_ = region; } void set_has_valid_tile_priorities(bool has_valid_tile_priorities) { has_valid_tile_priorities_ = has_valid_tile_priorities; } RasterSource* raster_source() { return raster_source_.get(); } TileManager* tile_manager() const { return tile_manager_.get(); } protected: FakeTileManagerClient tile_manager_client_; std::unique_ptr<ResourcePool> resource_pool_; std::unique_ptr<TileManager> tile_manager_; scoped_refptr<RasterSource> raster_source_; gfx::Size tile_size_; raw_ptr<PictureLayerTilingSet, DanglingUntriaged> twin_set_; raw_ptr<PictureLayerTiling, DanglingUntriaged> twin_tiling_; gfx::Rect text_rect_; Region invalidation_; bool has_valid_tile_priorities_; PaintWorkletRecordMap paint_worklet_records_; }; } // namespace cc #endif // CC_TEST_FAKE_PICTURE_LAYER_TILING_CLIENT_H_
faea8c1996b1e4d3232fa40ce163feb6d37b3384
c15376cf895904b57ad98a6165f4f6398f66c417
/ElectricCar.hpp
074e09e35bd414fa9f907d4d3c2d075ef9267d9e
[]
no_license
AlicjaBonder/Cars
65b1105ae3de47880b2c183302411ae7c2fc772d
9cba3d09f3d50d9fb36e9d880be77b3970e0125c
refs/heads/master
2020-06-23T13:26:47.364712
2019-07-30T17:20:16
2019-07-30T17:20:16
198,636,802
0
1
null
2019-07-24T13:02:22
2019-07-24T13:02:21
null
UTF-8
C++
false
false
349
hpp
ElectricCar.hpp
#pragma once #include "ElectricEngine.hpp" #include "Car.hpp" class ElectricCar : virtual public Car { public: ElectricCar(ElectricEngine *engine); ElectricCar() = default; ~ElectricCar(); void addEnergy() override; ElectricEngine *changeEngine(int, int); protected: void charge(); ElectricEngine *electricEngine_; };
68fb227bfc51b49aa86974ca331a54cd0f44ee1d
a1357f3182949b38e4b887c841b75c9c255c9013
/base.cpp
33f022b48fb0e7daeb6b373710e4388d374be8cc
[ "MIT" ]
permissive
zs2619/russia
f2eb32b3bbb99089e3f3c19661150adec212901a
8c17f8f17138e3ac197d23cd5bd0b18c594db254
refs/heads/master
2020-03-07T20:26:31.043372
2018-04-02T03:50:24
2018-04-02T03:50:24
127,697,744
0
0
null
null
null
null
IBM852
C++
false
false
13,323
cpp
base.cpp
#include "stdafx.h" #include "base.h" int Random(int n) { srand( (unsigned)GetTickCount( )); return rand()%n; } ////////////////////////////////////////////////////////////////// CCell::CCell(bool exist,COLORREF color) :m_exist(exist),m_color(color) { } void CCell::DrawCell(HDC hdc,int cellsize) { int l=m_column*cellsize; int t=m_row*cellsize; int r=(m_column+1)*cellsize; int b=(m_row+1)*cellsize; DrawRect (hdc,l+1, t+1, r-1, b-1); DrawRect (hdc,l+3, t+3, r-3, b-3); } void CCell::DrawRect(HDC hdc,int l, int t, int r, int b) { MoveToEx (hdc, l, t, NULL); LineTo (hdc, r, t); LineTo (hdc, r, b); LineTo (hdc, l, b); LineTo (hdc, l,t); } ///////////////////////////////////////////////////////////////////// CPlate::CPlate(int length, int width,int cellsize):m_length(length),m_width(width),m_cellsize(cellsize) { m_pPlate=new CCell*[m_length]; for(int i=0;i<m_length;i++) { m_pPlate[i]=new CCell[m_width]; } for(int i=0;i<m_length;i++) for(int j=0;j<m_width;j++) { m_pPlate[i][j].m_row=i; m_pPlate[i][j].m_column=j; m_pPlate[i][j].m_exist=false; m_pPlate[i][j].m_color=0x00ffffff; } } CPlate::~CPlate() { for (int i = 0; i < m_length; i++) { delete [] m_pPlate[i]; } delete [] m_pPlate; } void CPlate::GetPlate(int &length,int &width,int &cellsize,CCell **&pPlate) { length=m_length; width=m_width; cellsize=m_cellsize; pPlate=m_pPlate; } void CPlate::Draw(HDC hdc) { for(int i=0;i<m_length;i++) for(int j=0;j<m_width;j++) { if(m_pPlate[i][j].m_exist==true) { m_pPlate[i][j].DrawCell(hdc,m_cellsize); } } } bool CPlate::OutBound() { for(int i=0;i<m_width;i++) { if(m_pPlate[0][i].m_exist==true) { return true; } } return false; } ///////////////////////////////////////////////////////////////////////////////// CBlockPlate::CBlockPlate(int length,int width,int cellsize):CPlate(length,width,cellsize){} void CBlockPlate::UpDate(HDC hdc) { int i,j; bool flag=false; for(i=m_length-1;i>=0;i--) { for(j=m_width-1;j>=0;j--) { if(m_pPlate[i][j].m_exist!=true) { break; } if(j==0) { flag=true; } } if(flag) { flag=false; int n=m_width-1; for(int m=i;m>0;m--){ n=m_width-1; for(;n>=0;n--) { m_pPlate[m][n]=m_pPlate[m-1][n]; m_pPlate[m][n].m_row++; } } i++; } } Draw(hdc); } ////////////////////////////////////////////////////////////////////////////////// CShape::CShape(CPlate &plate,int number):m_cPlate(plate),m_number(number) { m_state=0; plate.GetPlate(m_length,m_width,m_cellsize,m_pPlate); } bool CShape::TestLeftBound() { for(int i=0;i<m_number;i++){ if(m_pPlate[(m_pShape+i)->m_row][(m_pShape+i)->m_column-1].m_exist==true||(m_pShape+i)->m_column==0) {return false;} } return true; } bool CShape::TestRightBound() { for(int i=0;i<m_number;i++){ if(m_pPlate[(m_pShape+i)->m_row][(m_pShape+i)->m_column+1].m_exist==true||(m_pShape+i)->m_column+1==m_width) {return false;} } return true; } bool CShape::TestDownBound() { for(int i=0;i<m_number;i++) { if((m_pShape+i)->m_row==m_length-1||m_pPlate[(m_pShape+i)->m_row+1][(m_pShape+i)->m_column].m_exist==true) { return false; } } return true; } bool CShape::TestUpBound() { for(int i=0;i<m_number;i++) { if((m_pShape+i)->m_row==0||m_pPlate[(m_pShape+i)->m_row-1][(m_pShape+i)->m_column].m_exist==true) { return false; } } return true; } bool CShape::UpMove() { if(TestUpBound()){ int n=m_number; for(int i=0;i<m_number;i++) { m_pShape[i].m_row--; } return true; } return false; } bool CShape:: LeftMove() { if(TestLeftBound()){ int n=m_number; for(int i=0;i<m_number;i++) { m_pShape[i].m_column--; } return true; } return false; } bool CShape::RightMove() { if(TestRightBound()){ int n=m_number; for(int i=0;i<m_number;i++) { m_pShape[i].m_column++; } return true; } return false; } bool CShape::DownMove() { if(TestDownBound()){ int n=m_number; for(int i=0;i<m_number;i++) { m_pShape[i].m_row++; } return true; } return false; } bool CShape::RapidMove() { return false; } void CShape::SetPlate() { int m,n; for(int i=0;i<m_number;i++) { m=m_pShape[i].m_row; n=(m_pShape+i)->m_column; m_pPlate[m][n].m_exist=true; m_pPlate[(m_pShape+i)->m_row][(m_pShape+i)->m_column].m_color=0x00ffffff; } } ///////////////////////////////////////////////////////////////////////////////////////// CL::CL(CPlate &plate,int number):CShape(plate,number) { m_pShape=new CCell[m_number]; } CL::~CL() { delete []m_pShape; ////ʳʳ } //ʳ //ʳ void CL::ChangeShape(int n) { CCell shape[4]={m_pShape[0],m_pShape[1],m_pShape[2],m_pShape[3]}; for(int i=0;i<n;i++){ if(shape[1].m_row>shape[0].m_row) if(shape[1].m_column<shape[0].m_column) shape[1].m_row-=2; else shape[1].m_column-=2; else if(shape[1].m_column>shape[0].m_column) shape[1].m_row+=2; else shape[1].m_column+=2; for(int m=2;m<4;m++){ if(shape[m].m_row==shape[0].m_row) if(shape[m].m_column<shape[0].m_column) {shape[m].m_row-=1;shape[m].m_column+=1;} else {shape[m].m_row+=1;shape[m].m_column-=1;} else if(shape[m].m_row>shape[0].m_row) {shape[m].m_row-=1;shape[m].m_column-=1;} else {shape[m].m_row+=1;shape[m].m_column+=1;} } } int c=0; for(int m=0;m<m_number;m++){ if(!((shape+m)->m_column<0||(shape+m)->m_column>m_width-1||(shape+m)->m_row>m_length-1||(shape+m)->m_row<0||m_pPlate[(shape+m)->m_row][(shape+m)->m_column].m_exist==true)) { c++; } } if(c==4){ m_pShape[0]=shape[0]; m_pShape[1]=shape[1]; m_pShape[2]=shape[2]; m_pShape[3]=shape[3]; } /*if(m_pShape[0].m_row==m_pShape[2].m_row&&m_pShape[0].m_row==m_pShape[3].m_row&&m_pShape[0].m_row<m_pShape[1].m_row) { for(int i=0;i<m_number;i++) { m_pShape[i].m_row--; } }*/ } void CL::Initialize() { m_pShape[0].m_column=m_width/2-1; m_pShape[0].m_row=1; // m_pShape[1].m_column=m_width/2-2; m_pShape[1].m_row=0; // ʳʳʳ m_pShape[2].m_column=m_width/2-2; m_pShape[2].m_row=1; // ʳ m_pShape[3].m_column=m_width/2; m_pShape[3].m_row=1; if(1== Random(2)) { m_pShape[1].m_column+=2; } m_state=Random(m_number); if(m_state!=0) ChangeShape(m_state); } void CL::Draw(HDC hdc) { for(int i=0;i<m_number;i++) { (m_pShape+i)->DrawCell(hdc,m_cellsize); } } //////////////////////////////////////////////////////////////////////////////// CT::CT(CPlate &plate,int number):CShape(plate,number) { m_pShape=new CCell[m_number]; } CT::~CT() { // delete []m_pShape; ////ʳʳʳ } // ʳ void CT::Draw(HDC hdc) { for(int i=0;i<m_number;i++) { (m_pShape+i)->DrawCell(hdc,m_cellsize); } } void CT::ChangeShape(int n) { CCell shape[4]={m_pShape[0],m_pShape[1],m_pShape[2],m_pShape[3]}; for(int i=0;i<n;i++) { if(shape[2].m_row<shape[0].m_row) // ʳ { ////ʳʳ shape[1].m_row--;shape[1].m_column++; // ʳ shape[2].m_row++;shape[2].m_column++; shape[3].m_row++;shape[3].m_column--; break; } if(shape[2].m_row>shape[0].m_row) { shape[1].m_row++;shape[1].m_column--; shape[2].m_row--;shape[2].m_column--; shape[3].m_row--;shape[3].m_column++; break; } if(shape[2].m_column>shape[0].m_column) { shape[1].m_row++;shape[1].m_column++; shape[2].m_row++;shape[2].m_column--; shape[3].m_row--;shape[3].m_column--; break; } if(shape[2].m_column<shape[0].m_column) { shape[1].m_row--;shape[1].m_column--; shape[2].m_row--;shape[2].m_column++; shape[3].m_row++;shape[3].m_column++; break; } } int c=0; for(int m=0;m<m_number;m++){ if(!((shape+m)->m_column<0||(shape+m)->m_column>m_width-1||(shape+m)->m_row>m_length-1||(shape+m)->m_row<0||m_pPlate[(shape+m)->m_row][(shape+m)->m_column].m_exist==true)) { c++; } } if(c==4){ m_pShape[0]=shape[0]; m_pShape[1]=shape[1]; m_pShape[2]=shape[2]; m_pShape[3]=shape[3]; } } void CT::Initialize() { m_pShape[0].m_column=m_width/2-1; m_pShape[0].m_row=1; // m_pShape[1].m_column=m_width/2-2; m_pShape[1].m_row=1; // ʳ m_pShape[2].m_column=m_width/2-1; m_pShape[2].m_row=0; ////ʳʳʳ m_pShape[3].m_column=m_width/2; m_pShape[3].m_row=1; /// m_state=Random(m_number); if(m_state!=0) ChangeShape(m_state); } ////////////////////////////////////////////////////////////////////////////////// CS::CS(CPlate &plate,int number):CShape(plate,number) { m_pShape=new CCell[m_number]; } CS::~CS() { delete []m_pShape; } void CS::Draw(HDC hdc) { for(int i=0;i<m_number;i++) { (m_pShape+i)->DrawCell(hdc,m_cellsize); } } void CS::ChangeShape(int n) { CCell shape[4]={m_pShape[0],m_pShape[1],m_pShape[2],m_pShape[3]}; if(shape[0].m_column==shape[1].m_column&&shape[0].m_row<shape[3].m_row) { shape[1].m_row++;shape[1].m_column++; shape[2].m_row--;shape[2].m_column++; if(shape[3].m_row>shape[0].m_row) { shape[3].m_row-=2; } else { shape[3].m_column+=2; } } else { if(shape[3].m_column<shape[0].m_column) { shape[1].m_row--;shape[1].m_column--; shape[2].m_row--;shape[2].m_column++; shape[3].m_column+=2; } else { shape[1].m_row++;shape[1].m_column++; shape[2].m_row++;shape[2].m_column--; shape[3].m_column-=2; } } int c=0; for(int m=0;m<m_number;m++){ if(!((shape+m)->m_column<0||(shape+m)->m_column>m_width-1||(shape+m)->m_row>m_length-1||(shape+m)->m_row<0||m_pPlate[(shape+m)->m_row][(shape+m)->m_column].m_exist==true)) { c++; } } if(c==4){ m_pShape[0]=shape[0]; m_pShape[1]=shape[1]; m_pShape[2]=shape[2]; m_pShape[3]=shape[3]; } } void CS::Initialize() { m_pShape[0].m_column=m_width/2-1; m_pShape[0].m_row=1; // m_pShape[1].m_column=m_width/2-1; m_pShape[1].m_row=0; // ʳ ʳʳ m_pShape[2].m_column=m_width/2-2; m_pShape[2].m_row=1; ////ʳʳ ʳʳ m_pShape[3].m_column=m_width/2-2; m_pShape[3].m_row=2; // ʳ if(1== Random(2)) // { // ʳ ʳʳ m_pShape[1].m_row+=2; // ʳʳ ʳʳ m_pShape[3].m_row-=2; // ʳ } m_state=Random(2); if(m_state!=0) ChangeShape(); } /////////////////////////////////////////////////////////////////////////////////// CSquare::CSquare(CPlate &plate,int number):CShape(plate,number) { m_pShape=new CCell[m_number]; } CSquare::~CSquare() { delete []m_pShape; } void CSquare::Draw(HDC hdc) { for(int i=0;i<m_number;i++) { (m_pShape+i)->DrawCell(hdc,m_cellsize); ////ʳʳ } ///ʳʳ } void CSquare::ChangeShape(int n) { } void CSquare::Initialize() { m_pShape[0].m_column=m_width/2-1; m_pShape[0].m_row=0; m_pShape[1].m_column=m_width/2-2; m_pShape[1].m_row=0; m_pShape[2].m_column=m_width/2-1; m_pShape[2].m_row=1; m_pShape[3].m_column=m_width/2-2; m_pShape[3].m_row=1; } ///////////////////////////////////////////////////////////////////////////////// CI::CI(CPlate &plate,int number):CShape(plate,number) { m_pShape=new CCell[m_number]; } CI::~CI() { delete []m_pShape; } void CI::Draw(HDC hdc) { for(int i=0;i<m_number;i++) { (m_pShape+i)->DrawCell(hdc,m_cellsize); } } void CI::ChangeShape(int n) { CCell shape[4]={m_pShape[0],m_pShape[1],m_pShape[2],m_pShape[3]}; for(int i=0;i<n;i++) { if(shape[1].m_row==shape[0].m_row) { shape[1].m_row++;shape[1].m_column--; shape[2].m_row--;shape[2].m_column++; shape[3].m_row-=2;shape[3].m_column+=2; } else{ shape[1].m_row--;shape[1].m_column++; shape[2].m_row++;shape[2].m_column--; shape[3].m_row+=2;shape[3].m_column-=2; } } int c=0; for(int m=0;m<m_number;m++){ if(!((shape+m)->m_column<0||(shape+m)->m_column>m_width-1||(shape+m)->m_row>m_length-1||(shape+m)->m_row<0||m_pPlate[(shape+m)->m_row][(shape+m)->m_column].m_exist==true)) { c++; } } if(c==4){ m_pShape[0]=shape[0]; m_pShape[1]=shape[1]; m_pShape[2]=shape[2]; m_pShape[3]=shape[3]; } } void CI::Initialize() { m_pShape[0].m_column=m_width/2-1; m_pShape[0].m_row=1; // ʳʳʳʳ m_pShape[1].m_column=m_width/2; m_pShape[1].m_row=1; m_pShape[2].m_column=m_width/2-2; m_pShape[2].m_row=1; m_pShape[3].m_column=m_width/2-3; m_pShape[3].m_row=1; m_state=Random(2); if(m_state!=0) ChangeShape(m_state); } //////////////////////////////////////////////////////////////////////////////////
b42b21787f54919dc6f0436c3668409eb98af804
7df60cff2293ef347835be310ff94bb4339c8507
/Day 14M/ex01/FruitNode.hpp
1bb2f1cef1c9bc1346ece7bfcfb4aa7c59e25226
[]
no_license
halil28450/PoolCPP
e9ca42e2adf8a3e2333e2519a33b4cce1a5d92fc
b74387e9cf7bdf853dca86be984bb196f2e0558a
refs/heads/main
2023-03-18T19:04:33.014416
2021-02-15T12:14:57
2021-02-15T12:14:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
420
hpp
FruitNode.hpp
/* ** EPITECH PROJECT, 2021 ** B_CPP_300_STG_3_1_CPPD14M_arthur_robine ** File description: ** Created by arthur, */ #ifndef B_CPP_300_STG_3_1_CPPD14M_ARTHUR_ROBINE_FRUITNODE_HPP #define B_CPP_300_STG_3_1_CPPD14M_ARTHUR_ROBINE_FRUITNODE_HPP #include "Fruit.hpp" typedef struct FruitNode_s { Fruit *content; struct FruitNode_s *next; } FruitNode; #endif //B_CPP_300_STG_3_1_CPPD14M_ARTHUR_ROBINE_FRUITNODE_HPP
7f02e228f6bd945c2d1e3e81438a111ba042b31c
4094a7d3bba1f55d8b1ef4914ae200275745d66c
/TinyBitmapMaker/tinybmp_maker/tinybmp.h
17f1cf06b58ee662be9dc1400ccfe565d9e85432
[]
no_license
SanJeong/21400684
255f44ae6642f680511a568398f90919a7e9fc94
02a8b995255d9edfc1b2f7691a638546dcb8c3e2
refs/heads/master
2021-01-20T00:50:48.411475
2017-06-22T13:06:15
2017-06-22T13:06:15
89,196,666
0
0
null
null
null
null
UTF-8
C++
false
false
630
h
tinybmp.h
#pragma once #include <iostream> #include "tinybmp_def.h" class TinyBitmap { public: TinyBitmap(); TinyBitmap(const char* _path); TinyBitmap(const TinyBitmap& rhs); virtual ~TinyBitmap(); public: void print_header(std::ostream& strm); void print_info_header(std::ostream& strm); public: BITMAP_INFO_HEADER& get_info_header(){ return m_info_header;} unsigned char*** get_buf(){ return m_image_buf; } public: bool import_image(const char* _path); bool export_image(const char* _path); private: BITMAP_HEADER m_header; BITMAP_INFO_HEADER m_info_header; unsigned char*** m_image_buf; };
e8c6564ed725358b01a054e2fad5cac41c6aac6c
d601a1278001292cc76d089013e31cba83109233
/Mando Engine/Motor/Graficos/textura_arreglada.h
39c437310ae5ceadb57ae0321b05c6bc09ab6fe9
[]
no_license
MANDO11121/Mando_Engine
cab47d3aab710fd2db6e7b4af84b6955db2e4749
8099ac83f37b08a28c9772e7e364efe603453361
refs/heads/master
2021-01-01T05:28:12.811231
2016-05-27T23:48:34
2016-05-27T23:48:34
59,664,306
0
0
null
null
null
null
UTF-8
C++
false
false
708
h
textura_arreglada.h
#pragma once #include "textura.h" #include "modelo.h" #include "recurso.h" namespace graficos{ class Textura_Arreglada : public Recurso { public: Textura_Arreglada(); Textura_Arreglada(Textura2D *textura,GLuint numeroframes,const char* nombre); Textura_Arreglada(Textura2D *textura,GLuint numeroframes,TransData *frames,const char* nombre); virtual ~Textura_Arreglada(); void setFrame(GLuint indice,TransData &frame); inline TransData &getFrame(GLuint indice) { if(indice>=_Num_Frames) MERROR("Fuera de indice"); else return _Frames[indice]; } private: Textura2D *_textura; GLuint _Num_Frames; TransData *_Frames; }; }
41f05117be2165fe57deca7b3839392dee438024
ef2d829c0ac2bf2367ec61d1972913c13917ff99
/306_additiveNum.cpp
41b6e458709a26e07176a1f24cc907625b867bb7
[]
no_license
yuweichen1008/leetcode-1
9c87c6e762f6dfc34e5e2f44feaa1b60ac3e7f91
713eed352ae075840b762d8082e5590906b52192
refs/heads/master
2021-06-12T04:15:00.909986
2017-01-07T17:18:22
2017-01-07T17:18:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,105
cpp
306_additiveNum.cpp
class Solution { public: bool isAdditiveNumber(string num) { for(int i = 0; i<num.size()/2; i++){ if(dfs(stoll(num.substr(0, i+1)), i+1, num)) return true; if(num[0]=='0') return false; } return false; } bool dfs(long long int prev, int secondIndex, string num){ bool res = false; for(int i = secondIndex; i < num.size(); i++){ long long int next = stoll(num.substr(secondIndex, i-secondIndex+1)); long long int tempSum; tempSum = prev + next; string tempSumStr = to_string(tempSum); if(tempSumStr.size()+i+1 <= num.size()){ if(tempSumStr == num.substr(i+1, tempSumStr.size())) if(i+tempSumStr.size()+1 == num.size()) return true; else res |= dfs(next, i+1, num); } else break; if(num[secondIndex] == '0') break; } return res; } };
532f612a9d2f55b4649558b85ee38efa9b344f4c
55676aced145d877d6b8649edab5085c995e3c84
/Codes/Control_Board_Atmega32/10motors/10motors.cpp
2b9d0ff5acdb564024c0e5bc63784fcfc48a4caa
[ "MIT" ]
permissive
rhitvik/Smart_Vending_Machine
2a0ffc5cbd11731f7ce4673759ae97127b010010
c2083ffb0be3e22aff474cace7e6d560f70e78ee
refs/heads/master
2021-01-04T04:57:44.335655
2020-03-02T01:27:21
2020-03-02T01:27:21
240,396,566
3
0
null
null
null
null
UTF-8
C++
false
false
13,638
cpp
10motors.cpp
/* * _10motors.cpp * * Created: 10-Nov-16 1:44:31 PM * Author: RHITVIK */ /* * coinAcceptor_innterruptProgram.cpp * * Created: 26-Jul-16 7:34:29 PM * Author: RHITVIK */ // #include <avr/io.h> // // int main(void) // { // GICR |= (1<<INT1); // MCUCR |= (1<<ISC10) | (1<<ISC11); // // while(1) // { // //TODO:: Please write your application code // } // } #define F_CPU 12000000UL #define OFF 0 #define ON 1 #include<avr/io.h> #include<util/delay.h> #include<avr/interrupt.h> #include<string.h> void disable_driver(void); void accept_coin(void); void return_coin(void); void initialise_PWM(void); void PWM1(void); void PWM2(void); void sw_debounce_pressed(void); void sw_debounce_released(void); void KILL_PWM1(void); void KILL_PWM2(void); void initialise_counter(void); void stop_counter(void); void detect_coin(void); void vend_STATIONERY(void); void check_IF_successful(void); void CHECK_STOCK(void); void resetParameters(void); void motor(int a,bool b); void spi_init_master_INTERRUPT (void); void spi_init_master (void); void spi_init_slave (void); char spi_tranceiver (unsigned char data); void spi_kill_master(void); void spi_kill_slave(void); void recieve_packets(void); void library(void); static volatile uint8_t count=0; //for interrupt generation static volatile uint8_t count1=0; //10 sec delay initializer static volatile uint8_t FAIL = 0; unsigned char packet = 0; unsigned char packet1 = 0; unsigned char packet2 = 0; unsigned char packet3 = 0; unsigned char packet4 = 0; uint8_t p = 0; uint8_t kick = 0; uint8_t STOCK = 0; uint8_t coin_10RS = 0; uint8_t RS10_coin_no = 0; uint8_t coin_count = 0; uint8_t coin_05RS = 0; uint8_t RS05_coin_no = 0; int money = 0; int u = 0; int pressed=0; int pressed_1=0; int pressed_2=0; int refresh = 0; int refresh2 = 0; char b = 0; int main(void) { MCUCSR |= (1<<JTD); MCUCSR |= (1<<JTD); DDRA |= 0xFF; DDRB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2) | (1<<PINB3); DDRC |= 0xFF; DDRD |= 0b11110011; PORTA = 0; PORTB &=~ (1<<PINB0); PORTB &=~ (1<<PINB1); PORTB &=~ (1<<PINB2); PORTB &=~ (1<<PINB3); PORTC = 0; PORTD |= 0b00001100; char a = 0; // GICR |= (1<<INT1); // MCUCR |= (1<<ISC10);//|(1<<ISC11);//// // // sei(); initialise_PWM(); PWM1(); PWM2(); spi_init_slave(); // while(100) // { // PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); // _delay_ms(1000); // PORTB &= ~(1<<PINB0); // PORTB &= ~(1<<PINB1); // PORTB &= ~(1<<PINB2); // _delay_ms(1000); // } while(3) { spi_tranceiver(0); packet = SPDR; library(); } //TODO:: Please write your application code } void initialise_PWM(void) { TCCR1A |= (1<<WGM11); TCCR1B |= (1<<WGM12) |(1<<WGM13) |(1<<CS10); ICR1=19999; //top value } void PWM1(void) { TCCR1A |= (1<<COM1A1); OCR1A = 19990; ///////put the ocr value } void PWM2(void) { TCCR1A |= (1<<COM1B1); OCR1B = 19990; ///////put the ocr value } void sw_debounce_pressed(void) { //code unsigned int pressed_confidence_level=0; pressed_confidence_level++; if(pressed_confidence_level>=500 )//put a debouncing value/////////////// { pressed_confidence_level=0; } } void sw_debounce_released(void) { unsigned int released_confidence_level=0; released_confidence_level++; if(released_confidence_level>=500 )//put a debouncing value////////////// { released_confidence_level=0; } } void KILL_PWM1(void) { TCCR1A &=~ (1<<COM1A1); OCR1A = 0; } void KILL_PWM2(void) { TCCR1A &=~ (1<<COM1B1); OCR1B = 0; } void initialise_counter(void) { TCCR0 |= (1<<CS01)|(1<<CS00); TIMSK |= (1<<TOIE0); TCNT0 = 0; } void stop_counter(void) { TCCR0 &=~ (1<<CS00); TCCR0 &=~ (1<<CS01); TIMSK &=~ (1<<TOIE0); _delay_ms(1); TCNT0=0; } void resetParameters(void) { count=0; //for interrupt generation count1=0; //10 sec delay initializer FAIL = 0; p = 0; kick = 0; STOCK = 0; coin_10RS = 0; RS10_coin_no = 0; coin_count = 0; coin_05RS = 0; RS05_coin_no = 0; money = 0; pressed=0; pressed_1=0; pressed_2=0; refresh = 0; refresh2 = 0; stop_counter(); PORTC = 0; } void motor(int a,bool b) { if (b == ON) { switch (a) { case 1: PORTA |= (1<<PINA0); PORTA &=~(1<<PINA1); break; case 2: PORTA |= (1<<PINA2); PORTA &=~(1<<PINA3); break; case 3: PORTA |= (1<<PINA4); PORTA &=~(1<<PINA5); break; case 4: PORTA |= (1<<PINA6); PORTA &=~(1<<PINA7); break; case 5: PORTC |= (1<<PINC0); PORTC &=~(1<<PINC1); break; case 6: PORTC |= (1<<PINC2); PORTC &=~(1<<PINC3); break; case 7: PORTC |= (1<<PINC4); PORTC &=~(1<<PINC5); break; case 8: PORTC |= (1<<PINC6); PORTC &=~(1<<PINC7); break; case 9: PORTD |= (1<<PIND0); PORTD &=~(1<<PIND1); break; case 10: PORTD |= (1<<PIND6); PORTD &=~(1<<PIND7); break; } } else if (b == OFF) { switch (a) { case 1: PORTA &=~(1<<PINA0); PORTA &=~(1<<PINA1); break; case 2: PORTA &=~(1<<PINA2); PORTA &=~(1<<PINA3); break; case 3: PORTA &=~(1<<PINA4); PORTA &=~(1<<PINA5); break; case 4: PORTA &=~(1<<PINA6); PORTA &=~(1<<PINA7); break; case 5: PORTC &=~(1<<PINC0); PORTC &=~(1<<PINC1); break; case 6: PORTC &=~(1<<PINC2); PORTC &=~(1<<PINC3); break; case 7: PORTC &=~(1<<PINC4); PORTC &=~(1<<PINC5); break; case 8: PORTC &=~(1<<PINC6); PORTC &=~(1<<PINC7); break; case 9: PORTD &=~(1<<PIND0); PORTD &=~(1<<PIND1); break; case 10: PORTD &=~(1<<PIND6); PORTD &=~(1<<PIND7); break; } } } // Initialize SPI Master Device (with SPI interrupt) void spi_init_master_INTERRUPT (void) { // Set MOSI, SCK as Output DDRB |= (1<<PINB5)|(1<<PINB7); DDRB &=~ (1<<PINB6); PORTB |= (1<<PINB6); // Enable SPI, Set as Master // Prescaler: Fosc/16, Enable Interrupts //The MOSI, SCK pins are as per ATMega8 SPCR |= (1<<SPE)|(1<<MSTR)|(1<<SPR0)|(1<<SPIE); // Enable Global Interrupts //sei(); } // Initialize SPI Master Device (without interrupt) void spi_init_master (void) { // Set MOSI, SCK as Output DDRB |= (1<<PINB5)|(1<<PINB7); DDRB &=~ (1<<PINB6); PORTB |= (1<<PINB6); // Enable SPI, Set as Master //Prescaler: Fosc/16, Enable Interrupts SPCR |= (1<<SPE)|(1<<MSTR)|(1<<SPR0); } // Initialize SPI Slave Device void spi_init_slave (void) { DDRB &=~ (1<<PINB6); //MISO as OUTPUT PORTB |= (1<<PINB6); // but here in input DDRB &=~ (1<<PINB5); //MOSI as input PORTB |= (1<<PINB5); DDRB &=~ (1<<PINB4); //SS as input PORTB |= (1<<PINB4); DDRB &=~ (1<<PINB7); //SCK as input PORTB |= (1<<PINB7); SPCR |= (1<<SPE); //Enable SPI SPCR &=~ (1<<MSTR); // disable master control } //Function to send and receive data for both master and slave char spi_tranceiver (unsigned char data) { // Load data into the buffer SPDR = data; //Wait until transmission complete while(!(SPSR & (1<<SPIF) )); // Return received data return SPDR; } //kill spi void spi_kill_master(void) { // Set MOSI, SCK as Output DDRB |= (1<<PINB5)|(1<<PINB7); DDRB &=~ (1<<PINB6); PORTB |= (1<<PINB6); SPCR &=~ (1<<SPE); SPCR &=~ (1<<MSTR); SPCR &=~ (1<<SPR0); } void spi_kill_slave(void) { DDRB |= (1<<PINB6); //MISO as OUTPUT DDRB &=~ (1<<PINB5); PORTB |= (1<<PINB5); DDRB &=~ (1<<PINB7); PORTB |= (1<<PINB7); SPCR &=~ (1<<SPE); //disable SPI SPCR &=~ (1<<MSTR); } void recieve_packets(void) { spi_tranceiver('a'); packet = SPDR; switch (packet) { case 'W': spi_tranceiver('W'); packet1 = SPDR; break; //first packet is to be received case 'X': spi_tranceiver('X'); packet2 = SPDR; break; //second packet is to be received case 'Y': spi_tranceiver('y'); packet3 = SPDR; break; ///third packet is to be received case 'Z': spi_tranceiver('Z'); packet4 = SPDR; break; //fourth packet is to be received } } void library (void) { switch (packet) { case 255: packet = 0; break; case 'A': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); packet = 0; motor(1 ,ON); b=1; break; case 'B': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); packet = 0; motor(2 ,ON); b=1; break; case 'C': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); packet = 0; motor(3 ,ON); b=1; break; case 'D': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); packet = 0; motor(4 ,ON); b=1; break; case 'E': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); packet = 0; motor(5 ,ON); b=1; break; case 'F': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); packet = 0; motor(6 ,ON); b=1; break; case 'G': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); motor(7 ,ON); b=1; break; case 'H': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); packet = 0; motor(8 ,ON); b=1; break; case 'I': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); packet = 0; motor(9 ,ON); b=1; break; case 'J': PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); _delay_ms(500); PORTB &= ~(1<<PINB0); PORTB &= ~(1<<PINB1); PORTB &= ~(1<<PINB2); packet = 0; motor(10 ,ON); b=1; break; case 'Y'://///////// packet = 0; PORTB ^= (1<<PINB0); PORTB ^= (1<<PINB1); PORTB ^= (1<<PINB2); motor(1,OFF); motor(2,OFF); motor(3,OFF); motor(4,OFF); motor(5,OFF); motor(6,OFF); motor(7,OFF); motor(8,OFF); motor(9,OFF); motor(10,OFF); break; } } // ISR(INT1_vect) // { // if (b==1) // { // u++; // if (u>=2) // { // b=0; // u=0; // PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); // _delay_ms(500); // PORTB &= ~(1<<PINB0); // PORTB &= ~(1<<PINB1); // PORTB &= ~(1<<PINB2); // // motor(1,OFF); // motor(2,OFF); // motor(3,OFF); // motor(4,OFF); // motor(5,OFF); // motor(6,OFF); // motor(7,OFF); // motor(8,OFF); // motor(9,OFF); // motor(10,OFF); // } // } // // // } //b = 1; //spi_init_slave(); // // // //spi_tranceiver('a'); // ISR(TIMER0_OVF_vect) // { // count++; // if (count==61) // { // // 1 second has elapsed // count=0; // // count1++; // // PORTC ^= (1<<PINC3); // // if (count1==20)/////// calibrate it further // { // //return coin if not dispatched // count1=0; // FAIL=1; // } // } // } /* case 'a': packet = 0; motor(1 ,OFF); break; case 'b': packet = 0; motor(2 ,OFF); break; case 'c': packet = 0; motor(3 ,OFF); break; case 'd': packet = 0; motor(4 ,OFF); break; case 'e': packet = 0; motor(5 ,OFF); break; case 'f': packet = 0; motor(6 ,OFF); break; case 'g': packet = 0; motor(7 ,OFF); break; case 'h': packet = 0; motor(8 ,OFF); break; case 'i': packet = 0; motor(9 ,OFF); break; case 'j': packet = 0; motor(10 ,OFF); break; */ //void recieve_instruction () // motor motorID start/stop // if (packet == 'a') // { // PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); // _delay_ms(50); // PORTB &=~ (1<<PINB0); // PORTB &=~ (1<<PINB1); // PORTB &=~ (1<<PINB2); // _delay_ms(50); // // PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); // _delay_ms(50); // PORTB &=~ (1<<PINB0); // PORTB &=~ (1<<PINB1); // PORTB &=~ (1<<PINB2); // _delay_ms(50); // // PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); // _delay_ms(50); // PORTB &=~ (1<<PINB0); // PORTB &=~ (1<<PINB1); // PORTB &=~ (1<<PINB2); // _delay_ms(50); // } // else // if (packet == 'b') // { // PORTB |= (1<<PINB0); // _delay_ms(100); // PORTB |= (1<<PINB1); // _delay_ms(100); // PORTB |= (1<<PINB2); // _delay_ms(100); // PORTB &=~ (1<<PINB0); // PORTB &=~ (1<<PINB1); // PORTB &=~ (1<<PINB2); // _delay_ms(50); // } // // spi_tranceiver('y'); // packet = SPDR; // // if (packet == 'a') // { // PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); // _delay_ms(50); // PORTB &=~ (1<<PINB0); // PORTB &=~ (1<<PINB1); // PORTB &=~ (1<<PINB2); // _delay_ms(50); // // PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); // _delay_ms(50); // PORTB &=~ (1<<PINB0); // PORTB &=~ (1<<PINB1); // PORTB &=~ (1<<PINB2); // _delay_ms(50); // // PORTB |= (1<<PINB0) | (1<<PINB1) | (1<<PINB2); // _delay_ms(50); // PORTB &=~ (1<<PINB0); // PORTB &=~ (1<<PINB1); // PORTB &=~ (1<<PINB2); // _delay_ms(50); // } // else // if (packet == 'b') // { // PORTB |= (1<<PINB0); // _delay_ms(100); // PORTB |= (1<<PINB1); // _delay_ms(100); // PORTB |= (1<<PINB2); // _delay_ms(100); // PORTB &=~ (1<<PINB0); // PORTB &=~ (1<<PINB1); // PORTB &=~ (1<<PINB2); // _delay_ms(50); // }
f93752cf032762ba4c4f42d3e9af7bf2ea9d3742
2703a7d33aa8dca99c446b33f59cc986ba638dff
/chapter_10/10ـx.cpp
fa5d6e18571af635bac59794cb91773c9cd76cdd
[]
no_license
TamijiMehrdad/learning_cpp
99808fe918c943aba8491a14cd57ab3fb214125a
3c25add55cf870e83d17b0ede22720807f87dcac
refs/heads/master
2023-02-19T19:52:25.646079
2021-01-20T05:46:13
2021-01-20T05:46:13
324,397,691
0
0
null
null
null
null
UTF-8
C++
false
false
2,028
cpp
10ـx.cpp
#include "cpp_tools.h" #include <iostream> #include <iterator> #include <algorithm> #include <limits> #include <random> #include <ctime> #include <cstdlib> #include <string> #include <typeinfo> #include <array> #include <vector> #include <string_view> #include <numeric> #include <cassert> #include <tuple> #include <chrono> #include <sstream> #include <cstdarg> #include <functional> int recursive_binary_search(const int *array, int target, int min, int max) { int mid{(max + min) / 2}; if(array[mid] == target) return mid; else { if(min >= max) return -1; else { if(array[mid] > target) return recursive_binary_search(array,target,min ,mid -1); else { return recursive_binary_search(array,target,mid +1 ,max); } } } } int main() { constexpr int array[]{ 3, 6, 8, 12, 14, 17, 20, 21, 26, 32, 36, 37, 42, 44, 48 }; // We're going to test a bunch of values to see if they produce the expected results constexpr int numTestValues{ 9 }; // Here are the test values constexpr int testValues[numTestValues]{ 0, 3, 12, 13, 22, 26, 43, 44, 49 }; // And here are the expected results for each value int expectedValues[numTestValues]{ -1, 0, 3, -1, -1, 8, -1, 13, -1 }; // Loop through all of the test values for (int count{ 0 }; count < numTestValues; ++count) { // See if our test value is in the array int index{ recursive_binary_search(array, testValues[count], 0, static_cast<int>(std::size(array)) - 1) }; // If it matches our expected value, then great! if (index == expectedValues[count]) std::cout << "test value " << testValues[count] << " passed!\n"; else // otherwise, our recursive_binary_search() function must be broken std::cout << "test value " << testValues[count] << " failed. There's something wrong with your code!\n"; } return 0; }
2e50afd75fc3e69f755734bef22c1fe494ce3851
f4e5527938a6378e40100d4d7cdb96dd28032a7e
/onda.cpp
5261f9a0b291719aa04dbae3cba08888ad779e36
[ "MIT" ]
permissive
LorenaL10/LorenaLarrota_Ejercicio30
d6028fce90982f1306ee10753ca9c46b626ea399
aef7a3d052a0ed1083f26a6d2e07d20a7ce5b9ff
refs/heads/master
2020-05-20T22:43:26.768421
2019-05-09T12:54:07
2019-05-09T12:54:07
185,787,866
0
0
null
null
null
null
UTF-8
C++
false
false
1,215
cpp
onda.cpp
#include <iostream> #include <fstream> #include <cmath> using namespace std; int main(){ int m=100; double c=1; double t_max=2.0; double t=0.0; double u[m+1]; double u_final[m+1]; double u_inicial[m-1]; double delta_t=0.01; double delta_x=0.01; double beta= c*delta_t/delta_x; double x; int n=t_max/delta_t; ofstream outfile; // inicializo for(int i=0; i<m; i++){ x=i*delta_x; u_final[i]=exp(-300*(x-0.12)*(x-0.12)); u_inicial[i]=exp(-300*(x-0.12-c*t_max)*(x-0.12-c*t_max)); u[i]=0; } outfile.open("onda.txt"); while (1<t_max){ for (int i=0; i<m-1; i++) { u[i+1] = u_inicial[i]-0.25*beta*(u_inicial[i+1]-u_inicial[i-1])+(beta*beta/8)*[(u_inicial[i+1]+u_inicial[i])*(u_inicial[i+1]*u_inicial[i+1]+u_inicial[i]*u_inicial[i])- (u_inicial[i]+u_inicial[i-1])*(u_inicial[i]*u_inicial[i]+u_inicial[i-1]*u_inicial[i-1])]; u[0]=0; u[m-1]=0; u_inicial[i]=u[i]; } for(int j=0;j<m-1;j++){ double pos = 0.01*j; double y = u[j]; outfile << y << " "; } outfile << "\n"; t=t+delta_t; } outfile.close(); return 0; }
6a31d04cc023179033e1207b9de451c6697ae633
2365c324eb4046a2cc1c3cbf9010ee718b6918ab
/Assignment1/check.cpp
c605cb9fcfb5b034ef46eb2c7ad67fdc96e8bfc3
[]
no_license
parinaya-007/Pattern_Recognition
7b9ea1e0603043b009105dd8dac53e0aaf3cd3a9
2c3073650dc518913959711241cd4895eda3b968
refs/heads/master
2021-01-23T11:40:09.010168
2017-09-06T17:51:33
2017-09-06T17:51:33
102,634,049
0
0
null
null
null
null
UTF-8
C++
false
false
799
cpp
check.cpp
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { int t, n; cin >> t; while(t--){ cin >> n; long a[n]; vector<bool> c(n+1, false); for(int i=0; i<n; i++){ cin >> a[i]; } bool check = true; for(int i=0; i<n; i++){ c[a[i]] = true; } for(int i=1; i<=n; i++){ if(c[i]==false) check = false; } int count = 0; for(int i=1; i<n; i++){ if(a[i]>=a[i-1]) count++; } if(count==n-1) check = false; if(check) cout << "Beautiful" << endl; else cout << "Ugly" << endl; } return 0; }
951ec2b8204dcb6a55d76bce615796de83e3c12b
e85f5698d351bacf62a41e6fc1b684b1f1a287eb
/RougeLike/DX9Game/ModelManager.cpp
7a7424d47255c050ed34c03d083c930cb1ced022
[]
no_license
Tetetenon/RoguelikeProject
1117405df2112308b2875d14256aa9a1245dc5d7
1b1b73f40017a829f56441c43f8182b37261e369
refs/heads/master
2021-01-12T17:25:01.186392
2016-10-21T13:16:59
2016-10-21T13:16:59
71,565,659
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
4,926
cpp
ModelManager.cpp
#include "ModelManager.h" CMesh CModelManager::m_MeshData[MODEL_MAX]; //メッシュデータ保存用 bool CModelManager::m_MeshLoadFlg[MODEL_MAX] = {false}; //モデルデータ読み込みフラグ //-----モデルデータパス----- #define PATH_MESH_PLAYER _T("../data/model/model/RedHood.x") //プレイヤー(赤ずきん) #define PATH_MESH_BEE _T("../data/model/model/Bee.x") //エネミー(蜂) #define PATH_MESH_BEAR _T("../data/model/model/Bear.x") //エネミー(クマ) #define PATH_MESH_WOLF _T("../data/model/model/Wolf.x") //エネミー(狼) #define PATH_MESH_TREE _T("../data/model/model/Tree.x") //フィールドオブジェ(木) #define PATH_MESH_WALL _T("../data/model/model/Wall.x") //フィールドオブジェ(壁) #define PATH_MESH_ITEM _T("../data/model/model/TreasureBox.x") //フィールドオブジェ(宝箱) #define PATH_MESH_STAIRS _T("../data/model/model/Stairs.x") //フィールドオブジェ(階段) #define PATH_MESH_HIT _T("../data/model/model/Hit.x") //戦闘時ヒット #define PATH_MESH_DELETE _T("../data/model/model/Delete.x") //戦闘時消滅 //--------------------------------------------------------------------------------------- //コンストラクタ //--------------------------------------------------------------------------------------- CModelManager::CModelManager(void) { } //--------------------------------------------------------------------------------------- //デストラクタ //--------------------------------------------------------------------------------------- CModelManager::~CModelManager(void) { } //--------------------------------------------------------------------------------------- //メッシュデータをロードする //--------------------------------------------------------------------------------------- void CModelManager::LoadMesh() { //メッシュデータの初期化 ReleaseMesh(); //-----プレイヤーモデルの読み込み----- if(!m_MeshLoadFlg[MODEL_PLAYER]) { //モデルデータのロード m_MeshLoadFlg[MODEL_PLAYER] = m_MeshData[MODEL_PLAYER].Initialize(PATH_MESH_PLAYER,true); } //-----蜂モデルの読み込み----- if(!m_MeshLoadFlg[MODEL_BEE]) { //モデルデータのロード m_MeshLoadFlg[MODEL_BEE] = m_MeshData[MODEL_BEE].Initialize(PATH_MESH_BEE,true); } //-----クマモデルの読み込み----- if(!m_MeshLoadFlg[MODEL_BEAR]) { //モデルデータのロード m_MeshLoadFlg[MODEL_BEAR] = m_MeshData[MODEL_BEAR].Initialize(PATH_MESH_BEAR,true); } //-----狼モデルの読み込み----- if(!m_MeshLoadFlg[MODEL_WOLF]) { //モデルデータのロード m_MeshLoadFlg[MODEL_WOLF] = m_MeshData[MODEL_WOLF].Initialize(PATH_MESH_WOLF,true); } //-----木モデルの読み込み----- if(!m_MeshLoadFlg[MODEL_TREE]) { //モデルデータのロード m_MeshLoadFlg[MODEL_TREE] = m_MeshData[MODEL_TREE].Initialize(PATH_MESH_TREE,true); } //-----壁モデルの読み込み----- if(!m_MeshLoadFlg[MODEL_WALL]) { //モデルデータのロード m_MeshLoadFlg[MODEL_WALL] = m_MeshData[MODEL_WALL].Initialize(PATH_MESH_WALL,true); } //-----宝箱モデルの読み込み----- if(!m_MeshLoadFlg[MODEL_TREASUREBOX]) { //モデルデータのロード m_MeshLoadFlg[MODEL_TREASUREBOX] = m_MeshData[MODEL_TREASUREBOX].Initialize(PATH_MESH_ITEM,true); } //-----階段モデルの読み込み----- if(!m_MeshLoadFlg[MODEL_STAIRS]) { //モデルデータのロード m_MeshLoadFlg[MODEL_STAIRS] = m_MeshData[MODEL_STAIRS].Initialize(PATH_MESH_STAIRS,true); } //-----戦闘ヒット読み込み----- if(!m_MeshLoadFlg[MODEL_HIT]) { //モデルデータのロード m_MeshLoadFlg[MODEL_HIT] = m_MeshData[MODEL_HIT].Initialize(PATH_MESH_HIT,true); } //-----戦闘消滅の読み込み----- if(!m_MeshLoadFlg[MODEL_DELETE]) { //モデルデータのロード m_MeshLoadFlg[MODEL_DELETE] = m_MeshData[MODEL_DELETE].Initialize(PATH_MESH_DELETE,true); } } //--------------------------------------------------------------------------------------- //全てのメッシュデータを削除する //--------------------------------------------------------------------------------------- void CModelManager::ReleaseMesh() { //メッシュデータが存在すれば、削除をすべてのメッシュデータに対し行う for(int i = 0;i < MODEL_MAX;i++) { //メッシュデータが読み込まれている if(m_MeshLoadFlg[i]) { //メッシュの終了処理 m_MeshData[i].Finalize(); //フラグを倒す m_MeshLoadFlg[i] = false; } } } //--------------------------------------------------------------------------------------- //指定されたメッシュデータを渡す //--------------------------------------------------------------------------------------- CMesh* CModelManager::GetMesh(int nNumber) { return &m_MeshData[nNumber]; }
8d6593df8c9f663d1e4b527a14767b26dca369b0
0a70cf01bf16fc0cd1a696e08f657739eb4fd87c
/hdu/4912.cpp
232d302883801244e961c4e53eef3a5e7876b824
[]
no_license
erjiaqing/my_solutions
ca63b664cb6f7ecb7d756a70666fdf3be6dc06b3
87bf90af4aca2853f30a7c341fe747d499728ba3
refs/heads/master
2022-09-05T17:45:19.902071
2022-08-13T02:18:30
2022-08-13T02:18:30
20,209,446
10
7
null
null
null
null
UTF-8
C++
false
false
1,671
cpp
4912.cpp
#include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 5; int dep[maxn], fa[22][maxn]; int n, m; vector<int> e[maxn]; int vis[maxn]; struct que{ int x, y, a, d; que(){} que(int _x, int _y, int _a, int _d): x(_x), y(_y), a(_a), d(_d){} }; void dfs(int u, int f) { fa[0][u] = f; for (int v : e[u]) if (v != f) { dep[v] = dep[u] + 1; dfs(v, u); } } int lca(int u, int v) { if (dep[u] < dep[v]) swap(u, v); for (int c = 20; c >= 0; c--) if (dep[fa[c][u]] >= dep[v]) u = fa[c][u]; if (v == u) return v; for (int c = 20; c >= 0; c--) if (fa[c][u] != fa[c][v]) { u = fa[c][u]; v = fa[c][v]; } return fa[0][u]; } void mark(int u) { vis[u] = 1; for (int v : e[u]) { if (vis[v] || fa[0][u] == v) continue; mark(v); } } int sol() { memset(dep, -1, sizeof(dep)); memset(vis, 0, sizeof(vis)); memset(fa, 0, sizeof(fa)); dep[1] = 1; for (int i = 1; i < maxn; i++) e[i].clear(); for (int i = 1; i < n; i++) { int a, b; scanf("%d%d", &a, &b); e[a].push_back(b); e[b].push_back(a); } dfs(1, 1); for (int i = 1; i <= 20; i++) for (int j = 1; j <= n; j++) if (fa[i - 1][j]) fa[i][j] = fa[i - 1][fa[i - 1][j]]; vector<que> q; for (int i = 0; i < m; i++) { int u, v, a; scanf("%d%d", &u, &v); a = lca(u, v); q.push_back(que(u, v, a, dep[a])); } sort(q.begin(), q.end(), [](que &a, que &b){return a.d > b.d;}); int ans = 0; for (auto qu : q) { //cerr << qu.x << ' ' << qu.a << ' ' << qu.y << endl; if (vis[qu.x] == 0 && vis[qu.y] == 0) { ans++; mark(qu.a); } } return ans; } int main() { while (~scanf("%d%d", &n, &m)) printf("%d\n", sol()); return 0; }
d3a710736be592d41cb1da2064c228c1df6321ba
3a933103ae20bef6c1d1b6d0aefa7526bef6b055
/main.cpp
32281e73c02d580719e3c9a01080f56630fee214
[]
no_license
Daniel-TEC-17/Case-2-AA
c6b882755c44df56cb3047aaca5a5f4469393fe5
b9c52709abde1321fad5179f9f5bb1d9e8db0099
refs/heads/main
2023-03-11T11:39:13.051539
2021-03-03T01:55:47
2021-03-03T01:55:47
343,969,151
0
0
null
null
null
null
UTF-8
C++
false
false
3,515
cpp
main.cpp
#include <iostream> using namespace std; class Delivery{ public: double speed; // km/h double type; // 1=bicycle, 2=moto, 3=car double getTimeRestaurantHome(double pDistance, double pSpeed){ // Distancia en kilometros cout<< "Dura "<<(pDistance/pSpeed)*60 << " minutos en llegar del restaurante a la casa"<<endl; return (pDistance/pSpeed)*60; // retorna tiempo en minutos } double getTimeDeliveryRestaurant(double pDistance , double pSpeed){ // Distancia en kilometros cout<< "Dura "<<(pDistance/pSpeed)*60 << " minutos en llegar de donde esta el repartidor a el restaurante"<<endl;; return (pDistance/pSpeed)*60; // retorna tiempo en minutos } }; class Bicycle: public Delivery { public: }; class Motocycle: public Delivery { public: }; class Car: public Delivery { public: }; class Restaurant{ public: string name; Delivery observers[3]; void encontrarRepartidor(double pBicicleta, double pCar, double pMoto){ if( pBicicleta < pCar){ if( pBicicleta < pMoto){ cout<< "El metodo mas veloz es la Bicicleta con un tiempo total en minutos de: "<< pBicicleta<<endl; }else{ cout<< "El metodo mas veloz es la Moto con un tiempo total en minutos de: "<< pMoto<<endl; } }else{ if (pCar < pMoto){ cout<< "El metodo mas veloz es el CArro con un tiempo total en minutos de: "<< pCar<<endl; }else{ cout<< "El metodo mas veloz es la Moto con un tiempo total en minutos de: "<< pMoto<<endl; } } } }; int main() { Restaurant rest; Bicycle bici; Motocycle moto; Car carro; bici.speed = 20; bici.type = 1; moto.speed = 40; moto.type = 2; carro.speed = 30; carro.type = 3; rest.observers[0] = bici; rest.observers[1] = moto; rest.observers[2] = carro; double distance; double distanceM; double distanceC; double distanceB; cout<< "Cual es la distancia del restaurante a su casa?" <<endl; cin>> distance; cout<< "Cual es la distancia de la moto a el restaurante?" <<endl; cin>> distanceM; cout<< "Cual es la distancia del carro a el restaurante?" <<endl; cin>> distanceC; cout<< "Cual es la distancia de la bici a el restaurante?" <<endl; cin>> distanceB; cout<< "-----------BICI-----------------"<< endl; double bicicleta = rest.observers[0].getTimeDeliveryRestaurant(distanceB , rest.observers[0].speed) + rest.observers[0].getTimeRestaurantHome(distance, rest.observers[0].speed); cout<< "-------------CARRO---------------"<< endl; double car = rest.observers[0].getTimeDeliveryRestaurant(distanceC , rest.observers[0].speed) + rest.observers[0].getTimeRestaurantHome(distance, rest.observers[0].speed); cout<< "--------------MOTO--------------"<< endl; double pMoto = rest.observers[0].getTimeDeliveryRestaurant(distanceM , rest.observers[0].speed) + rest.observers[0].getTimeRestaurantHome(distance, rest.observers[0].speed); cout<< "---------------RESPUESTA--------- "<<endl; rest.encontrarRepartidor(bicicleta, car, pMoto); return 0; }
699c4862e7e5b1cc56bfe9ce109a96d3404cc4aa
1c3f4d69e3eb58a3e601f6240e7bd91bdcbe34d7
/ChapterTime/Chapter.h
8cb487f3b92f078564935b2d18b9fe3eb3b93557
[]
no_license
Elegant996/ChapterTime
10b2e2bed175aa68acfa196402209dce20e7722e
5544f560ba075a94b2f5de5204fec62761e23c48
refs/heads/master
2016-09-15T15:43:24.392730
2016-04-22T00:46:18
2016-04-22T00:46:18
34,589,196
0
0
null
null
null
null
UTF-8
C++
false
false
637
h
Chapter.h
#pragma once #include <string> #include "Time.h" using namespace std; class Chapter { public: Chapter(Time time, int index = 0, string name = ""); Chapter(const Chapter &chapter); ~Chapter(); Chapter& operator-=(const Chapter &right); Chapter& operator-(const Chapter &right); Chapter& operator*=(const float &right); Chapter& operator*(const float &right); Chapter& operator+=(const int &right); Chapter& operator+(const int &right); int getIndex(); Time getTime(); string getName(); void setIndex(int index); void setTime(Time time); void setName(string name); private: int index; Time time; string name; };
1bd6223a83faf7f5c8287c8f9bb02a04ed31e6ed
9ee36bd00b676e9b59bdcc1cc9134854ccedb7dd
/matrix.cpp
f0c5b8f23a92dc5aca037907f02a52254682305d
[]
no_license
dragly/vmc
711508c31354d871330d3903712cd544e0bbdda8
f523ecf3b212272978a43986027035c713a74b01
refs/heads/master
2020-06-04T19:43:56.109510
2013-09-13T09:39:17
2013-09-13T09:39:17
3,335,986
0
0
null
null
null
null
UTF-8
C++
false
false
1,623
cpp
matrix.cpp
#include <cmath> #include <iostream> #include <fstream> #include <sstream> #include <iomanip> using namespace std; /* * The function * void **matrix() * reserves dynamic memory for a two-dimensional matrix * using the C++ command new . No initialization of the elements. * Input data: * int row - number of rows * int col - number of columns * int num_bytes- number of bytes for each * element * Returns a void **pointer to the reserved memory location. */ void **matrix(int row, int col, int num_bytes) { int i, num; char **pointer, *ptr; pointer = new(nothrow) char* [row]; if(!pointer) { cout << "Exception handling: Memory allocation failed"; cout << " for "<< row << "row addresses !" << endl; return NULL; } i = (row * col * num_bytes)/sizeof(char); pointer[0] = new(nothrow) char [i]; if(!pointer[0]) { cout << "Exception handling: Memory allocation failed"; cout << " for address to " << i << " characters !" << endl; return NULL; } ptr = pointer[0]; num = col * num_bytes; for(i = 0; i < row; i++, ptr += num ) { pointer[i] = ptr; } return (void **)pointer; } // end: function void **matrix() /* * The function * void free_matrix() * releases the memory reserved by the function matrix() *for the two-dimensional matrix[][] * Input data: * void far **matr - pointer to the matrix */ void free_matrix(void **matr) { delete [] (char *) matr[0]; delete [] matr; } // End: function free_matrix()
992305e968542b0c4671d3e7133508b55f37e89b
9a65215216f6685c405721199d068e6b7f687d4f
/tracer.cpp
c17a77da3c03eda8b53ce00b848caba21167f302
[]
no_license
ylshan/CAD_TRACKER
9e5a97692e04a19eebd372d5545810f8bcc8faf5
63eb8bbc66c5d920011e31ccfb333a6723fa7b8a
refs/heads/master
2021-08-29T01:54:34.155610
2017-12-13T10:40:12
2017-12-13T10:40:12
null
0
0
null
null
null
null
GB18030
C++
false
false
14,358
cpp
tracer.cpp
#include"tracer.h" /* 矩阵相乘 pragma one:内参矩阵 pragma two:相机坐标系采样点集 pragma three:前一帧姿态矩阵 pragma four: CAD模型可见采样点 pragma five: 采样点和搜索点相对位置误差 pragma six:采样的个数 pragma seven:法向量 */ //求加权矩阵W,W对应的是一个对角矩阵 static int weight_error(int gesture_nnum,MARTIX randomError, MARTIX* weight_martix) { int ret = 0; if (!weight_martix) { ret = -1; printf("权重矩阵不能为空"); return ret; } weight_martix->cols = weight_martix->rows = gesture_nnum; for (int i = 0; i < gesture_nnum; i++) { weight_martix->martix[i*gesture_nnum + i] = 1 / (0.01 + randomError.martix[i]); // printf("%f--", weight_martix->martix[i*gesture_nnum + i]); } return ret; } //根据六个自由度计算姿态变化矩阵M static int gesture_change(MARTIX six_freedom,MARTIX* lds,MARTIX* gestureChangeM) { int ret = 0; if (!lds || !gestureChangeM) { ret = -1; printf("李代数矩阵或者姿态变化矩阵不能为空"); return ret; } gestureChangeM->cols = gestureChangeM->rows = 4; //构造一个4*4的单位矩阵 MARTIX singleMartix; singleMartix.cols = singleMartix.rows = 4; singleMartix.martix = (float*)malloc(sizeof(float)*pow(4, 2)); memset(singleMartix.martix, 0, sizeof(float)*pow(4, 2)); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (i == j) { singleMartix.martix[i * 4 + j] = 1; } else { singleMartix.martix[i * 4 + j] = 0; } } } //泰勒展开的后四项 MARTIX tempMartix[4]; for (int i = 0; i < 4; i++) { tempMartix[i].cols = 4; tempMartix[i].rows = 4; tempMartix[i].martix = (float*)malloc(sizeof(float)*pow(4, 2)); memset(tempMartix[i].martix, 0, sizeof(float)*pow(4, 2)); } //计算泰勒展开的第二项 for (int j = 0; j < 6; j++) { num_mul_matrix(lds[j], six_freedom.martix[j], &lds[j]); add_maritx(tempMartix[0], lds[j], &tempMartix[0]); } MARTIX ysTemp; ysTemp.cols = 4; ysTemp.rows = 4; ysTemp.martix = (float*)malloc(sizeof(float)*pow(4, 2)); memset(ysTemp.martix, 0, sizeof(float)*pow(4, 2)); mul_maritx(tempMartix[0], tempMartix[0], &ysTemp); num_mul_matrix(ysTemp,1/2, &ysTemp); assign_martix(ysTemp, &tempMartix[1]); mul_maritx(tempMartix[1], tempMartix[0], &tempMartix[2]); num_mul_matrix(tempMartix[2], 1/6, &tempMartix[2]); mul_maritx(tempMartix[1], tempMartix[1], &tempMartix[3]); num_mul_matrix(tempMartix[3], 1 / 24, &tempMartix[3]); add_maritx(singleMartix, tempMartix[0], gestureChangeM); for (int i = 1; i < 4; i++) { add_maritx(*gestureChangeM, tempMartix[i], gestureChangeM); } if (singleMartix.martix) { free(singleMartix.martix); singleMartix.martix = NULL; } for (int i = 0; i < 4; i++) { free(tempMartix[i].martix); tempMartix[i].martix = NULL; } if (ysTemp.martix) { free(ysTemp.martix); ysTemp.martix = NULL; } return ret; } //计算六个自由度u1,u2,u3,u4,u5,u6 static int six_freedom(MARTIX J_martix, MARTIX W_martix, MARTIX E_martix, MARTIX *result_martix) { int ret = 0; MARTIX trs_J_martix; MARTIX temp_martix1; MARTIX temp_martix3; temp_martix3.rows = 6; temp_martix3.cols = 6; // printf("---%d---%d \n", temp_martix3.rows, temp_martix3.cols); temp_martix3.martix = (float*)malloc(sizeof(float) * 36); MARTIX temp_converse_martix; temp_converse_martix.cols = 6; temp_converse_martix.rows = 6; temp_converse_martix.martix = (float*)malloc(sizeof(float)*temp_converse_martix.cols*temp_converse_martix.rows); // for (int i = 0; i < J_martix.rows; i++) // { // for (int j = 0; j < J_martix.cols; j++) // { // printf("%f-", J_martix.martix[i*J_martix.cols + j]); // } // } // for (int i = 0; i < W_martix.rows; i++) // { // for (int j = 0; j < W_martix.cols; j++) // { // printf("%f-", W_martix.martix[i*W_martix.cols + j]); // } // } // printf("%d---%d\n", temp_converse_martix.cols, temp_converse_martix.rows); trs_J_martix.cols = J_martix.rows; trs_J_martix.rows = J_martix.cols; trs_J_martix.martix = (float*)malloc(sizeof(float)*trs_J_martix.cols*trs_J_martix.rows); ret = translate_martix(J_martix, &trs_J_martix); temp_martix1.rows = 6; temp_martix1.cols = trs_J_martix.cols; temp_martix1.martix = (float*)malloc(sizeof(float)*temp_martix1.cols*temp_martix1.rows); ret = mul_maritx(trs_J_martix, W_martix, &temp_martix1); // int* tem = (int*)malloc(sizeof(int) * 100); // memset(tem, 0, sizeof(int) * 100); ret = mul_maritx(temp_martix1, J_martix, &temp_martix3); // for (int i = 0; i < temp_martix3.rows; i++) // { // for (int j = 0; j < temp_martix3.cols; j++) // { // printf("%f--", temp_martix3.martix[i*temp_martix3.cols + j]); // } // } ret = converse_martix(temp_martix3, &temp_converse_martix); ret = mul_maritx(temp_converse_martix, trs_J_martix, &temp_martix1); ret = mul_maritx(temp_martix1, W_martix, &temp_martix1); result_martix->rows = 6; result_martix->cols = 1; // result_martix->martix = (float*)malloc(sizeof(float)*result_martix->rows*result_martix->cols); ret = mul_maritx(temp_martix1, E_martix, result_martix); if (trs_J_martix.martix) { free(trs_J_martix.martix); trs_J_martix.martix = NULL; } //中段位置 if (temp_martix1.martix) { free(temp_martix1.martix); temp_martix1.martix = NULL; } if (temp_martix3.martix) { free(temp_martix3.martix); temp_martix3.martix = NULL; } if (temp_converse_martix.martix) { free(temp_converse_martix.martix); temp_converse_martix.martix = NULL; } return ret; } //最小二乘获取新位姿 int leastSquares(MARTIX internalRef, MARTIX CameraSamplePoint, MARTIX gesture, MARTIX ModulePoint, MARTIX randomError, int gesture_nnum, MARTIX deviation, MARTIX* nxtGesture) { int ret = 0; //根据相机内参构造 2*2 JK矩阵 MARTIX JK; JK.cols = JK.rows = 2; JK.martix = (float*)malloc(sizeof(float)*JK.cols*JK.rows); JK.martix[0] = internalRef.martix[0]; JK.martix[1] = internalRef.martix[1]; JK.martix[2] = internalRef.martix[3]; JK.martix[3] = internalRef.martix[4]; //构造6个李代数旋转矩阵 MARTIX G[6]; G[0].rows = G[1].rows = G[2].rows = G[3].rows = G[4].rows = G[5].rows = 4; G[0].cols = G[1].cols = G[2].cols = G[3].cols = G[4].cols = G[5].cols = 4; G[0].martix = (float*)malloc(sizeof(float)*G[0].rows*G[0].cols); memset(G[0].martix, 0, sizeof(float)*G[0].rows*G[0].cols); G[0].martix[3] = 1.0f; G[1].martix = (float*)malloc(sizeof(float)*G[1].rows*G[1].cols); memset(G[1].martix, 0, sizeof(float)*G[1].rows*G[1].cols); G[1].martix[7] = 1.0f; G[2].martix = (float*)malloc(sizeof(float)*G[2].rows*G[2].cols); memset(G[2].martix, 0, sizeof(float)*G[2].rows*G[2].cols); G[2].martix[11] = 1.0f; G[3].martix = (float*)malloc(sizeof(float)*G[3].rows*G[3].cols); memset(G[3].martix, 0, sizeof(float)*G[3].rows*G[3].cols); G[3].martix[6] = -1.0f; G[3].martix[9] = 1.0f; G[4].martix = (float*)malloc(sizeof(float)*G[4].rows*G[4].cols); memset(G[4].martix, 0, sizeof(float)*G[4].rows*G[4].cols); G[4].martix[2] = 1.0f; G[4].martix[8] = -1.0f; G[5].martix = (float*)malloc(sizeof(float)*G[5].rows*G[5].cols); memset(G[5].martix, 0, sizeof(float)*G[5].rows*G[5].cols); G[5].martix[1] = -1.0f; G[5].martix[4] = 1.0f; //缓存雅克比矩阵Jij MARTIX Jij; Jij.cols = 6; Jij.rows = gesture_nnum; Jij.martix = (float*)malloc(sizeof(float)*Jij.rows*Jij.cols); //根据相机坐标系下面的坐标点构造JP矩阵 MARTIX JP; JP.cols = 4; JP.rows = 2; JP.martix = (float*)malloc(sizeof(float)*JP.cols*JP.rows); //niT矩阵(1*2),法向量的转置矩阵 MARTIX trs_ni; trs_ni.cols = 2; trs_ni.rows = 1; trs_ni.martix = (float*)malloc(sizeof(float)*trs_ni.cols*trs_ni.rows); //niT*Jk缓存矩阵 MARTIX output_martix1; output_martix1.rows = 1; output_martix1.cols = 2; output_martix1.martix = (float*)malloc(sizeof(float)*output_martix1.rows*output_martix1.cols); //niT*JK*[Jp 0]缓存矩阵 MARTIX output_martix2; output_martix2.rows = 1; output_martix2.cols = 4; output_martix2.martix = (float*)malloc(sizeof(float)*output_martix2.rows*output_martix2.cols); //niT*Jk*[Jp 0]*Et缓存矩阵 MARTIX output_martix21; output_martix21.rows = 1; output_martix21.cols = 4; output_martix21.martix = (float*)malloc(sizeof(float)*output_martix21.rows*output_martix21.cols); //构建CAD模型可见的采集点矩阵Pi MARTIX Pi; Pi.cols = 1; Pi.rows = 4; Pi.martix = (float*)malloc(sizeof(float)*Pi.cols*Pi.rows); //构造一个n*6的雅克比矩阵(n代表采样点的个数) for (int i = 0; i < gesture_nnum; i++) { JP.martix[0] = 1 / CameraSamplePoint.martix[ 2* gesture_nnum + i]; // printf("%f--", JP.martix[0]); JP.martix[1] = 0.0f; JP.martix[2] = -(CameraSamplePoint.martix[0* gesture_nnum + i]) / (pow(CameraSamplePoint.martix[2 * gesture_nnum + i], 2)); // printf("%f--", JP.martix[2]); JP.martix[3] = 0.0f; JP.martix[4] = 0.0f; JP.martix[5] = 1 / CameraSamplePoint.martix[2 * gesture_nnum + i]; // printf("%f--", JP.martix[5]); JP.martix[6] = -(CameraSamplePoint.martix[1* gesture_nnum+i ]) / (pow(CameraSamplePoint.martix[2 * gesture_nnum + i], 2)); // printf("%f--", JP.martix[6]); JP.martix[7] = 0.0f; trs_ni.martix[0] = deviation.martix[0 * gesture_nnum + i]; trs_ni.martix[1] = deviation.martix[1 * gesture_nnum + i]; //niT*Jk ret = mul_maritx(trs_ni, JK, &output_martix1); //niT*Jk*JP ret = mul_maritx(output_martix1, JP, &output_martix2); //niT*Jk*JP ret = mul_maritx(output_martix2, gesture, &output_martix21); Pi.martix[0] = ModulePoint.martix[0*gesture_nnum+i]; Pi.martix[1] = ModulePoint.martix[1 * gesture_nnum + i]; Pi.martix[2] = ModulePoint.martix[2 * gesture_nnum + i]; Pi.martix[3] = 1.0f; //Jij结果矩阵1*1 MARTIX result_martix; result_martix.rows = 1; result_martix.cols = 1; result_martix.martix = (float*)malloc(sizeof(float)*result_martix.rows*result_martix.cols); //Gj*Pi的缓存矩阵 MARTIX output_martix3; output_martix3.rows = 4; output_martix3.cols = 1; output_martix3.martix = (float*)malloc(sizeof(float)*output_martix3.rows*output_martix3.cols); for (int j = 0; j < 6; j++) { ret = mul_maritx(G[j], Pi, &output_martix3); ret = mul_maritx(output_martix2, output_martix3, &result_martix); Jij.martix[i * 6 + j] = result_martix.martix[0]; } if (output_martix3.martix) { free(output_martix3.martix); output_martix3.martix = NULL; } if (result_martix.martix) { free(result_martix.martix); result_martix.martix = NULL; } } //计算加权矩阵W MARTIX weight_martix; weight_martix.cols = gesture_nnum; weight_martix.rows = gesture_nnum; weight_martix.martix = (float*)malloc(sizeof(float)*pow(gesture_nnum, 2)); memset(weight_martix.martix, 0, sizeof(float)*pow(gesture_nnum, 2)); ret = weight_error(gesture_nnum, randomError, &weight_martix); //缓存六个自由度 MARTIX sixFreedom; sixFreedom.cols = 1; sixFreedom.rows = 6; sixFreedom.martix = (float*)malloc(sizeof(float)*sixFreedom.cols*sixFreedom.rows); memset(sixFreedom.martix, 0, sizeof(float)*sixFreedom.cols*sixFreedom.rows); //计算六个自由度 ret = six_freedom(Jij, weight_martix, randomError, &sixFreedom); //姿态变化矩阵 MARTIX gestureChangeM; gestureChangeM.cols = gestureChangeM.rows = 4; gestureChangeM.martix = (float*)malloc(sizeof(float)*pow(4, 2)); memset(gestureChangeM.martix, 0, sizeof(float)*pow(4, 2)); //根据自由度计算姿态变化矩阵M ret = gesture_change(sixFreedom, G, &gestureChangeM); //更新位姿 mul_maritx(gesture, gestureChangeM,nxtGesture); // ret = update_gesture(sixFreedom, gesture, nxtGesture, gestureChangeM); //释放空间 if (JK.martix) { free(JK.martix); JK.martix = NULL; } for (int i = 0; i < 6; i++) { if (G[i].martix) { free(G[i].martix); G[i].martix = NULL; } } if (weight_martix.martix) { free(weight_martix.martix); weight_martix.martix = NULL; } if (sixFreedom.martix) { free(sixFreedom.martix); sixFreedom.martix = NULL; } if (Jij.martix) { free(Jij.martix); Jij.martix = NULL; } if (gestureChangeM.martix) { free(gestureChangeM.martix); gestureChangeM.martix = NULL; } if (output_martix21.martix) { free(output_martix21.martix); output_martix21.martix = NULL; } if (trs_ni.martix) { free(trs_ni.martix); trs_ni.martix = NULL; } if (output_martix1.martix) { free(output_martix1.martix); output_martix1.martix = NULL; } if (output_martix2.martix) { free(output_martix2.martix); output_martix2.martix = NULL; } if (JP.martix) { free(JP.martix); JP.martix = NULL; } if (Pi.martix) { free(Pi.martix); Pi.martix = NULL; } return ret; }
a4cd2f27867f225b2c1e00816b0b04a3ec606128
023763d9f86116381f5765c51fb8b403e8eef527
/ABC/117/a.cpp
df2a9b961afdf6eda1025429de916e41a241bff4
[]
no_license
Hilary02/atcoder
d45589682159c0f838561fc7d0bd25f0828e578b
879c74f3acc7befce75abd10abf1ab43967fc3c7
refs/heads/master
2021-07-18T11:34:22.702502
2021-07-11T09:04:12
2021-07-11T09:04:12
144,648,001
0
0
null
null
null
null
UTF-8
C++
false
false
223
cpp
a.cpp
#include <iostream> using namespace std; int main(int argc, char const *argv[]) { cin.tie(0); ios::sync_with_stdio(false); int t, x; cin >> t >> x; double ans = (double)t / x; cout << ans << "\n"; return 0; }
f634767f9fa3cde7740c5c8a232910c19ec491ae
b181ef00bfaaeac1908533df12ec5ddde801003c
/示例代码/CH09_C2.cpp
90a8c4383c08f943bacd7ea10bc8559f10e03d8b
[]
no_license
clarencehua/candcpp
b5c3ab9ea86efc12537df29cee3634f335b7f358
77022a497cc5ec443c1de437983986d811e58090
refs/heads/master
2020-07-26T16:26:46.058862
2019-10-06T08:47:44
2019-10-06T08:47:44
208,703,235
0
0
null
null
null
null
GB18030
C++
false
false
172
cpp
CH09_C2.cpp
#include <stdio.h> int main() { int arr[4] = {1,2,3,4}; int* p = arr; // arr本身的类型就是int* int* p2 = &arr[0]; // 第一个元素的地址 return 0; }
1d790fb5e1d9c637ba1a65df63beeaae8462ec8c
ca170d96a960e95a7822eb69c65179898a601329
/plugins/crg_spherical_view/main.cxx
45a59ba68d9a85cf9df58a29e63cb2ebbe093a6a
[]
permissive
sgumhold/cgv
fbd67e9612d4380714467d161ce264cf8c544b96
cd1eb14564280f12bac35d6603ec2bfe6016faed
refs/heads/master
2023-08-17T02:30:27.528703
2023-01-04T12:50:38
2023-01-04T12:50:38
95,436,980
17
29
BSD-3-Clause
2023-04-20T20:54:52
2017-06-26T10:49:07
C++
UTF-8
C++
false
false
323
cxx
main.cxx
#include <cgv/base/register.h> #include "spherical_view_interactor.h" #ifdef _USRDLL # define CGV_EXPORTS #else # define CGV_FORCE_STATIC_LIB #endif #include <cgv/config/lib_begin.h> extern CGV_API cgv::base::object_registration_1<spherical_view_interactor,const char*> spherical_view_interactor_instance("trackball");
65c1e01edfb2dbd3caa8ed94d6c8c8b33b26d98a
cbd0a3af7c57e901896a5132928287ed78527c5b
/modules/kernel/src/process/ProcessUnlockAndSchedule.cc
f72757f853d7026b8bac82e0ea5f6fb8d0514805
[ "LicenseRef-scancode-unknown-license-reference", "Beerware", "BSD-2-Clause" ]
permissive
eryjus/century-os
ad81a8a29e8b6c8cf0d65242dcb030a5346b5dc9
6e6bef8cbc0f9c5ff6a943b44aa87a7e89fdfbd7
refs/heads/master
2021-06-03T11:45:02.476664
2020-04-17T22:50:05
2020-04-17T22:50:05
134,635,625
13
2
NOASSERTION
2020-06-06T16:15:41
2018-05-23T23:21:18
C++
UTF-8
C++
false
false
1,594
cc
ProcessUnlockAndSchedule.cc
//=================================================================================================================== // // ProcessUnlockAndSchedule.cc -- Exit a postponed schedule block and take care of any pending schedule changes // // Copyright (c) 2017-2020 -- Adam Clark // Licensed under "THE BEER-WARE LICENSE" // See License.md for details. // // ------------------------------------------------------------------------------------------------------------------ // // Date Tracker Version Pgmr Description // ----------- ------- ------- ---- --------------------------------------------------------------------------- // 2019-Mar-18 Initial 0.3.2 ADCL Initial version // //=================================================================================================================== #include "types.h" #include "lists.h" #include "timer.h" #include "spinlock.h" #include "process.h" // // -- decrease the lock count on the scheduler // ---------------------------------------- EXPORT KERNEL void ProcessUnlockAndSchedule(void) { assert_msg(AtomicRead(&scheduler.postponeCount) > 0, "postponeCount out if sync"); if (AtomicDecAndTest0(&scheduler.postponeCount) == true) { if (scheduler.processChangePending != false) { scheduler.processChangePending = false; // need to clear this to actually perform a change #if DEBUG_ENABLED(ProcessUnlockAndSchedule) kprintf("Finally scheduling!\n"); #endif ProcessSchedule(); } } ProcessUnlockScheduler(); }
45ef40754e584984b7a5d671f3b80f5ed2e0839e
5d62ab24849dcac18290641c8dcd137bba105843
/util.cpp
d23c999a2c0fdb1a1c550f3afd138952b2e96cc6
[]
no_license
desonses/Juego-de-naves-en-C
4f9b69c56a44cc66a36ad3ecfa443692be8c2d38
76d2294286425ede087b135dc4ee7cb7a8fefaf8
refs/heads/master
2020-12-21T11:00:24.699765
2020-02-17T21:31:53
2020-02-17T21:31:53
236,411,279
0
0
null
null
null
null
UTF-8
C++
false
false
17,303
cpp
util.cpp
#include"util.h" #include<time.h> #include<stdio.h> #include<stdlib.h> #include<string> #include <SDL/SDL_ttf.h> SDL_Surface *texto; TTF_Font *fuente; SDL_Color bgcolor,fgcolor; SDL_Rect rectangulo; /* ******************************************************************************* */ /*se realiza el movimiento de los tipos de nave 1 y 0, y se realiza la reactivacion de nuestra nave principal una vez que ha perdido una vida*/ void Muevenave() { if( (jugador.getactivo()) == 2){ jugador.addtime(-1); if(jugador.gettime() <= 0){ jugador.settime(0); SDL_Delay( 50 ); jugador.setactivo(1); } } if(jugador.getactivo() == 0){ jugador.addtime(-1); if(jugador.gettime() <= 0){ jugador.settime(50); if(jugador.getvidas() == 0) { jugador.setactivo(0); } else{ jugador.setactivo(2); jugador.setx(320); jugador.sety(400); } } } /*se realiza el movimiendo de nuestras naves enemigas segun el tipo 0 ó 1 */ for (int i=0; i<=3; i++){ if(enemy[i].getactivo() == 1){ enemy[i].setx(enemy[i].getx() + enemy[i].getdx()); enemy[i].sety(enemy[i].gety() + enemy[i].getdy()); //mov de tipo 0 if(enemy[i].gettipo() == 0){ if( (enemy[i].getestado() == 0) && (enemy[i].gety() > 240) ){ Creadispenemigo(i); enemy[i].setdy(-3); enemy[i].setdx(0); enemy[i].setestado(1); } } /* desactivamos la nave enemiga si ya no esta visible o salio de la pantalla*/ if( (enemy[i].gety() > 480) || (enemy[i].gety() < -50) ){ enemy[i].setactivo(0); } } } // dibuja(movimiendo) los disparos enemigos for(int i=0; i <= 7; i++){ if(disp[i].getactivo() == 1){ disp[i].setx(disp[i].getx() + disp[i].getdx()); disp[i].sety(disp[i].gety() + disp[i].getdy()); if(disp[i].gety() > 480 ){/* desactivamos el disparo si salio de la pantalla*/ disp[i].setactivo(0); } } } } /* ******************************************************************************* */ /*se realiza el desplazamiento de nuestros disparos a traves de la pantalla y se desactiva una vez que ha salido de la pantalla*/ void Muevebalas() { int i; for (i = 0; i <= MAXBALAS; i++) { // si la pos.X del desparo no es 0, // es una bala activa. if (bala[i].getx() != 0) { bala[i].addy(-5); // si el disparo sale de la pantalla la desactivamos if (bala[i].gety() < 0) { bala[i].setx(0); } } } } /* ******************************************************************************* */ /*se realiza el dibuja del mapa y nuestra naave principal, así mismo, se realiza la deteccion de colision entre nuestra nave principal y alguna nave enemiga del tipo 0 y 1, ademas de la deteccion de colision de los disparon, tanto enemigos como disparos de nuestra nave principal*/ void DrawScene(SDL_Surface *screen) { char msg[30], vidas[30]; int i,j,x,y,t; // movimiento del scenario (scroll) indice_in += 2; if (indice_in>=64) { indice_in=0; indice-=10; } if (indice <= 0) { indice=MAXMAP-100; // si llegamos al final, empezamos de nuevo. indice_in=0; } //dibujar escenario for (i=0 ; i<10 ; i++) { for (j=0 ; j<10 ; j++) { t=mapa[indice+(i*10+j)]; // calculo de la posición del tile x=j*64; y=(i-1)*64+indice_in; // dibujamos el tile suelo[t].setx(x); suelo[t].sety(y); suelo[t].Draw(screen); } } // dibuja avión if(jugador.getactivo() == 1){ nave.setx(jugador.getx()); nave.sety(jugador.gety()); nave.Draw(screen); } /*nos ayuda para reactivar nuestraa nave una vez que ha perdido alguna vida*/ if( (jugador.getactivo() == 2) && ( (jugador.gettime() % 2) == 0) ){ nave.setx(jugador.getx()); nave.sety(jugador.gety()); nave.Draw(screen); } // dibuja a las naves enemigas for(i = 0; i <= 3; i++){ if(enemy[i].getactivo() == 1){ if(enemy[i].gettipo() == 0){// enemigo de tipo 0 malo1.setx(enemy[i].getx()); malo1.sety(enemy[i].gety()); malo1.Selframe(enemy[i].getnframe()); malo1.Draw(screen); if( (malo1.Colision(nave) == TRUE) && (jugador.getactivo() == 1)){ jugador.addvidas(-1); //Creaexplosion(255); jugador.settime(30); //exp.setactivo(1); //Creaexplosion(255); Creaexplosion(i); Creaexplosion(255); jugador.setactivo(0); // desactivar nuestra nave SDL_Delay( 50 ); enemy[i].setactivo(0); } } if(enemy[i].gettipo() == 1){// enemigos de tipo 1 malo.setx(enemy[i].getx()); malo.sety(enemy[i].gety()); malo.Draw(screen); if( (malo.Colision(nave) == TRUE) && (jugador.getactivo() == 1) ){ jugador.addvidas(-1); jugador.settime(30); Creaexplosion(i); // explosion para la nave enemiga Creaexplosion(255);// explosion para nuestra nave // jugador.setactivo(0); SDL_Delay( 50 ); enemy[i].setactivo(0); } } } } // dibuja nuestros disparos solo si nuestra nave esta activa for (i = 0; i <= MAXBALAS; i++) { if (bala[i].getx() != 0 && jugador.getactivo() == 1) { mibala.setx(bala[i].getx()); mibala.sety(bala[i].gety()); mibala.Draw(screen); for(int j=0; j <= 7; j++){ if(enemy[j].getactivo() == 1){ switch(enemy[j].gettipo()){ case 0: //comprobamos el impacto con la nave de tipo 1 malo1.setx(enemy[j].getx()); malo1.sety(enemy[j].gety()); if((mibala.Colision(malo1) == TRUE) && enemy[i].getactivo()==0){ Creaexplosion(j); enemy[j].setactivo(0); score += 10; //mibala.setestado(0); } break; case 1: //comprobamos el impacto con la nave de tipo 1 malo.setx(enemy[j].getx()); malo.sety(enemy[j].gety()); if((mibala.Colision(malo) == TRUE) && (enemy[i].getactivo()==0)){ Creaexplosion(j); enemy[j].setactivo(0); score += 10; } break; } } } } } // dibujamos los dispparos enemigos for(i=0; i<=7; i++){ if(disp[i].getactivo() == 1){ dispene.setx(disp[i].getx()); dispene.sety(disp[i].gety()); disp[i].addtime(1); if(disp[i].gettime() >= 5){ disp[i].settime(0); if(disp[i].getestado() == 0){ //dispene.Selframe(1); disp[i].setestado(1); }else{ dispene.Selframe(0); disp[i].setestado(0); } } dispene.Draw(screen); // revisamos si nos han dado if(dispene.Colision(nave) && jugador.getactivo() == 1){ jugador.addvidas(-1); Creaexplosion(255); jugador.settime(30); jugador.setactivo(0); } } } // dibujamos el score sprintf(msg, "Life: %d \t\t\tScore: %d",jugador.getvidas() ,score); texto = TTF_RenderText_Shaded(fuente,msg,fgcolor,bgcolor); rectangulo.y=5; rectangulo.x=210; rectangulo.w = texto->w; rectangulo.h = texto->h; SDL_SetColorKey(texto,SDL_SRCCOLORKEY|SDL_RLEACCEL, SDL_MapRGB(texto->format,255,0,0)); SDL_BlitSurface(texto,NULL,screen,&rectangulo); // dibuja las explosiones for(i=0; i <= 7; i++){ if(explod[i].getactivo() == 1){ explode.Selframe(explod[i].getnframe()); explode.setx(explod[i].getx()); explode.sety(explod[i].gety()); explod[i].addnframe(1); explode.Draw(screen); if(explod[i].getnframe() > 7){ explod[i].setactivo(0); } } } SDL_Flip(screen); } /* ******************************************************************************* */ /* se realiza la activacion de la explosion, puede suceder tanto para las naves enemigas y nuestra nave principal al cual le damos las coordenanas y el enemigo i que colisiona*/ void Creaexplosion(int j){ int libre = -1; for(int i=0 ; i <= 7; i++){ if(explod[i].getactivo() == 0) libre=i; } explod[libre].setactivo(1); explod[libre].setnframe(1); if(libre >= 0){ if(j != 255){ // explod[libre].setactivo(1); // explod[libre].setnframe(0); explod[libre].setx(enemy[j].getx()); explod[libre].sety(enemy[j].gety()); }else{ // explod[libre].setactivo(1); // explod[libre].setnframe(0); explod[libre].setx(jugador.getx()); explod[libre].sety(jugador.gety()); } } } /* ******************************************************************************* */ /*se crean los disparos de nuestra nave principal y se le da la coordenada segun la posicion de nuestra nave principal*/ void Creadisparo() { int libre = -1; // ¿Hay alguna bala libre? for (int i=0 ; i<=1 ; i++) { if (bala[i].getx() == 0) libre=i; } // Hay una bala if (libre>=0) { bala[libre].setx(nave.getx()); bala[libre].sety(nave.gety()-15); } } /* ******************************************************************************* */ /* se crean las naves enemigas, suceden de dos tipos 1 y 0, kamikase y nave caza, ademas, se les da una coordenada aleatoria dentro de la pantalla, el numero de enemigos creados es de 7 */ void Creaenemigo(){ int libre = -1; for(int i = 0; i <= nmalos; i++){ if (enemy[i].getactivo() == 0) libre = i; } if(libre >= 0){ enemy[libre].setactivo(1); enemy[libre].setnframe(0); enemy[libre].setx(rand()); if(enemy[libre].getx() > 600){ enemy[libre].setx( (int)enemy[libre].getx() % 600 ); } enemy[libre].settipo(rand()); if(enemy[libre].gettipo() >= 2){ enemy[libre].settipo( (int)enemy[libre].gettipo() % 2 ); } // avion tipo caza if(enemy[libre].gettipo() == 0){ enemy[libre].sety(-30); enemy[libre].setdx(0); enemy[libre].setdy(5); enemy[libre].setestado(0); } //avion tipo kamikase if(enemy[libre].gettipo() == 1){ enemy[libre].sety(-30); if(enemy[libre].getx() > nave.getx()){ enemy[libre].setdx(-3); }else{ enemy[libre].setdx(3); } enemy[libre].setdy(5); enemy[libre].setestado(0); } } } /* ******************************************************************************* */ /*se realiza la creacion de los disparos enemigos, solo ocurre en la nave de tipo caza, ademas se le da la coordenada de la nave i que creara el disparo*/ void Creadispenemigo(int j){ int libre = -1; for(int i=0; i <= 7; i++){ if(disp[i].getactivo() == 0) libre=i; } if(libre >= 0){ disp[libre].setactivo(1); if(enemy[j].getx() > nave.getx()){ disp[libre].setdx(-3); }else{ disp[libre].setdx(3); } disp[libre].setdy(3); disp[libre].setx(enemy[j].getx() + 30); disp[libre].sety(enemy[j].gety() + 20); disp[libre].setestado(0); disp[libre].settime(0); } } /* ******************************************************************************* */ /*se realiza la activacion de nuestra nave principal(coordenadas y vidas), naves enemigas, tipo 0 y 1, se activan los disparos de nuestra nave principal y los disparos de nuestra nave enemiga tipo caza. Se inicializa el puntaje y mapa */ void Inicializa() { srand( (unsigned)time( NULL ) ); int i,c; //TTF_Font *Font=NULL; jugador.setactivo(1); jugador.setvidas(3);// vidass al inicio del juego jugador.setx(300); jugador.sety(300); indice=MAXMAP-100; indice_in=0; // inicializamos el array de explociones for(i = 0; i <= 7; i++){ explod[i].setactivo(0); } // incializamo el array de enemigos for (i=0; i <= nmalos; i++) { enemy[i].setactivo(0); } // Inicializamos el array de balas(nuetro jugador) for (i=0 ; i<=MAXBALAS ; i++) { bala[i].addx(0); bala[i].addy(0); //bala[i].setactivo(0); } // inicializamos el array de disparos enemigos for(i=0; i <= 7; i++){ disp[i].setactivo(0); } /*para el color del msg de score*/ fgcolor.r=200; bgcolor.r=255; fgcolor.g=200; bgcolor.g=0; fgcolor.b=10; bgcolor.b=0; if(TTF_Init() == 0) { atexit(TTF_Quit); } fuente = TTF_OpenFont("ep.ttf", 20);// cargamos la fuente // Carga del mapa if((f=fopen("mapa3.MAP","r")) != NULL) { c=fread(mapa,MAXMAP,1,f); fclose(f); } } /* ******************************************************************************* */ /*se encarga de finalizar los sprites y eliminar*/ void Finaliza() { // finalizamos los sprites nave.Finalize(); malo.Finalize(); mibala.Finalize(); suelo[0].Finalize(); suelo[1].Finalize(); suelo[2].Finalize(); // cerramos el joystick if (SDL_JoystickOpened(0)) { SDL_JoystickClose(joystick); } explode.Finalize(); } /* ******************************************************************************* */ /*se realiza la inicializacion de los sprites, se cargan los tiles de nuestra nave principal, nave enemiga y los tiles de disparo, asi como los tiles que dibujan la explosion*/ int InitSprites() { fnave.Load((char*)"imagen/nave.bmp"); nave.Addframe(fnave); fmalo.Load((char*)"imagen/enemigo.bmp");// avion de tipo caza malo.Addframe(fmalo); fmalo1_1.Load((char*)"imagen/enemigo2.bmp");// avion de tipo kamikase malo1.Addframe(fmalo1_1); dis.Load((char*)"imagen/dotenemy.bmp"); dispene.Addframe(dis); tile1.Load((char*)"imagen/tile0.bmp");// fondo principal suelo[0].Addframe(tile1); tile2.Load((char*)"imagen/planet3.bmp"); suelo[1].Addframe(tile2); tile3.Load((char*)"imagen/planet11.bmp"); suelo[2].Addframe(tile3); //tile4.Load((char*)"imagen/planet4.bmp"); //suelo[3].Addframe(tile4); labala.Load((char*)"imagen/dot.bmp"); mibala.Addframe(labala); ex[0].Load((char*)"imagen/explode1.bmp"); explode.Addframe(ex[0]); ex[1].Load((char*)"imagen/explode2.bmp"); explode.Addframe(ex[1]); ex[2].Load((char*)"imagen/explode3.bmp"); explode.Addframe(ex[2]); ex[3].Load((char*)"imagen/explode4.bmp"); explode.Addframe(ex[3]); ex[4].Load((char*)"imagen/explode5.bmp"); explode.Addframe(ex[4]); ex[5].Load((char*)"imagen/explode6.bmp"); explode.Addframe(ex[5]); ex[6].Load((char*)"imagen/explode7.bmp"); explode.Addframe(ex[6]); return 0; } /* ******************************************************************************* */ /*util para que nuestro juego no se acelere o se ralentice en sistemas distintos, es decir, la velocidad del juego sera la misma en distintos equipos*/ void ResetTimeBase() { ini_milisegundos = SDL_GetTicks(); } /* ******************************************************************************* */ /*igual que la de arriba (resettimebase)*/ int CurrentTime() { fin_milisegundos = SDL_GetTicks(); return fin_milisegundos-ini_milisegundos; }
92a131bb1a4c2f4ec878cb53bf2c926029d06b84
a2622fadea7ae1580a64a65022f3d127b444b4b0
/CS495/MazeRunner/MazeRunner/MazeRunner/Rect.cpp
48784f3c5a22a12ef6037fa529384bbc9cee3925
[]
no_license
zahnur/assignments
489e2a07508836bb836dd54d1712202a183ab9c3
afb08feb61b3125a412ffde829c1b4f12f9c7c72
refs/heads/master
2023-03-30T19:23:49.629551
2016-08-25T23:22:49
2016-08-25T23:22:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,236
cpp
Rect.cpp
// // Rect.cpp // RubixCube // // Created by Cohen Adair on 2015-10-04. // Copyright © 2015 Cohen Adair. All rights reserved. // #include "Rect.h" // constructors Rect::Rect() { this->topRight = new Point(0, 0, 0); this->topLeft = new Point(0, 0, 0); this->bottomRight = new Point(0, 0, 0); this->bottomLeft = new Point(0, 0, 0); } Rect::Rect(Point *topRight, Point *topLeft, Point *bottomLeft, Point *bottomRight) { this->topRight = topRight; this->topLeft = topLeft; this->bottomLeft = bottomLeft; this->bottomRight = bottomRight; } Rect::~Rect() { delete topRight; delete topLeft; delete bottomLeft; delete bottomRight; } // manipulating Rect * Rect::clone() { return new Rect(topRight->clone(), topLeft->clone(), bottomLeft->clone(), bottomRight->clone()); } bool Rect::intersectsPoint(Point *p, float tolerance) { double xMin = topLeft->getX() - tolerance; double xMax = topRight->getX() + tolerance; double yMin = bottomLeft->getY() - tolerance; double yMax = topLeft->getY() + tolerance; double zMin = topRight->getZ() - tolerance; double zMax = topLeft->getZ() + tolerance; // this should always pring "1"s for every case //cout << "X: " << (xMin <= xMax) << ", Y: " << (yMin <= yMax) << ", Z: " << (zMin <= zMax) << endl; return xMin <= p->getX() && xMax >= p->getX() && yMin <= p->getY() && yMax >= p->getY() && zMin <= p->getZ() && zMax >= p->getZ(); } // getters and setters Point * Rect::getTopRight() { return topRight; } void Rect::setTopRight(Point *p) { topRight = p; } Point * Rect::getTopLeft() { return topLeft; } void Rect::setTopLeft(Point *p) { topLeft = p; } Point * Rect::getBottomLeft() { return bottomLeft; } void Rect::setBottomLeft(Point *p) { bottomLeft = p; } Point * Rect::getBottomRight() { return bottomRight; } void Rect::setBottomRight(Point *p) { bottomRight = p; } float Rect::getLength() { return length; } void Rect::setLength(float len) { length = len; } // drawing void Rect::draw() { glBegin(GL_QUADS); bottomLeft->draw(); bottomRight->draw(); topRight->draw(); topLeft->draw(); glEnd(); } // draws the rectangle with the specified texture; repeats the texture the specified amount of times void Rect::draw(int textureIndex, int repeatX, int repeatY) { GLUtils::switchTexture(textureIndex); glBegin(GL_QUADS); glTexCoord2f(0, 0); bottomLeft->draw(); glTexCoord2f(repeatX, 0); bottomRight->draw(); glTexCoord2f(repeatX, repeatY); topRight->draw(); glTexCoord2f(0, repeatY); topLeft->draw(); glEnd(); } void Rect::draw2D(int textureIndex) { GLUtils::switchTexture(textureIndex); glBegin(GL_QUADS); glTexCoord2f(0, 1); bottomLeft->draw2D(); glTexCoord2f(1, 1); bottomRight->draw2D(); glTexCoord2f(1, 0); topRight->draw2D(); glTexCoord2f(0, 0); topLeft->draw2D(); glEnd(); } // debugging void Rect::print() { topRight->print(); topLeft->print(); bottomLeft->print(); bottomRight->print(); }
37c3da4f590a55ca30757f704838e1390965d732
46ab07f4f6d54acf310eff79f6669c206408caf8
/code/include/algorithm/Algorithm.hpp
e2c38083571120bf48cb7eb71413987d4dfab7c1
[]
no_license
wojciech161/master-thesis
cba03114dcc914eeeccb500b0901da3c260710d2
dec3cc93dc5369c2ff3b61641e1c53f70b9d726f
refs/heads/master
2021-01-20T08:44:21.426623
2014-07-06T14:47:25
2014-07-06T14:47:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
645
hpp
Algorithm.hpp
#ifndef ALGORITHM_ALGORITHM_HPP_ #define ALGORITHM_ALGORITHM_HPP_ #include "IAlgorithm.hpp" #include "core/ParametersGetter.hpp" namespace algorithm { class Algorithm : public IAlgorithm { public: Algorithm( const cv::Mat&, core::ParametersGetter& ); ~Algorithm(); boost::shared_ptr<cv::Mat> run(); private: void backgroundDetection( bool ); void lineDetection( bool ); private: boost::shared_ptr<cv::Mat> image_; core::ParametersGetter& parameters_; boost::shared_ptr<cv::Mat> backgroundImage_; boost::shared_ptr<cv::Mat> contourImage_; }; } // namespace algorithm #endif // ALGORITHM_ALGORITHM_HPP_
c5196fd3f50addbfeb4f12cb0012a28df6c34f25
10a0a67eb510cf2a421a45e55b60ea15376532ac
/Controller/Controller/Soft_REV3/TouchGFX/generated/gui_generated/include/gui_generated/containers/NumberEditorBase.hpp
f1bd41a6fc2b65897319492cd814d77adf05d3dd
[]
no_license
arneman44/Modular-Lab-PowerSupply
d63bf60a5a983d1d11a08e106d19799875eed9f4
7e806c540778e56692f621f55c7e4cc4db033afe
refs/heads/master
2023-04-25T00:46:29.130486
2021-05-24T02:30:41
2021-05-24T02:30:41
345,243,783
1
2
null
null
null
null
UTF-8
C++
false
false
2,423
hpp
NumberEditorBase.hpp
/*********************************************************************************/ /********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/ /*********************************************************************************/ #ifndef NUMBEREDITORBASE_HPP #define NUMBEREDITORBASE_HPP #include <gui/common/FrontendApplication.hpp> #include <touchgfx/containers/Container.hpp> #include <touchgfx/widgets/BoxWithBorder.hpp> #include <touchgfx/widgets/Box.hpp> #include <touchgfx/widgets/TextArea.hpp> #include <touchgfx/containers/buttons/Buttons.hpp> class NumberEditorBase : public touchgfx::Container { public: NumberEditorBase(); virtual ~NumberEditorBase() {} virtual void initialize(); protected: FrontendApplication& application() { return *static_cast<FrontendApplication*>(touchgfx::Application::getInstance()); } /* * Member Declarations */ touchgfx::BoxWithBorder boxWithBorder1; touchgfx::Box VoltageReadBack; touchgfx::TextArea VoltageRead; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonNR7; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonNR8; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonNR9; touchgfx::IconButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonBACKSPACE; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonNR4; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonNR5; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonNR6; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonNR1; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonNR2; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonNR3; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonCOMMA; touchgfx::TextButtonStyle< touchgfx::BoxWithBorderButtonStyle< touchgfx::TouchButtonTrigger > > ButtonENTER; private: }; #endif // NUMBEREDITORBASE_HPP
9f7d0d3bb436d729263408d69d7caacabaa7d841
cb142e98b043e7088f0fe009f5159928877acf1b
/LCD_All/OLEDx/example3/example3.ino
1884930cb21f8981149522161b72d72d447b50ea
[]
no_license
wetnt/Arduino_public
ef30502b4a30e099a09e2617fd58fd3a9801cf13
4cc331e2f43dda0df8f78d9cfe924da130ca5df3
refs/heads/master
2021-01-23T09:38:43.302783
2019-09-12T00:29:43
2019-09-12T00:29:43
33,909,041
2
2
null
null
null
null
UTF-8
C++
false
false
971
ino
example3.ino
#include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define OLED_RESET 4 Adafruit_SSD1306 display(OLED_RESET); void setup() { Serial.begin(115200); delay(500); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //I2C addr 0x3D (for the 128x64) display.display(); delay(1000); display.clearDisplay(); // text display tests displayText("Hello, world!"); // display.invertDisplay(true); delay(1000); // display.invertDisplay(false); delay(1000); // display.clearDisplay(); // display.drawBitmap2(30, 16, logo16_glcd_bmp, 16, 16, 1); // display.display(); } void displayDelay() { display.display(); delay(2000); display.clearDisplay(); } void dText(int x,int y, String s) { display.clearDisplay(); display.setTextSize(2); display.setTextColor(WHITE, BLACK);//display.setTextColor(WHITE); display.setCursor(0, 0); display.println(s); display.display(); delay(2000); display.clearDisplay(); } void loop() { }
95992ffefbb63f0d9bc796b9cfb2fa2ad9af5271
b613a0065bc552577908326d7acf1ee4927c31b4
/SCRABBLE[CODE]/Pool.h
36cdbc48619d888d96869045fd9a70b72d938a88
[ "MIT" ]
permissive
RuiMoreira1/Prog-Project-2019-2020
acca2433afe8adb65ecc09db222e2f0846783a93
ed181e40fa639d91d5f4a8ddd7d199e9775bbed5
refs/heads/master
2022-07-26T02:26:37.285139
2020-05-20T20:42:21
2020-05-20T20:42:21
257,694,716
1
0
null
null
null
null
UTF-8
C++
false
false
1,976
h
Pool.h
#pragma once #include <iostream> #include <iostream> #include <vector> #include <string> #include <time.h> #include <stdlib.h> #include "BOARD.h" using namespace std; class Pool { public: Pool() = default; void FormPool(); //Formar as peças necessárias para completar o jogo void Form_init_coor(); //Obter as coordenadas iniciais de cada palavra void Form_word(); //Obter um vector com as palavras do ficheiro .txt string Get_word_copy(int num) const; //Obter a plavra atravês do indice, vector de words copiado e alterado void Form_direc(); //Foram o vector com as direções das palavras H ou V void Form_all_coor(); //Formar as coordenadas de todas as letras de todas as palavras int Get_all_coor1(int word, int num) const; //all_coor[1] = word, coor[1][2] = linha int Get_all_coor2(int word, int num) const; //all_coor[1] = word, coor[1][2] = coluna char Give_Tile(int num); //Da uma letra random e retira da tiles int Get_Size() const; //Da o tamanho do vetor com as peças int Get_Size_w() const; //Da o tamanho do vetor words int Get_w_Size(int num) const; //Da a length da palavra void Vector_Copy(); //Copia o vector void Set_to_Hash(int word_n, int letter, string player_coor); //Mete uma letra em # no vector w_copy void Add_to_Pool(char x); //Adiciona as tiles void Print_Board(); //Print do BOARD private: vector<char> tiles; //Vetor com as peças vector<int> ini_coor1; //Coordenadas iniciais com linha vector<int> ini_coor2; //Coordenadas iniciais com coluna vector<string> w; //Vector de words vector<string> w_copy; //Vector de words copia vector<string> dire; //Vector com directions vector<vector<int>> all_coor1; //Todas as coordenadas atraves de words e linhas vector<vector<int>> all_coor2; //Todas as coordenadas atraves de words e colunas vector<vector<int>> All_Things; BOARD var = BOARD(var.Get_Warnings(0)); //var para iniciar BOARD };
4095c489cec3b512ca3812ba106349f7e24699bb
e3e4d41d5bc6663189334ec6550c6a4842ef2491
/contest_test/D-jumping-mario.cpp
00526461f70c037b6085c1e20b9d6b4d16f2b833
[]
no_license
morshedmasud/programming_contest
7533ddc7ad55eff0816e575152abb36bff084d2d
ee8a84abb50ef734f6607ddf77f3b7c52bfc6349
refs/heads/master
2020-06-18T20:52:56.921855
2019-09-28T04:18:58
2019-09-28T04:18:58
196,444,170
1
0
null
null
null
null
UTF-8
C++
false
false
488
cpp
D-jumping-mario.cpp
#include <iostream> using namespace std; #include <stdio.h> #include <vector> int main() { int k; cin>>k; for(int j = 1; j <= k; j++){ int heigh=0, low=0, temp=0, n, t; cin>>t; for(int i=0; i<t; i++){ cin>>n; if (i == 0){ temp = n; } else if(n > temp){ heigh++; temp = n; } else if(n < temp){ low++; temp = n; } } printf("Case %d: %d %d\n", j, heigh, low); } return 0; }
7b7ef0a85f8b9ac3720919f8c6b88b6bab0c1328
86d1379ba12df590132073833a7ac9a6d68c32e5
/UnitTest1.cpp
4eb4336b5d2d3c1caf988526725b0a50e32c6409
[]
no_license
Maria16339/5.1E
127d3aa7fbf3b26a0197c1ddc898e13a4115d815
83e69f5f0887faeca9c51205350d80270399edb4
refs/heads/main
2023-04-16T14:31:47.908660
2021-04-26T18:04:10
2021-04-26T18:04:10
361,846,264
0
0
null
null
null
null
UTF-8
C++
false
false
441
cpp
UnitTest1.cpp
#include "pch.h" #include "CppUnitTest.h" #include "C://Users/User/source/repos/5.1E/5.1E/myerror.h" #include "C://Users/User/source/repos/5.1E/5.1E/myerror.cpp" using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace UnitTest1 { TEST_CLASS(UnitTest1) { public: TEST_METHOD(TestMethod1) { myerror e("q"); string s = e.what(); string s2 = "q"; Assert::AreEqual(s2, s); } }; }
63465529de3c82010cf774fa943efd4d67601ef4
5014f8e91975e14647b17283de4ce0e1dcad4347
/projects/static_library/source/greeting.cpp
efa3650c7b68c92ec419ae0e1f51360c09e1a4d3
[]
no_license
MarleneSimtec/vs2019-cmake-template
0a8b0762cde700a9f8ec981d79eb024cb6d6bbb0
f1c870c4234ebdc018e6e8934090835903d0311e
refs/heads/master
2023-03-24T14:57:18.410984
2021-03-15T19:36:26
2021-03-15T19:36:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
198
cpp
greeting.cpp
#include "static_library/greeting.hpp" #include <iostream> int Foo::answerToUltimateQuestion() const { return 42; } void library_func() { std::cout << "Hello from static library!\n"; }
0e5e4a2c14ce634bd01891384aa8505c2d842661
4ff2f0281e7ac90314935a564223f8f810a906ef
/Source/AnalyserComponent.h
9c6e4a5f4b54f05fedec4866555ba73604ea2d3d
[]
no_license
drinkWater22/ClarityBeta
3791aab3b2cdd5c9a5c5247374319fab04f808d0
14e065f63d23c35acb779df65c0d911d84d239fa
refs/heads/main
2023-04-03T03:53:48.068235
2021-03-29T14:16:11
2021-03-29T14:16:11
352,440,616
0
0
null
null
null
null
UTF-8
C++
false
false
4,405
h
AnalyserComponent.h
#pragma once class AnalyserComponent : public juce::AudioAppComponent, private juce::Timer { public: AnalyserComponent() : forwardFFT(fftOrder), window(fftSize, juce::dsp::WindowingFunction<float>::hann) { setOpaque(true); setAudioChannels(2, 0); // we want a couple of input channels but no outputs startTimerHz(30); } ~AnalyserComponent() override { shutdownAudio(); } //============================================================================== void prepareToPlay(int, double) override {} void releaseResources() override {} void getNextAudioBlock(const juce::AudioSourceChannelInfo& bufferToFill) override { if (bufferToFill.buffer->getNumChannels() > 0) { auto* channelData = bufferToFill.buffer->getReadPointer(0, bufferToFill.startSample); for (auto i = 0; i < bufferToFill.numSamples; ++i) pushNextSampleIntoFifo(channelData[i]); } } //============================================================================== void paint(juce::Graphics& g) override { g.fillAll(juce::Colours::black); g.setOpacity(1.0f); g.setColour(juce::Colours::white); drawFrame(g); } void timerCallback() override { if (nextFFTBlockReady) { drawNextFrameOfSpectrum(); nextFFTBlockReady = false; repaint(); } } void pushNextSampleIntoFifo(float sample) noexcept { // if the fifo contains enough data, set a flag to say // that the next frame should now be rendered.. if (fifoIndex == fftSize) // [11] { if (!nextFFTBlockReady) // [12] { juce::zeromem(fftData, sizeof(fftData)); memcpy(fftData, fifo, sizeof(fifo)); nextFFTBlockReady = true; } fifoIndex = 0; } fifo[fifoIndex++] = sample; // [12] } void drawNextFrameOfSpectrum() { // first apply a windowing function to our data window.multiplyWithWindowingTable(fftData, fftSize); // [1] // then render our FFT data.. forwardFFT.performFrequencyOnlyForwardTransform(fftData); // [2] auto mindB = -100.0f; auto maxdB = 0.0f; for (int i = 0; i < scopeSize; ++i) // [3] { auto skewedProportionX = 1.0f - std::exp(std::log(1.0f - (float)i / (float)scopeSize) * 0.2f); auto fftDataIndex = juce::jlimit(0, fftSize / 2, (int)(skewedProportionX * (float)fftSize * 0.5f)); auto level = juce::jmap(juce::jlimit(mindB, maxdB, juce::Decibels::gainToDecibels(fftData[fftDataIndex]) - juce::Decibels::gainToDecibels((float)fftSize)), mindB, maxdB, 0.0f, 1.0f); scopeData[i] = level; // [4] } } void drawFrame(juce::Graphics& g) { for (int i = 1; i < scopeSize; ++i) { auto width = getLocalBounds().getWidth(); auto height = getLocalBounds().getHeight(); g.drawLine({ (float)juce::jmap(i - 1, 0, scopeSize - 1, 0, width), juce::jmap(scopeData[i - 1], 0.0f, 1.0f, (float)height, 0.0f), (float)juce::jmap(i, 0, scopeSize - 1, 0, width), juce::jmap(scopeData[i], 0.0f, 1.0f, (float)height, 0.0f) }); } } enum { fftOrder = 11, // [1] fftSize = 1 << fftOrder, // [2] scopeSize = 512 // [3] }; private: juce::dsp::FFT forwardFFT; // [4] juce::dsp::WindowingFunction<float> window; // [5] float fifo[fftSize]; // [6] float fftData[2 * fftSize]; // [7] int fifoIndex = 0; // [8] bool nextFFTBlockReady = false; // [9] float scopeData[scopeSize]; // [10] JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AnalyserComponent) };
c173bcc62fb127c15f972c891eb06545f602cb04
45316e2ae6d0fa3ee7f25187fab1122c51253b83
/RepeatingElements/RepeatingElements.cpp
7ba3c9ec669d43777591c3f007310b6c223afd0a
[]
no_license
KajalGada/coding-practice-cplusplus
edddc0c77d7bf6e0be17474d27a6334a18c04ece
8bad940ee44d3c7a988cb45c996e2dfb451cd9ab
refs/heads/master
2021-09-11T13:31:43.682865
2018-04-08T00:37:14
2018-04-08T00:37:14
109,053,232
0
0
null
null
null
null
UTF-8
C++
false
false
1,573
cpp
RepeatingElements.cpp
/* Problem Statement: Given an array of n+2 elements, all elements from 1 to n occur * once except 2. Find the 2 repeating elements. * Author: Kajal Damji Gada * Date Created: 7th April, 2018 */ #include <iostream> #include <vector> #include <math.h> int func_fact(int n) { if (n == 1) { return 1; } else { return (n * func_fact(n-1)); } } int main() { std::vector<int> arr = {1,2,3,3,4,5,6,6,7}; int arrSize = arr.size(); int n = arrSize - 2; // Compute sum of array int sum = 0; for (int arrInd = 0; arrInd < arr.size(); ++arrInd) { sum += arr[arrInd]; } // Compute product of array int prod = 1; for (int arrInd = 0; arrInd < arr.size(); ++arrInd) { prod *= arr[arrInd]; } //std::cout << "Sum: " << sum << " Product: " << prod << std::endl; // Compute sum of n and product of n int expSum = n * (n + 1)/2; int expProd = func_fact(n); //std::cout << "Expected Sum: " << expSum << " Expected Product: " << expProd << std::endl; // Compute difference to get (a+b) and (a*b) int n1 = sum - expSum; int n2 = prod/expProd; //std::cout << "n1: " << n1 << " n2: " << n2 << std::endl; /* Find repeating elements a and b * (a + b) = n1 * (a * b) = n2 * (a - b)^2 = (a+b)^2 - 4ab * (a - b)^2 = (n1)^2 - 4n2 * (a - b) = sqrt(n1^2 - 4n2 = n3 */ int n3 = sqrt((n1*n1) - (4*n2)); //std::cout << "n3: " << n3 << std::endl; /* a + b = n1 * a - b = n3 * 2a = n1 + n3 */ int a = (n1 + n3)/2; int b = n1 - a; // Print results std::cout << "Repeating elements are: " << a << " " << b << std::endl; return 0; }
edf117b328354cafe3d649db1b6c72093632df70
b886b5e17872191a996559c87f717f91e370ea09
/ProgramEntrance.h
5bc886e9dc86d05e64f0c1de05775d58a326c5aa
[]
no_license
upupupY/Sheller
a2afcaa5c7f25fd72e749d9fc510637d3e6a9a69
917405fc6e9293cfc4738783fc8e6b34e31e1f17
refs/heads/master
2022-01-08T08:55:33.788156
2019-04-28T13:57:12
2019-04-28T13:57:12
198,168,089
5
2
null
2019-07-22T07:13:22
2019-07-22T07:13:22
null
UTF-8
C++
false
false
265
h
ProgramEntrance.h
#pragma once #ifndef PROGRAMENTRANCE_H_ #define PROGRAMENTRANCE_H_ #include "stdafx.h" class ProgramEntPoint : public CWinApp { public: ProgramEntPoint(); ~ProgramEntPoint(); private: virtual BOOL InitInstance() override; }; ProgramEntPoint g_WinApp; #endif
e7a536d7f649742e0ca11988970aa9b10c4d6552
655825d8684a8d43028bc945e3179ab1048c0914
/Editor/SceneTab.h
121c3d2b5c6c692a12591109c71236efc027630e
[ "MIT" ]
permissive
haohuixin/Urho3D-Toolbox
0fd32712001932fdb67e3b7c580a3ac5a8988aa6
6a069d8522ff811e8a886a32992ad10d4a65d802
refs/heads/master
2020-04-17T11:42:00.760953
2017-11-11T16:39:34
2017-11-11T16:40:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,083
h
SceneTab.h
// // Copyright (c) 2008-2017 the Urho3D project. // // 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. // #pragma once #include <Urho3D/Urho3DAll.h> #include <Toolbox/SystemUI/SystemUI.h> #include <Toolbox/SystemUI/AttributeInspector.h> #include <Toolbox/SystemUI/Gizmo.h> #include <Toolbox/SystemUI/ImGuiDock.h> #include <Toolbox/Graphics/SceneView.h> #include "IDPool.h" namespace Urho3D { class SceneSettings; class SceneEffects; class SceneTab : public SceneView { URHO3D_OBJECT(SceneTab, SceneView); public: /// Construct. explicit SceneTab(Context* context, StringHash id, const String& afterDockName, ui::DockSlot_ position); /// Destruct. ~SceneTab() override; /// Set screen rectangle where scene is being rendered. void SetSize(const IntRect& rect) override; /// Render scene window. bool RenderWindow(); /// Render inspector window. void RenderInspector(); /// Render scene hierarchy window. void RenderSceneNodeTree(Node* node=nullptr); /// Load scene from xml or json file. void LoadScene(const String& filePath); /// Save scene to a resource file. bool SaveScene(const String& filePath = ""); /// Add a node to selection. void Select(Node* node); /// Remove a node from selection. void Unselect(Node* node); /// Select if node was not selected or unselect if node was selected. void ToggleSelection(Node* node); /// Unselect all nodes. void UnselectAll(); /// Return true if node is selected by gizmo. bool IsSelected(Node* node) const; /// Return list of selected nodes. const Vector<WeakPtr<Node>>& GetSelection() const; /// Render buttons which customize gizmo behavior. void RenderGizmoButtons(); /// Save project data to xml. void SaveProject(XMLElement scene) const; /// Load project data from xml. void LoadProject(XMLElement scene); /// Set scene view tab title. void SetTitle(const String& title); /// Get scene view tab title. String GetTitle() const { return title_; } /// Returns title which uniquely identifies scene tab in imgui. String GetUniqueTitle() const { return uniqueTitle_;} /// Return true if scene tab is active and focused. bool IsActive() const { return isActive_; } /// Return inuque object id. StringHash GetID() const { return id_; } /// Clearing cached paths forces choosing a file name next time scene is saved. void ClearCachedPaths(); /// Return true if scene view was rendered on this frame. bool IsRendered() const { return isRendered_; } protected: /// Called when node selection changes. void OnNodeSelectionChanged(); /// Creates scene camera and other objects required by editor. void CreateObjects() override; /// Unique scene id. StringHash id_; /// Scene title. Should be unique. String title_ = "Scene"; /// Title with id appended to it. Used as unique window name. String uniqueTitle_; /// Last resource path scene was loaded from or saved to. String path_; /// Scene dock is active and window is focused. bool isActive_ = false; /// Gizmo used for manipulating scene elements. Gizmo gizmo_; /// Current window flags. ImGuiWindowFlags windowFlags_ = 0; /// Attribute inspector. AttributeInspector inspector_; /// Current selected component displayed in inspector. WeakPtr<Component> selectedComponent_; /// Name of sibling dock for initial placement. String placeAfter_; /// Position where this scene view should be docked initially. ui::DockSlot_ placePosition_; /// Last known mouse position when it was visible. IntVector2 lastMousePosition_; /// Flag set to true when dock contents were visible. Used for tracking "appearing" effect. bool isRendered_ = false; /// Serializable which handles scene settings. SharedPtr<SceneSettings> settings_; /// Serializable which handles scene postprocess effect settings. SharedPtr<SceneEffects> effectSettings_; }; };
20dc2f6c1cffd6bba9178c504bb7c567630ed3b3
6923f79f1eaaba0ab28b25337ba6cb56be97d32d
/Fluid_Engine_Development_Doyub_Kim/src/jet/grid_emitter_set2.cpp
8cef91149de9e212c3a46c46e1fb7465a74e36e6
[ "MIT" ]
permissive
burakbayramli/books
9fe7ba0cabf06e113eb125d62fe16d4946f4a4f0
5e9a0e03aa7ddf5e5ddf89943ccc68d94b539e95
refs/heads/master
2023-08-17T05:31:08.885134
2023-08-14T10:05:37
2023-08-14T10:05:37
72,460,321
223
174
null
2022-10-24T12:15:06
2016-10-31T17:24:00
Jupyter Notebook
UTF-8
C++
false
false
1,254
cpp
grid_emitter_set2.cpp
// Copyright (c) 2016 Doyub Kim #include <pch.h> #include <jet/grid_emitter_set2.h> #include <vector> using namespace jet; GridEmitterSet2::GridEmitterSet2() { } GridEmitterSet2::GridEmitterSet2( const std::vector<GridEmitter2Ptr>& emitters) { for (const auto& e : emitters) { addEmitter(e); } } GridEmitterSet2::~GridEmitterSet2() { } void GridEmitterSet2::addEmitter(const GridEmitter2Ptr& emitter) { _emitters.push_back(emitter); } void GridEmitterSet2::onUpdate( double currentTimeInSeconds, double timeIntervalInSeconds) { for (auto& emitter : _emitters) { emitter->update(currentTimeInSeconds, timeIntervalInSeconds); } } GridEmitterSet2::Builder GridEmitterSet2::builder() { return Builder(); } GridEmitterSet2::Builder& GridEmitterSet2::Builder::withEmitters( const std::vector<GridEmitter2Ptr>& emitters) { _emitters = emitters; return *this; } GridEmitterSet2 GridEmitterSet2::Builder::build() const { return GridEmitterSet2(_emitters); } GridEmitterSet2Ptr GridEmitterSet2::Builder::makeShared() const { return std::shared_ptr<GridEmitterSet2>( new GridEmitterSet2(_emitters), [] (GridEmitterSet2* obj) { delete obj; }); }
021bf08005224dd751b8a03d7eee6dd144304bca
84a14018b6b9ae6abc621da56cd13755454e13a8
/LetCode5.cpp
df98004f894fd1d817e1ec44812c1bb7df7c5535
[]
no_license
whhpc19891120/algorithm
27c9ea9e9cbe41f7f66910dbc240366a4738331e
1ebe886562383d18930199fa9e7b46b5bfb05bc9
refs/heads/master
2022-11-28T15:30:49.969399
2020-08-15T06:31:54
2020-08-15T06:31:54
287,591,567
0
0
null
null
null
null
GB18030
C++
false
false
4,497
cpp
LetCode5.cpp
/* 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 ? s 的最大长度为 1000。 示例 1: 输入 : "babad" 输出 : "bab" 注意 : "aba" 也是一个有效答案。 示例 2: 输入 : "cbbd" 输出 : "bb" 来源:力扣(LeetCode) 链接:https ://leetcode-cn.com/problems/longest-palindromic-substring 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ #include <string> #include <vector> #include <algorithm> using namespace std; class Solution { public: // 暴力破解法(效率太低) string longestPalindrome1(string s) { string res = "";//存放结果 string temp = "";//存放子串 for (int i = 0; i < s.length(); i++) { for (int j = i; j < s.length(); j++) { temp = temp + s[j]; string tem = temp;//tem存放子串反转结果 std::reverse(tem.begin(), tem.end());//反转 if (temp == tem) res = res.length() > temp.length() ? res : temp; } temp = ""; } return res; } // 翻转求最大公共子串 并判断是否回文(仍旧会超过时间限制) string longestPalindrome2(string s) { //大小为1的字符串必为回文串 if (s.length() == 1) return s; //rev存放s反转结果 string rev = s; //存放结果 string res; std::reverse(rev.begin(), rev.end()); if (rev == s) return s; //存放回文子串的长度 int len = 0; //查找s与rev的最长公共子串 for (int i = 0; i < s.length(); i++) { string temp;//存放待验证子串 for (int j = i; j < s.length(); j++) { temp = temp + s[j]; if (rev.find(temp) != -1) { //q用来验证temp是否是回文子串 string q = temp; std::reverse(q.begin(), q.end()); if (q == temp) { len = temp.length(); res = temp; } } else break; } temp = ""; } return res; } // 动态规划(响应时间太长 Do not AC) string longestPalindrome3(string s) { int length = s.size(); if (length == 0 || length == 1) return s; //定义二维动态数组 vector<vector<int>> dp(length, vector<int>(length)); int maxLen = 0; string maxPal = ""; for (int len = 1; len <= len; len++) { //遍历所有的长度 for (int start = 0; start < length; start++) { int end = start + len - 1; if (end >= length) //下标已经越界,结束本次循环 break; dp[start][end] = (len == 1 || len == 2 || dp[start + 1][end - 1]) && s[start] == s[end]; //长度为 1 和 2 的单独判断下 if (dp[start][end] && len > maxLen) { maxPal = s.substr(start, end + 1); } } } return maxPal; } // 动态规划(AC 效率低下) string longestPalindrome4(string s) { int len = s.size(); if (len == 0 || len == 1) return s; int start = 0;//回文串起始位置 int max = 1;//回文串最大长度 vector<vector<int>> dp(len, vector<int>(len));//定义二维动态数组 for (int i = 0; i < len; i++)//初始化状态 { dp[i][i] = 1; if (i < len - 1 && s[i] == s[i + 1]) { dp[i][i + 1] = 1; max = 2; start = i; } } for (int l = 3; l <= len; l++)//l表示检索的子串长度,等于3表示先检索长度为3的子串 { for (int i = 0; i + l - 1 < len; i++) { int j = l + i - 1;//终止字符位置 if (s[i] == s[j] && dp[i + 1][j - 1] == 1)//状态转移 { dp[i][j] = 1; start = i; max = l; } } } return s.substr(start, max);//获取最长回文子串 } // 中心扩散法 string longestPalindrome(string s) { int len = s.size(); if (len == 0 || len == 1) return s; int start = 0;//记录回文子串起始位置 int end = 0;//记录回文子串终止位置 int mlen = 0;//记录最大回文子串的长度 for (int i = 0; i < len; i++) { int len1 = expendaroundcenter(s, i, i);//一个元素为中心 int len2 = expendaroundcenter(s, i, i + 1);//两个元素为中心 mlen = max(max(len1, len2), mlen); if (mlen > end - start + 1) { start = i - (mlen - 1) / 2; end = i + mlen / 2; } } return s.substr(start, mlen); //该函数的意思是获取从start开始长度为mlen长度的字符串 } private: //计算以left和right为中心的回文串长度 int expendaroundcenter(string s, int left, int right) { int L = left; int R = right; while (L >= 0 && R < s.length() && s[R] == s[L]) { L--; R++; } return R - L - 1; } };
2a24948e52249276eeff884f418c5845a788eb7a
111c3ebecfa9eac954bde34b38450b0519c45b86
/SDK_Perso/include/Cockpit/Base/Header/AI/States/AI_AnimateModel.h
9269ffb21fa5d775bffda7cbc396c06c982ac142
[]
no_license
1059444127/NH90
25db189bb4f3b7129a3c6d97acb415265339dab7
a97da9d49b4d520ad169845603fd47c5ed870797
refs/heads/master
2021-05-29T14:14:33.309737
2015-10-05T17:06:10
2015-10-05T17:06:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,224
h
AI_AnimateModel.h
#pragma once #include "AI/States/AI_IState.h" namespace gunner_AI { struct ArgumentState { ArgumentState() : arg_(-1), pylon_(-1), speed_(0.0f), target_(0.0f), init_(UNDEF_VALUE), finished_(false) {} virtual ~ArgumentState(){} virtual bool l_read(Lua::Config& config); int arg_; char pylon_; /*arg location, -1 - main LA model*/ float speed_; /*changing speed*/ float target_; float init_; /*used when initialized*/ bool finished_; float cur_speed_; }; class CndArgumentState : public ArgumentState { public: ~CndArgumentState(); virtual bool l_read(Lua::Config& config) override; ConditionVector conditions_; }; typedef ed::vector<CndArgumentState*> CndArgStateVector; class AnimateModelState : public State { public: AnimateModelState(); ~AnimateModelState(); virtual void l_read(Lua::Config& config) override; virtual void on_start() override; virtual void simulate(double dt) override; private: CndArgStateVector arguments_; }; class InitModelState : public State { public: InitModelState(); ~InitModelState(); virtual void l_read(Lua::Config& config) override; virtual void on_finish() override; private: ArgsVector arguments_; }; }
40f271f41523158c8ac980ef6d7f3b7a5fe5c416
78e6f8b29560c70ca9e1eedcfff6f1111f7370c8
/OpenGL 3D Game/src/engine/platform/vulkan/rendering/shaders/pbr/VKPBRShader.cpp
410e20cb2e5db2deb9bf4c63fee52c3f16f8ecbc
[]
no_license
Andrispowq/OpenGL-3D-Game
511104617e403a5f8c448390e5ee411a47697e8e
8f0fcf1edcea7673b36e09f177aa75c4416a2d05
refs/heads/master
2023-01-29T04:34:12.471328
2020-12-01T13:42:51
2020-12-01T13:42:51
242,340,559
1
0
null
null
null
null
UTF-8
C++
false
false
4,810
cpp
VKPBRShader.cpp
#include "engine/prehistoric/core/util/Includes.hpp" #include <glew.h> #include "VKPBRShader.h" VKPBRShader::VKPBRShader(Window* window) : VKShader(window->getContext(), window->getSwapchain()) { AddShader(ResourceLoader::LoadShaderVK("vulkan/pbr/pbr_VS.spv"), VERTEX_SHADER); AddShader(ResourceLoader::LoadShaderVK("vulkan/pbr/pbr_FS.spv"), FRAGMENT_SHADER); AddUniform("camera", VERTEX_SHADER | FRAGMENT_SHADER, UniformBuffer, 0, 0, sizeof(float) * 16 * 2 + Vector4f::size()); AddUniform("lightConditions", VERTEX_SHADER | FRAGMENT_SHADER, UniformBuffer, 0, 1, sizeof(int) * 2 + sizeof(float) * 2); AddUniform("lights", VERTEX_SHADER | FRAGMENT_SHADER, UniformBuffer, 0, 2, Vector4f::size() * 3 * EngineConfig::lightsMaxNumber); AddUniform("material", GEOMETRY_SHADER | FRAGMENT_SHADER, UniformBuffer, 1, 0, Vector4f::size() * 2 + sizeof(int) + sizeof(float) * 4); AddUniform(ALBEDO_MAP, FRAGMENT_SHADER, CombinedImageSampler, 1, 1, 0, nullptr); AddUniform(DISPLACEMENT_MAP, FRAGMENT_SHADER, CombinedImageSampler, 1, 2, 0, nullptr); AddUniform(NORMAL_MAP, FRAGMENT_SHADER, CombinedImageSampler, 1, 3, 0, nullptr); AddUniform(METALLIC_MAP, FRAGMENT_SHADER, CombinedImageSampler, 1, 4, 0, nullptr); AddUniform(ROUGHNESS_MAP, FRAGMENT_SHADER, CombinedImageSampler, 1, 5, 0, nullptr); AddUniform(OCCLUSION_MAP, FRAGMENT_SHADER, CombinedImageSampler, 1, 6, 0, nullptr); AddUniform(EMISSION_MAP, FRAGMENT_SHADER, CombinedImageSampler, 1, 7, 0, nullptr); AddUniform("m_transform", VERTEX_SHADER, UniformBuffer, 2, 0, sizeof(float) * 16); descriptorPool->finalise(pipelineLayout); } void VKPBRShader::UpdateShaderUniforms(Camera* camera, const std::vector<Light*>& lights, uint32_t instance_index) const { //Offset values are copied from shaders SetUniform("camera", camera->getViewMatrix(), 0, instance_index); SetUniform("camera", camera->getProjectionMatrix(), 64, instance_index); SetUniform("camera", camera->getPosition(), 128, instance_index); SetUniformi("lightConditions", EngineConfig::rendererHighDetailRange, 0, instance_index); SetUniformi("lightConditions", (uint32_t)lights.size() >= EngineConfig::lightsMaxNumber ? EngineConfig::lightsMaxNumber : (uint32_t)lights.size(), 4, instance_index); SetUniformf("lightConditions", EngineConfig::rendererGamma, 8, instance_index); SetUniformf("lightConditions", EngineConfig::rendererExposure, 12, instance_index); size_t baseOffset = EngineConfig::lightsMaxNumber * Vector4f::size(); for (uint32_t i = 0; i < EngineConfig::lightsMaxNumber; i++) { size_t currentOffset = Vector4f::size() * i; if (i < lights.size()) { Light* light = lights[i]; SetUniform("lights", Vector4f(light->getParent()->getWorldTransform().getPosition(), 0), baseOffset * 0 + currentOffset, instance_index); SetUniform("lights", Vector4f(light->getColour(), 0), baseOffset * 1 + currentOffset, instance_index); SetUniform("lights", Vector4f(light->getIntensity(), 0), baseOffset * 2 + currentOffset, instance_index); } else { SetUniform("lights", Vector4f(), baseOffset * 0 + currentOffset, instance_index); SetUniform("lights", Vector4f(), baseOffset * 1 + currentOffset, instance_index); SetUniform("lights", Vector4f(), baseOffset * 2 + currentOffset, instance_index); } } BindSets(commandBuffer, 0, 1, instance_index); } void VKPBRShader::UpdateObjectUniforms(GameObject* object, uint32_t instance_index) const { Material* material = ((RendererComponent*)object->GetComponent(RENDERER_COMPONENT))->getMaterial(); //Offset values are copied from shaders SetUniform("m_transform", object->getWorldTransform().getTransformationMatrix(), instance_index); SetUniform("material", material->getVector3f(COLOUR), 0, instance_index); SetUniform("material", material->getVector3f(EMISSION), 16, instance_index); SetUniformi("material", material->exists(NORMAL_MAP), 32, instance_index); SetUniformf("material", material->getFloat(HEIGHT_SCALE), 36, instance_index); SetUniformf("material", material->getFloat(METALLIC), 40, instance_index); SetUniformf("material", material->getFloat(ROUGHNESS), 44, instance_index); SetUniformf("material", material->getFloat(OCCLUSION), 48, instance_index); SetTexture(ALBEDO_MAP, material->getTexture(ALBEDO_MAP), instance_index); SetTexture(DISPLACEMENT_MAP, material->getTexture(DISPLACEMENT_MAP), instance_index); SetTexture(NORMAL_MAP, material->getTexture(NORMAL_MAP), instance_index); SetTexture(METALLIC_MAP, material->getTexture(METALLIC_MAP), instance_index); SetTexture(ROUGHNESS_MAP, material->getTexture(ROUGHNESS_MAP), instance_index); SetTexture(OCCLUSION_MAP, material->getTexture(OCCLUSION_MAP), instance_index); SetTexture(EMISSION_MAP, material->getTexture(EMISSION_MAP), instance_index); BindSets(commandBuffer, 1, 2, instance_index); }
8720afc03d85936e6e67223b5f7e605f5e63ba07
2b79678e272b77210e3ceabd671e5e8914d8b2c7
/point-sum.cpp
0205dff26660942ef7042cb2e376cd72bf88107c
[ "LicenseRef-scancode-bsd-3-clause-jtag" ]
permissive
jackbackrack/stanza-benchmarks
25e0032c0d463b8a3ba86cfc054f940e9599e4e1
109377abb4003ece25c2c21ba47f7cd218dc9969
refs/heads/master
2016-09-12T13:09:20.380957
2016-04-19T01:45:16
2016-04-19T01:45:16
56,455,369
0
0
null
null
null
null
UTF-8
C++
false
false
789
cpp
point-sum.cpp
// See license.txt for details about licensing. #include <stdlib.h> #include <stdio.h> #include <math.h> #include <time.h> class vec_t { public: float x, y, z; vec_t (const float x, const float y, const float z) : x(x), y(y), z(z) {} vec_t operator+(const vec_t& b) const { return vec_t(x + b.x, y + b.y, z + b.z); } }; vec_t benchmark (int n, const vec_t& p) { vec_t sum(0.0, 0.0, 0.0); for (int i = 0; i < n; i++) sum = sum + p; return sum; } int main (int argc, char* argv[]) { const int iters = atoi(argv[1]); clock_t begin = clock(); const vec_t p = vec_t(0.1, 0.2, 0.3); vec_t res = benchmark(iters, p); clock_t end = clock(); double time_spent = (double)(end - begin) / CLOCKS_PER_SEC; if (res.x > 0.0) printf("%f\n", time_spent); }
290eeae013dc23c6f220a85683d6da8bc6663823
620596a6f32271c165a9797e3dc7045115c3cb9d
/UBC_Sailbot_Unit_Tests/SailbotUnitTest.cpp
3f68eedc9febf1d9306858b2933b226babb7a1a0
[]
no_license
stanleyye/UBC-Sailbot
885ff7f79d8fb2b11dac6bc28be17392c60d2b75
a7c556e0d33c67b4d7ab5628d39587300d3449b2
refs/heads/master
2021-05-16T07:29:32.652329
2017-09-17T02:01:37
2017-09-17T02:01:46
103,796,026
0
0
null
null
null
null
UTF-8
C++
false
false
2,321
cpp
SailbotUnitTest.cpp
#include "stdafx.h" #include "CppUnitTest.h" #include "../UBC_Sailbot/StandardCalc.h" using namespace Microsoft::VisualStudio::CppUnitTestFramework; namespace UBC_Sailbot_Unit_Tests { TEST_CLASS(UnitTest1) { public: TEST_METHOD(TestMethod1) { StandardCalc standard_calc; // already bound within the ranges of -180 and 180 Assert::AreEqual(-180.0f, standard_calc.BoundTo180(-180.0f), L"message", LINE_INFO()); Assert::AreEqual(179.99f, standard_calc.BoundTo180(179.99f), L"message", LINE_INFO()); // just outside of the bound of 179.999... Assert::AreEqual(-180.0f, standard_calc.BoundTo180(180.0f), L"message", LINE_INFO()); Assert::AreEqual(-179.5f, standard_calc.BoundTo180(180.5f), L"message", LINE_INFO()); // outside the bounds Assert::AreEqual(0.0f, standard_calc.BoundTo180(-360.00f), L"message", LINE_INFO()); Assert::AreEqual(0.0f, standard_calc.BoundTo180(-720.00f), L"message", LINE_INFO()); Assert::AreEqual(0.0f, standard_calc.BoundTo180(360.00f), L"message", LINE_INFO()); Assert::AreEqual(0.0f, standard_calc.BoundTo180(720.00f), L"message", LINE_INFO()); Assert::AreEqual(-90.0f, standard_calc.BoundTo180(-450.0f), L"message", LINE_INFO()); Assert::AreEqual(-90.0f, standard_calc.BoundTo180(270.0f), L"message", LINE_INFO()); Assert::AreEqual(100.5500000f, standard_calc.BoundTo180(460.5500000f), 0.0001f); Assert::AreEqual(100.5422f, standard_calc.BoundTo180(460.5422f), 0.0001f); } TEST_METHOD(TestMethod2) { StandardCalc standard_calc; // middle angle is one of the outer angles Assert::AreEqual(false, standard_calc.IsAngleBetween(-180.0f, -10.0f, -10.0f), L"message", LINE_INFO()); Assert::AreEqual(false, standard_calc.IsAngleBetween(-170.0f, -170.0f, 15.0f), L"message", LINE_INFO()); // test within range Assert::AreEqual(true, standard_calc.IsAngleBetween(-90.0f, -180.0f, 110.0f), L"message", LINE_INFO()); Assert::AreEqual(true, standard_calc.IsAngleBetween(-40.0f, 720.0f, 90.0f), L"message", LINE_INFO()); // test angle that is not within the range of the two angles Assert::AreEqual(false, standard_calc.IsAngleBetween(-90.0f, -180.0f, 80.0f), L"message", LINE_INFO()); Assert::AreEqual(false, standard_calc.IsAngleBetween(15.0f, 475.0f, 90.0f), L"message", LINE_INFO()); } }; }
6cbe63afc94f9cb67e165ef6f351c21e3e2d13d8
6f62ebea07a193c19ba54425b20f88397b6506bf
/Algorithm/Sort/QuickSort.h
4200715a3a3b7cb5c22269abc93baa182315a5f8
[]
no_license
wuzeyu2015/Algorithm-4th-edition-C
390e56170cb623b9075cbb180b31519a37608116
20f0abc0343e4f45325847394b7b5550d7956593
refs/heads/master
2022-07-24T11:23:19.097198
2022-07-18T15:21:31
2022-07-18T15:21:31
96,655,795
1
0
null
null
null
null
GB18030
C++
false
false
21,251
h
QuickSort.h
#ifndef QUICKSORT_H #define QUICKSORT_H #include "InsetionSort.h" #include "SortTestHelper.h" #include <time.h> #include <vector> /*打算重新学习下算法,顺便把相关的东西整理到自己博客上,博客一搜重复的内容一大片,不论是正确还是错误的都带着很多主观看法,所以写这个不是为了成为参考资料,只为整理下自己的思路、备忘,如果被网路上的同学们检索到,希望大家能够自己甄别其中好坏,有问题的地方,也希望能够提出来大家共同学习。 这里从快速排序和归并排序开始,因为对于新入行的同学来讲,这两个排序是理解递归的一个很好的切入点。*/ // 直接进入主题,快排思想,就是把数组首位数字v放入数组有序时它该处的位置,同时使其左右数据满足如下描述性质: // [|v|..................] ==> [....<v....|v|....>v.....] // 这个步骤称之为partition,可以发现经过一次partition,v的序列位定下来了,同时其他的数据虽然没有排好序,但是至少处在它该处的区间。 // 然后对<v和>v的区间再次进行partition(递归),可以预见区间被划分得越来越多也越来越小,数据被分割得越来越精确(接近它的序列位) // 最后完全停留在它的序列位上,此时整个数组有序。 // 类似于二分法,此数组理想情况下被分割的次数是logN,每次分割后,遍历数据量为N,时间复杂度NlogN。 // 此时可以写出快排伪代码: int _partition(int a[], int lo, int hi); void _quicksort(int a[], int lo, int hi){ if (lo >= hi) return; int j = _partition(a, lo, hi); _quicksort(a, lo, j - 1); _quicksort(a, j + 1, hi); } // 看起来道理很简单是不是?我们只需要实现核心算法partition就可以了,partition过程中区间处于以下状态: // [(v, lo) | .....<v..... | i......j | .....>v.....hi] // 其中索引上i、j参数需要明确它们的含义: // i:右遍历指针,满足[lo, i) < v // j:左遍历指针,满足(j, hi] > v // 由i和j来找出v的序列位 //那么问题来了,整个递归结构很清晰,但是前(启动partition:各个参数初始值)、后(退出partition:退出条件)两个部分如何分析? int _partition(int a[], int lo, int hi){ int i = lo; int j = hi + 1; int v = a[lo]; while(true){ while(a[++i] < v){ if (i >= hi) break; } while(a[--j] > v){ if (j <= lo) break; } if (i >= j) // ">=" 还是 ">" ? break; swap(a[i], a[j]); } swap(a[lo], a[j]); return j; } void quicksort(int a[], int n){ _quicksort(a, 0, n - 1); } void testQuickSort(){ int n = 10000; int* arr = SortTestHelper::generateRandomArray(n, 0, n); SortTestHelper::testSort("Quick Sort", quicksort, arr, n); } #endif //QUICKSORT_H