hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
108
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
1cf4de7d0607d40a8af627f859f668dddcd71d44
13,332
cpp
C++
WebKit/Source/WebCore/html/shadow/SliderThumbElement.cpp
JavaScriptTesting/LJS
9818dbdb421036569fff93124ac2385d45d01c3a
[ "Apache-2.0" ]
1
2019-06-18T06:52:54.000Z
2019-06-18T06:52:54.000Z
WebKit/Source/WebCore/html/shadow/SliderThumbElement.cpp
JavaScriptTesting/LJS
9818dbdb421036569fff93124ac2385d45d01c3a
[ "Apache-2.0" ]
null
null
null
WebKit/Source/WebCore/html/shadow/SliderThumbElement.cpp
JavaScriptTesting/LJS
9818dbdb421036569fff93124ac2385d45d01c3a
[ "Apache-2.0" ]
null
null
null
/* * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. 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 "config.h" #include "SliderThumbElement.h" #include "CSSValueKeywords.h" #include "Event.h" #include "Frame.h" #include "HTMLInputElement.h" #include "HTMLParserIdioms.h" #include "MouseEvent.h" #include "RenderDeprecatedFlexibleBox.h" #include "RenderSlider.h" #include "RenderTheme.h" #include "ShadowRoot.h" #include "StepRange.h" #include <wtf/MathExtras.h> using namespace std; namespace WebCore { inline static double sliderPosition(HTMLInputElement* element) { StepRange range(element); return range.proportionFromValue(range.valueFromElement(element)); } inline static bool hasVerticalAppearance(HTMLInputElement* input) { ASSERT(input->renderer()); RenderStyle* sliderStyle = input->renderer()->style(); return sliderStyle->appearance() == SliderVerticalPart || sliderStyle->appearance() == MediaVolumeSliderPart; } SliderThumbElement* sliderThumbElementOf(Node* node) { ASSERT(node); ShadowRoot* shadow = node->toInputElement()->shadowRoot(); ASSERT(shadow); Node* thumb = shadow->firstChild()->firstChild()->firstChild(); ASSERT(thumb); return toSliderThumbElement(thumb); } // -------------------------------- RenderSliderThumb::RenderSliderThumb(Node* node) : RenderBlock(node) { } void RenderSliderThumb::updateAppearance(RenderStyle* parentStyle) { if (parentStyle->appearance() == SliderVerticalPart) style()->setAppearance(SliderThumbVerticalPart); else if (parentStyle->appearance() == SliderHorizontalPart) style()->setAppearance(SliderThumbHorizontalPart); else if (parentStyle->appearance() == MediaSliderPart) style()->setAppearance(MediaSliderThumbPart); else if (parentStyle->appearance() == MediaVolumeSliderPart) style()->setAppearance(MediaVolumeSliderThumbPart); if (style()->hasAppearance()) theme()->adjustSliderThumbSize(style()); } bool RenderSliderThumb::isSliderThumb() const { return true; } void RenderSliderThumb::layout() { // Do not cast node() to SliderThumbElement. This renderer is used for // TrackLimitElement too. HTMLInputElement* input = node()->shadowAncestorNode()->toInputElement(); bool isVertical = style()->appearance() == SliderThumbVerticalPart || style()->appearance() == MediaVolumeSliderThumbPart; double fraction = sliderPosition(input) * 100; if (isVertical) style()->setTop(Length(100 - fraction, Percent)); else if (style()->isLeftToRightDirection()) style()->setLeft(Length(fraction, Percent)); else style()->setRight(Length(fraction, Percent)); RenderBlock::layout(); } // -------------------------------- // FIXME: Find a way to cascade appearance and adjust heights, and get rid of this class. // http://webkit.org/b/62535 class RenderSliderContainer : public RenderDeprecatedFlexibleBox { public: RenderSliderContainer(Node* node) : RenderDeprecatedFlexibleBox(node) { } private: virtual void layout(); }; void RenderSliderContainer::layout() { HTMLInputElement* input = node()->shadowAncestorNode()->toInputElement(); bool isVertical = hasVerticalAppearance(input); style()->setBoxOrient(isVertical ? VERTICAL : HORIZONTAL); // Sets the concrete height if the height of the <input> is not fixed or a // percentage value because a percentage height value of this box won't be // based on the <input> height in such case. Length inputHeight = input->renderer()->style()->height(); RenderObject* trackRenderer = node()->firstChild()->renderer(); if (!isVertical && input->renderer()->isSlider() && !inputHeight.isFixed() && !inputHeight.isPercent()) { RenderObject* thumbRenderer = input->shadowRoot()->firstChild()->firstChild()->firstChild()->renderer(); if (thumbRenderer) { style()->setHeight(thumbRenderer->style()->height()); if (trackRenderer) trackRenderer->style()->setHeight(thumbRenderer->style()->height()); } } else { style()->setHeight(Length(100, Percent)); if (trackRenderer) trackRenderer->style()->setHeight(Length()); } RenderDeprecatedFlexibleBox::layout(); // Percentage 'top' for the thumb doesn't work if the parent style has no // concrete height. Node* track = node()->firstChild(); if (track && track->renderer()->isBox()) { RenderBox* trackBox = track->renderBox(); trackBox->style()->setHeight(Length(trackBox->height() - trackBox->borderAndPaddingHeight(), Fixed)); } } // -------------------------------- void SliderThumbElement::setPositionFromValue() { // Since the code to calculate position is in the RenderSliderThumb layout // path, we don't actually update the value here. Instead, we poke at the // renderer directly to trigger layout. if (renderer()) renderer()->setNeedsLayout(true); } RenderObject* SliderThumbElement::createRenderer(RenderArena* arena, RenderStyle*) { return new (arena) RenderSliderThumb(this); } bool SliderThumbElement::isEnabledFormControl() const { return hostInput()->isEnabledFormControl(); } bool SliderThumbElement::isReadOnlyFormControl() const { return hostInput()->isReadOnlyFormControl(); } Node* SliderThumbElement::focusDelegate() { return hostInput(); } void SliderThumbElement::dragFrom(const LayoutPoint& point) { setPositionFromPoint(point); startDragging(); } void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) { HTMLInputElement* input = hostInput(); if (!input->renderer() || !renderer()) return; LayoutPoint offset = roundedLayoutPoint(input->renderer()->absoluteToLocal(point, false, true)); bool isVertical = hasVerticalAppearance(input); LayoutUnit trackSize; LayoutUnit position; LayoutUnit currentPosition; // We need to calculate currentPosition from absolute points becaue the // renderer for this node is usually on a layer and renderBox()->x() and // y() are unusable. // FIXME: This should probably respect transforms. LayoutPoint absoluteThumbOrigin = renderBox()->absoluteBoundingBoxRectIgnoringTransforms().location(); LayoutPoint absoluteSliderContentOrigin = roundedLayoutPoint(input->renderer()->localToAbsolute()); if (isVertical) { trackSize = input->renderBox()->contentHeight() - renderBox()->height(); position = offset.y() - renderBox()->height() / 2; currentPosition = absoluteThumbOrigin.y() - absoluteSliderContentOrigin.y(); } else { trackSize = input->renderBox()->contentWidth() - renderBox()->width(); position = offset.x() - renderBox()->width() / 2; currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x(); } position = max<LayoutUnit>(0, min(position, trackSize)); if (position == currentPosition) return; StepRange range(input); double fraction = static_cast<double>(position) / trackSize; if (isVertical || !renderBox()->style()->isLeftToRightDirection()) fraction = 1 - fraction; double value = range.clampValue(range.valueFromProportion(fraction)); // FIXME: This is no longer being set from renderer. Consider updating the method name. input->setValueFromRenderer(serializeForNumberType(value)); renderer()->setNeedsLayout(true); input->dispatchFormControlChangeEvent(); } void SliderThumbElement::startDragging() { if (Frame* frame = document()->frame()) { frame->eventHandler()->setCapturingMouseEventsNode(this); m_inDragMode = true; } } void SliderThumbElement::stopDragging() { if (!m_inDragMode) return; if (Frame* frame = document()->frame()) frame->eventHandler()->setCapturingMouseEventsNode(0); m_inDragMode = false; if (renderer()) renderer()->setNeedsLayout(true); } void SliderThumbElement::defaultEventHandler(Event* event) { if (!event->isMouseEvent()) { HTMLDivElement::defaultEventHandler(event); return; } // FIXME: Should handle this readonly/disabled check in more general way. // Missing this kind of check is likely to occur elsewhere if adding it in each shadow element. HTMLInputElement* input = hostInput(); if (!input || input->isReadOnlyFormControl() || !input->isEnabledFormControl()) { HTMLDivElement::defaultEventHandler(event); return; } MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); bool isLeftButton = mouseEvent->button() == LeftButton; const AtomicString& eventType = event->type(); // We intentionally do not call event->setDefaultHandled() here because // MediaControlTimelineElement::defaultEventHandler() wants to handle these // mouse events. if (eventType == eventNames().mousedownEvent && isLeftButton) { startDragging(); return; } else if (eventType == eventNames().mouseupEvent && isLeftButton) { stopDragging(); return; } else if (eventType == eventNames().mousemoveEvent) { if (m_inDragMode) setPositionFromPoint(mouseEvent->absoluteLocation()); return; } HTMLDivElement::defaultEventHandler(event); } void SliderThumbElement::detach() { if (m_inDragMode) { if (Frame* frame = document()->frame()) frame->eventHandler()->setCapturingMouseEventsNode(0); } HTMLDivElement::detach(); } HTMLInputElement* SliderThumbElement::hostInput() const { // Only HTMLInputElement creates SliderThumbElement instances as its shadow nodes. // So, shadowAncestorNode() must be an HTMLInputElement. return shadowAncestorNode()->toInputElement(); } const AtomicString& SliderThumbElement::shadowPseudoId() const { DEFINE_STATIC_LOCAL(AtomicString, sliderThumb, ("-webkit-slider-thumb")); return sliderThumb; } // -------------------------------- inline TrackLimiterElement::TrackLimiterElement(Document* document) : HTMLDivElement(HTMLNames::divTag, document) { } PassRefPtr<TrackLimiterElement> TrackLimiterElement::create(Document* document) { RefPtr<TrackLimiterElement> element = adoptRef(new TrackLimiterElement(document)); CSSInlineStyleDeclaration* style = element->ensureInlineStyleDecl(); style->setProperty(CSSPropertyVisibility, CSSValueHidden); style->setProperty(CSSPropertyPosition, CSSValueStatic); return element.release(); } RenderObject* TrackLimiterElement::createRenderer(RenderArena* arena, RenderStyle*) { return new (arena) RenderSliderThumb(this); } const AtomicString& TrackLimiterElement::shadowPseudoId() const { DEFINE_STATIC_LOCAL(AtomicString, sliderThumb, ("-webkit-slider-thumb")); return sliderThumb; } TrackLimiterElement* trackLimiterElementOf(Node* node) { ASSERT(node); ShadowRoot* shadow = node->toInputElement()->shadowRoot(); ASSERT(shadow); Node* limiter = shadow->firstChild()->lastChild(); ASSERT(limiter); return static_cast<TrackLimiterElement*>(limiter); } // -------------------------------- inline SliderContainerElement::SliderContainerElement(Document* document) : HTMLDivElement(HTMLNames::divTag, document) { } PassRefPtr<SliderContainerElement> SliderContainerElement::create(Document* document) { return adoptRef(new SliderContainerElement(document)); } RenderObject* SliderContainerElement::createRenderer(RenderArena* arena, RenderStyle*) { return new (arena) RenderSliderContainer(this); } const AtomicString& SliderContainerElement::shadowPseudoId() const { DEFINE_STATIC_LOCAL(AtomicString, sliderThumb, ("-webkit-slider-container")); return sliderThumb; } }
34.272494
126
0.704845
JavaScriptTesting
1cf7a1559aae83b8a8fd1054dd02842bf6d4b59e
16,956
cpp
C++
jni/events/basesynthevent.cpp
scottmccain/MWEngine
e8aa3e37a7c9d0cc3198081d12e3342fe227af3c
[ "MIT" ]
null
null
null
jni/events/basesynthevent.cpp
scottmccain/MWEngine
e8aa3e37a7c9d0cc3198081d12e3342fe227af3c
[ "MIT" ]
null
null
null
jni/events/basesynthevent.cpp
scottmccain/MWEngine
e8aa3e37a7c9d0cc3198081d12e3342fe227af3c
[ "MIT" ]
null
null
null
/** * The MIT License (MIT) * * Copyright (c) 2013-2014 Igor Zinken - http://www.igorski.nl * * 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 "basesynthevent.h" #include "../audioengine.h" #include "../sequencer.h" #include "../global.h" #include "../utilities/utils.h" #include <cmath> /* constructor / destructor */ BaseSynthEvent::BaseSynthEvent() { } /** * initializes an BaseSynthEvent for use in a sequenced context * * @param aFrequency {int} the frequency of the note to synthesize in Hz * @param aPosition {int} the step position in the sequencer * @param aLength {float} the length in steps the note lasts * @param aInstrument {SynthInstrument} the instruments properties * @param aAutoCache {bool} whether to start caching automatically, this is * only available if AudioEngineProps::EVENT_CACHING is true */ BaseSynthEvent::BaseSynthEvent( float aFrequency, int aPosition, float aLength, SynthInstrument *aInstrument, bool aAutoCache ) { init( aInstrument, aFrequency, aPosition, aLength, true ); setAutoCache( aAutoCache ); } /** * initializes an BaseSynthEvent to be synthesized at once, for a live instrument context * * @param aFrequency {int} the frequency of the note to synthesize in Hz * @param aInstrument {SynthInstrument} */ BaseSynthEvent::BaseSynthEvent( float aFrequency, SynthInstrument *aInstrument ) { init( aInstrument, aFrequency, 0, 1, false ); } BaseSynthEvent::~BaseSynthEvent() { removeFromSequencer(); if ( _adsr != 0 ) { delete _adsr; _adsr = 0; } } /* public methods */ /** * will only occur for a sequenced BaseSynthEvent */ void BaseSynthEvent::mixBuffer( AudioBuffer* outputBuffer, int bufferPos, int minBufferPosition, int maxBufferPosition, bool loopStarted, int loopOffset, bool useChannelRange ) { // is EVENT_CACHING is enabled, read from cached buffer if ( AudioEngineProps::EVENT_CACHING ) { BaseAudioEvent::mixBuffer( outputBuffer, bufferPos, minBufferPosition, maxBufferPosition, loopStarted, loopOffset, useChannelRange ); } else { // EVENT_CACHING is disabled, synthesize on the fly lock(); // over the max position ? read from the start ( implies that sequence has started loop ) if ( bufferPos >= maxBufferPosition ) { if ( useChannelRange ) bufferPos -= maxBufferPosition; else if ( !loopStarted ) bufferPos -= ( maxBufferPosition - minBufferPosition ); } int bufferEndPos = bufferPos + AudioEngineProps::BUFFER_SIZE; if (( bufferPos >= _sampleStart || bufferEndPos > _sampleStart ) && bufferPos < _sampleEnd ) { // render the snippet _cacheWriteIndex = _sampleStart > bufferPos ? 0 : bufferPos - _sampleStart; int writeOffset = _sampleStart > bufferPos ? _sampleStart - bufferPos : 0; render( _buffer ); // overwrites old buffer contents outputBuffer->mergeBuffers( _buffer, 0, writeOffset, MAX_PHASE ); // reset of properties at end of write if ( _cacheWriteIndex >= _sampleLength ) calculateBuffers(); } if ( loopStarted && bufferPos >= loopOffset ) { bufferPos = minBufferPosition + loopOffset; if ( bufferPos >= _sampleStart && bufferPos <= _sampleEnd ) { _cacheWriteIndex = 0; // render the snippet from the start render( _buffer ); // overwrites old buffer contents outputBuffer->mergeBuffers( _buffer, 0, loopOffset, MAX_PHASE ); // reset of properties at end of write if ( _cacheWriteIndex >= _sampleLength ) calculateBuffers(); } } unlock(); } } AudioBuffer* BaseSynthEvent::getBuffer() { if ( AudioEngineProps::EVENT_CACHING ) { // if caching hasn't completed, fill cache fragment if ( !_cachingCompleted ) doCache(); } return _buffer; } float BaseSynthEvent::getFrequency() { return _frequency; } void BaseSynthEvent::setFrequency( float aFrequency ) { _frequency = aFrequency; } /** * @param aPosition position in the sequencer where this event starts playing * @param aLength length (in sequencer steps) of this event * @param aInstrument the SynthInstrument whose properties will be used for synthesizing this event * can be NULL to keep the current SynthInstrument, if not null the current * SynthInstrument is replaced */ void BaseSynthEvent::invalidateProperties( int aPosition, float aLength, SynthInstrument *aInstrument ) { // swap instrument if new one is different to existing reference if ( aInstrument != 0 && _instrument != aInstrument ) { removeFromSequencer(); _instrument = aInstrument; addToSequencer(); } position = aPosition; length = aLength; // is this event caching ? if ( AudioEngineProps::EVENT_CACHING && !_cachingCompleted ) _cancel = true; if ( _rendering ) _update = true; // we're rendering, request update from within render loop else updateProperties(); // instant update as we're not rendering } void BaseSynthEvent::unlock() { _locked = false; if ( _updateAfterUnlock ) calculateBuffers(); _updateAfterUnlock = false; } void BaseSynthEvent::calculateBuffers() { if ( _locked ) { _updateAfterUnlock = true; return; } int oldLength; if ( isSequenced ) { _cancel = true; oldLength = _sampleLength; _sampleLength = ( int )( length * ( float ) AudioEngine::bytes_per_tick ); _sampleStart = position * AudioEngine::bytes_per_tick; _sampleEnd = _sampleStart + _sampleLength; } else { // quick releases of a noteOn-instruction should ring for at least a 64th note _minLength = AudioEngine::bytes_per_bar / 64; _sampleLength = AudioEngine::bytes_per_bar; // important for amplitude swell in oldLength = AudioEngineProps::BUFFER_SIZE; // buffer is as long as the engine's buffer size _hasMinLength = false; // keeping track if the min length has been rendered } _adsr->setBufferLength( _sampleLength ); // sample length changed (f.i. tempo change) or buffer not yet created ? // create buffer for (new) sample length if ( _sampleLength != oldLength || _buffer == 0 ) { // note that when event caching is enabled, the buffer is as large as // the total event length requires if ( AudioEngineProps::EVENT_CACHING && isSequenced ) { destroyBuffer(); // clear previous buffer contents _buffer = new AudioBuffer( AudioEngineProps::OUTPUT_CHANNELS, _sampleLength ); } else _buffer = new AudioBuffer( AudioEngineProps::OUTPUT_CHANNELS, AudioEngineProps::BUFFER_SIZE ); } if ( AudioEngineProps::EVENT_CACHING && isSequenced ) { resetCache(); // yes here, not in cache()-invocation as cancels might otherwise remain permanent (see BulkCacher) if ( _autoCache && !_caching ) // re-cache cache( false ); } } /** * synthesize is invoked by the Sequencer for rendering a non-sequenced * BaseSynthEvent into a single buffer * * aBufferLength {int} length of the buffer to synthesize */ AudioBuffer* BaseSynthEvent::synthesize( int aBufferLength ) { // in case buffer length is unequal to cached length, create new write buffer if ( aBufferLength != AudioEngineProps::BUFFER_SIZE || _buffer == 0 ) { destroyBuffer(); _buffer = new AudioBuffer( AudioEngineProps::OUTPUT_CHANNELS, aBufferLength ); } render( _buffer ); // synthesize, also overwrites old buffer contents // keep track of the rendered bytes, in case of a key up event // we still want to have the sound ring for the minimum period // defined in the constructor instead of cut off immediately if ( _queuedForDeletion && _minLength > 0 ) _minLength -= aBufferLength; if ( _minLength <= 0 ) { _hasMinLength = true; setDeletable( _queuedForDeletion ); // this event is about to be deleted, apply a tiny fadeout if ( _queuedForDeletion ) { int amt = ceil( aBufferLength / 4 ); SAMPLE_TYPE envIncr = MAX_PHASE / amt; SAMPLE_TYPE amp = MAX_PHASE; for ( int i = aBufferLength - amt; i < aBufferLength; ++i ) { for ( int c = 0, nc = _buffer->amountOfChannels; c < nc; ++c ) _buffer->getBufferForChannel( c )[ i ] *= amp; amp -= envIncr; } } } return _buffer; } /** * (pre-)cache the contents of the BaseSynthEvent in its entirety * this can be done in idle time to make optimum use of resources */ void BaseSynthEvent::cache( bool doCallback ) { if ( _buffer == 0 ) return; // cache request likely invoked after destruction _caching = true; doCache(); if ( doCallback ) sequencer::bulkCacher->cacheQueue(); } ADSR* BaseSynthEvent::getADSR() { return _adsr; } float BaseSynthEvent::getVolume() { return _volume; } void BaseSynthEvent::setVolume( float aValue ) { _volume = aValue; } /* protected methods */ /** * actual updating of the properties, requested by invalidateProperties * this operation might potentially delete objects that could be in * use during a rendering operation, as such it is invoked from the render */ void BaseSynthEvent::updateProperties() { // ADSR envelopes _adsr->cloneEnvelopes( _instrument->adsr ); calculateBuffers(); _update = false; // we're in sync now :) _cancel = false; } /** * the actual synthesizing of the audio * * @param aOutputBuffer {AudioBuffer*} the buffer to write into */ void BaseSynthEvent::render( AudioBuffer* aOutputBuffer ) { // override in your custom subclass, note that // the body of the function will look somewhat like this: _rendering = true; int bufferLength = aOutputBuffer->bufferSize; int renderStartOffset = AudioEngineProps::EVENT_CACHING && isSequenced ? _cacheWriteIndex : 0; int maxSampleIndex = _sampleLength - 1; // max index possible for this events length int renderEndOffset = renderStartOffset + bufferLength; // max buffer index to be written to in this cycle // keep in bounds of event duration if ( renderEndOffset > maxSampleIndex ) { renderEndOffset = maxSampleIndex; aOutputBuffer->silenceBuffers(); // as we tend to overwrite the incoming buffer } int i; for ( i = renderStartOffset; i < renderEndOffset; ++i ) { // render math goes here SAMPLE_TYPE amp = 0.0; // end of single render iteration, write into output buffer goes here : if ( _update ) updateProperties(); // if an update was requested, do it now (prior to committing to buffer) if ( _cancel ) break; // if a caching cancel was requested, cancel now // -- write the output into the buffers channels for ( int c = 0, ca = aOutputBuffer->amountOfChannels; c < ca; ++c ) aOutputBuffer->getBufferForChannel( c )[ i ] = amp * _volume; } // apply ADSR envelopes and update cacheWriteIndex for next render cycle _adsr->apply( aOutputBuffer, _cacheWriteIndex ); _cacheWriteIndex += i; if ( AudioEngineProps::EVENT_CACHING ) { if ( isSequenced ) { _caching = false; // was a cancel requested ? re-cache to match the new instrument properties (cancel // may only be requested during the changing of properties!) if ( _cancel ) { //calculateBuffers(); // no, use a manual invocation (BulkCacher) } else { if ( i == maxSampleIndex ) _cachingCompleted = true; if ( _bulkCacheable ) _autoCache = true; } } } _cancel = false; // ensure we can render for the next iteration _rendering = false; } void BaseSynthEvent::setDeletable( bool value ) { // pre buffered event or rendered min length ? schedule for immediate deletion if ( isSequenced || _hasMinLength ) _deleteMe = value; else _queuedForDeletion = value; } /** * @param aInstrument pointer to the SynthInstrument containing the rendering properties for the BaseSynthEvent * @param aFrequency frequency in Hz for the note to be rendered * @param aPosition offset in the sequencer where this event starts playing / becomes audible * @param aLength length of the event (in sequencer steps) * @param aIsSequenced whether this event is sequenced and only audible in a specific sequence range */ void BaseSynthEvent::init( SynthInstrument *aInstrument, float aFrequency, int aPosition, int aLength, bool aIsSequenced ) { _destroyableBuffer = true; // synth event buffer is always unique and managed by this instance ! _instrument = aInstrument; _adsr = aInstrument->adsr != 0 ? aInstrument->adsr->clone() : new ADSR(); // when instrument has no fixed length and the decay is short // we deactivate the decay envelope completely (for now) if ( !aIsSequenced && _adsr->getDecay() < .75 ) _adsr->setDecay( 0 ); _buffer = 0; _locked = false; position = aPosition; length = aLength; isSequenced = aIsSequenced; _queuedForDeletion = false; _deleteMe = false; _update = false; _cancel = false; // whether we should cancel caching _hasMinLength = isSequenced; // a sequenced event has no early cancel _caching = false; _cachingCompleted = false; // whether we're done caching _autoCache = false; // we'll cache sequentially instead _rendering = false; _volume = aInstrument->volume; _sampleLength = 0; _cacheWriteIndex = 0; setFrequency( aFrequency ); calculateBuffers(); addToSequencer(); } void BaseSynthEvent::addToSequencer() { // adds the event to the sequencer so it can be heard if ( isSequenced ) _instrument->audioEvents->push_back( this ); else _instrument->liveAudioEvents->push_back( this ); } void BaseSynthEvent::removeFromSequencer() { if ( !isSequenced ) { for ( int i; i < _instrument->liveAudioEvents->size(); i++ ) { if ( _instrument->liveAudioEvents->at( i ) == this ) { _instrument->liveAudioEvents->erase( _instrument->liveAudioEvents->begin() + i ); break; } } } else { for ( int i; i < _instrument->audioEvents->size(); i++ ) { if ( _instrument->audioEvents->at( i ) == this ) { _instrument->audioEvents->erase( _instrument->audioEvents->begin() + i ); break; } } } } /** * render the event into the buffer and cache its * contents for the given bufferLength (we can cache * buffer fragments on demand, or all at once) */ void BaseSynthEvent::doCache() { render( _buffer ); }
32.297143
121
0.630573
scottmccain
1cf9552c81aebe439df5d6232a43a2b649d91b46
286
cpp
C++
events/DisconnectPlayerEvent.cpp
deb0ch/R-Type
8bb37cd5ec318efb97119afb87d4996f6bb7644e
[ "WTFPL" ]
5
2016-03-15T20:14:10.000Z
2020-10-30T23:56:24.000Z
events/DisconnectPlayerEvent.cpp
deb0ch/R-Type
8bb37cd5ec318efb97119afb87d4996f6bb7644e
[ "WTFPL" ]
3
2018-12-19T19:12:44.000Z
2020-04-02T13:07:00.000Z
events/DisconnectPlayerEvent.cpp
deb0ch/R-Type
8bb37cd5ec318efb97119afb87d4996f6bb7644e
[ "WTFPL" ]
2
2016-04-11T19:29:28.000Z
2021-11-26T20:53:22.000Z
#include "DisconnectPlayerEvent.hh" DisconnectPlayerEvent::DisconnectPlayerEvent(unsigned int hash) : AEvent("DisconnectPlayerEvent"), _hash(hash) {} DisconnectPlayerEvent::~DisconnectPlayerEvent() {} unsigned int DisconnectPlayerEvent::getRemoteId() const { return this->_hash; }
22
110
0.797203
deb0ch
7f2e9d5841d3e43121f5aa0cadb8d9ff159623bb
788
cpp
C++
src/Server/Ph0enix-Server/Agent.cpp
SKGP/EDR
da4cb02afe164d38014a3616e7cff8e71ce56965
[ "MIT" ]
6
2021-05-23T13:26:23.000Z
2021-07-27T08:11:29.000Z
src/Server/Ph0enix-Server/Agent.cpp
SKGP/EDR
da4cb02afe164d38014a3616e7cff8e71ce56965
[ "MIT" ]
null
null
null
src/Server/Ph0enix-Server/Agent.cpp
SKGP/EDR
da4cb02afe164d38014a3616e7cff8e71ce56965
[ "MIT" ]
1
2021-05-29T06:22:34.000Z
2021-05-29T06:22:34.000Z
#include "Agent.h" Agent::Agent() { } Agent::~Agent() { } std::string Agent::getIp() { return this->ip; } std::string Agent::getMac() { return this->mac; } std::string Agent::getHostName() { return this->hostName; } int Agent::getReputation() { return this->reputation; } SOCKET Agent::getsocket() { return this->socket; } bool Agent::getActive() { return this->active; } void Agent::setIp(std::string ip) { this->ip = ip; } void Agent::setMac(std::string mac) { this->mac = mac; } void Agent::setHostName(std::string hostName) { this->hostName = hostName; } void Agent::setReputation(int reputation) { this->reputation = reputation; } void Agent::setSocket(SOCKET socket) { this->socket = socket; } void Agent::setActive(bool active) { this->active = active; }
11.257143
45
0.668782
SKGP
7f37d226759fb210eac85a515d9f71aaa5253726
971
cpp
C++
CodeInterviews-SwordOffer/Offer41-Median-of-Dataflow/solution1.cpp
loyio/leetcode
366393c29a434a621592ef6674a45795a3086184
[ "CC0-1.0" ]
null
null
null
CodeInterviews-SwordOffer/Offer41-Median-of-Dataflow/solution1.cpp
loyio/leetcode
366393c29a434a621592ef6674a45795a3086184
[ "CC0-1.0" ]
null
null
null
CodeInterviews-SwordOffer/Offer41-Median-of-Dataflow/solution1.cpp
loyio/leetcode
366393c29a434a621592ef6674a45795a3086184
[ "CC0-1.0" ]
2
2022-01-25T05:31:31.000Z
2022-02-26T07:22:23.000Z
class MedianFinder { public: priority_queue<int, vector<int>, less<int>> maxHeap; priority_queue<int, vector<int>, greater<int>> minHeap; /** initialize your data structure here. */ MedianFinder() { } void addNum(int num) { if(maxHeap.size() == minHeap.size()){ minHeap.push(num); int top = minHeap.top(); minHeap.pop(); maxHeap.push(top); }else{ maxHeap.push(num); int top = maxHeap.top(); maxHeap.pop(); minHeap.push(top); } } double findMedian() { if(maxHeap.size() == minHeap.size()){ return (maxHeap.top() + minHeap.top())*1.0/2; }else{ return maxHeap.top()*1.0; } } }; /** * Your MedianFinder object will be instantiated and called as such: * MedianFinder* obj = new MedianFinder(); * obj->addNum(num); * double param_2 = obj->findMedian(); */
24.897436
68
0.530381
loyio
7f3bbb1b1b870b6214b4494887e9b7170561a50c
833
hpp
C++
genfile/include/genfile/SNPPositionInRangeTest.hpp
gavinband/bingwa
d52e166b3bb6bc32cd32ba63bf8a4a147275eca1
[ "BSL-1.0" ]
3
2021-04-21T05:42:24.000Z
2022-01-26T14:59:43.000Z
genfile/include/genfile/SNPPositionInRangeTest.hpp
gavinband/bingwa
d52e166b3bb6bc32cd32ba63bf8a4a147275eca1
[ "BSL-1.0" ]
2
2020-04-09T16:11:04.000Z
2020-11-10T11:18:56.000Z
genfile/include/genfile/SNPPositionInRangeTest.hpp
gavinband/qctool
8d8adb45151c91f953fe4a9af00498073b1132ba
[ "BSL-1.0" ]
null
null
null
// Copyright Gavin Band 2008 - 2012. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef SNPPOSITIONINRANGETEST_HPP #define SNPPOSITIONINRANGETEST_HPP #include <set> #include <string> #include "genfile/GenomePosition.hpp" #include "genfile/GenomePositionRange.hpp" #include "genfile/VariantIdentifyingDataTest.hpp" namespace genfile { // Test if the given SNP is in the given (closed) range of positions. struct SNPPositionInRangeTest: public VariantIdentifyingDataTest { SNPPositionInRangeTest( GenomePositionRange const range ) ; bool operator()( VariantIdentifyingData const& data ) const ; std::string display() const ; private: GenomePositionRange const m_range ; } ; } #endif
28.724138
70
0.757503
gavinband
7f3e0af4fd178c06656c65fe128efe2248347a09
2,303
hh
C++
gazebo/rendering/LensFlare.hh
traversaro/gazebo
6fd426b3949c4ca73fa126cde68f5cc4a59522eb
[ "ECL-2.0", "Apache-2.0" ]
2
2021-09-04T07:42:58.000Z
2021-10-01T07:00:46.000Z
gazebo/rendering/LensFlare.hh
traversaro/gazebo
6fd426b3949c4ca73fa126cde68f5cc4a59522eb
[ "ECL-2.0", "Apache-2.0" ]
1
2020-06-04T10:26:04.000Z
2020-06-04T10:26:04.000Z
gazebo/rendering/LensFlare.hh
traversaro/gazebo
6fd426b3949c4ca73fa126cde68f5cc4a59522eb
[ "ECL-2.0", "Apache-2.0" ]
2
2019-11-10T07:19:09.000Z
2019-11-21T19:11:11.000Z
/* * Copyright (C) 2017 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef GAZEBO_RENDERING_LENSFLARE_HH_ #define GAZEBO_RENDERING_LENSFLARE_HH_ #include <memory> #include "gazebo/msgs/msgs.hh" #include "gazebo/rendering/RenderTypes.hh" #include "gazebo/util/system.hh" namespace gazebo { /// \ingroup gazebo_rendering /// \brief Rendering namespace namespace rendering { class LensFlarePrivate; /// \addtogroup gazebo_rendering Rendering /// \{ /// \class LensFlare LensFlare.hh rendering/rendering.hh /// \brief Camera lens flare compositor. This lens flare effect does not /// perform any depth checking so if the directional light is occluded by an /// object in the scene, lens flare will pass through the object. The lens /// flare's color is set by the shaders and not exposed through an API in /// this class. class GZ_RENDERING_VISIBLE LensFlare { /// \brief Constructor public: LensFlare(); /// \brief Destructor public: virtual ~LensFlare(); /// \brief Set the camera which lensFlare will be applied to. /// \param[in] _camera Camera to be distorted public: void SetCamera(CameraPtr _camera); /// \brief Set the scale of lens flare. Must be greater than 0. /// \param[in] _scale Scale of lens flare public: void SetScale(const double _scale); /// \brief Update function to search light source private: void Update(); /// \brief Request callback /// \param[in] _msg The message data. private: void OnRequest(ConstRequestPtr &_msg); /// \internal /// \brief Pointer to private data. private: std::unique_ptr<LensFlarePrivate> dataPtr; }; /// \} } } #endif
30.302632
80
0.689101
traversaro
7f4409bb279d27d75306c5fd42d79a9bbf3143eb
1,894
cpp
C++
src/allocation_wrapper.cpp
falcon-computing/bwa-flow
e710e7d06e4e1f2d69490e408a73af04a11b79de
[ "Apache-2.0" ]
null
null
null
src/allocation_wrapper.cpp
falcon-computing/bwa-flow
e710e7d06e4e1f2d69490e408a73af04a11b79de
[ "Apache-2.0" ]
null
null
null
src/allocation_wrapper.cpp
falcon-computing/bwa-flow
e710e7d06e4e1f2d69490e408a73af04a11b79de
[ "Apache-2.0" ]
null
null
null
#include <stdlib.h> /* Avoid breaking the usual definitions */ #include <stdio.h> #include <string.h> #include <stdexcept> #include <errno.h> #include <glog/logging.h> #include "allocation_wrapper.h" #ifdef calloc # undef calloc #endif void *calloc_wrapper(size_t nmemb, size_t size, const char *file, unsigned int line, const char *func) { void *p = calloc(nmemb, size); if (NULL == p) { std::string err_string = "Memory allocation failed"; if (errno==12) err_string += " due to out-of-memory"; else err_string += " due to internal failure"; throw std::runtime_error(err_string); } return p; } #ifdef malloc # undef malloc #endif void *malloc_wrapper(size_t size, const char *file, unsigned int line, const char *func) { void *p = malloc(size); if (NULL == p) { std::string err_string = "Memory allocation failed"; if (errno==12) err_string += " due to out-of-memory"; else err_string += " due to internal failure"; throw std::runtime_error(err_string); } return p; } #ifdef realloc # undef realloc #endif void *realloc_wrapper(void *ptr, size_t size, const char *file, unsigned int line, const char *func) { void *p = realloc(ptr, size); if (NULL == p) { std::string err_string = "Memory allocation failed"; if (errno==12) err_string += " due to out-of-memory"; else err_string += " due to internal failure"; throw std::runtime_error(err_string); } return p; } #ifdef strdup # undef strdup #endif char *strdup_wrapper(const char *s, const char *file, unsigned int line, const char *func) { char *p = strdup(s); if (NULL == p) { std::string err_string = "Memory allocation failed"; if (errno==12) err_string += " due to out-of-memory"; else err_string += " due to internal failure"; throw std::runtime_error(err_string); } return p; }
25.945205
104
0.653643
falcon-computing
7f4a041a282e53a4b2bf70ace30f418d40c181ab
1,521
cc
C++
src/q_251_300/q0283.cc
vNaonLu/daily-leetcode
2830c2cd413d950abe7c6d9b833c771f784443b0
[ "MIT" ]
2
2021-09-28T18:41:03.000Z
2021-09-28T18:42:57.000Z
src/q_251_300/q0283.cc
vNaonLu/Daily_LeetCode
30024b561611d390931cef1b22afd6a5060cf586
[ "MIT" ]
16
2021-09-26T11:44:20.000Z
2021-11-28T06:44:02.000Z
src/q_251_300/q0283.cc
vNaonLu/daily-leetcode
2830c2cd413d950abe7c6d9b833c771f784443b0
[ "MIT" ]
1
2021-11-22T09:11:36.000Z
2021-11-22T09:11:36.000Z
#include <gtest/gtest.h> #include <iostream> #include <vector> using namespace std; /** * This file is generated by leetcode_add.py v1.0 * * 283. * Move Zeroes * * ––––––––––––––––––––––––––––– Description ––––––––––––––––––––––––––––– * * Given an integer array ‘nums’ , move all ‘0’ 's to the end of it while * maintaining the relative order of the non-zero * “Note” that you must do this in-place without making a copy of the * array. * * ––––––––––––––––––––––––––––– Constraints ––––––––––––––––––––––––––––– * * • ‘1 ≤ nums.length ≤ 10⁴’ * • ‘-2³¹ ≤ nums[i] ≤ 2³¹ - 1’ * */ struct q283 : public ::testing::Test { // Leetcode answer here class Solution { public: void moveZeroes(vector<int>& nums) { int fillindex = -1; for (int i = 0; i < nums.size(); ++i) { if (nums[i] != 0) { nums[++fillindex] = nums[i]; } } while (fillindex < nums.size() - 1) { nums[++fillindex] = 0; } } }; class Solution *solution; }; TEST_F(q283, sample_input01) { solution = new Solution(); vector<int> nums = {0, 1, 0, 3, 12}; vector<int> exp = {1, 3, 12, 0, 0}; solution->moveZeroes(nums); // Assume the first argument is answer. EXPECT_EQ(nums, exp); delete solution; } TEST_F(q283, sample_input02) { solution = new Solution(); vector<int> nums = {0}; vector<int> exp = {0}; solution->moveZeroes(nums); // Assume the first argument is answer. EXPECT_EQ(nums, exp); delete solution; }
23.4
75
0.543064
vNaonLu
7f4f0c4c4540f7d0e805f59e01bccc6884ead5b3
1,911
cpp
C++
Logger.cpp
ufix-performance/ufix
220f00bfced2c9dd31e51d2f6d7ce9d7d3edf0bb
[ "Apache-2.0" ]
null
null
null
Logger.cpp
ufix-performance/ufix
220f00bfced2c9dd31e51d2f6d7ce9d7d3edf0bb
[ "Apache-2.0" ]
null
null
null
Logger.cpp
ufix-performance/ufix
220f00bfced2c9dd31e51d2f6d7ce9d7d3edf0bb
[ "Apache-2.0" ]
null
null
null
#include <execinfo.h> #include "Logger.h" #include "utils.h" #include "constants.h" namespace ufix { Logger::Logger() { reset(); } void Logger::reset() { log_file = NULL; } void Logger::set_log_file(FILE * file) { if (log_file == NULL) { log_file = file; } } void Logger::fatal(const char * msg) { char time[32]; format_time(time); fprintf(log_file, "%s FATAL: %s\n", time, msg); void* callstack[128]; int i, frames = backtrace(callstack, 128); char** strs = backtrace_symbols(callstack, frames); for (i = 0; i < frames; ++i) { fprintf(log_file, "%s\n", strs[i]); } free(strs); fflush(log_file); exit(-1); } void Logger::error(const char * msg) { char time[32]; format_time(time); fprintf(log_file, "%s ERROR: %s\n", time, msg); fflush(log_file); } void Logger::warn(const char * msg) { char time[32]; format_time(time); fprintf(log_file, "%s WARN: %s\n", time, msg); fflush(log_file); } void Logger::info(const char * msg) { char time[32]; format_time(time); fprintf(log_file, "%s INFO: %s\n", time, msg); fflush(log_file); } void Logger::session_msg_sent(WMessage * msg) { int len; const char * data = msg->get_data(len); char time[32]; format_time(time); fprintf(log_file, "%s SS -> %.*s\n", time, len, data); fflush(log_file); } void Logger::session_msg_recv(RMessage * msg) { int len; const char * data = msg->get_data(len); char time[32]; format_time(time); fprintf(log_file, "%s SS <- %.*s\n", time, len, data); fflush(log_file); } void Logger::msg_error(const char * msg, int len, const char * error) { char time[32]; format_time(time); fprintf(log_file, "%s ERR %.*s. ERROR msg: %s\n", time, len, msg, error); fflush(log_file); } }
22.75
81
0.577185
ufix-performance
7f53e434568b0723e58ecb4111a2a05c383f41be
2,902
cpp
C++
loader.cpp
fuadsaud/objviewer
56d1e427319ac706d80adb6b1675986839b4ccb6
[ "MIT" ]
1
2017-03-09T21:46:37.000Z
2017-03-09T21:46:37.000Z
loader.cpp
fuadsaud/objviewer
56d1e427319ac706d80adb6b1675986839b4ccb6
[ "MIT" ]
null
null
null
loader.cpp
fuadsaud/objviewer
56d1e427319ac706d80adb6b1675986839b4ccb6
[ "MIT" ]
null
null
null
#include "loader.h" obj::loader::loader(std::string p) { path = p.c_str(); } void obj::loader::load(obj::mesh * m) { std::ifstream in(path.c_str()); obj::group * g = new obj::group(); m->push_group(g); obj::vertex * v; obj::vertex2 * t; obj::face * face; std::vector<std::string> f; std::vector<std::string> tokens; while (!in.eof()) { std::string line; std::getline(in, line); if (line.empty()) continue; tokens = split(line, ' ', false); switch(line[0]) { case 'v': if (tokens.size() > 3) { switch (line[1]) { case 't': m->push_texture(new obj::vertex2( atof(tokens.at(1).c_str()), atof(tokens.at(2).c_str()))); case 'n': v = new obj::vertex( atof(tokens.at(1).c_str()), atof(tokens.at(2).c_str()), atof(tokens.at(3).c_str())); m->push_normal(v); break; default: v = new obj::vertex( atof(tokens.at(1).c_str()), atof(tokens.at(2).c_str()), atof(tokens.at(3).c_str())); m->push_vertex(v); break; } } else { m->push_texture(t); } break; case 'f': face = new obj::face(); for (int i = 1; i < tokens.size(); i++) { f = split(tokens[i], '/', true); face->push_vertex(atoi(f[0].c_str()) - 1); if (f.size() > 1 && !f[1].empty()) { face->push_texture(atoi(f[1].c_str()) - 1); } if (f.size() > 2) { face->push_normal(atoi(f[2].c_str()) - 1); } } g->push_face(face); break; case 'g': if (!g->get_faces().empty()) { if (tokens.size() == 1) { g = new obj::group(); } else { g = new obj::group(tokens.at(1)); } m->push_group(g); } break; case 'm': m->set_material_library("fixtures/" + tokens[1]); break; case 'u': std::string material = std::string(tokens[1]); g->set_material(material); break; } } }
28.732673
69
0.334941
fuadsaud
7f540df80152a6685c264bbf2d069c73c6e025d3
5,830
cpp
C++
src/Ihm/colorline.cpp
grea09/dirige
cffd6f1b2d993d7e49b54c6da59ae03b1346c01b
[ "MIT" ]
1
2015-12-26T08:20:50.000Z
2015-12-26T08:20:50.000Z
src/Ihm/colorline.cpp
grea09/dirige
cffd6f1b2d993d7e49b54c6da59ae03b1346c01b
[ "MIT" ]
null
null
null
src/Ihm/colorline.cpp
grea09/dirige
cffd6f1b2d993d7e49b54c6da59ae03b1346c01b
[ "MIT" ]
null
null
null
/**************************************************************************** ** ** Copyright 2010 Antoine GRÉA <grea09@gmail.com> ** ** $QT_BEGIN_LICENSE:LGPL$ ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, ** MA 02110-1301, USA. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "colorline.h" using namespace Ihm; /*! Titre \project DiRIGe \class ColorLine \ingroup Ihm \brief Une classe pour afficher une ligne de gestion de couleur. \author Copyright 2010 Antoine GRÉA <grea09@gmail.com> \sa ToolBarColor, BitMap::ColorCost, {IHM} */ //Constants //{ const int ColorLine::SliderTickInterval = 50; const int ColorLine::SpinBoxMax = 400; const int ColorLine::SpinBoxMin = 0; const int ColorLine::SpinBoxDef = 100; const QString ColorLine::SpinBoxSuffix = "%"; const QString ColorLine::CheckBoxText = "Passante"; const QSize ColorLine::FixedSize = QSize(32,32 * 3); //} //Builders //{ ColorLine::ColorLine(QWidget* parent, Bitmap::ColorCost* colorCost) : QToolBar(parent), colorCost_(colorCost), buttonColor_(this) { debugsub(ENTER); if(!colorCost_) { colorCost_ = new Bitmap::ColorCost(Qt::black,-1); editColor(); } build(); } //} //Destroyers //{ //{ //Getters //{ //~ QAction* ColorLine::getActionDelColor() //~ { //~ //~ return actionDelColor_; //~ //~ } //~ //~ QAction* ColorLine::getActionEditColor() //~ { //~ //~ return actionEditColor_; //~ //~ } Bitmap::ColorCost* ColorLine::getColorCost() { debugsub(ENTER); debugV(colorCost_); debugsub(EXIT_SUCCESS); return colorCost_; } QColor ColorLine::getColor() { debugsub(ENTER); debugV(colorCost_); debugsub(EXIT_SUCCESS); return colorCost_->getColor(); } //} //Setters //{ void ColorLine::setColorCost(Bitmap::ColorCost colorCost) { debugsub(ENTER); delete colorCost_; colorCost_ = new Bitmap::ColorCost(colorCost); debugsub(EXIT_SUCCESS); } void ColorLine::setPassable(bool state) { debugsub(ENTER); colorCost_->setCost((state)?(spinBox_->value()):(-1)); passable_->setChecked(state); debugsub(EXIT_SUCCESS); } void ColorLine::setCost(int cost) { debugsub(ENTER); passable_->setChecked(true); colorCost_->setCost(cost); debugsub(EXIT_SUCCESS); } void ColorLine::setColor(QColor color) { debugsub(ENTER); QEvent* event = new QEvent(QEvent::None); emit colorAuthorization(color,event,this); if (event->isAccepted()) { colorCost_->setColor(color); emit colorIt(color); buttonColor_.setColor(color); } delete event; debugsub(EXIT_SUCCESS); } //} //Processing //{ void ColorLine::build() { debugsub(ENTER); buttonColor_.setColor(colorCost_->getColor()); slider_ = new QSlider(Qt::Horizontal,this); slider_->setRange ( SpinBoxMin, SpinBoxMax ); slider_->setTickInterval(SliderTickInterval); slider_->setTickPosition( QSlider::TicksBothSides ); slider_->setValue( SpinBoxDef ); spinBox_ = new QSpinBox(this); spinBox_->setRange ( SpinBoxMin, SpinBoxMax ); spinBox_->setValue ( SpinBoxDef ); spinBox_->setSuffix ( SpinBoxSuffix ); passable_ = new QGroupBox(CheckBoxText,this); passable_->setCheckable(true); passable_->setChecked(colorCost_->getCost() == -1); passable_->setFlat(true); passable_->setVisible(true); QVBoxLayout* passableLayout = new QVBoxLayout; passableLayout->addWidget(spinBox_); passableLayout->addWidget(slider_); passable_->setLayout(passableLayout); actionDelColor_ = new QAction(QIcon(":/images/color-delete.png"),"Supprimer la couleur",(QWidget*)this); actionEditColor_ = new QAction(QIcon(":/images/color-edit.png"),QString::fromUtf8("Éditer la couleur"),this); connect(slider_, SIGNAL(valueChanged(int)), spinBox_, SLOT(setValue(int))); connect(spinBox_, SIGNAL(valueChanged(int)), slider_, SLOT(setValue(int))); connect(passable_,SIGNAL(toggled(bool)),this,SLOT(setPassable(bool))); connect(slider_,SIGNAL(valueChanged(int)),this,SLOT(setCost(int))); connect(&buttonColor_,SIGNAL(clicked()),this,SLOT(emitColor())); connect(actionDelColor_,SIGNAL(triggered()),this,SLOT(delColor())); connect(actionEditColor_,SIGNAL(triggered()),this,SLOT(editColor())); this->addWidget(&buttonColor_); this->addWidget(passable_); this->addAction(actionEditColor_); this->addAction(actionDelColor_); //~ this->setFixedSize(FixedSize); this->setPassable(colorCost_->getCost()>0); this->setVisible(true); debugsub(EXIT_SUCCESS); } void ColorLine::delColor() { debugsub(ENTER); emit deleteMe(this); debugsub(EXIT_SUCCESS); } void ColorLine::editColor() { debugsub(ENTER); QColorDialog colorDialog; QColor color = colorDialog.getColor(); if(color.isValid()) { setColor(color); } debugsub(EXIT_SUCCESS); } void ColorLine::emitColor() { debugsub(ENTER); emit colorIt(colorCost_->getColor()); debugsub(EXIT_SUCCESS); } //} //Operators //{ //} //Display //{ //}
21.355311
111
0.66295
grea09
7f54503df223b72945a5ec38fb4c399f5d40dc5c
45,452
cpp
C++
src/game/g_script.cpp
jumptohistory/jaymod
92d0a0334ac27da94b12280b0b42b615b8813c23
[ "Apache-2.0" ]
25
2016-05-27T11:53:58.000Z
2021-10-17T00:13:41.000Z
src/game/g_script.cpp
jumptohistory/jaymod
92d0a0334ac27da94b12280b0b42b615b8813c23
[ "Apache-2.0" ]
1
2016-07-09T05:25:03.000Z
2016-07-09T05:25:03.000Z
src/game/g_script.cpp
jumptohistory/jaymod
92d0a0334ac27da94b12280b0b42b615b8813c23
[ "Apache-2.0" ]
16
2016-05-28T23:06:50.000Z
2022-01-26T13:47:12.000Z
//=========================================================================== // // Name: g_script.c // Function: Wolfenstein Entity Scripting // Programmer: Ridah // Tab Size: 4 (real tabs) //=========================================================================== #include <bgame/impl.h> #include <omnibot/et/g_etbot_interface.h> /* Scripting that allows the designers to control the behaviour of entities according to each different scenario. */ vmCvar_t g_scriptDebug; // //==================================================================== // // action functions need to be declared here so they can be accessed in the scriptAction table qboolean G_ScriptAction_GotoMarker( gentity_t *ent, char *params ); qboolean G_ScriptAction_Wait( gentity_t *ent, char *params ); qboolean G_ScriptAction_Trigger( gentity_t *ent, char *params ); qboolean G_ScriptAction_PlaySound( gentity_t *ent, char *params ); qboolean G_ScriptAction_PlayAnim( gentity_t *ent, char *params ); qboolean G_ScriptAction_AlertEntity( gentity_t *ent, char *params ); qboolean G_ScriptAction_ToggleSpeaker( gentity_t *ent, char *params ); qboolean G_ScriptAction_DisableSpeaker( gentity_t *ent, char *params ); qboolean G_ScriptAction_EnableSpeaker( gentity_t *ent, char *params ); qboolean G_ScriptAction_Accum( gentity_t *ent, char *params ); qboolean G_ScriptAction_GlobalAccum( gentity_t *ent, char *params ); qboolean G_ScriptAction_Print( gentity_t *ent, char *params ); qboolean G_ScriptAction_FaceAngles( gentity_t *ent, char *params ); qboolean G_ScriptAction_ResetScript( gentity_t *ent, char *params ); qboolean G_ScriptAction_TagConnect( gentity_t *ent, char *params ); qboolean G_ScriptAction_Halt( gentity_t *ent, char *params ); qboolean G_ScriptAction_StopSound( gentity_t *ent, char *params ); //qboolean G_ScriptAction_StartCam( gentity_t *ent, char *params ); qboolean G_ScriptAction_EntityScriptName( gentity_t *ent, char *params); qboolean G_ScriptAction_AIScriptName( gentity_t *ent, char *params); qboolean G_ScriptAction_AxisRespawntime( gentity_t *ent, char *params ); qboolean G_ScriptAction_AlliedRespawntime( gentity_t *ent, char *params ); qboolean G_ScriptAction_NumberofObjectives( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetWinner( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetDefendingTeam( gentity_t *ent, char *params ); qboolean G_ScriptAction_Announce( gentity_t *ent, char *params ); qboolean G_ScriptAction_Announce_Icon( gentity_t *ent, char *params ); qboolean G_ScriptAction_AddTeamVoiceAnnounce( gentity_t *ent, char *params ); qboolean G_ScriptAction_RemoveTeamVoiceAnnounce( gentity_t *ent, char *params ); qboolean G_ScriptAction_TeamVoiceAnnounce( gentity_t *ent, char *params ); qboolean G_ScriptAction_EndRound( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetRoundTimelimit( gentity_t *ent, char *params ); qboolean G_ScriptAction_RemoveEntity( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetState( gentity_t *ent, char *params ); qboolean G_ScriptAction_VoiceAnnounce( gentity_t *ent, char *params); qboolean G_ScriptAction_FollowSpline( gentity_t *ent, char *params ); qboolean G_ScriptAction_FollowPath( gentity_t *ent, char *params ); qboolean G_ScriptAction_AbortMove( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetSpeed( gentity_t* ent, char *params ); qboolean G_ScriptAction_SetRotation( gentity_t* ent, char *params ); qboolean G_ScriptAction_StopRotation( gentity_t* ent, char *params ); qboolean G_ScriptAction_StartAnimation( gentity_t* ent, char *params ); qboolean G_ScriptAction_AttatchToTrain( gentity_t* ent, char *params ); qboolean G_ScriptAction_FreezeAnimation( gentity_t* ent, char *params ); qboolean G_ScriptAction_UnFreezeAnimation( gentity_t* ent, char *params ); qboolean G_ScriptAction_ShaderRemap( gentity_t* ent, char *params ); qboolean G_ScriptAction_ShaderRemapFlush( gentity_t* ent, char *params ); qboolean G_ScriptAction_ChangeModel( gentity_t* ent, char *params ); qboolean G_ScriptAction_SetChargeTimeFactor( gentity_t* ent, char *params ); qboolean G_ScriptAction_SetDamagable( gentity_t *ent, char *params ); qboolean G_ScriptAction_StartCam( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetInitialCamera( gentity_t *ent, char *params ); qboolean G_ScriptAction_StopCam( gentity_t *ent, char *params ); qboolean G_ScriptAction_RepairMG42( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetHQStatus( gentity_t *ent, char *params ); qboolean G_ScriptAction_PrintAccum(gentity_t *ent, char *params ); qboolean G_ScriptAction_PrintGlobalAccum(gentity_t *ent, char *params ); qboolean G_ScriptAction_BotDebugging(gentity_t *ent, char *params ); qboolean G_ScriptAction_ObjectiveStatus( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetModelFromBrushmodel( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetPosition( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetAutoSpawn( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetMainObjective( gentity_t *ent, char *params ); qboolean G_ScriptAction_SpawnRubble( gentity_t *ent, char *params ); qboolean G_ScriptAction_AllowTankExit( gentity_t *ent, char *params ); qboolean G_ScriptAction_AllowTankEnter( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetTankAmmo( gentity_t *ent, char *params ); qboolean G_ScriptAction_AddTankAmmo( gentity_t *ent, char *params ); qboolean G_ScriptAction_Kill( gentity_t *ent, char *params ); qboolean G_ScriptAction_DisableMessage( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetGlobalFog( gentity_t *ent, char *params ); qboolean G_ScriptAction_Cvar( gentity_t *ent, char *params ); qboolean G_ScriptAction_AbortIfWarmup( gentity_t *ent, char *params ); qboolean G_ScriptAction_AbortIfNotSinglePlayer( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicStart( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicPlay( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicStop( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicQueue( gentity_t *ent, char *params ); qboolean G_ScriptAction_MusicFade( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetDebugLevel( gentity_t *ent, char *params ); qboolean G_ScriptAction_FadeAllSounds( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetBotGoalState( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetBotGoalPriority( gentity_t *ent, char *params ); qboolean G_ScriptAction_SetAASState( gentity_t *ent, char *params ); qboolean G_ScriptAction_Construct(gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleClass( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleChargeBarReq( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleConstructXPBonus( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleDestructXPBonus( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleHealth( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleWeaponclass( gentity_t *ent, char *params ) ; qboolean G_ScriptAction_ConstructibleDuration( gentity_t *ent, char *params ) ; //bani qboolean etpro_ScriptAction_SetValues( gentity_t *ent, char *params ); qboolean etpro_ScriptAction_Create( gentity_t *ent, char *params ); qboolean etpro_ScriptAction_DeleteEntity( gentity_t *ent, char *params ); // these are the actions that each event can call g_script_stack_action_t gScriptActions[] = { {"gotomarker", G_ScriptAction_GotoMarker}, {"playsound", G_ScriptAction_PlaySound}, {"playanim", G_ScriptAction_PlayAnim}, {"wait", G_ScriptAction_Wait}, {"trigger", G_ScriptAction_Trigger}, {"alertentity", G_ScriptAction_AlertEntity}, {"togglespeaker", G_ScriptAction_ToggleSpeaker}, {"disablespeaker", G_ScriptAction_DisableSpeaker}, {"enablespeaker", G_ScriptAction_EnableSpeaker}, {"accum", G_ScriptAction_Accum}, {"globalaccum", G_ScriptAction_GlobalAccum}, {"print", G_ScriptAction_Print}, {"faceangles", G_ScriptAction_FaceAngles}, {"resetscript", G_ScriptAction_ResetScript}, {"attachtotag", G_ScriptAction_TagConnect}, {"halt", G_ScriptAction_Halt}, {"stopsound", G_ScriptAction_StopSound}, // {"startcam", G_ScriptAction_StartCam}, {"entityscriptname", G_ScriptAction_EntityScriptName}, {"aiscriptname", G_ScriptAction_AIScriptName}, {"wm_axis_respawntime", G_ScriptAction_AxisRespawntime}, {"wm_allied_respawntime", G_ScriptAction_AlliedRespawntime}, {"wm_number_of_objectives", G_ScriptAction_NumberofObjectives}, {"wm_setwinner", G_ScriptAction_SetWinner}, {"wm_set_defending_team", G_ScriptAction_SetDefendingTeam}, {"wm_announce", G_ScriptAction_Announce}, {"wm_teamvoiceannounce", G_ScriptAction_TeamVoiceAnnounce}, {"wm_addteamvoiceannounce", G_ScriptAction_AddTeamVoiceAnnounce}, {"wm_removeteamvoiceannounce", G_ScriptAction_RemoveTeamVoiceAnnounce}, {"wm_announce_icon", G_ScriptAction_Announce_Icon}, {"wm_endround", G_ScriptAction_EndRound}, {"wm_set_round_timelimit", G_ScriptAction_SetRoundTimelimit}, {"wm_voiceannounce", G_ScriptAction_VoiceAnnounce}, {"wm_objective_status", G_ScriptAction_ObjectiveStatus}, {"wm_set_main_objective", G_ScriptAction_SetMainObjective}, {"remove", G_ScriptAction_RemoveEntity}, {"setstate", G_ScriptAction_SetState}, {"followspline", G_ScriptAction_FollowSpline}, {"followpath", G_ScriptAction_FollowPath}, {"abortmove", G_ScriptAction_AbortMove}, {"setspeed", G_ScriptAction_SetSpeed}, {"setrotation", G_ScriptAction_SetRotation}, {"stoprotation", G_ScriptAction_StopRotation}, {"startanimation", G_ScriptAction_StartAnimation}, {"attatchtotrain", G_ScriptAction_AttatchToTrain}, {"freezeanimation", G_ScriptAction_FreezeAnimation}, {"unfreezeanimation", G_ScriptAction_UnFreezeAnimation}, {"remapshader", G_ScriptAction_ShaderRemap}, {"remapshaderflush", G_ScriptAction_ShaderRemapFlush}, {"changemodel", G_ScriptAction_ChangeModel}, {"setchargetimefactor", G_ScriptAction_SetChargeTimeFactor}, {"setdamagable", G_ScriptAction_SetDamagable}, {"startcam", G_ScriptAction_StartCam}, {"SetInitialCamera", G_ScriptAction_SetInitialCamera}, {"stopcam", G_ScriptAction_StopCam}, {"repairmg42", G_ScriptAction_RepairMG42}, {"sethqstatus", G_ScriptAction_SetHQStatus}, {"printaccum", G_ScriptAction_PrintAccum}, {"printglobalaccum", G_ScriptAction_PrintGlobalAccum}, {"botgebugging", G_ScriptAction_BotDebugging}, {"cvar", G_ScriptAction_Cvar}, {"abortifwarmup", G_ScriptAction_AbortIfWarmup}, {"abortifnotsingleplayer", G_ScriptAction_AbortIfNotSinglePlayer}, {"mu_start", G_ScriptAction_MusicStart}, {"mu_play", G_ScriptAction_MusicPlay}, {"mu_stop", G_ScriptAction_MusicStop}, {"mu_queue", G_ScriptAction_MusicQueue}, {"mu_fade", G_ScriptAction_MusicFade}, {"setdebuglevel", G_ScriptAction_SetDebugLevel}, {"setposition", G_ScriptAction_SetPosition}, {"setautospawn", G_ScriptAction_SetAutoSpawn}, // Gordon: going for longest silly script command ever here :) (sets a model for a brush to one stolen from a func_brushmodel {"setmodelfrombrushmodel", G_ScriptAction_SetModelFromBrushmodel}, // fade all sounds up or down {"fadeallsounds", G_ScriptAction_FadeAllSounds}, {"setbotgoalstate", G_ScriptAction_SetBotGoalState}, {"setbotgoalpriority", G_ScriptAction_SetBotGoalPriority}, {"setaasstate", G_ScriptAction_SetAASState}, {"construct", G_ScriptAction_Construct}, {"spawnrubble", G_ScriptAction_SpawnRubble}, {"setglobalfog", G_ScriptAction_SetGlobalFog}, {"allowtankexit", G_ScriptAction_AllowTankExit}, {"allowtankenter", G_ScriptAction_AllowTankEnter}, {"settankammo", G_ScriptAction_SetTankAmmo}, {"addtankammo", G_ScriptAction_AddTankAmmo}, {"kill", G_ScriptAction_Kill}, {"disablemessage", G_ScriptAction_DisableMessage}, //bani { "set", etpro_ScriptAction_SetValues }, { "create", etpro_ScriptAction_Create }, { "delete", etpro_ScriptAction_DeleteEntity }, { "constructible_class", G_ScriptAction_ConstructibleClass }, { "constructible_chargebarreq", G_ScriptAction_ConstructibleChargeBarReq }, { "constructible_constructxpbonus", G_ScriptAction_ConstructibleConstructXPBonus }, { "constructible_destructxpbonus", G_ScriptAction_ConstructibleDestructXPBonus }, { "constructible_health", G_ScriptAction_ConstructibleHealth }, { "constructible_weaponclass", G_ScriptAction_ConstructibleWeaponclass }, { "constructible_duration" , G_ScriptAction_ConstructibleDuration }, {NULL, NULL} }; static qboolean G_Script_EventMatch_StringEqual( g_script_event_t *event, const char* eventParm ); static qboolean G_Script_EventMatch_IntInRange( g_script_event_t *event, const char* eventParm ); // the list of events that can start an action sequence g_script_event_define_t gScriptEvents[] = { {"spawn", NULL}, // called as each character is spawned into the game {"trigger", G_Script_EventMatch_StringEqual}, // something has triggered us (always followed by an identifier) {"pain", G_Script_EventMatch_IntInRange}, // we've been hurt {"death", NULL}, // RIP {"activate", G_Script_EventMatch_StringEqual}, // something has triggered us [activator team] {"stopcam", NULL}, {"playerstart", NULL}, {"built", G_Script_EventMatch_StringEqual}, {"buildstart", G_Script_EventMatch_StringEqual}, {"decayed", G_Script_EventMatch_StringEqual}, {"destroyed", G_Script_EventMatch_StringEqual}, {"rebirth", NULL}, {"failed", NULL}, {"dynamited", NULL}, {"defused", NULL}, {"mg42", G_Script_EventMatch_StringEqual}, {"message", G_Script_EventMatch_StringEqual}, // contains a sequence of VO in a message {"exploded", NULL}, {NULL, NULL} }; /* =============== G_Script_EventMatch_StringEqual =============== */ static qboolean G_Script_EventMatch_StringEqual( g_script_event_t *event, const char* eventParm ) { if (eventParm && !Q_stricmp( event->params, eventParm )) return qtrue; else return qfalse; } /* =============== G_Script_EventMatch_IntInRange =============== */ static qboolean G_Script_EventMatch_IntInRange( g_script_event_t *event, const char* eventParm ) { char* pString, *token; int int1, int2, eInt; // get the cast name pString = (char*)eventParm; token = COM_ParseExt( &pString, qfalse ); int1 = atoi( token ); token = COM_ParseExt( &pString, qfalse ); int2 = atoi( token ); eInt = atoi( event->params ); if( eventParm && eInt > int1 && eInt <= int2 ) { return qtrue; } else { return qfalse; } } /* =============== G_Script_EventForString =============== */ int G_Script_EventForString( const char *string ) { int i, hash; hash = BG_StringHashValue_Lwr( string ); for( i = 0; gScriptEvents[i].eventStr; i++) { if( gScriptEvents[i].hash == hash && !Q_stricmp( string, gScriptEvents[i].eventStr ) ) { return i; } } return -1; } /* =============== G_Script_ActionForString =============== */ g_script_stack_action_t *G_Script_ActionForString( char *string ) { int i, hash; hash = BG_StringHashValue_Lwr( string ); for( i = 0; gScriptActions[i].actionString; i++ ) { if( gScriptActions[i].hash == hash && !Q_stricmp( string, gScriptActions[i].actionString ) ) { return &gScriptActions[i]; } } return NULL; } /* ============= G_Script_ScriptLoad Loads the script for the current level into the buffer ============= */ void G_Script_ScriptLoad( void ) { char filename[MAX_QPATH]; vmCvar_t mapname; fileHandle_t f; int len; qboolean found = qfalse; trap_Cvar_Register( &g_scriptDebug, "g_scriptDebug", "0", 0 ); level.scriptEntity = NULL; trap_Cvar_VariableStringBuffer( "g_scriptName", filename, sizeof(filename) ); if (strlen( filename ) > 0) { trap_Cvar_Register( &mapname, "g_scriptName", "", CVAR_CHEAT ); } else { trap_Cvar_Register( &mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM ); } // Jaybird - etpro mapscripts // Check for custom mapscript first if(g_mapScriptDirectory.string[0]) { Q_strncpyz(filename, g_mapScriptDirectory.string, sizeof(filename)); Q_strcat(filename, sizeof(filename), "/"); Q_strcat( filename, sizeof(filename), mapname.string ); if ( g_gametype.integer == GT_WOLF_LMS ) { Q_strcat( filename, sizeof(filename), "_lms" ); } Q_strcat( filename, sizeof(filename), ".script" ); len = trap_FS_FOpenFile( filename, &f, FS_READ ); if(len > 0) found = qtrue; } // If it wasn't found, run the standard script if(!found) { Q_strncpyz( filename, "maps/", sizeof(filename) ); Q_strcat( filename, sizeof(filename), mapname.string ); if ( g_gametype.integer == GT_WOLF_LMS ) { Q_strcat( filename, sizeof(filename), "_lms" ); } Q_strcat( filename, sizeof(filename), ".script" ); len = trap_FS_FOpenFile( filename, &f, FS_READ ); } // make sure we clear out the temporary scriptname trap_Cvar_Set( "g_scriptName", "" ); if( len < 0 ) { return; } // END Mad Doc - TDF // Arnout: make sure we terminate the script with a '\0' to prevent parser from choking //level.scriptEntity = G_Alloc( len ); //trap_FS_Read( level.scriptEntity, len, f ); level.scriptEntity = (char*)G_Alloc( len + 1 ); trap_FS_Read( level.scriptEntity, len, f ); *(level.scriptEntity + len) = '\0'; // Gordon: and make sure ppl haven't put stuff with uppercase in the string table.. G_Script_EventStringInit(); // Gordon: discard all the comments NOW, so we dont deal with them inside scripts // Gordon: disabling for a sec, wanna check if i can get proper line numbers from error output // COM_Compress( level.scriptEntity ); trap_FS_FCloseFile( f ); } /* ============== G_Script_ParseSpawnbot Parses "Spawnbot" command, precaching a custom character if specified ============== */ void G_Script_ParseSpawnbot( char **ppScript, char params[], int paramsize ) { qboolean parsingCharacter = qfalse; char *token; token = COM_ParseExt(ppScript, qfalse ); while( token[0] ) { // if we are currently parsing a spawnbot command, check the parms for // a custom character, which we will need to precache on the client // did we just see a '/character' parm? if( parsingCharacter ) { parsingCharacter = qfalse; G_CharacterIndex( token ); if( !BG_FindCharacter( token ) ) { bg_character_t *character = BG_FindFreeCharacter( token ); Q_strncpyz( character->characterFile, token, sizeof(character->characterFile) ); if( !G_RegisterCharacter( token, character ) ) { G_Error( "ERROR: G_Script_ParseSpawnbot: failed to load character file '%s'\n", token ); } } #ifdef DEBUG G_DPrintf( "precached character %s\n", token ); #endif } else if( !Q_stricmp( token, "/character" ) ) { parsingCharacter = qtrue; } if( strlen( params ) ) // add a space between each param Q_strcat( params, paramsize, " " ); if( strrchr(token,' ' )) // need to wrap this param in quotes since it has more than one word Q_strcat( params, paramsize, "\"" ); Q_strcat( params, paramsize, token ); if( strrchr(token,' ') ) // need to wrap this param in quotes since it has more than one word Q_strcat( params, paramsize, "\"" ); token = COM_ParseExt( ppScript, qfalse ); } } /* ============== G_Script_ScriptParse Parses the script for the given entity ============== */ void G_Script_ScriptParse( gentity_t *ent ) { char *pScript; char *token; qboolean wantName; qboolean inScript; int eventNum; g_script_event_t events[G_MAX_SCRIPT_STACK_ITEMS]; int numEventItems; g_script_event_t *curEvent; // DHM - Nerve :: Some of our multiplayer script commands have longer parameters //char params[MAX_QPATH]; char params[MAX_INFO_STRING]; // dhm - end g_script_stack_action_t *action; int i; int bracketLevel; qboolean buildScript; if (!ent->scriptName) return; if (!level.scriptEntity) return; buildScript = (qboolean)trap_Cvar_VariableIntegerValue( "com_buildScript" ); pScript = level.scriptEntity; wantName = qtrue; inScript = qfalse; COM_BeginParseSession("G_Script_ScriptParse"); bracketLevel = 0; numEventItems = 0; memset( events, 0, sizeof(events) ); while (1) { token = COM_Parse( &pScript ); if ( !token[0] ) { if ( !wantName ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() ); } break; } // end of script if ( token[0] == '}' ) { if ( inScript ) { break; } if ( wantName ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' found, but not expected.\n", COM_GetCurrentParseLine() ); } wantName = qtrue; } else if ( token[0] == '{' ) { if ( wantName ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '{' found, NAME expected.\n", COM_GetCurrentParseLine() ); } } else if ( wantName ) { if ( !Q_stricmp( token, "bot" ) ) { // a bot, skip this whole entry SkipRestOfLine ( &pScript ); // skip this section SkipBracedSection( &pScript ); // continue; } if( !Q_stricmp( token, "entity" ) ) { // this is an entity, so go back to look for a name continue; } if ( !Q_stricmp( ent->scriptName, token ) ) { inScript = qtrue; numEventItems = 0; } wantName = qfalse; } else if ( inScript ) { Q_strlwr( token ); eventNum = G_Script_EventForString( token ); if (eventNum < 0) { G_Error( "G_Script_ScriptParse(), Error (line %d): unknown event: %s.\n", COM_GetCurrentParseLine(), token ); } if( numEventItems >= G_MAX_SCRIPT_STACK_ITEMS ) { G_Error( "G_Script_ScriptParse(), Error (line %d): G_MAX_SCRIPT_STACK_ITEMS reached (%d)\n", COM_GetCurrentParseLine(), G_MAX_SCRIPT_STACK_ITEMS ); } curEvent = &events[numEventItems]; curEvent->eventNum = eventNum; memset( params, 0, sizeof(params) ); // parse any event params before the start of this event's actions while ((token = COM_Parse( &pScript )) != NULL && (token[0] != '{')) { if( !token[0] ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() ); } if(strlen( params )) { // add a space between each param Q_strcat( params, sizeof(params), " " ); } Q_strcat( params, sizeof(params), token ); } if( strlen( params ) ) { // copy the params into the event curEvent->params = (char*)G_Alloc( strlen( params ) + 1 ); Q_strncpyz( curEvent->params, params, strlen(params)+1 ); } // parse the actions for this event while( (token = COM_Parse( &pScript )) != NULL && (token[0] != '}') ) { if( !token[0] ) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() ); } action = G_Script_ActionForString( token ); if( !action ) { G_Error( "G_Script_ScriptParse(), Error (line %d): unknown action: %s.\n", COM_GetCurrentParseLine(), token ); } curEvent->stack.items[curEvent->stack.numItems].action = action; memset( params, 0, sizeof(params) ); // Ikkyo - Parse for {}'s if this is a set command if( !Q_stricmp( action->actionString, "set" ) || !Q_stricmp( action->actionString, "create" ) || !Q_stricmp( action->actionString, "delete" ) ) { token = COM_Parse( &pScript ); if( token[0] != '{' ) { COM_ParseError( "'{' expected, found: %s.\n", token ); } while( ( token = COM_Parse( &pScript ) ) && ( token[0] != '}') ) { if ( strlen( params ) ) // add a space between each param Q_strcat( params, sizeof( params ), " " ); if ( strrchr( token,' ') ) // need to wrap this param in quotes since it has more than one word Q_strcat( params, sizeof( params ), "\"" ); Q_strcat( params, sizeof( params ), token ); if ( strrchr( token,' ') ) // need to wrap this param in quotes since it has mor Q_strcat( params, sizeof( params ), "\"" ); } } else // hackly precaching of custom characters if( !Q_stricmp(token, "spawnbot") ) { // this is fairly indepth, so I'll move it to a separate function for readability G_Script_ParseSpawnbot( &pScript, params, MAX_INFO_STRING ); } else { token = COM_ParseExt( &pScript, qfalse ); for (i=0; token[0]; i++) { if( strlen( params ) ) // add a space between each param Q_strcat( params, sizeof(params), " " ); if( i == 0 ) { // Special case: playsound's need to be cached on startup to prevent in-game pauses if (!Q_stricmp(action->actionString, "playsound")) { G_SoundIndex(token); } else if (!Q_stricmp(action->actionString, "changemodel")) { G_ModelIndex(token); } else if ( buildScript && ( !Q_stricmp(action->actionString, "mu_start") || !Q_stricmp(action->actionString, "mu_play") || !Q_stricmp(action->actionString, "mu_queue") || !Q_stricmp(action->actionString, "startcam")) ) { if(strlen(token)) // we know there's a [0], but don't know if it's '0' trap_SendServerCommand(-1, va("addToBuild %s\n", token) ); } } if(i == 0 || i == 1) { if (!Q_stricmp(action->actionString, "remapshader")) { G_ShaderIndex(token); } } if (strrchr(token,' ')) // need to wrap this param in quotes since it has more than one word Q_strcat( params, sizeof(params), "\"" ); Q_strcat( params, sizeof(params), token ); if (strrchr(token,' ')) // need to wrap this param in quotes since it has more than one word Q_strcat( params, sizeof(params), "\"" ); token = COM_ParseExt( &pScript, qfalse ); } } if (strlen( params )) { // copy the params into the event curEvent->stack.items[curEvent->stack.numItems].params = (char*)G_Alloc( strlen( params ) + 1 ); Q_strncpyz( curEvent->stack.items[curEvent->stack.numItems].params, params, strlen(params)+1 ); } curEvent->stack.numItems++; if (curEvent->stack.numItems >= G_MAX_SCRIPT_STACK_ITEMS) { G_Error( "G_Script_ScriptParse(): script exceeded G_MAX_SCRIPT_STACK_ITEMS (%d), line %d\n", G_MAX_SCRIPT_STACK_ITEMS, COM_GetCurrentParseLine() ); } } numEventItems++; } else { // skip this character completely // TTimo gcc: suggest parentheses around assignment used as truth value while ( ( token = COM_Parse( &pScript ) ) != NULL ) { if (!token[0]) { G_Error( "G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found.\n", COM_GetCurrentParseLine() ); } else if (token[0] == '{') { bracketLevel++; } else if (token[0] == '}') { if (!--bracketLevel) break; } } } } // alloc and copy the events into the gentity_t for this cast if (numEventItems > 0) { ent->scriptEvents = (g_script_event_t*)G_Alloc( sizeof(g_script_event_t) * numEventItems ); memcpy( ent->scriptEvents, events, sizeof(g_script_event_t) * numEventItems ); ent->numScriptEvents = numEventItems; } } /* ================ G_Script_ScriptChange ================ */ qboolean G_Script_ScriptRun( gentity_t *ent ); void G_Script_ScriptChange( gentity_t *ent, int newScriptNum ) { g_script_status_t scriptStatusBackup; // backup the current scripting memcpy( &scriptStatusBackup, &ent->scriptStatus, sizeof(g_script_status_t) ); // set the new script to this cast, and reset script status ent->scriptStatus.scriptEventIndex = newScriptNum; ent->scriptStatus.scriptStackHead = 0; ent->scriptStatus.scriptStackChangeTime = level.time; ent->scriptStatus.scriptId = scriptStatusBackup.scriptId + 1; ent->scriptStatus.scriptFlags |= SCFL_FIRST_CALL; // try and run the script, if it doesn't finish, then abort the current script (discard backup) if ( G_Script_ScriptRun( ent ) && (ent->scriptStatus.scriptId == scriptStatusBackup.scriptId + 1)) { // make sure we didnt change our script via a third party // completed successfully memcpy( &ent->scriptStatus, &scriptStatusBackup, sizeof(g_script_status_t) ); ent->scriptStatus.scriptFlags &= ~SCFL_FIRST_CALL; } } // Gordon: lower the strings and hash them void G_Script_EventStringInit( void ) { int i; for( i = 0; gScriptEvents[i].eventStr; i++) { gScriptEvents[i].hash = BG_StringHashValue_Lwr( gScriptEvents[i].eventStr ); } for( i = 0; gScriptActions[i].actionString; i++) { gScriptActions[i].hash = BG_StringHashValue_Lwr( gScriptActions[i].actionString ); } } /* ================ G_Script_GetEventIndex returns the event index within the entity for the specified event string xkan, 10/28/2002 - extracted from G_Script_ScriptEvent. ================ */ static int G_Script_GetEventIndex( gentity_t *ent, const char* eventStr, const char* params ) { int i, eventNum = -1; int hash = BG_StringHashValue_Lwr( eventStr ); // find out which event this is for( i = 0; gScriptEvents[i].eventStr; i++) { if( gScriptEvents[i].hash == hash && !Q_stricmp( eventStr, gScriptEvents[i].eventStr ) ) { // match found eventNum = i; break; } } if( eventNum < 0 ) { if( g_cheats.integer ) { // dev mode G_Printf( "devmode-> G_Script_GetEventIndex(), unknown event: %s\n", eventStr ); } return -1; } // show debugging info if (g_scriptDebug.integer) { G_Printf( "%i : (%s) GScript event: %s %s\n", level.time, ent->scriptName ? ent->scriptName : "n/a", eventStr, params ? params : "" ); } // see if this entity has this event for( i = 0; i < ent->numScriptEvents; i++) { if (ent->scriptEvents[i].eventNum == eventNum) { if( (!ent->scriptEvents[i].params) || (!gScriptEvents[eventNum].eventMatch || gScriptEvents[eventNum].eventMatch( &ent->scriptEvents[i], params ))) { return i; } } } return -1; // event not found/matched in this ent } /* ================ G_Script_ScriptEvent An event has occured, for which a script may exist ================ */ void G_Script_ScriptEvent( gentity_t *ent, const char* eventStr, const char* params ) { int i = G_Script_GetEventIndex(ent, eventStr, params); if (i>=0) G_Script_ScriptChange( ent, i ); ////////////////////////////////////////////////////////////////////////// // skip these if(!Q_stricmp(eventStr, "trigger") || !Q_stricmp(eventStr, "activate") || !Q_stricmp(eventStr, "spawn") || !Q_stricmp(eventStr, "death") || !Q_stricmp(eventStr, "pain") || !Q_stricmp(eventStr, "playerstart")) return; if(!Q_stricmp(eventStr, "defused")) { Bot_Util_SendTrigger(ent, NULL, va("Defused at %s.", ent->parent ? ent->parent->track : ent->track), eventStr); } else if(!Q_stricmp(eventStr, "dynamited")) { Bot_Util_SendTrigger(ent, NULL, va("Planted at %s.", ent->parent ? ent->parent->track : ent->track), eventStr); } else if(!Q_stricmp(eventStr, "destroyed")) { Bot_Util_SendTrigger(ent, NULL, va("%s Destroyed.", ent->parent ? ent->parent->track : ent->track), eventStr); } else if(!Q_stricmp(eventStr, "exploded")) { Bot_Util_SendTrigger(ent, NULL, va("Explode_%s Exploded.", _GetEntityName(ent) ),eventStr); } } /* ============= G_Script_ScriptRun returns qtrue if the script completed ============= */ qboolean G_Script_ScriptRun( gentity_t *ent ) { g_script_stack_t *stack; int oldScriptId; if (!ent->scriptEvents) { ent->scriptStatus.scriptEventIndex = -1; return qtrue; } // if we are still doing a gotomarker, process the movement if (ent->scriptStatus.scriptFlags & SCFL_GOING_TO_MARKER) { G_ScriptAction_GotoMarker( ent, NULL ); } // if we are animating, do the animation if (ent->scriptStatus.scriptFlags & SCFL_ANIMATING) { G_ScriptAction_PlayAnim( ent, ent->scriptStatus.animatingParams ); } if (ent->scriptStatus.scriptEventIndex < 0) return qtrue; stack = &ent->scriptEvents[ent->scriptStatus.scriptEventIndex].stack; if (!stack->numItems) { ent->scriptStatus.scriptEventIndex = -1; return qtrue; } // // show debugging info if (g_scriptDebug.integer && ent->scriptStatus.scriptStackChangeTime == level.time) { if (ent->scriptStatus.scriptStackHead < stack->numItems) { G_Printf( "%i : (%s) GScript command: %s %s\n", level.time, ent->scriptName, stack->items[ent->scriptStatus.scriptStackHead].action->actionString, (stack->items[ent->scriptStatus.scriptStackHead].params ? stack->items[ent->scriptStatus.scriptStackHead].params : "") ); } } // while (ent->scriptStatus.scriptStackHead < stack->numItems) { oldScriptId = ent->scriptStatus.scriptId; if (!stack->items[ent->scriptStatus.scriptStackHead].action->actionFunc( ent, stack->items[ent->scriptStatus.scriptStackHead].params )) { ent->scriptStatus.scriptFlags &= ~SCFL_FIRST_CALL; return qfalse; } //if the scriptId changed, a new event was triggered in our scripts which did not finish if (oldScriptId != ent->scriptStatus.scriptId) { return qfalse; } // move to the next action in the script ent->scriptStatus.scriptStackHead++; // record the time that this new item became active ent->scriptStatus.scriptStackChangeTime = level.time; // ent->scriptStatus.scriptFlags |= SCFL_FIRST_CALL; // show debugging info if (g_scriptDebug.integer) { if (ent->scriptStatus.scriptStackHead < stack->numItems) { G_Printf( "%i : (%s) GScript command: %s %s\n", level.time, ent->scriptName, stack->items[ent->scriptStatus.scriptStackHead].action->actionString, (stack->items[ent->scriptStatus.scriptStackHead].params ? stack->items[ent->scriptStatus.scriptStackHead].params : "") ); } } } ent->scriptStatus.scriptEventIndex = -1; return qtrue; } //================================================================================ // Script Entities void mountedmg42_fire( gentity_t *other ) { vec3_t forward, right, up; vec3_t muzzle; gentity_t *self; if( !( self = other->tankLink ) ) { return; } AngleVectors( other->client->ps.viewangles, forward, right, up ); VectorCopy( other->s.pos.trBase, muzzle ); // VectorMA( muzzle, 42, up, muzzle ); muzzle[2] += other->client->ps.viewheight; VectorMA( muzzle, 58, forward, muzzle ); SnapVector( muzzle ); if( self->s.density & 8 ) { Fire_Lead_Ext( other, other, MG42_SPREAD_MP, MG42_DAMAGE_MP, muzzle, forward, right, up, MOD_BROWNING ); } else { Fire_Lead_Ext( other, other, MG42_SPREAD_MP, MG42_DAMAGE_MP, muzzle, forward, right, up, MOD_MG42 ); } } void script_linkentity(gentity_t *ent) { // this is required since non-solid brushes need to be linked but not solid trap_LinkEntity(ent); // if ((ent->s.eType == ET_MOVER) && !(ent->spawnflags & 2)) { // ent->s.solid = 0; // } } void script_mover_die(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod) { G_Script_ScriptEvent( self, "death", "" ); if (!(self->spawnflags & 8)) { G_FreeEntity( self ); } if( self->tankLink ) { G_LeaveTank( self->tankLink, qtrue ); } self->die = NULL; } void script_mover_set_blocking( gentity_t *ent ) { if (ent->r.linked && ent->r.contents == CONTENTS_SOLID) { G_SetAASBlockingEntity( ent, AAS_AREA_AVOID ); } } void script_mover_aas_blocking( gentity_t *ent ) { if( ent->timestamp <= level.time ) { // are we moving? if (ent->s.pos.trType != TR_STATIONARY /*VectorLengthSquared( ent->s.pos.trDelta )*/) { // never block while moving if (ent->AASblocking) { G_SetAASBlockingEntity( ent, AAS_AREA_ENABLED ); } } else if (!VectorCompare( ent->s.pos.trBase, ent->botAreaPos )) { script_mover_set_blocking( ent ); VectorCopy( ent->s.pos.trBase, ent->botAreaPos ); } ent->timestamp = level.time + 500; } if( ent->spawnflags & 128 ) { if( !ent->tankLink ) { if( ent->mg42weapHeat ) { ent->mg42weapHeat -= int(300.0f * FRAMETIME * 0.001f); if( ent->mg42weapHeat < 0 ) ent->mg42weapHeat = 0; } if( ent->backupWeaponTime ) { ent->backupWeaponTime -= FRAMETIME; if( ent->backupWeaponTime < 0 ) ent->backupWeaponTime = 0; } } } ent->nextthink = level.time + FRAMETIME; } void script_mover_spawn(gentity_t *ent) { if (ent->spawnflags & 128) { if(!ent->tagBuffer) { ent->nextTrain = ent; } else { gentity_t* tent = G_FindByTargetname( NULL, ent->tagBuffer); if(!tent) { ent->nextTrain = ent; } else { ent->nextTrain = tent; } } ent->s.effect3Time = ent->nextTrain-g_entities; } if (ent->spawnflags & 2) { ent->clipmask = CONTENTS_SOLID; ent->r.contents = CONTENTS_SOLID; } else { ent->s.eFlags |= EF_NONSOLID_BMODEL; ent->clipmask = 0; ent->r.contents = 0; } script_linkentity(ent); // now start thinking process which controls AAS interaction script_mover_set_blocking( ent ); ent->think = script_mover_aas_blocking; ent->nextthink = level.time + 200; } void script_mover_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { if(ent->spawnflags & 8) { if(ent->count) { ent->health = ent->count; ent->s.dl_intensity = ent->health; G_Script_ScriptEvent( ent, "rebirth", "" ); ent->die = script_mover_die; } } else { script_mover_spawn(ent); } } void script_mover_blocked( gentity_t *ent, gentity_t *other ) { // remove it, we must not stop for anything or it will screw up script timing if ( !other->client && other->s.eType != ET_CORPSE ) { // /me slaps nerve // except CTF flags!!!! if( other->s.eType == ET_ITEM && other->item->giType == IT_TEAM ) { Team_DroppedFlagThink( other ); return; } G_TempEntity( other->s.origin, EV_ITEM_POP ); G_FreeEntity( other ); return; } // FIXME: we could have certain entities stop us, thereby "pausing" movement // until they move out the way. then we can just call the GotoMarker() again, // telling it that we are just now calling it for the first time, so it should // start us on our way again (theoretically speaking). // kill them G_Damage( other, ent, ent, NULL, NULL, 9999, 0, MOD_CRUSH ); } /*QUAKED script_mover (0.5 0.25 1.0) ? TRIGGERSPAWN SOLID EXPLOSIVEDAMAGEONLY RESURECTABLE COMPASS ALLIED AXIS MOUNTED_GUN Scripted brush entity. A simplified means of moving brushes around based on events. "modelscale" - Scale multiplier (defaults to 1, and scales uniformly) "modelscale_vec" - Set scale per-axis. Overrides "modelscale", so if you have both the "modelscale" is ignored "model2" optional md3 to draw over the solid clip brush "scriptname" name used for scripting purposes (like aiName in AI scripting) "health" optionally make this entity damagable "description" used with health, if the entity is damagable, it draws a healthbar with this description above it. */ void SP_script_mover(gentity_t *ent) { float scale[3] = {1,1,1}; vec3_t scalevec; char tagname[MAX_QPATH]; char* modelname; char* tagent; char cs[MAX_INFO_STRING]; char* s; if (!ent->model) G_Error("script_mover must have a \"model\"\n" ); if (!ent->scriptName) G_Error("script_mover must have a \"scriptname\"\n" ); ent->blocked = script_mover_blocked; // first position at start VectorCopy( ent->s.origin, ent->pos1 ); // VectorCopy( ent->r.currentOrigin, ent->pos1 ); VectorCopy( ent->pos1, ent->pos2 ); // don't go anywhere just yet trap_SetBrushModel( ent, ent->model ); InitMover( ent ); ent->reached = NULL; ent->s.animMovetype = 0; ent->s.density = 0; if (ent->spawnflags & 256) { ent->s.density |= 2; } if (ent->spawnflags & 8) { ent->use = script_mover_use; } if (ent->spawnflags & 16) { ent->s.time2 = 1; } else { ent->s.time2 = 0; } if (ent->spawnflags & 32) { ent->s.teamNum = TEAM_ALLIES; } else if (ent->spawnflags & 64) { ent->s.teamNum = TEAM_AXIS; } else { ent->s.teamNum = TEAM_FREE; } if (ent->spawnflags & 1) { ent->use = script_mover_use; trap_UnlinkEntity(ent); // make sure it's not visible return; } G_SetAngle (ent, ent->s.angles); G_SpawnInt( "health", "0", &ent->health ); if(ent->health) { ent->takedamage = qtrue; ent->count = ent->health; // client needs to know about it as well ent->s.effect1Time = ent->count; ent->s.dl_intensity = 255; if( G_SpawnString( "description", "", &s ) ) { trap_GetConfigstring( CS_SCRIPT_MOVER_NAMES, cs, sizeof(cs) ); Info_SetValueForKey( cs, va("%i",ent-g_entities), s ); trap_SetConfigstring( CS_SCRIPT_MOVER_NAMES, cs ); } } else { ent->count = 0; } ent->die = script_mover_die; // look for general scaling if(G_SpawnFloat( "modelscale", "1", &scale[0])) { scale[2] = scale[1] = scale[0]; } if(G_SpawnString( "model2", "", &modelname ) ) { COM_StripExtension( modelname, tagname ); Q_strcat( tagname, MAX_QPATH, ".tag" ); ent->tagNumber = trap_LoadTag( tagname ); /* if( !(ent->tagNumber = trap_LoadTag( tagname )) ) { Com_Error( ERR_DROP, "Failed to load Tag File (%s)\n", tagname ); }*/ } // look for axis specific scaling if(G_SpawnVector("modelscale_vec", "1 1 1", &scalevec[0])) { VectorCopy(scalevec, scale); } if(scale[0] != 1 || scale[1] != 1 || scale[2] != 1) { ent->s.density |= 1; // scale is stored in 'angles2' VectorCopy(scale, ent->s.angles2); } if (ent->spawnflags & 128) { ent->s.density |= 4; ent->waterlevel = 0; if( G_SpawnString( "gun", "", &modelname ) ) { if( !Q_stricmp( modelname, "browning" ) ) { ent->s.density |= 8; } } G_SpawnString("tagent", "", &tagent); Q_strncpyz( ent->tagBuffer, tagent, 16 ); ent->s.powerups = -1; } ent->think = script_mover_spawn; ent->nextthink = level.time + FRAMETIME; } //.............................................................................. void script_model_med_spawn(gentity_t *ent) { if (ent->spawnflags & 2) { ent->clipmask = CONTENTS_SOLID; ent->r.contents = CONTENTS_SOLID; } ent->s.eType = ET_GENERAL; ent->s.modelindex = G_ModelIndex (ent->model); ent->s.frame = 0; VectorCopy( ent->s.origin, ent->s.pos.trBase ); ent->s.pos.trType = TR_STATIONARY; trap_LinkEntity(ent); } void script_model_med_use(gentity_t *ent, gentity_t *other, gentity_t *activator) { script_model_med_spawn(ent); } /*QUAKED script_model_med (0.5 0.25 1.0) (-16 -16 -24) (16 16 64) TriggerSpawn Solid MEDIUM SIZED scripted entity, used for animating a model, moving it around, etc SOLID spawnflag means this entity will clip the player and AI, otherwise they can walk straight through it "model" the full path of the model to use "scriptname" name used for scripting purposes (like aiName in AI scripting) */ void SP_script_model_med(gentity_t *ent) { if (!ent->model) G_Error("script_model_med %s must have a \"model\"\n", ent->scriptName ); if (!ent->scriptName) G_Error("script_model_med must have a \"scriptname\"\n" ); ent->s.eType = ET_GENERAL; ent->s.apos.trType = TR_STATIONARY; ent->s.apos.trTime = 0; ent->s.apos.trDuration = 0; VectorCopy (ent->s.angles, ent->s.apos.trBase); VectorClear (ent->s.apos.trDelta ); if (ent->spawnflags & 1) { ent->use = script_model_med_use; trap_UnlinkEntity(ent); // make sure it's not visible return; } script_model_med_spawn(ent); } //.............................................................................. /*QUAKED script_camera (1.0 0.25 1.0) (-8 -8 -8) (8 8 8) TriggerSpawn This is a camera entity. Used by the scripting to show cinematics, via special camera commands. See scripting documentation. "scriptname" name used for scripting purposes (like aiName in AI scripting) */ void SP_script_camera(gentity_t *ent) { if (!ent->scriptName) G_Error("%s must have a \"scriptname\"\n", ent->classname ); ent->s.eType = ET_CAMERA; ent->s.apos.trType = TR_STATIONARY; ent->s.apos.trTime = 0; ent->s.apos.trDuration = 0; VectorCopy (ent->s.angles, ent->s.apos.trBase); VectorClear (ent->s.apos.trDelta ); ent->s.frame = 0; ent->r.svFlags |= SVF_NOCLIENT; // only broadcast when in use } /*QUAKED script_multiplayer (1.0 0.25 1.0) (-8 -8 -8) (8 8 8) This is used to script multiplayer maps. Entity not displayed in game. // Gordon: also storing some stuff that will change often but needs to be broadcast, so we dont want to use a configstring "scriptname" name used for scripting purposes (REQUIRED) */ void SP_script_multiplayer(gentity_t *ent) { ent->scriptName = "game_manager"; // Gordon: broadcasting this to clients now, should be cheaper in bandwidth for sending landmine info ent->s.eType = ET_GAMEMANAGER; ent->r.svFlags = SVF_BROADCAST; if(level.gameManager) { // Gordon: ok, making this an error now G_Error("^1ERROR: multiple script_multiplayers found^7\n"); } level.gameManager = ent; level.gameManager->s.otherEntityNum = MAX_TEAM_LANDMINES; // axis landmine count level.gameManager->s.otherEntityNum2 = MAX_TEAM_LANDMINES; // allies landmine count level.gameManager->s.modelindex = qfalse; // axis HQ doesn't exist level.gameManager->s.modelindex2 = qfalse; // allied HQ doesn't exist trap_LinkEntity( ent ); } /* ================= SP_func_fakebrush ----------------- Jaybird Added for fake brush compatibility with ETPro ================= */ void SP_func_fakebrush (gentity_t *ent) { // Set the brush (will automatically set up ef_fakebmodel) trap_SetBrushModel( ent, ent->model ); // Link it trap_LinkEntity( ent ); }
33.543911
272
0.691037
jumptohistory
7f55ee3e5aaeda93228401f6811366967ffaffd7
3,100
cc
C++
source/driver.cc
chinmaygarde/epoxy
17cddb751e25c75b54da66932d2d64722cffc8b8
[ "MIT" ]
4
2020-07-09T04:58:14.000Z
2021-09-11T03:56:22.000Z
source/driver.cc
chinmaygarde/epoxy
17cddb751e25c75b54da66932d2d64722cffc8b8
[ "MIT" ]
null
null
null
source/driver.cc
chinmaygarde/epoxy
17cddb751e25c75b54da66932d2d64722cffc8b8
[ "MIT" ]
null
null
null
// This source file is part of Epoxy licensed under the MIT License. // See LICENSE.md file for details. #include "driver.h" #include "file.h" #include "scanner.h" #include <algorithm> #include <iostream> #include <sstream> #include <string> namespace epoxy { Driver::Driver(std::string advisory_file_name) : advisory_file_name_(std::move(advisory_file_name)) { location_.initialize(&advisory_file_name_); } Driver::~Driver() = default; void Driver::AddNamespace(Namespace ns) { namespaces_.emplace_back(std::move(ns)); } Driver::ParserResult Driver::Parse(const std::string& text) { Scanner scanner(text); if (!scanner.IsValid()) { return ParserResult::kParserError; } Parser parser(*this, scanner.GetHandle()); switch (parser.parse()) { case 0: /* parsing was successful (return is due to end-of-input) */ return ParserResult::kSuccess; case 1: /* contains a syntax error */ return ParserResult::kSyntaxError; case 2: /* memory exhaustion */ return ParserResult::kOutOfMemory; } return ParserResult::kParserError; } void Driver::ReportParsingError(const class location& location, const std::string& message) { errors_.emplace_back(Driver::Error{location, message}); } static void UnderscoreErrorInText(std::ostream& stream, const location& position, const std::string& original_text) { if (original_text.empty()) { return; } auto line = GetLineInString(original_text, position.begin.line); if (!line.has_value()) { return; } std::string pad(2u, ' '); stream << pad << line.value() << std::endl; const auto column = std::max<size_t>(static_cast<size_t>(position.begin.column), 1u); std::string bar(column - 1, '-'); stream << pad << bar << "^" << std::endl; } void Driver::PrettyPrintErrors(std::ostream& stream, const std::string& original_text) const { for (const auto& error : errors_) { const auto& error_begin = error.location.begin; stream << *error_begin.filename << ":" << error_begin.line << ":" << error_begin.column << ": error: " << error.message << std::endl; UnderscoreErrorInText(stream, error.location, original_text); } } const std::vector<Namespace>& Driver::GetNamespaces() const { return namespaces_; } location Driver::GetCurrentLocation() const { return location_; } static size_t GetNewlinesInString(const std::string& string) { return std::count_if(string.begin(), string.end(), [](const auto& c) { return c == '\n'; }); } static size_t CharsAfterLastNewline(const std::string& string) { auto last = string.find_last_of('\n'); if (last == std::string::npos) { return string.size(); } else { return string.size() - last - 1u; } } void Driver::BumpCurrentLocation(const char* c_text) { std::string text(c_text); location_.step(); location_.lines(GetNewlinesInString(text)); location_.columns(CharsAfterLastNewline(text)); } } // namespace epoxy
26.271186
78
0.653548
chinmaygarde
7f586f305b5d2239aa813c14cf9ae04586a1a575
642
cpp
C++
tests/uit/setup/InterProcAddress.cpp
perryk12/conduit
3ea055312598353afd465536c8e04cdec1111c8c
[ "MIT" ]
null
null
null
tests/uit/setup/InterProcAddress.cpp
perryk12/conduit
3ea055312598353afd465536c8e04cdec1111c8c
[ "MIT" ]
1
2020-10-22T20:41:05.000Z
2020-10-22T20:41:05.000Z
tests/uit/setup/InterProcAddress.cpp
perryk12/conduit
3ea055312598353afd465536c8e04cdec1111c8c
[ "MIT" ]
null
null
null
#include <set> #define CATCH_CONFIG_MAIN #define CATCH_CONFIG_DEFAULT_REPORTER "multiprocess" #include "Catch/single_include/catch2/catch.hpp" #include "uitsl/debug/MultiprocessReporter.hpp" #include "uitsl/mpi/MpiGuard.hpp" #include "uit/setup/InterProcAddress.hpp" const uitsl::MpiGuard guard; TEST_CASE("Test InterProcAddress") { // TODO flesh out stub test uit::InterProcAddress{0}; REQUIRE( uit::InterProcAddress{0} == uit::InterProcAddress{0} ); REQUIRE(!( uit::InterProcAddress{0} < uit::InterProcAddress{0} )); REQUIRE( uit::InterProcAddress{0} != uit::InterProcAddress{1} ); std::set<uit::InterProcAddress>{}; }
24.692308
68
0.744548
perryk12
7f5b31585be667553afca635d75d39fdc2c980ee
2,581
cc
C++
cdrs/src/model/PaginateProjectRequest.cc
aliyun/aliyun-openapi-cpp-sdk
0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36
[ "Apache-2.0" ]
89
2018-02-02T03:54:39.000Z
2021-12-13T01:32:55.000Z
cdrs/src/model/PaginateProjectRequest.cc
aliyun/aliyun-openapi-cpp-sdk
0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36
[ "Apache-2.0" ]
89
2018-03-14T07:44:54.000Z
2021-11-26T07:43:25.000Z
cdrs/src/model/PaginateProjectRequest.cc
aliyun/aliyun-openapi-cpp-sdk
0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36
[ "Apache-2.0" ]
69
2018-01-22T09:45:52.000Z
2022-03-28T07:58:38.000Z
/* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/cdrs/model/PaginateProjectRequest.h> using AlibabaCloud::CDRS::Model::PaginateProjectRequest; PaginateProjectRequest::PaginateProjectRequest() : RpcServiceRequest("cdrs", "2020-11-01", "PaginateProject") { setMethod(HttpRequest::Method::Post); } PaginateProjectRequest::~PaginateProjectRequest() {} std::string PaginateProjectRequest::getType()const { return type_; } void PaginateProjectRequest::setType(const std::string& type) { type_ = type; setBodyParameter("Type", type); } long PaginateProjectRequest::getPageNumber()const { return pageNumber_; } void PaginateProjectRequest::setPageNumber(long pageNumber) { pageNumber_ = pageNumber; setBodyParameter("PageNumber", std::to_string(pageNumber)); } bool PaginateProjectRequest::getCountTotalNum()const { return countTotalNum_; } void PaginateProjectRequest::setCountTotalNum(bool countTotalNum) { countTotalNum_ = countTotalNum; setBodyParameter("CountTotalNum", countTotalNum ? "true" : "false"); } std::string PaginateProjectRequest::getAppName()const { return appName_; } void PaginateProjectRequest::setAppName(const std::string& appName) { appName_ = appName; setBodyParameter("AppName", appName); } std::string PaginateProjectRequest::get_NameSpace()const { return _nameSpace_; } void PaginateProjectRequest::set_NameSpace(const std::string& _nameSpace) { _nameSpace_ = _nameSpace; setBodyParameter("_NameSpace", _nameSpace); } long PaginateProjectRequest::getPageSize()const { return pageSize_; } void PaginateProjectRequest::setPageSize(long pageSize) { pageSize_ = pageSize; setBodyParameter("PageSize", std::to_string(pageSize)); } std::string PaginateProjectRequest::getNameLike()const { return nameLike_; } void PaginateProjectRequest::setNameLike(const std::string& nameLike) { nameLike_ = nameLike; setBodyParameter("NameLike", nameLike); }
24.121495
75
0.748935
aliyun
7f5e9068af284cba93236e3803fe9c4ec8371fe6
8,691
cpp
C++
Source/MIVIBridge/Private/MIVICharacterBase.cpp
DrowningDragons/MIVIBridge
07fe752958b370d649d42ddf9f50cdcf089a31ad
[ "MIT" ]
1
2021-12-30T13:14:06.000Z
2021-12-30T13:14:06.000Z
Source/MIVIBridge/Private/MIVICharacterBase.cpp
DrowningDragons/MIVIBridge
07fe752958b370d649d42ddf9f50cdcf089a31ad
[ "MIT" ]
null
null
null
Source/MIVIBridge/Private/MIVICharacterBase.cpp
DrowningDragons/MIVIBridge
07fe752958b370d649d42ddf9f50cdcf089a31ad
[ "MIT" ]
1
2022-01-04T01:11:04.000Z
2022-01-04T01:11:04.000Z
// Copyright (c) 2019-2021 Drowning Dragons Limited. All Rights Reserved. #include "MIVICharacterBase.h" #include "Net/UnrealNetwork.h" #include "GameFramework/CharacterMovementComponent.h" #include "Pawn/VIPawnVaultComponent.h" #include "VIMotionWarpingComponent.h" #include "Components/CapsuleComponent.h" #include "VIBlueprintFunctionLibrary.h" void AMIVICharacterBase::BeginPlay() { Super::BeginPlay(); VaultComponent = IVIPawnInterface::Execute_GetPawnVaultComponent(this); MotionWarping = IVIPawnInterface::Execute_GetMotionWarpingComponent(this); } void AMIVICharacterBase::CheckJumpInput(float DeltaTime) { const bool bIsVaulting = IsVaulting(); // Server update simulated proxies with correct vaulting state if (GetLocalRole() == ROLE_Authority && GetNetMode() != NM_Standalone) { bRepIsVaulting = bIsVaulting; } // Try to vault from local input if (IsLocallyControlled() && VaultComponent) { // Disable jump if vaulting if (VaultComponent->bPressedVault) { bPressedJump = false; } // Possibly execute vault if (GetCharacterMovement()) { VaultComponent->CheckVaultInput(DeltaTime, GetCharacterMovement()->MovementMode); } else { VaultComponent->CheckVaultInput(DeltaTime); } } // Pick up changes in vaulting state to change movement mode // to something other than flying (required for root motion on Z) if (bWasVaulting && !bIsVaulting) { StopVaultAbility(); } // Call super so we actually jump if we're meant to Super::CheckJumpInput(DeltaTime); // Cache end of frame bWasVaulting = bIsVaulting; } void AMIVICharacterBase::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const { Super::GetLifetimeReplicatedProps(OutLifetimeProps); DOREPLIFETIME_CONDITION(AMIVICharacterBase, bRepIsVaulting, COND_SimulatedOnly); DOREPLIFETIME_CONDITION(AMIVICharacterBase, RepMotionMatch, COND_SimulatedOnly); } void AMIVICharacterBase::Jump() { // If missing critical components then jump and exit if (!VaultComponent || !GetCharacterMovement()) { Super::Jump(); return; } // Either jump or vault, determined by VaultComponent::EVIJumpKeyPriority if (VaultComponent->Jump(GetCharacterMovement()->GetGravityZ(), CanJump(), GetCharacterMovement()->IsFalling())) { // Jump normally Super::Jump(); } else { // Jump key essentially presses the vault input VaultComponent->Vault(); } } void AMIVICharacterBase::StopJumping() { Super::StopJumping(); // Release vault input if the jump key pressed vault instead if (VaultComponent) { VaultComponent->StopJumping(); } } void AMIVICharacterBase::StartVaultAbility_Implementation() { // Called by GA_Vault // Need to be in flying mode to have root motion on Z axis if (GetCharacterMovement() && GetLocalRole() > ROLE_SimulatedProxy) { GetCharacterMovement()->SetMovementMode(MOVE_Flying); } } void AMIVICharacterBase::StopVaultAbility() { // Called by CheckJumpInput() // Exiting flying mode // This may put is straight into falling if we aren't properly grounded, which is fine if (GetCharacterMovement() && GetLocalRole() > ROLE_SimulatedProxy) { GetCharacterMovement()->SetMovementMode(GetCharacterMovement()->GetGroundMovementMode()); } OnStopVaultAbility(); } void AMIVICharacterBase::OnRep_MotionMatch() { // Simulated proxies update their sync points here, sent from the server during GA_Vault MotionWarping->AddOrUpdateSyncPoint(TEXT("VaultSyncPoint"), FVIMotionWarpingSyncPoint(RepMotionMatch.Location, RepMotionMatch.Direction.ToOrientationQuat())); } bool AMIVICharacterBase::IsVaulting() const { // Simulated proxies use the value provided by server if (GetLocalRole() == ROLE_SimulatedProxy) { return bRepIsVaulting; } // Local and authority uses gameplay tags for a predicted result if (VaultComponent) { return VaultComponent->IsVaulting(); } return false; } // *********************************************** // // ******** Begin Pawn Vaulting Interface ******** // // *********************************************** // UVIPawnVaultComponent* AMIVICharacterBase::GetPawnVaultComponent_Implementation() const { // You need to override this UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AMIVICharacterBase::GetPawnVaultComponent not implemented for { %s }. Cannot Vault."), *GetName())); return nullptr; } UVIMotionWarpingComponent* AMIVICharacterBase::GetMotionWarpingComponent_Implementation() const { // You need to override this UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AMIVICharacterBase::GetMotionWarpingComponent not implemented for { %s }. Cannot Vault."), *GetName())); return nullptr; } FVIAnimSet AMIVICharacterBase::GetVaultAnimSet_Implementation() const { // You need to override this UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AMIVICharacterBase::GetVaultAnimSet not implemented for { %s }. Cannot Vault."), *GetName())); return FVIAnimSet(); } FVITraceSettings AMIVICharacterBase::GetVaultTraceSettings_Implementation() const { // You need to override this UVIBlueprintFunctionLibrary::MessageLogError(FString::Printf(TEXT("AMIVICharacterBase::GetVaultTraceSettings not implemented for { %s }. Using default trace settings."), *GetName()), false); return FVITraceSettings(); } FVector AMIVICharacterBase::GetVaultDirection_Implementation() const { // Use input vector if available if (GetCharacterMovement() && !GetCharacterMovement()->GetCurrentAcceleration().IsNearlyZero()) { return GetCharacterMovement()->GetCurrentAcceleration(); } // Use character facing direction if not providing input return GetActorForwardVector(); } bool AMIVICharacterBase::CanVault_Implementation() const { // Vaulting must finish before starting another vault attempt if (IsVaulting()) { return false; } // Invalid components if (!VaultComponent || !GetCharacterMovement()) { return false; } // Animation instance is required to play vault montage if (!GetMesh() || !GetMesh()->GetAnimInstance()) { return false; } // Authority not initialized (this isn't set on clients) if (HasAuthority() && !VaultComponent->bVaultAbilityInitialized) { return false; } // Exit if character is in a state they cannot vault from if (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling() || GetCharacterMovement()->IsSwimming()) { if (GetCharacterMovement()->IsMovingOnGround() && !VaultComponent->bCanVaultFromGround) { return false; } if (GetCharacterMovement()->IsFalling() && !VaultComponent->bCanVaultFromFalling) { return false; } if (GetCharacterMovement()->IsSwimming() && !VaultComponent->bCanVaultFromSwimming) { return false; } } else { return false; } // Can't vault while crouching if (!VaultComponent->bCanVaultFromCrouching && GetCharacterMovement()->IsCrouching()) { return false; } // Passed all conditions return true; } void AMIVICharacterBase::OnLocalPlayerVault_Implementation(const FVector& Location, const FVector& Direction) { // LocalPlayer just stores the data in the same place for convenience, ease of use, memory reduction, etc RepMotionMatch = FVIRepMotionMatch(Location, Direction); } void AMIVICharacterBase::GetVaultLocationAndDirection_Implementation(FVector& OutLocation, FVector& OutDirection) const { // Because LocalPlayer stores in the same place, no need for any testing as they all use RepMotionMatch to store this // This is only currently used for FBIK tracing OutLocation = RepMotionMatch.Location; OutDirection = RepMotionMatch.Direction; } void AMIVICharacterBase::ReplicateMotionMatch_Implementation(const FVIRepMotionMatch& MotionMatch) { // GA_Vault has directed server to update it's RepMotionMatch property so that it will // be replicated to simulated proxies with 1 decimal point of precision (net quantization) RepMotionMatch = MotionMatch; } bool AMIVICharacterBase::IsWalkable_Implementation(const FHitResult& HitResult) const { // Surface we hit can be walked on or not return GetCharacterMovement() && GetCharacterMovement()->IsWalkable(HitResult); } bool AMIVICharacterBase::CanAutoVaultInCustomMovementMode_Implementation() const { return true; // Example usage commented out /* if (GetCharacterMovement()) { switch (GetCharacterMovement()->CustomMovementMode) { case 0: return false; case 1: // Some example custom mode where auto vault can work return true; case 2: return false; default: return true; } } */ } // *********************************************** // // ********* End Pawn Vaulting Interface ********* // // *********************************************** //
28.035484
191
0.741457
DrowningDragons
7f67a6f21326776d182f36bc7f4f77e9a121e7c7
417
cpp
C++
src/Data/TSWXResultsDT.cpp
pavanad/language-tools
e431f547161583b17046aa2952bd0bd435842155
[ "MIT" ]
3
2018-08-16T20:15:42.000Z
2021-06-13T06:47:06.000Z
src/Data/TSWXResultsDT.cpp
pavanad/language-tools
e431f547161583b17046aa2952bd0bd435842155
[ "MIT" ]
null
null
null
src/Data/TSWXResultsDT.cpp
pavanad/language-tools
e431f547161583b17046aa2952bd0bd435842155
[ "MIT" ]
2
2018-07-24T19:13:29.000Z
2019-04-06T17:36:18.000Z
//--------------------------------------------------------------------------- #pragma hdrstop #include "TSWXResultsDT.h" #pragma package(smart_init) //--------------------------------------------------------------------------- void TSWXResultsDT::SetData(int files, int nodes, std::vector< std::vector<UnicodeString> > results) { m_files = files; m_nodes = nodes; m_results = results; }
24.529412
78
0.419664
pavanad
7f6e4c8cff0c521e2d3a2ae6da9d2c139c8f39e2
694
cpp
C++
src/jobSystem/private/jobystem/job.cpp
PierreEVEN/HeadlessEngine
95ffef8a7a71c5bb6e806a96c39e88cfc24311a9
[ "MIT" ]
2
2021-07-12T08:58:49.000Z
2021-09-04T10:31:04.000Z
src/jobSystem/private/jobystem/job.cpp
PierreEVEN/TestFlightSimulator
95ffef8a7a71c5bb6e806a96c39e88cfc24311a9
[ "MIT" ]
1
2021-10-11T13:09:32.000Z
2021-10-11T13:09:32.000Z
src/jobSystem/private/jobystem/job.cpp
PierreEVEN/HeadlessEngine
95ffef8a7a71c5bb6e806a96c39e88cfc24311a9
[ "MIT" ]
null
null
null
#include "jobSystem/job.h" #include <memory> namespace job_system { int64_t stat_awaiting_jobs = 0; int64_t stat_total_job = 0; std::shared_ptr<IJobTask> IJobTask::find_current_parent_task() { if (Worker* worker = Worker::get()) { return worker->get_current_task(); } return nullptr; } int64_t IJobTask::get_stat_total_job_count() { return stat_total_job; } int64_t IJobTask::get_stat_awaiting_job_count() { return stat_awaiting_jobs; } void IJobTask::inc_job_count() { stat_total_job++; stat_awaiting_jobs++; } void IJobTask::dec_awaiting_job_count() { stat_awaiting_jobs--; } void IJobTask::dec_total_job_count() { stat_total_job--; } }
14.765957
63
0.714697
PierreEVEN
7f6e5b03489a33cdc086f784b03c8ca232778bd7
650
hpp
C++
libs/core/include/fcppt/math/matrix/row_type_fwd.hpp
pmiddend/fcppt
9f437acbb10258e6df6982a550213a05815eb2be
[ "BSL-1.0" ]
null
null
null
libs/core/include/fcppt/math/matrix/row_type_fwd.hpp
pmiddend/fcppt
9f437acbb10258e6df6982a550213a05815eb2be
[ "BSL-1.0" ]
null
null
null
libs/core/include/fcppt/math/matrix/row_type_fwd.hpp
pmiddend/fcppt
9f437acbb10258e6df6982a550213a05815eb2be
[ "BSL-1.0" ]
null
null
null
// Copyright Carl Philipp Reh 2009 - 2018. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef FCPPT_MATH_MATRIX_ROW_TYPE_FWD_HPP_INCLUDED #define FCPPT_MATH_MATRIX_ROW_TYPE_FWD_HPP_INCLUDED #include <fcppt/math/size_type.hpp> #include <fcppt/math/vector/static_fwd.hpp> namespace fcppt { namespace math { namespace matrix { /** \brief The type of matrix row \ingroup fcpptmathmatrix */ template< typename T, fcppt::math::size_type C > using row_type = fcppt::math::vector::static_< T, C >; } } } #endif
15.116279
61
0.730769
pmiddend
7f775ab97dd4795f51ff1b3337b80a6491ae4f92
1,857
hpp
C++
Document.hpp
chrisoldwood/XML
78913e7b9fbc1fbfec3779652d034ebd150668bc
[ "MIT" ]
1
2020-09-11T13:21:05.000Z
2020-09-11T13:21:05.000Z
Document.hpp
chrisoldwood/XML
78913e7b9fbc1fbfec3779652d034ebd150668bc
[ "MIT" ]
null
null
null
Document.hpp
chrisoldwood/XML
78913e7b9fbc1fbfec3779652d034ebd150668bc
[ "MIT" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// //! \file Document.hpp //! \brief The Document class declaration. //! \author Chris Oldwood // Check for previous inclusion #ifndef XML_DOCUMENT_HPP #define XML_DOCUMENT_HPP #if _MSC_VER > 1000 #pragma once #endif #include "Node.hpp" #include "NodeContainer.hpp" #include "ElementNode.hpp" namespace XML { //////////////////////////////////////////////////////////////////////////////// //! The XML node type used for the top-most node. This represents the document. class Document : public Node, public NodeContainer { public: //! Default constructor. Document(); //! Construction with a root element. Document(ElementNodePtr root); // // Properties. // //! Get the real type of the node. virtual NodeType type() const; //! Checks if the document has a root element. bool hasRootElement() const; // // Methods. // //! Get the root element. const ElementNodePtr getRootElement() const; //! Get the root element. ElementNodePtr getRootElement(); private: // // Members. // //! Destructor. virtual ~Document(); }; //! The default Document smart-pointer type. typedef Core::RefCntPtr<Document> DocumentPtr; //////////////////////////////////////////////////////////////////////////////// //! Get the real type of the node. inline NodeType Document::type() const { return DOCUMENT_NODE; } //////////////////////////////////////////////////////////////////////////////// //! Create an empty document. inline DocumentPtr makeDocument() { return DocumentPtr(new Document()); } //////////////////////////////////////////////////////////////////////////////// //! Create an empty document. inline DocumentPtr makeDocument(ElementNodePtr root) { return DocumentPtr(new Document(root)); } //namespace XML } #endif // XML_DOCUMENT_HPP
19.967742
80
0.558966
chrisoldwood
7f797dcf0d1a76d2e63ebbe386faf815b89f7b12
7,040
hpp
C++
include/UnityEngine/Timeline/ControlPlayableAsset_-GetControlableScripts-d__39.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/UnityEngine/Timeline/ControlPlayableAsset_-GetControlableScripts-d__39.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/UnityEngine/Timeline/ControlPlayableAsset_-GetControlableScripts-d__39.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" // Including type: UnityEngine.Timeline.ControlPlayableAsset #include "UnityEngine/Timeline/ControlPlayableAsset.hpp" // Including type: System.Collections.Generic.IEnumerable`1 #include "System/Collections/Generic/IEnumerable_1.hpp" // Including type: System.Collections.Generic.IEnumerator`1 #include "System/Collections/Generic/IEnumerator_1.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: UnityEngine namespace UnityEngine { // Forward declaring type: MonoBehaviour class MonoBehaviour; // Forward declaring type: GameObject class GameObject; } // Forward declaring namespace: System::Collections namespace System::Collections { // Skipping declaration: IEnumerator because it is already included! } // Completed forward declares // Type namespace: UnityEngine.Timeline namespace UnityEngine::Timeline { // Size: 0x44 #pragma pack(push, 1) // Autogenerated type: UnityEngine.Timeline.ControlPlayableAsset/<GetControlableScripts>d__39 // [CompilerGeneratedAttribute] Offset: DD7A60 class ControlPlayableAsset::$GetControlableScripts$d__39 : public ::Il2CppObject/*, public System::Collections::Generic::IEnumerable_1<UnityEngine::MonoBehaviour*>, public System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*>*/ { public: // private System.Int32 <>1__state // Size: 0x4 // Offset: 0x10 int $$1__state; // Field size check static_assert(sizeof(int) == 0x4); // Padding between fields: $$1__state and: $$2__current char __padding0[0x4] = {}; // private UnityEngine.MonoBehaviour <>2__current // Size: 0x8 // Offset: 0x18 UnityEngine::MonoBehaviour* $$2__current; // Field size check static_assert(sizeof(UnityEngine::MonoBehaviour*) == 0x8); // private System.Int32 <>l__initialThreadId // Size: 0x4 // Offset: 0x20 int $$l__initialThreadId; // Field size check static_assert(sizeof(int) == 0x4); // Padding between fields: $$l__initialThreadId and: root char __padding2[0x4] = {}; // private UnityEngine.GameObject root // Size: 0x8 // Offset: 0x28 UnityEngine::GameObject* root; // Field size check static_assert(sizeof(UnityEngine::GameObject*) == 0x8); // public UnityEngine.GameObject <>3__root // Size: 0x8 // Offset: 0x30 UnityEngine::GameObject* $$3__root; // Field size check static_assert(sizeof(UnityEngine::GameObject*) == 0x8); // private UnityEngine.MonoBehaviour[] <>7__wrap1 // Size: 0x8 // Offset: 0x38 ::Array<UnityEngine::MonoBehaviour*>* $$7__wrap1; // Field size check static_assert(sizeof(::Array<UnityEngine::MonoBehaviour*>*) == 0x8); // private System.Int32 <>7__wrap2 // Size: 0x4 // Offset: 0x40 int $$7__wrap2; // Field size check static_assert(sizeof(int) == 0x4); // Creating value type constructor for type: $GetControlableScripts$d__39 $GetControlableScripts$d__39(int $$1__state_ = {}, UnityEngine::MonoBehaviour* $$2__current_ = {}, int $$l__initialThreadId_ = {}, UnityEngine::GameObject* root_ = {}, UnityEngine::GameObject* $$3__root_ = {}, ::Array<UnityEngine::MonoBehaviour*>* $$7__wrap1_ = {}, int $$7__wrap2_ = {}) noexcept : $$1__state{$$1__state_}, $$2__current{$$2__current_}, $$l__initialThreadId{$$l__initialThreadId_}, root{root_}, $$3__root{$$3__root_}, $$7__wrap1{$$7__wrap1_}, $$7__wrap2{$$7__wrap2_} {} // Creating interface conversion operator: operator System::Collections::Generic::IEnumerable_1<UnityEngine::MonoBehaviour*> operator System::Collections::Generic::IEnumerable_1<UnityEngine::MonoBehaviour*>() noexcept { return *reinterpret_cast<System::Collections::Generic::IEnumerable_1<UnityEngine::MonoBehaviour*>*>(this); } // Creating interface conversion operator: operator System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*> operator System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*>() noexcept { return *reinterpret_cast<System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*>*>(this); } // public System.Void .ctor(System.Int32 <>1__state) // Offset: 0x17C611C template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static ControlPlayableAsset::$GetControlableScripts$d__39* New_ctor(int $$1__state) { static auto ___internal__logger = ::Logger::get().WithContext("UnityEngine::Timeline::ControlPlayableAsset::$GetControlableScripts$d__39::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<ControlPlayableAsset::$GetControlableScripts$d__39*, creationType>($$1__state))); } // private System.Void System.IDisposable.Dispose() // Offset: 0x17C7A08 void System_IDisposable_Dispose(); // private System.Boolean MoveNext() // Offset: 0x17C7A0C bool MoveNext(); // private UnityEngine.MonoBehaviour System.Collections.Generic.IEnumerator<UnityEngine.MonoBehaviour>.get_Current() // Offset: 0x17C7B60 UnityEngine::MonoBehaviour* System_Collections_Generic_IEnumerator$UnityEngine_MonoBehaviour$_get_Current(); // private System.Void System.Collections.IEnumerator.Reset() // Offset: 0x17C7B68 void System_Collections_IEnumerator_Reset(); // private System.Object System.Collections.IEnumerator.get_Current() // Offset: 0x17C7BC8 ::Il2CppObject* System_Collections_IEnumerator_get_Current(); // private System.Collections.Generic.IEnumerator`1<UnityEngine.MonoBehaviour> System.Collections.Generic.IEnumerable<UnityEngine.MonoBehaviour>.GetEnumerator() // Offset: 0x17C7BD0 System::Collections::Generic::IEnumerator_1<UnityEngine::MonoBehaviour*>* System_Collections_Generic_IEnumerable$UnityEngine_MonoBehaviour$_GetEnumerator(); // private System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() // Offset: 0x17C7C7C System::Collections::IEnumerator* System_Collections_IEnumerable_GetEnumerator(); }; // UnityEngine.Timeline.ControlPlayableAsset/<GetControlableScripts>d__39 #pragma pack(pop) static check_size<sizeof(ControlPlayableAsset::$GetControlableScripts$d__39), 64 + sizeof(int)> __UnityEngine_Timeline_ControlPlayableAsset_$GetControlableScripts$d__39SizeCheck; static_assert(sizeof(ControlPlayableAsset::$GetControlableScripts$d__39) == 0x44); } DEFINE_IL2CPP_ARG_TYPE(UnityEngine::Timeline::ControlPlayableAsset::$GetControlableScripts$d__39*, "UnityEngine.Timeline", "ControlPlayableAsset/<GetControlableScripts>d__39");
54.573643
489
0.742898
darknight1050
7f7de4f5b9fb796b3548a3e2ce282d8e0d96279e
1,944
cpp
C++
src/human.cpp
Groogy/derelict
5ca82ae5a5a553e292e388706a27b53840cf3afa
[ "Zlib" ]
null
null
null
src/human.cpp
Groogy/derelict
5ca82ae5a5a553e292e388706a27b53840cf3afa
[ "Zlib" ]
null
null
null
src/human.cpp
Groogy/derelict
5ca82ae5a5a553e292e388706a27b53840cf3afa
[ "Zlib" ]
null
null
null
#include "human.hpp" #include "tile.hpp" #include "terrain.hpp" #include "earth.hpp" #include "tilemap.hpp" #include "settler.hpp" constexpr int TicksPerSettlement = 40; Human::Human(sf::Vector2i settlement) { mySettlements.push_back(settlement); nTimeToGrowth = TicksPerSettlement; } void Human::update(Earth& earth) { auto& tilemap = earth.accessTilemap(); std::vector<sf::Vector2i> destroyedSettlements; for(auto settlement : mySettlements) { const auto& tile = tilemap.getTile(settlement); if(tile.getTerrain()->getName() != "Settlement") { destroyedSettlements.push_back(settlement); } else { nTimeToGrowth -= rand() % 2 == 0 ? 1 : 0; } } for(auto destroyed : destroyedSettlements) { mySettlements.erase(macros::find(mySettlements, destroyed)); } if(nTimeToGrowth <= 0) { handleGrowth(earth); nTimeToGrowth = TicksPerSettlement * mySettlements.size(); } std::vector<Settler*> doneSettlers; for(auto& settler : mySettlers) { if(settler->update(earth)) { doneSettlers.push_back(settler.get()); } } auto building = tilemap.getTile(mySettlements.front()).getBuilding(); for(auto done : doneSettlers) { auto pos = done->getPosition(); tilemap.setTileTerrain(pos, "Settlement"); tilemap.setBuilding(pos, building); mySettlements.push_back(done->getPosition()); for(auto& settler : mySettlers) { if(settler.get() == done) { mySettlers.erase(macros::find(mySettlers, settler)); } } } } bool Human::isDestroyed() const { return mySettlements.empty(); } void Human::handleGrowth(Earth& earth) { auto& tilemap = earth.getTilemap(); int random = rand() % mySettlements.size(); sf::Vector2i settlement = mySettlements[random]; auto path = tilemap.findFirstConvertableWalkable(settlement, "Settlement"); if(path.isFinished()) return; auto settler = std::make_unique<Settler>(*this, settlement, path); mySettlers.push_back(std::move(settler)); }
21.6
76
0.705761
Groogy
7f7e56d5a52cb4499f999a3994d5b85b07734b44
3,453
cpp
C++
code archive/joi/2019-sp-day3 pC.cpp
brianbbsu/program
c4505f2b8c0b91010e157db914a63c49638516bc
[ "MIT" ]
4
2018-04-08T08:07:58.000Z
2021-06-07T14:55:24.000Z
code archive/joi/2019-sp-day3 pC.cpp
brianbbsu/program
c4505f2b8c0b91010e157db914a63c49638516bc
[ "MIT" ]
null
null
null
code archive/joi/2019-sp-day3 pC.cpp
brianbbsu/program
c4505f2b8c0b91010e157db914a63c49638516bc
[ "MIT" ]
1
2018-10-29T12:37:25.000Z
2018-10-29T12:37:25.000Z
//{ #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef double lf; typedef pair<ll,ll> ii; #define REP(i,n) for(ll i=0;i<n;i++) #define REP1(i,n) for(ll i=1;i<=n;i++) #define FILL(i,n) memset(i,n,sizeof i) #define X first #define Y second #define SZ(_a) (int)_a.size() #define ALL(_a) _a.begin(),_a.end() #define pb push_back #ifdef brian #define debug(...) do{\ fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\ _do(__VA_ARGS__);\ }while(0) template<typename T>void _do(T &&_x){cerr<<_x<<endl;} template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);} template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";} template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb) { _s<<"{"; for(It _it=_ita;_it!=_itb;_it++) { _s<<(_it==_ita?"":",")<<*_it; } _s<<"}"; return _s; } template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));} template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));} template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));} template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;} #define IOS() #else #define debug(...) #define pary(...) #define endl '\n' #define IOS() ios_base::sync_with_stdio(0);cin.tie(0); #endif // brian //} const ll MAXn=3e5+5,MAXlg=__lg(MAXn)+2; const ll MOD=1000000007; const ll INF=ll(1e15); struct qrtg{ ll i, s, st, e, et; }; ll l[2][MAXn], r[2][MAXn], ans[MAXn]; ii dp[2][MAXn][2]; ll n, q; const ll K = 700; //vector<qrtg> qr[2]; set<ii> u[2][K + 5], d[2][K + 5]; void let(ll p, ll s,ll t) { t--; l[0][p] = s - p; r[0][p] = t - p; p = n - p; l[1][p] = s - p; r[1][p] = t - p; } ii cal(ll fg,ll it, ll x) { ll ut = prev(u[fg][it].lower_bound({x, -1}))->Y; ll dt = d[fg][it].lower_bound({x, INF})->Y; if(min(ut, dt) == n)return {0, x}; if(ut <= dt)return {dp[fg][ut][1].X + x - r[fg][ut], dp[fg][ut][1].Y}; else return dp[fg][dt][0]; } void build(ll fg, ll it) { } int main() { IOS(); cin>>n>>q; REP1(i,n-1) { ll s, t; cin>>s>>t; let(i, s, t); } for(int i = 0;i < q;i++) { ll tp, s, st, e, et; cin>>tp>>s>>st>>e>>et; if(s < e)qr[0].pb({i, s, st, e, et}); else qr[1].pb({i, n - s + 1, st, n - e + 1, et}); } for(int fg = 0;fg <= 1;fg ++) { u.clear();d.clear(); u.insert({-INF, n});d.insert({INF, n}); sort(ALL(qr[fg]), [](auto &a, auto &b){return a.s > b.s;}); for(auto &p:qr[fg])p.st -= p.s, p.et -= p.e; int it = 0; for(int i = n-1;i >= 1; i--) { dp[fg][i][0] = cal(fg, l[fg][i]); dp[fg][i][1] = cal(fg, r[fg][i]); u.erase(u.lower_bound({r[fg][i], -1}), u.end()); d.erase(d.begin(), d.lower_bound({l[fg][i], INF})); u.insert({r[fg][i], i});d.insert({l[fg][i], i}); while(it != SZ(qr[fg]) && qr[fg][it].s == i){ ii t = cal(fg, qr[fg][it].st); if(t.Y > qr[fg][it].et)t.X += t.Y - qr[fg][it].et; ans[qr[fg][it].i] = t.X; it++; } } } REP(i, q)cout<<ans[i]<<endl; }
25.768657
129
0.504489
brianbbsu
7f856f4c3a4036ac8066fbfdb77d87c861bcaa8f
7,964
cpp
C++
compiler/src/ast/stmt/ast_flow_codegen.cpp
TuplexLanguage/tuplex
fc436c78224522663e40e09d36f83570fd76ba2d
[ "Apache-2.0" ]
15
2017-08-15T20:46:44.000Z
2021-12-15T02:51:13.000Z
compiler/src/ast/stmt/ast_flow_codegen.cpp
TuplexLanguage/tuplex
fc436c78224522663e40e09d36f83570fd76ba2d
[ "Apache-2.0" ]
null
null
null
compiler/src/ast/stmt/ast_flow_codegen.cpp
TuplexLanguage/tuplex
fc436c78224522663e40e09d36f83570fd76ba2d
[ "Apache-2.0" ]
1
2017-09-28T14:48:15.000Z
2017-09-28T14:48:15.000Z
#include "ast_flow.hpp" #include "ast/expr/ast_ref.hpp" #include "llvm_generator.hpp" #include "parsercontext.hpp" using namespace llvm; Value* TxCondClauseNode::code_gen_cond( LlvmGenerationContext& context, GenScope* scope ) const { return this->condExpr->code_gen_expr( context, scope ); } Value* TxIsClauseNode::code_gen_cond( LlvmGenerationContext& context, GenScope* scope ) const { auto refExprV = this->origValueExpr->code_gen_dyn_value( context, scope ); Constant* reqTargetTypeIdC = ConstantInt::get( Type::getInt32Ty( context.llvmContext ), this->typeExpr->qtype()->target_type()->get_runtime_type_id() ); auto typeEqCondV = context.gen_isa( scope, refExprV, reqTargetTypeIdC ); // // exact type equality, not is-a: // Value* runtimeTargetTypeIdV = gen_get_ref_typeid( context, scope, refExprV ); // auto typeEqCondV = scope->builder->CreateICmpEQ( runtimeTargetTypeIdV, reqTargetTypeIdC ); return typeEqCondV; } void TxIsClauseNode::code_gen_prestep( LlvmGenerationContext& context, GenScope* scope ) const { this->valueField->code_gen_field( context, scope ); } void TxForHeaderNode::code_gen_init( LlvmGenerationContext& context, GenScope* scope ) const { this->initStmt->code_gen( context, scope ); } Value* TxForHeaderNode::code_gen_cond( LlvmGenerationContext& context, GenScope* scope ) const { return this->nextCond->expr->code_gen_expr( context, scope ); } void TxForHeaderNode::code_gen_poststep( LlvmGenerationContext& context, GenScope* scope ) const { this->stepStmt->code_gen( context, scope ); } void TxInClauseNode::code_gen_init( LlvmGenerationContext& context, GenScope* scope ) const { this->iterField->code_gen_field( context, scope ); } Value* TxInClauseNode::code_gen_cond( LlvmGenerationContext& context, GenScope* scope ) const { return this->nextCond->code_gen_expr( context, scope ); } void TxInClauseNode::code_gen_prestep( LlvmGenerationContext& context, GenScope* scope ) const { this->valueField->code_gen_field( context, scope ); } void TxElseClauseNode::code_gen( LlvmGenerationContext& context, GenScope* scope ) const { TRACE_CODEGEN( this, context ); scope->builder->SetCurrentDebugLocation( DebugLoc::get( ploc.begin.line, ploc.begin.column, scope->debug_scope() ) ); return this->body->code_gen( context, scope ); } void TxIfStmtNode::code_gen( LlvmGenerationContext& context, GenScope* scope ) const { TRACE_CODEGEN( this, context ); scope->builder->SetCurrentDebugLocation( DebugLoc::get( ploc.begin.line, ploc.begin.column, scope->debug_scope() ) ); auto suiteDScope = context.debug_builder()->createLexicalBlock( scope->debug_scope(), get_parser_context()->debug_file(), ploc.begin.line, ploc.begin.column ); scope->push_debug_scope( suiteDScope ); std::string id = std::to_string( this->ploc.begin.line ); auto parentFunc = scope->builder->GetInsertBlock()->getParent(); BasicBlock* trueBlock = BasicBlock::Create( context.llvmContext, "if_true"+id, parentFunc ); BasicBlock* postBlock = nullptr; // generate initialization: this->header->code_gen_init( context, scope ); // generate condition: auto condVal = this->header->code_gen_cond( context, scope ); // generate branch and else code: if ( this->elseClause ) { BasicBlock* elseBlock = BasicBlock::Create( context.llvmContext, "if_else"+id, parentFunc ); scope->builder->CreateCondBr( condVal, trueBlock, elseBlock ); scope->builder->SetInsertPoint( elseBlock ); this->elseClause->code_gen( context, scope ); if ( !this->elseClause->ends_with_terminal_stmt() ) { postBlock = BasicBlock::Create( context.llvmContext, "if_post"+id, parentFunc ); scope->builder->CreateBr( postBlock ); // branch from end of else suite to next-block } } else { postBlock = BasicBlock::Create( context.llvmContext, "if_post"+id, parentFunc ); scope->builder->CreateCondBr( condVal, trueBlock, postBlock ); } // generate true code: scope->builder->SetInsertPoint( trueBlock ); this->header->code_gen_prestep( context, scope ); this->body->code_gen( context, scope ); this->header->code_gen_poststep( context, scope ); if ( postBlock ) { // note: trueBlock may not be the "current" block anymore when reaching end of body if ( !scope->builder->GetInsertBlock()->getTerminator() ) scope->builder->CreateBr( postBlock ); // branch from end of true block to next-block scope->builder->SetInsertPoint( postBlock ); } scope->pop_debug_scope(); } void TxForStmtNode::code_gen( LlvmGenerationContext& context, GenScope* scope ) const { TRACE_CODEGEN( this, context ); scope->builder->SetCurrentDebugLocation( DebugLoc::get( ploc.begin.line, ploc.begin.column, scope->debug_scope() ) ); auto suiteDScope = context.debug_builder()->createLexicalBlock( scope->debug_scope(), get_parser_context()->debug_file(), ploc.begin.line, ploc.begin.column ); scope->push_debug_scope( suiteDScope ); std::string id = std::to_string( this->ploc.begin.line ); auto parentFunc = scope->builder->GetInsertBlock()->getParent(); BasicBlock* condBlock = BasicBlock::Create( context.llvmContext, "loop_cond"+id, parentFunc ); BasicBlock* loopBlock = BasicBlock::Create( context.llvmContext, "loop_body"+id, parentFunc ); BasicBlock* postBlock = nullptr; // generate initialization: for ( auto clause : *this->loopHeaders ) { clause->code_gen_init( context, scope ); } scope->builder->CreateBr( condBlock ); // generate condition block: scope->builder->SetInsertPoint( condBlock ); Value* condVal = this->loopHeaders->back()->code_gen_cond( context, scope ); if ( this->loopHeaders->size() > 1 ) { // TODO: test all the conditions for ( int i = this->loopHeaders->size()-1 ; i >= 0; i-- ) { condVal = scope->builder->CreateAnd( this->loopHeaders->at(i)->code_gen_cond( context, scope ), condVal ); } } if ( this->elseClause ) { BasicBlock* elseBlock = BasicBlock::Create( context.llvmContext, "loop_else"+id, parentFunc ); scope->builder->CreateCondBr( condVal, loopBlock, elseBlock ); // generate else code: scope->builder->SetInsertPoint( elseBlock ); this->elseClause->code_gen( context, scope ); if ( !this->ends_with_terminal_stmt() ) { postBlock = BasicBlock::Create( context.llvmContext, "loop_post"+id, parentFunc ); scope->builder->CreateBr( postBlock ); // branch from end of else suite to post-block } } else { postBlock = BasicBlock::Create( context.llvmContext, "loop_post"+id, parentFunc ); scope->builder->CreateCondBr( condVal, loopBlock, postBlock ); } // generate loop code: CompoundStatementScope css( condBlock, postBlock ); scope->compStmtStack.push( &css ); { scope->builder->SetInsertPoint( loopBlock ); for ( auto clause : *this->loopHeaders ) { clause->code_gen_prestep( context, scope ); } this->body->code_gen( context, scope ); // note: loopBlock is may not be the "current" block anymore when reaching end of loop body if ( !scope->builder->GetInsertBlock()->getTerminator() ) { for ( auto clause : *this->loopHeaders ) { clause->code_gen_poststep( context, scope ); } scope->builder->CreateBr( condBlock ); // branch from end of loop body to cond-block } } scope->compStmtStack.pop(); if ( postBlock ) scope->builder->SetInsertPoint( postBlock ); scope->pop_debug_scope(); }
44
125
0.669513
TuplexLanguage
7f8d846f514f4a917304cc8aed37c5fb0b9a7180
21,379
hpp
C++
Lib/Chip/CM0/NXP/LPC800_v0.3/SWM.hpp
cjsmeele/Kvasir
c8d2acd8313ae52d78259ee2d409b963925f77d7
[ "Apache-2.0" ]
376
2015-07-17T01:41:20.000Z
2022-03-26T04:02:49.000Z
Lib/Chip/CM0/NXP/LPC800_v0.3/SWM.hpp
cjsmeele/Kvasir
c8d2acd8313ae52d78259ee2d409b963925f77d7
[ "Apache-2.0" ]
59
2015-07-03T21:30:13.000Z
2021-03-05T11:30:08.000Z
Lib/Chip/CM0/NXP/LPC800_v0.3/SWM.hpp
cjsmeele/Kvasir
c8d2acd8313ae52d78259ee2d409b963925f77d7
[ "Apache-2.0" ]
53
2015-07-14T12:17:06.000Z
2021-06-04T07:28:40.000Z
#pragma once #include <Register/Utility.hpp> namespace Kvasir { //Switch matrix (SWM) namespace SwmPinassign0{ ///<Pin assign register 0. Assign movable functions U0_TXD, U0_RXD, U0_RTS, U0_CTS using Addr = Register::Address<0x4000c000,0x00000000,0x00000000,unsigned>; ///U0_TXD function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> u0TxdO{}; ///U0_RXD function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,8),Register::ReadWriteAccess,unsigned> u0RxdI{}; ///U0_RTS function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> u0RtsO{}; ///U0_CTS function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> u0CtsI{}; } namespace SwmPinassign1{ ///<Pin assign register 1. Assign movable functions U0_SCLC, U1_TXD, U1_RXD using Addr = Register::Address<0x4000c004,0x00000000,0x00000000,unsigned>; ///U0_SCLK function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> u0SclkIo{}; ///U1_TXD function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,8),Register::ReadWriteAccess,unsigned> u1TxdO{}; ///U1_RXD function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> u1RxdI{}; ///U1_RTS function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> u1RtsO{}; } namespace SwmPinassign2{ ///<Pin assign register 2. Assign movable functions U2_TXD, U2_RXD using Addr = Register::Address<0x4000c008,0x00000000,0x00000000,unsigned>; ///U1_CTS function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> u1CtsI{}; ///U1_SCLK function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,8),Register::ReadWriteAccess,unsigned> u1SclkIo{}; ///U2_TXD function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> u2TxdO{}; ///U2_RXD function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> u2RxdI{}; } namespace SwmPinassign3{ ///<Pin assignregister 3. Assign movable function SPI0_SCK using Addr = Register::Address<0x4000c00c,0x00000000,0x00000000,unsigned>; ///U2_RTS function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> u2RtsO{}; ///U2_CTS function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,8),Register::ReadWriteAccess,unsigned> u2CtsI{}; ///U2_SCLK function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> u2SclkIo{}; ///SPI0_SCK function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> spi0SckIo{}; } namespace SwmPinassign4{ ///<Pin assign register 4. Assign movable functions SPI0_MOSI, SPI0_MISO, SPI0_SSEL, SPI1_SCK using Addr = Register::Address<0x4000c010,0x00000000,0x00000000,unsigned>; ///SPI0_MOSI function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> spi0MosiIo{}; ///SPI0_MISIO function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,8),Register::ReadWriteAccess,unsigned> spi0MisoIo{}; ///SPI0_SSEL function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> spi0SselIo{}; ///SPI1_SCK function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> spi1SckIo{}; } namespace SwmPinassign5{ ///<Pin assign register 5. Assign movable functions SPI1_MOSI, SPI1_MISO, SPI1_SSEL, CTIN_0 using Addr = Register::Address<0x4000c014,0x00000000,0x00000000,unsigned>; ///SPI1_MOSI function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> spi1MosiIo{}; ///SPI1_MISIO function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,8),Register::ReadWriteAccess,unsigned> spi1MisoIo{}; ///SPI1_SSEL function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> spi1SselIo{}; ///CTIN_0 function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> ctin0I{}; } namespace SwmPinassign6{ ///<Pin assign register 6. Assign movable functions CTIN_1, CTIN_2, CTIN_3, CTOUT_0 using Addr = Register::Address<0x4000c018,0x00000000,0x00000000,unsigned>; ///CTIN_1 function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> ctin1I{}; ///CTIN_2function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,8),Register::ReadWriteAccess,unsigned> ctin2I{}; ///CTIN_3 function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> ctin3I{}; ///CTOUT_0 function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> ctout0O{}; } namespace SwmPinassign7{ ///<Pin assign egister 7. Assign movable functions CTOUT_1, CTOUT_2, CTOUT_3, I2C_SDA using Addr = Register::Address<0x4000c01c,0x00000000,0x00000000,unsigned>; ///CTOUT_1 function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> ctout1O{}; ///CTOUT_2 function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,8),Register::ReadWriteAccess,unsigned> ctout2O{}; ///CTOUT_3 function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> ctout3O{}; ///I2C_SDA function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> i2cSdaIo{}; } namespace SwmPinassign8{ ///<Pin assign register 8. Assign movable functions I2C_SCL, ACMP_O, CLKOUT, GPIO_INT_BMAT using Addr = Register::Address<0x4000c020,0x00000000,0x00000000,unsigned>; ///I2C_SCL function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,0),Register::ReadWriteAccess,unsigned> i2cSclIo{}; ///ACMP_O_O function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,8),Register::ReadWriteAccess,unsigned> acmpOO{}; ///CLKOUT function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,16),Register::ReadWriteAccess,unsigned> clkoutO{}; ///GPIO_INT_BMAT function assignment. The value is the pin number to be assigned to this function. The following pins are available: PIO0_0 (= 0) to PIO0_17 (= 0x11). constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> gpioIntBmatO{}; } namespace SwmPinenable0{ ///<Pin enable register 0. Enables fixed-pin functions ACMP_I0, ACMP_I1, SWCLK, SWDIO, XTALIN, XTALOUT, RESET, CLKIN, VDDCMP using Addr = Register::Address<0x4000c1c0,0x00000000,0x00000000,unsigned>; ///Enables fixed-pin function. Writing a 1 deselects the function and any movable function can be assigned to this pin. By default the fixed--pin function is deselected and GPIO is assigned to this pin. enum class Acmpi1enVal { enableAcmpI1This=0x00000000, ///<Enable ACMP_I1. This function is enabled on pin PIO0_0. disableAcmpI1Gpi=0x00000001, ///<Disable ACMP_I1. GPIO function PIO0_0 (default) or any other movable function can be assigned to pin PIO0_0. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Acmpi1enVal> acmpI1En{}; namespace Acmpi1enValC{ constexpr Register::FieldValue<decltype(acmpI1En)::Type,Acmpi1enVal::enableAcmpI1This> enableAcmpI1This{}; constexpr Register::FieldValue<decltype(acmpI1En)::Type,Acmpi1enVal::disableAcmpI1Gpi> disableAcmpI1Gpi{}; } ///Enables fixed-pin function. Writing a 1 deselects the function and any movable function can be assigned to this pin. By default the fixed-pin function is deselected and GPIO is assigned to this pin. Functions CLKIN and ACMP_I2 are connected to the same pin PIO0_1. To use ACMP_I2, disable the CLKIN function in bit 7 of this register and enable ACMP_I2. enum class Acmpi2enVal { enableAcmpI2This=0x00000000, ///<Enable ACMP_I2. This function is enabled on pin PIO0_1. disableAcmpI2Gpi=0x00000001, ///<Disable ACMP_I2. GPIO function PIO0_1 (default) or any other movable function can be assigned to pin PIO0_1. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Acmpi2enVal> acmpI2En{}; namespace Acmpi2enValC{ constexpr Register::FieldValue<decltype(acmpI2En)::Type,Acmpi2enVal::enableAcmpI2This> enableAcmpI2This{}; constexpr Register::FieldValue<decltype(acmpI2En)::Type,Acmpi2enVal::disableAcmpI2Gpi> disableAcmpI2Gpi{}; } ///Enables fixed-pin function. Writing a 1 deselects the function and any movable function can be assigned to this pin. This function is selected by default. enum class SwclkenVal { enableSwclkThisF=0x00000000, ///<Enable SWCLK. This function is enabled on pin PIO0_3. disableSwclkGpio=0x00000001, ///<Disable SWCLK. GPIO function PIO0_3 is selected on this pin. Any other movable function can be assigned to pin PIO0_3. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,SwclkenVal> swclkEn{}; namespace SwclkenValC{ constexpr Register::FieldValue<decltype(swclkEn)::Type,SwclkenVal::enableSwclkThisF> enableSwclkThisF{}; constexpr Register::FieldValue<decltype(swclkEn)::Type,SwclkenVal::disableSwclkGpio> disableSwclkGpio{}; } ///Enables fixed-pin function. Writing a 1 deselects the function and any movable function can be assigned to this pin. This function is selected by default. enum class SwdioenVal { enableSwdioThisF=0x00000000, ///<Enable SWDIO. This function is enabled on pin PIO0_2. disableSwdioGpio=0x00000001, ///<Disable SWDIO. GPIO function PIO0_2 is selected on this pin. Any other movable function can be assigned to pin PIO0_2. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,SwdioenVal> swdioEn{}; namespace SwdioenValC{ constexpr Register::FieldValue<decltype(swdioEn)::Type,SwdioenVal::enableSwdioThisF> enableSwdioThisF{}; constexpr Register::FieldValue<decltype(swdioEn)::Type,SwdioenVal::disableSwdioGpio> disableSwdioGpio{}; } ///Enables fixed-pin function. Writing a 1 deselects the function and any movable function can be assigned to this pin. By default the fixed--pin function is deselected and GPIO is assigned to this pin. enum class XtalinenVal { enableXtalinThis=0x00000000, ///<Enable XTALIN. This function is enabled on pin PIO0_8. disableXtalinGpio=0x00000001, ///<Disable XTALIN. GPIO function PIO0_8 (default) or any other movable function can be assigned to pin PIO0_8. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,XtalinenVal> xtalinEn{}; namespace XtalinenValC{ constexpr Register::FieldValue<decltype(xtalinEn)::Type,XtalinenVal::enableXtalinThis> enableXtalinThis{}; constexpr Register::FieldValue<decltype(xtalinEn)::Type,XtalinenVal::disableXtalinGpio> disableXtalinGpio{}; } ///Enables fixed-pin function. Writing a 1 deselects the function and any movable function can be assigned to this pin. By default the fixed--pin function is deselected and GPIO is assigned to this pin. enum class XtaloutenVal { enableXtaloutThis=0x00000000, ///<Enable XTALOUT. This function is enabled on pin PIO0_9. disableXtaloutGpi=0x00000001, ///<Disable XTALOUT. GPIO function PIO0_9 (default) or any other movable function can be assigned to pin PIO0_9. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,XtaloutenVal> xtaloutEn{}; namespace XtaloutenValC{ constexpr Register::FieldValue<decltype(xtaloutEn)::Type,XtaloutenVal::enableXtaloutThis> enableXtaloutThis{}; constexpr Register::FieldValue<decltype(xtaloutEn)::Type,XtaloutenVal::disableXtaloutGpi> disableXtaloutGpi{}; } ///Enables fixed-pin function. Writing a 1 deselects the function and any movable function can be assigned to this pin. This function is selected by default. enum class ResetenVal { enableResetThisF=0x00000000, ///<Enable RESET. This function is enabled on pin PIO0_5. disableResetGpio=0x00000001, ///<Disable RESET. GPIO function PIO0_5 is selected on this pin. Any other movable function can be assigned to pin PIO0_5. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,ResetenVal> resetEn{}; namespace ResetenValC{ constexpr Register::FieldValue<decltype(resetEn)::Type,ResetenVal::enableResetThisF> enableResetThisF{}; constexpr Register::FieldValue<decltype(resetEn)::Type,ResetenVal::disableResetGpio> disableResetGpio{}; } ///Enables fixed-pin function. Writing a 1 deselects the function and any movable function can be assigned to this pin. By default the fixed-pin function is deselected and GPIO is assigned to this pin. Functions CLKIN and ACMP_I2 are connected to the same pin PIO0_1. To use CLKIN, disable ACMP_I2 in bit 1 of this register and enable CLKIN. enum class ClkinVal { enableClkinThisF=0x00000000, ///<Enable CLKIN. This function is enabled on pin PIO0_1. disableClkinGpio=0x00000001, ///<Disable CLKIN. GPIO function PIO0_1 (default) or any other movable function can be assigned to pin CLKIN. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,ClkinVal> clkin{}; namespace ClkinValC{ constexpr Register::FieldValue<decltype(clkin)::Type,ClkinVal::enableClkinThisF> enableClkinThisF{}; constexpr Register::FieldValue<decltype(clkin)::Type,ClkinVal::disableClkinGpio> disableClkinGpio{}; } ///Enables fixed-pin function. Writing a 1 deselects the function and any movable function can be assigned to this pin. By default the fixed--pin function is deselected and GPIO is assigned to this pin. enum class VddcmpVal { enableVddcmpThis=0x00000000, ///<Enable VDDCMP. This function is enabled on pin PIO0_6. disableVddcmpGpio=0x00000001, ///<Disable VDDCMP. GPIO function PIO0_6 (default) or any other movable function can be assigned to pin PIO0_6. }; constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,VddcmpVal> vddcmp{}; namespace VddcmpValC{ constexpr Register::FieldValue<decltype(vddcmp)::Type,VddcmpVal::enableVddcmpThis> enableVddcmpThis{}; constexpr Register::FieldValue<decltype(vddcmp)::Type,VddcmpVal::disableVddcmpGpio> disableVddcmpGpio{}; } ///Reserved. constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,9),Register::ReadWriteAccess,unsigned> reserved{}; } }
106.895
364
0.730249
cjsmeele
7f8e15d29a1ba83e5bd1bdf02af3b85368fb2b89
16,297
cc
C++
nugen/EventGeneratorBase/test/EventGeneratorTest_module.cc
nusense/nugen
ee4fefda7f2aa5e5ca8ee9c741f07bd3dbef2ed7
[ "Apache-2.0" ]
null
null
null
nugen/EventGeneratorBase/test/EventGeneratorTest_module.cc
nusense/nugen
ee4fefda7f2aa5e5ca8ee9c741f07bd3dbef2ed7
[ "Apache-2.0" ]
null
null
null
nugen/EventGeneratorBase/test/EventGeneratorTest_module.cc
nusense/nugen
ee4fefda7f2aa5e5ca8ee9c741f07bd3dbef2ed7
[ "Apache-2.0" ]
null
null
null
//////////////////////////////////////////////////////////////////////// // // brebel@fnal.gov // //////////////////////////////////////////////////////////////////////// #ifndef EVGEN_TEST_H #define EVGEN_TEST_H #include <cstdlib> #include <string> #include <sstream> #include <vector> #include <map> #include <unistd.h> // Framework includes #include "art/Framework/Core/ModuleMacros.h" #include "art/Framework/Principal/Event.h" #include "fhiclcpp/ParameterSet.h" #include "art/Framework/Principal/Handle.h" #include "messagefacility/MessageLogger/MessageLogger.h" #include "art/Framework/Core/EDAnalyzer.h" #include "cetlib_except/exception.h" #include "cetlib/search_path.h" #include "nusimdata/SimulationBase/MCTruth.h" #include "nusimdata/SimulationBase/GTruth.h" #include "nusimdata/SimulationBase/MCFlux.h" #include "nusimdata/SimulationBase/MCNeutrino.h" #include "nusimdata/SimulationBase/MCParticle.h" #include "nugen/EventGeneratorBase/evgenbase.h" #include "nugen/EventGeneratorBase/GENIE/GENIEHelper.h" #include "TStopwatch.h" #include "TGeoManager.h" namespace art { class Event; } namespace simb { class MCParticle; } ///Monte Carlo event generation namespace evgen { /// A module to check the results from the Monte Carlo generator class EventGeneratorTest : public art::EDAnalyzer { public: explicit EventGeneratorTest(fhicl::ParameterSet const &pset); void analyze(art::Event const& evt); private: fhicl::ParameterSet GENIEParameterSet(std::string fluxType, bool usePOTPerSpill); void GENIETest(fhicl::ParameterSet const& pset); void GENIEHistogramFluxTest(); void GENIESimpleFluxTest(); void GENIEMonoFluxTest(); void GENIEAtmoFluxTest(); void GENIENtupleFluxTest(); fhicl::ParameterSet CRYParameterSet(); void CRYTest(); bool IntersectsDetector(simb::MCParticle const& part); void ProjectToSurface(TLorentzVector pos, TLorentzVector mom, int axis, double surfaceLoc, double* xyz); double fTotalGENIEPOT; ///< number of POT to generate with GENIE when ///< in total POT mode double fTotalGENIEInteractions; ///< number of interactions to generate with ///< GENIE when in EventsPerSpill mode double fTotalCRYSpills; ///< number of spills to use when testing CRY std::string fTopVolume; ///< Top Volume used by GENIE std::string fGeometryFile; ///< location of Geometry GDML file to test double fCryDetLength; ///< length of detector to test CRY, units of cm double fCryDetWidth; ///< width of detector to test CRY, units of cm double fCryDetHeight; ///< height of detector to test CRY, units of cm CLHEP::HepRandomEngine& fEngine; ///< art-owned engine used in generation random numbers }; } namespace evgen { //____________________________________________________________________________ EventGeneratorTest::EventGeneratorTest(fhicl::ParameterSet const& pset) : EDAnalyzer (pset) , fTotalGENIEPOT ( pset.get< double >("TotalGENIEPOT", 5e18)) , fTotalGENIEInteractions( pset.get< double >("TotalGENIEInteractions", 100) ) , fTotalCRYSpills ( pset.get< double >("TotalCRYSpills", 1000)) , fTopVolume ( pset.get< std::string >("TopVolume" )) , fGeometryFile ( pset.get< std::string >("GeometryFile" )) , fCryDetLength (1000.) , fCryDetWidth (500.) , fCryDetHeight (500.) , fEngine{createEngine(pset.get< int >("Seed", evgb::GetRandomNumberSeed()))} {} //____________________________________________________________________________ void EventGeneratorTest::analyze(art::Event const& evt) { mf::LogWarning("EventGeneratorTest") << "testing GENIE..."; mf::LogWarning("EventGeneratorTest") << "\t histogram flux..."; this->GENIEHistogramFluxTest(); mf::LogWarning("EventGeneratorTest") << "\t \t done." << "\t simple flux..."; this->GENIESimpleFluxTest(); mf::LogWarning("EventGeneratorTest") << "\t \t done." << "\t atmo flux..."; this->GENIEAtmoFluxTest(); mf::LogWarning("EventGeneratorTest") << "\t \t done." << "\t mono flux..."; this->GENIEMonoFluxTest(); mf::LogWarning("EventGeneratorTest") << "\t \t done.\n" << "GENIE tests done"; mf::LogWarning("EventGeneratorTest") << "testing CRY..."; this->CRYTest(); mf::LogWarning("EventGeneratorTest") << "\t CRY test done."; } //____________________________________________________________________________ fhicl::ParameterSet EventGeneratorTest::GENIEParameterSet(std::string fluxType, bool usePOTPerSpill) { // make a parameter set first so that we can pass it to the GENIEHelper // object we are going to make std::vector<double> beamCenter; beamCenter.push_back(0.0); beamCenter.push_back(0.); beamCenter.push_back(0.0); std::vector<double> beamDir; beamDir.push_back(0.); beamDir.push_back(0.); beamDir.push_back(1.); std::vector<int> flavors; if(fluxType.compare("atmo_FLUKA") == 0){ flavors.push_back(14); } else{ flavors.push_back(12); flavors.push_back(14); flavors.push_back(-12); flavors.push_back(-14); } std::vector<std::string> env; env.push_back("GPRODMODE"); env.push_back("YES"); env.push_back("GEVGL"); env.push_back("Default"); double potPerSpill = 5.e13; double eventsPerSpill = 0; if(!usePOTPerSpill) eventsPerSpill = 1; std::vector<std::string> fluxFiles; fluxFiles.push_back("samples_for_geniehelper/L010z185i_lowthr_ipndshed.root"); if(fluxType.compare("simple_flux") == 0){ fluxFiles.clear(); fluxFiles.push_back("samples_for_geniehelper/gsimple_NOvA-NDOS_le010z185i_20100521_RHC_lowth_s_00001.root"); } else if(fluxType.compare("atmo_FLUKA") == 0){ fluxFiles.clear(); // at FNAL this is installed relative to in /nusoft/data/flux fluxFiles.push_back("atmospheric/battistoni/sdave_numu07.dat"); } else if(fluxType.compare("ntuple") == 0){ throw cet::exception("EventGeneratorTest") <<"No ntuple flux file " << "exists, bail ungracefully"; } fhicl::ParameterSet pset; pset.put("FluxType", fluxType); pset.put("FluxFiles", fluxFiles); pset.put("BeamName", "numi"); pset.put("TopVolume", fTopVolume); pset.put("EventsPerSpill", eventsPerSpill); pset.put("POTPerSpill", potPerSpill); pset.put("BeamCenter", beamCenter); pset.put("BeamDirection", beamDir); pset.put("GenFlavors", flavors); pset.put("Environment", env); pset.put("DetectorLocation", "NOvA-ND"); mf::LogWarning("EventGeneratorTest") << pset.to_string(); return pset; } //____________________________________________________________________________ void EventGeneratorTest::GENIETest(fhicl::ParameterSet const& pset) { // use cet::search_path to get the Geometry file path cet::search_path sp("FW_SEARCH_PATH"); std::string geometryFile = fGeometryFile; if( !sp.find_file(geometryFile, fGeometryFile) ) throw cet::exception("EventGeneratorTest") << "cannot find geometry file:\n " << geometryFile << "\n to test GENIE"; TGeoManager::Import(geometryFile.c_str()); // make the GENIEHelper object evgb::GENIEHelper help(pset, gGeoManager, geometryFile, gGeoManager->FindVolumeFast(pset.get< std::string>("TopVolume").c_str())->Weight()); help.Initialize(); int interactionCount = 0; int nspill = 0; int spillLimit = 0; // decide if we are in POT/Spill or Events/Spill mode double eps = pset.get<double>("EventsPerSpill"); if(eps > 0.) spillLimit = TMath::Nint(fTotalGENIEInteractions/eps); else spillLimit = 1000; while(nspill < spillLimit){ ++nspill; while( !help.Stop() ){ simb::MCTruth truth; simb::MCFlux flux; simb::GTruth gTruth; if( help.Sample(truth, flux, gTruth) ) ++interactionCount; } // end creation loop for this spill } // end loop over spills // count the POT used and the number of events made mf::LogWarning("EventGeneratorTest") << "made " << interactionCount << " interactions with " << help.TotalExposure() << " POTs"; // compare to a simple expectation double totalExp = 0.; if(help.FluxType().compare("histogram") == 0 && pset.get<double>("EventsPerSpill") == 0){ std::vector<TH1D*> fluxhist = help.FluxHistograms(); if(fluxhist.size() < 1){ throw cet::exception("EventGeneratorTest") << "using histogram fluxes but no histograms provided!"; } // see comments in GENIEHelper::Initialize() for how this calculation was done. totalExp = 1.e-38*1.e-20*help.TotalHistFlux(); totalExp *= help.TotalExposure()*help.TotalMass()/(1.67262158e-27); mf::LogWarning("EventGeneratorTest") << "expected " << totalExp << " interactions"; if(std::abs(interactionCount - totalExp) > 3.*std::sqrt(totalExp) ){ throw cet::exception("EventGeneratorTest") << "generated count is more than " << "3 sigma off expectation"; } }// end if histogram fluxes return; } //____________________________________________________________________________ void EventGeneratorTest::GENIEHistogramFluxTest() { mf::LogWarning("EventGeneratorTest") << "\t\t\t 1 event per spill...\n"; // make the parameter set fhicl::ParameterSet pset1(this->GENIEParameterSet("histogram", false)); this->GENIETest(pset1); mf::LogWarning("EventGeneratorTest") <<"\t\t\t events based on POT per spill...\n"; fhicl::ParameterSet pset2(this->GENIEParameterSet("histogram", true)); this->GENIETest(pset2); return; } //____________________________________________________________________________ void EventGeneratorTest::GENIESimpleFluxTest() { // make the parameter set mf::LogWarning("EventGeneratorTest") << "testing GENIEHelper in simple_flux mode with \n" << "\t 1 event per spill...\n"; fhicl::ParameterSet pset1 = this->GENIEParameterSet("simple_flux", false); this->GENIETest(pset1); mf::LogWarning("EventGeneratorTest") <<"\t events based on POT per spill...\n"; fhicl::ParameterSet pset2 = this->GENIEParameterSet("simple_flux", true); this->GENIETest(pset2); return; } //____________________________________________________________________________ void EventGeneratorTest::GENIEMonoFluxTest() { // make the parameter set fhicl::ParameterSet pset1 = this->GENIEParameterSet("mono", false); mf::LogWarning("EventGeneratorTest") << "\t\t 1 event per spill...\n"; this->GENIETest(pset1); return; } //____________________________________________________________________________ void EventGeneratorTest::GENIEAtmoFluxTest() { // make the parameter set fhicl::ParameterSet pset1 = this->GENIEParameterSet("atmo_FLUKA", false); mf::LogWarning("EventGeneratorTest") << "\t\t 1 event per spill...\n"; this->GENIETest(pset1); return; } //____________________________________________________________________________ fhicl::ParameterSet EventGeneratorTest::CRYParameterSet() { fhicl::ParameterSet pset; pset.put("SampleTime", 600e-6 ); pset.put("TimeOffset", -30e-6 ); pset.put("EnergyThreshold", 50e-3 ); pset.put("Latitude", "latitude 41.8 " ); pset.put("Altitude", "altitude 0 " ); pset.put("SubBoxLength", "subboxLength 75 "); mf::LogWarning("EventGeneratorTest") << pset.to_string(); return pset; } //____________________________________________________________________________ void EventGeneratorTest::CRYTest() { // make the parameter set fhicl::ParameterSet pset = this->CRYParameterSet(); // make the CRYHelper evgb::CRYHelper help(pset, fEngine); int nspill = 0; double avPartPerSpill = 0.; double avPartIntersectPerSpill = 0.; double avMuonIntersectPerSpill = 0.; double avEIntersectPerSpill = 0.; while(nspill < TMath::Nint(fTotalCRYSpills) ){ simb::MCTruth mct; help.Sample(mct, 1., 100., 0); avPartPerSpill += mct.NParticles(); // now check to see if the particles go through the // detector enclosure for(int p = 0; p < mct.NParticles(); ++p){ if(this->IntersectsDetector(mct.GetParticle(p)) ){ avPartIntersectPerSpill += 1.; if(TMath::Abs(mct.GetParticle(p).PdgCode()) == 13) avMuonIntersectPerSpill += 1.; else if(TMath::Abs(mct.GetParticle(p).PdgCode()) == 11) avEIntersectPerSpill += 1.; } } ++nspill; } mf::LogWarning("EventGeneratorTest") << "there are " << avPartPerSpill/(1.*nspill) << " cosmic rays made per spill \n" << avPartIntersectPerSpill/(1.*nspill) << " intersect the detector per spill" << "\n\t " << avMuonIntersectPerSpill/(1.*nspill) << " muons \n\t" << avEIntersectPerSpill/(1.*nspill) << " electrons"; return; } //____________________________________________________________________________ bool EventGeneratorTest::IntersectsDetector(simb::MCParticle const& part) { // the particle's initial position and momentum TLorentzVector pos = part.Position(); TLorentzVector mom = part.Momentum(); if(TMath::Abs(mom.P()) == 0){ mf::LogWarning("EventGeneratorTest") << "particle has no momentum!!! bail"; return false; } double xyz[3] = {0.}; // Checking intersection with 6 planes // 1. Check intersection with the y = +halfheight plane this->ProjectToSurface(pos, mom, 1, 0.5*fCryDetHeight, xyz); if( TMath::Abs(xyz[0]) <= 0.5*fCryDetWidth && xyz[2] > 0. && TMath::Abs(xyz[2]) <= fCryDetLength ) return true; // 2. Check intersection with the +x plane this->ProjectToSurface(pos, mom, 0, 0.5*fCryDetWidth, xyz); if( TMath::Abs(xyz[1]) <= 0.5*fCryDetHeight && xyz[2] > 0. && TMath::Abs(xyz[2]) <= fCryDetLength ) return true; // 3. Check intersection with the -x plane this->ProjectToSurface(pos, mom, 0, -0.5*fCryDetWidth, xyz); if( TMath::Abs(xyz[1]) <= 0.5*fCryDetHeight && xyz[2] > 0. && TMath::Abs(xyz[2]) <= fCryDetLength ) return true; // 4. Check intersection with the z=0 plane this->ProjectToSurface(pos, mom, 2, 0., xyz); if( TMath::Abs(xyz[0]) <= 0.5*fCryDetWidth && TMath::Abs(xyz[1]) <= 0.5*fCryDetHeight ) return true; // 5. Check intersection with the z=detlength plane this->ProjectToSurface(pos, mom, 2, fCryDetLength, xyz); if( TMath::Abs(xyz[0]) <= 0.5*fCryDetWidth && TMath::Abs(xyz[1]) <= 0.5*fCryDetHeight ) return true; return false; } //____________________________________________________________________________ void EventGeneratorTest::ProjectToSurface(TLorentzVector pos, TLorentzVector mom, int axis, double surfaceLoc, double* xyz) { double momDir = 0.; double posDir = 0.; if(axis == 0){ momDir = mom.Px(); posDir = pos.X(); } else if(axis == 1){ momDir = mom.Py(); posDir = pos.X(); } else if(axis == 2){ momDir = mom.Pz(); posDir = pos.X(); } double ddS = (momDir/mom.P()); double length1Dim = (posDir - surfaceLoc); if(TMath::Abs(ddS) > 0.){ length1Dim /= ddS; xyz[0] = pos.X() + length1Dim*mom.Px()/mom.P(); xyz[1] = pos.Y() + length1Dim*mom.Py()/mom.P(); xyz[2] = pos.Z() + length1Dim*mom.Pz()/mom.P(); } return; } }// namespace namespace evgen{ DEFINE_ART_MODULE(EventGeneratorTest) } #endif // EVGEN_TEST_H
32.080709
114
0.63932
nusense
7f92e43c34d995bd5d9fc6cbd8abf11bf6e52483
605
hpp
C++
framework/pipeline/StandardLine.hpp
FeiGeChuanShu/TengineFactory
89524b8edc3fb6d00f60f12ebfcfdea985639e03
[ "Apache-2.0" ]
1
2021-09-30T05:44:57.000Z
2021-09-30T05:44:57.000Z
framework/pipeline/StandardLine.hpp
FeiGeChuanShu/TengineFactory
89524b8edc3fb6d00f60f12ebfcfdea985639e03
[ "Apache-2.0" ]
null
null
null
framework/pipeline/StandardLine.hpp
FeiGeChuanShu/TengineFactory
89524b8edc3fb6d00f60f12ebfcfdea985639e03
[ "Apache-2.0" ]
null
null
null
#ifndef STANDARDLINE_HPP #define STANDARDLINE_HPP #include <iostream> #include "LineBase.hpp" #include "Dataset.hpp" #include "ImageDispose.hpp" #include <memory> namespace TFactory { class StandardLine : public LineBase { private: Anchor anchor; public: StandardLine(); void onCreate(); void onPreProcess(); void onRun(uint8_t* imageData, int input_w, int input_h, std::vector<std::vector<float*>> streams); void onPostProcess(); std::vector<float*> onReceiveOutput(); void onDestory(); ~StandardLine(); private: void NoPostProcess(); void NMS(); }; } #endif
20.862069
103
0.700826
FeiGeChuanShu
7f93fb42d8ce71aee849da1cf06307bd605998e5
42,312
cc
C++
chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc
sarang-apps/darshan_browser
173649bb8a7c656dc60784d19e7bb73e07c20daa
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc
sarang-apps/darshan_browser
173649bb8a7c656dc60784d19e7bb73e07c20daa
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/android/features/cablev2_authenticator/native/cablev2_authenticator_android.cc
sarang-apps/darshan_browser
173649bb8a7c656dc60784d19e7bb73e07c20daa
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/android/jni_array.h" #include "base/android/jni_string.h" #include "base/base64url.h" #include "base/memory/singleton.h" #include "base/numerics/safe_math.h" #include "base/strings/string_number_conversions.h" #include "base/task/post_task.h" #include "components/cbor/diagnostic_writer.h" #include "components/cbor/reader.h" #include "components/cbor/writer.h" #include "components/device_event_log/device_event_log.h" #include "crypto/aead.h" #include "crypto/random.h" #include "device/fido/cable/cable_discovery_data.h" #include "device/fido/cable/v2_handshake.h" #include "device/fido/cbor_extract.h" #include "device/fido/fido_constants.h" #include "device/fido/fido_parsing_utils.h" #include "device/fido/fido_transport_protocol.h" #include "third_party/boringssl/src/include/openssl/aes.h" #include "third_party/boringssl/src/include/openssl/bytestring.h" #include "third_party/boringssl/src/include/openssl/digest.h" #include "third_party/boringssl/src/include/openssl/ec_key.h" #include "third_party/boringssl/src/include/openssl/ecdh.h" #include "third_party/boringssl/src/include/openssl/hkdf.h" #include "third_party/boringssl/src/include/openssl/obj.h" #include "third_party/boringssl/src/include/openssl/sha.h" // These "headers" actually contain several function definitions and thus can // only be included once across Chromium. #include "chrome/android/features/cablev2_authenticator/jni_headers/BLEHandler_jni.h" using base::android::ConvertJavaStringToUTF8; using base::android::ConvertUTF8ToJavaString; using base::android::JavaByteArrayToByteVector; using base::android::JavaParamRef; using base::android::ScopedJavaLocalRef; using base::android::ToJavaArrayOfByteArray; using base::android::ToJavaByteArray; using base::android::ToJavaIntArray; using device::CtapDeviceResponseCode; using device::CtapRequestCommand; using device::cbor_extract::IntKey; using device::cbor_extract::Is; using device::cbor_extract::Map; using device::cbor_extract::StepOrByte; using device::cbor_extract::Stop; using device::cbor_extract::StringKey; using device::fido_parsing_utils::CopyCBORBytestring; namespace { // TODO: this string is currently in the protocol, and saved in the // desktop's prefs, but not otherwise surfaced. See if we can get a better // value for it. constexpr char kDeviceName[] = "Android phone"; // Defragmenter accepts CTAP2 message fragments and reassembles them. // See // https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#ble-framing class Defragmenter { public: // Process appends the fragment |in| to the current message. If there is an // error, it returns false. Otherwise it returns true and, if a complete // message is available, |*out_result| is set to the command value and payload // and the Defragmenter is reset for the next message. Otherwise |*out_result| // is empty. // // If this function returns false, the object is no longer usable for future // fragments. // // The span in any |*out_result| value is only valid until the next call on // this object and may alias |in|. bool Process(base::span<const uint8_t> in, base::Optional<std::pair<uint8_t, base::span<const uint8_t>>>* out_result) { CBS cbs; CBS_init(&cbs, in.data(), in.size()); uint8_t lead_byte; if (!CBS_get_u8(&cbs, &lead_byte)) { return false; } const bool message_start = (lead_byte & 0x80) != 0; if (message_start != expect_message_start_) { return false; } if (message_start) { // The most-significant bit isn't masked off in order to match up with // the values in FidoBleDeviceCommand. const uint8_t command = lead_byte; uint16_t msg_len; if (!CBS_get_u16(&cbs, &msg_len) || msg_len < CBS_len(&cbs)) { return false; } if (msg_len == CBS_len(&cbs)) { base::span<const uint8_t> span(CBS_data(&cbs), CBS_len(&cbs)); out_result->emplace(command, span); return true; } expect_message_start_ = false; command_ = command; message_len_ = msg_len; next_fragment_ = 0; buf_.resize(0); buf_.insert(buf_.end(), CBS_data(&cbs), CBS_data(&cbs) + CBS_len(&cbs)); out_result->reset(); return true; } if (next_fragment_ != lead_byte) { return false; } buf_.insert(buf_.end(), CBS_data(&cbs), CBS_data(&cbs) + CBS_len(&cbs)); if (buf_.size() < message_len_) { next_fragment_ = (next_fragment_ + 1) & 0x7f; out_result->reset(); return true; } else if (buf_.size() > message_len_) { return false; } expect_message_start_ = true; out_result->emplace(command_, buf_); return true; } private: std::vector<uint8_t> buf_; uint8_t command_; uint16_t message_len_; uint8_t next_fragment_; bool expect_message_start_ = true; }; // AuthenticatorState contains the keys for a caBLE v2 authenticator. struct AuthenticatorState { // pairing_data contains long-term keys, and information that is potentially // sent to peers during QR pairing. The |v2| member of this structure will be // populated. device::CableDiscoveryData pairing_data; // identity_key is the long-term signing key. bssl::UniquePtr<EC_KEY> identity_key; // pairing_advert contains information about the BLE advert that is sent based // on the long-term keys. device::cablev2::NonceAndEID pairing_advert; // If doing a QR pairing, the following two members will be present. // qr_advert contains information about the BLE advert that is sent based on // QR pairing keys. base::Optional<device::cablev2::NonceAndEID> qr_advert; // qr_psk_gen_key contains the PSK generating key derived from the QR secret. base::Optional<device::CablePskGeneratorKey> qr_psk_gen_key; // peer_identity is the public-key of the desktop from the scanned QR code. base::Optional<bssl::UniquePtr<EC_POINT>> qr_peer_identity; }; struct MakeCredRequest { const std::vector<uint8_t>* client_data_hash; const std::string* rp_id; const std::vector<uint8_t>* user_id; const cbor::Value::ArrayValue* cred_params; const cbor::Value::ArrayValue* excluded_credentials; const std::string* origin; const std::vector<uint8_t>* challenge; }; static constexpr StepOrByte<MakeCredRequest> kMakeCredParseSteps[] = { // clang-format off ELEMENT(Is::kRequired, MakeCredRequest, client_data_hash), IntKey<MakeCredRequest>(1), Map<MakeCredRequest>(), IntKey<MakeCredRequest>(2), ELEMENT(Is::kRequired, MakeCredRequest, rp_id), StringKey<MakeCredRequest>(), 'i', 'd', '\0', Stop<MakeCredRequest>(), Map<MakeCredRequest>(), IntKey<MakeCredRequest>(3), ELEMENT(Is::kRequired, MakeCredRequest, user_id), StringKey<MakeCredRequest>(), 'i', 'd', '\0', Stop<MakeCredRequest>(), ELEMENT(Is::kRequired, MakeCredRequest, cred_params), IntKey<MakeCredRequest>(4), ELEMENT(Is::kOptional, MakeCredRequest, excluded_credentials), IntKey<MakeCredRequest>(5), // TODO: remove once the FIDO API can handle clientDataJSON Map<MakeCredRequest>(), IntKey<MakeCredRequest>(6), Map<MakeCredRequest>(), StringKey<MakeCredRequest>(), 'g', 'o', 'o', 'g', 'l', 'e', 'A', 'n', 'd', 'r', 'o', 'i', 'd', 'C', 'l', 'i', 'e', 'n', 't', 'D', 'a', 't', 'a', '\0', ELEMENT(Is::kRequired, MakeCredRequest, origin), IntKey<MakeCredRequest>(2), ELEMENT(Is::kRequired, MakeCredRequest, challenge), IntKey<MakeCredRequest>(3), Stop<MakeCredRequest>(), Stop<MakeCredRequest>(), Stop<MakeCredRequest>(), // clang-format on }; struct AttestationObject { const std::string* fmt; const std::vector<uint8_t>* auth_data; const cbor::Value* statement; }; static constexpr StepOrByte<AttestationObject> kAttObjParseSteps[] = { // clang-format off ELEMENT(Is::kRequired, AttestationObject, fmt), StringKey<AttestationObject>(), 'f', 'm', 't', '\0', ELEMENT(Is::kRequired, AttestationObject, auth_data), StringKey<AttestationObject>(), 'a', 'u', 't', 'h', 'D', 'a', 't', 'a', '\0', ELEMENT(Is::kRequired, AttestationObject, statement), StringKey<AttestationObject>(), 'a', 't', 't', 'S', 't', 'm', 't', '\0', Stop<AttestationObject>(), // clang-format on }; struct GetAssertionRequest { const std::string* rp_id; const std::vector<uint8_t>* client_data_hash; const cbor::Value::ArrayValue* allowed_credentials; const std::string* origin; const std::vector<uint8_t>* challenge; }; static constexpr StepOrByte<GetAssertionRequest> kGetAssertionParseSteps[] = { // clang-format off ELEMENT(Is::kRequired, GetAssertionRequest, rp_id), IntKey<GetAssertionRequest>(1), ELEMENT(Is::kRequired, GetAssertionRequest, client_data_hash), IntKey<GetAssertionRequest>(2), ELEMENT(Is::kOptional, GetAssertionRequest, allowed_credentials), IntKey<GetAssertionRequest>(3), // TODO: remove once the FIDO API can handle clientDataJSON Map<GetAssertionRequest>(), IntKey<GetAssertionRequest>(4), Map<GetAssertionRequest>(), StringKey<GetAssertionRequest>(), 'g', 'o', 'o', 'g', 'l', 'e', 'A', 'n', 'd', 'r', 'o', 'i', 'd', 'C', 'l', 'i', 'e', 'n', 't', 'D', 'a', 't', 'a', '\0', ELEMENT(Is::kRequired, GetAssertionRequest, origin), IntKey<GetAssertionRequest>(2), ELEMENT(Is::kRequired, GetAssertionRequest, challenge), IntKey<GetAssertionRequest>(3), Stop<GetAssertionRequest>(), Stop<GetAssertionRequest>(), Stop<GetAssertionRequest>(), // clang-format on }; // Client represents the state of a single BLE peer. class Client { public: class Delegate { public: virtual ~Delegate() = default; virtual void OnHandshake(Client* client) = 0; virtual void MakeCredential( Client* client, const std::string& origin, const std::string& rp_id, base::span<const uint8_t> challenge, base::span<const uint8_t> user_id, base::span<const int> algorithms, base::span<std::vector<uint8_t>> excluded_credential_ids, bool resident_key_required) = 0; virtual void GetAssertion( Client* client, const std::string& origin, const std::string& rp_id, base::span<const uint8_t> challenge, base::span<std::vector<uint8_t>> allowed_credential_ids) = 0; }; Client(uint64_t addr, uint16_t mtu, const AuthenticatorState* auth_state, Delegate* delegate) : addr_(addr), mtu_(mtu), auth_state_(auth_state), delegate_(delegate) {} bool Process( base::span<const uint8_t> fragment, base::Optional<std::vector<std::vector<uint8_t>>>* out_response) { if (!ProcessImpl(fragment, out_response)) { state_ = State::kError; return false; } return true; } base::Optional<std::vector<std::vector<uint8_t>>> EncryptAndFragment( base::span<uint8_t> data) { std::vector<uint8_t> encrypted_data = device::fido_parsing_utils::Materialize(data); if (!crypter_->Encrypt(&encrypted_data)) { FIDO_LOG(ERROR) << "Failed to encrypt response"; return base::nullopt; } std::vector<std::vector<uint8_t>> fragments; if (!Fragment(static_cast<uint8_t>(device::FidoBleDeviceCommand::kMsg), encrypted_data, &fragments)) { FIDO_LOG(ERROR) << "Failed to fragment response of length " << encrypted_data.size(); return base::nullopt; } return fragments; } uint64_t addr() { return addr_; } private: enum State { kHandshake, kConnected, kError, }; bool ProcessImpl( base::span<const uint8_t> fragment, base::Optional<std::vector<std::vector<uint8_t>>>* out_response) { out_response->reset(); if (state_ == State::kError) { return false; } base::Optional<std::pair<uint8_t, base::span<const uint8_t>>> message; if (!defrag_.Process(fragment, &message)) { FIDO_LOG(ERROR) << "Failed to defragment message"; return false; } if (!message) { return true; } std::vector<uint8_t> response; switch (state_) { case State::kHandshake: { if (message->first != static_cast<uint8_t>(device::FidoBleDeviceCommand::kControl)) { FIDO_LOG(ERROR) << "Expected control message but received command " << static_cast<unsigned>(message->first); return false; } // The handshake is prefixed with the EID that the peer is responding // to. This allows us to handle the case where we have started // advertising for a QR code, but the desktop is already paired and is // connecting based on long-term keys. device::CableEidArray requested_eid; if (!device::fido_parsing_utils::ExtractArray(message->second, 0, &requested_eid)) { return false; } base::Optional<std::unique_ptr<device::cablev2::Crypter>> handshake_result; if (requested_eid == auth_state_->pairing_advert.second) { handshake_result = device::cablev2::RespondToHandshake( auth_state_->pairing_data.v2->psk_gen_key, auth_state_->pairing_advert, auth_state_->identity_key.get(), /*peer_identity=*/nullptr, /*pairing_data=*/nullptr, message->second, &response); } else if (auth_state_->qr_advert.has_value() && requested_eid == auth_state_->qr_advert->second) { // TODO: QR handshakes currently always send pairing data, but it's // optional in the protocol. handshake_result = device::cablev2::RespondToHandshake( *auth_state_->qr_psk_gen_key, *auth_state_->qr_advert, /*identity=*/nullptr, auth_state_->qr_peer_identity->get(), &auth_state_->pairing_data, message->second, &response); } else { FIDO_LOG(ERROR) << "Peer is connecting to unknown EID " << base::HexEncode(requested_eid); return false; } if (!handshake_result) { FIDO_LOG(ERROR) << "Handshake failed"; return false; } crypter_ = std::move(handshake_result.value()); state_ = State::kConnected; delegate_->OnHandshake(this); break; } case State::kConnected: { if (message->first != static_cast<uint8_t>(device::FidoBleDeviceCommand::kMsg)) { FIDO_LOG(ERROR) << "Expected normal message but received command " << static_cast<unsigned>(message->first); return false; } std::vector<uint8_t> plaintext; if (!crypter_->Decrypt( static_cast<device::FidoBleDeviceCommand>(message->first), message->second, &plaintext) || plaintext.empty()) { FIDO_LOG(ERROR) << "Decryption failed"; return false; } base::span<const uint8_t> cbor_bytes = plaintext; const auto command = cbor_bytes[0]; cbor_bytes = cbor_bytes.subspan(1); base::Optional<cbor::Value> payload; if (!cbor_bytes.empty()) { payload = cbor::Reader::Read(cbor_bytes); if (!payload) { FIDO_LOG(ERROR) << "CBOR decoding failed for " << base::HexEncode(cbor_bytes); return false; } FIDO_LOG(DEBUG) << "<- (" << base::HexEncode(&command, 1) << ") " << cbor::DiagnosticWriter::Write(*payload); } else { FIDO_LOG(DEBUG) << "<- (" << base::HexEncode(&command, 1) << ") <no payload>"; } switch (command) { case static_cast<uint8_t>( device::CtapRequestCommand::kAuthenticatorGetInfo): { if (payload) { FIDO_LOG(ERROR) << "getInfo command incorrectly contained payload"; return false; } std::array<uint8_t, device::kAaguidLength> aaguid{}; std::vector<cbor::Value> versions; versions.emplace_back("FIDO_2_0"); std::vector<cbor::Value> extensions; extensions.emplace_back(device::kExtensionAndroidClientData); // TODO: should be based on whether a screen-lock is enabled. cbor::Value::MapValue options; options.emplace("uv", true); cbor::Value::MapValue response_map; response_map.emplace(1, std::move(versions)); response_map.emplace(2, std::move(extensions)); response_map.emplace(3, aaguid); response_map.emplace(4, std::move(options)); base::Optional<std::vector<uint8_t>> response_bytes( cbor::Writer::Write(cbor::Value(std::move(response_map)))); response = std::move(*response_bytes); response.insert(response.begin(), 0); break; } case static_cast<uint8_t>( device::CtapRequestCommand::kAuthenticatorMakeCredential): { if (!payload || !payload->is_map()) { FIDO_LOG(ERROR) << "Invalid makeCredential payload"; return false; } MakeCredRequest make_cred_request; if (!device::cbor_extract::Extract<MakeCredRequest>( &make_cred_request, kMakeCredParseSteps, payload->GetMap())) { LOG(ERROR) << "Failed to parse makeCredential request"; return false; } std::vector<int> algorithms; if (!device::cbor_extract::ForEachPublicKeyEntry( *make_cred_request.cred_params, cbor::Value("alg"), base::BindRepeating( [](std::vector<int>* out, const cbor::Value& value) -> bool { if (!value.is_integer()) { return false; } const int64_t alg = value.GetInteger(); if (alg > std::numeric_limits<int>::max() || alg < std::numeric_limits<int>::min()) { return false; } out->push_back(static_cast<int>(alg)); return true; }, base::Unretained(&algorithms)))) { return false; } std::vector<std::vector<uint8_t>> excluded_credential_ids; if (make_cred_request.excluded_credentials && !device::cbor_extract::ForEachPublicKeyEntry( *make_cred_request.excluded_credentials, cbor::Value("id"), base::BindRepeating( [](std::vector<std::vector<uint8_t>>* out, const cbor::Value& value) -> bool { if (!value.is_bytestring()) { return false; } out->push_back(value.GetBytestring()); return true; }, base::Unretained(&excluded_credential_ids)))) { return false; } // TODO: plumb the rk flag through once GmsCore supports resident // keys. This will require support for optional maps in |Extract|. delegate_->MakeCredential( this, *make_cred_request.origin, *make_cred_request.rp_id, *make_cred_request.challenge, *make_cred_request.user_id, algorithms, excluded_credential_ids, /*resident_key=*/false); return true; } case static_cast<uint8_t>( device::CtapRequestCommand::kAuthenticatorGetAssertion): { if (!payload || !payload->is_map()) { FIDO_LOG(ERROR) << "Invalid makeCredential payload"; return false; } GetAssertionRequest get_assertion_request; if (!device::cbor_extract::Extract<GetAssertionRequest>( &get_assertion_request, kGetAssertionParseSteps, payload->GetMap())) { FIDO_LOG(ERROR) << "Failed to parse getAssertion request"; return false; } std::vector<std::vector<uint8_t>> allowed_credential_ids; if (get_assertion_request.allowed_credentials && !device::cbor_extract::ForEachPublicKeyEntry( *get_assertion_request.allowed_credentials, cbor::Value("id"), base::BindRepeating( [](std::vector<std::vector<uint8_t>>* out, const cbor::Value& value) -> bool { if (!value.is_bytestring()) { return false; } out->push_back(value.GetBytestring()); return true; }, base::Unretained(&allowed_credential_ids)))) { return false; } delegate_->GetAssertion(this, *get_assertion_request.origin, *get_assertion_request.rp_id, *get_assertion_request.challenge, allowed_credential_ids); return true; } default: FIDO_LOG(ERROR) << "Received unknown command " << static_cast<unsigned>(command); return false; } if (!crypter_->Encrypt(&response)) { FIDO_LOG(ERROR) << "Failed to encrypt response"; return false; } break; } case State::kError: NOTREACHED(); return false; } std::vector<std::vector<uint8_t>> fragments; if (!Fragment(message->first, response, &fragments)) { FIDO_LOG(ERROR) << "Failed to fragment response of length " << response.size(); return false; } out_response->emplace(std::move(fragments)); return true; } // Fragment takes a command value and payload and appends one of more // fragments to |out_fragments| to respect |mtu_|. It returns true on success // and false on error. bool Fragment(uint8_t command, base::span<const uint8_t> in, std::vector<std::vector<uint8_t>>* out_fragments) { DCHECK(command & 0x80); if (in.size() > 0xffff || mtu_ < 4) { return false; } const size_t max_initial_fragment_bytes = mtu_ - 3; const size_t max_subsequent_fragment_bytes = mtu_ - 1; std::vector<uint8_t> fragment = {command, (in.size() >> 8) & 0xff, in.size() & 0xff}; const size_t todo = std::min(in.size(), max_initial_fragment_bytes); fragment.insert(fragment.end(), in.data(), in.data() + todo); in = in.subspan(todo); out_fragments->emplace_back(std::move(fragment)); uint8_t frag_num = 0; while (!in.empty()) { fragment.clear(); fragment.reserve(mtu_); fragment.push_back(frag_num); frag_num = (frag_num + 1) & 0x7f; const size_t todo = std::min(in.size(), max_subsequent_fragment_bytes); fragment.insert(fragment.end(), in.data(), in.data() + todo); in = in.subspan(todo); out_fragments->emplace_back(std::move(fragment)); } return true; } const uint64_t addr_; const uint16_t mtu_; const AuthenticatorState* const auth_state_; State state_ = State::kHandshake; Defragmenter defrag_; std::unique_ptr<device::cablev2::Crypter> crypter_; Delegate* delegate_; }; // CableInterface is a singleton that receives events from BLEHandler.java: // the code that interfaces to Android's BLE stack. All calls into this // object happen on a single thread. class CableInterface : public Client::Delegate { public: static CableInterface* GetInstance() { return base::Singleton<CableInterface>::get(); } void Start(JNIEnv* env, const JavaParamRef<jobject>& ble_handler, const JavaParamRef<jbyteArray>& state_bytes) { ble_handler_.Reset(ble_handler); env_ = env; if (!ParseState(state_bytes)) { FIDO_LOG(ERROR) << "ParseState() failed"; GenerateFreshStateAndStore(); } // At this point, the version two pairing data has been established, either // because it was parsed from the state, or because it was freshly generated // and saved. DCHECK(auth_state_.pairing_data.v2.has_value()); DCHECK(auth_state_.identity_key); StartAdvertising(auth_state_.pairing_data.v2->eid_gen_key, &auth_state_.pairing_advert); } void Stop() { ble_handler_.Reset(); clients_.clear(); known_mtus_.clear(); auth_state_.identity_key.reset(); auth_state_.qr_advert.reset(); auth_state_.qr_psk_gen_key.reset(); env_ = nullptr; } void OnQRScanned(const std::string& qr_url) { static const char kPrefix[] = "fido://c1/"; DCHECK(qr_url.find(kPrefix) == 0); base::StringPiece qr_url_base64(qr_url); qr_url_base64 = qr_url_base64.substr(sizeof(kPrefix) - 1); std::string qr_data_str; if (!base::Base64UrlDecode(qr_url_base64, base::Base64UrlDecodePolicy::DISALLOW_PADDING, &qr_data_str) || qr_data_str.size() != device::kCableQRDataSize) { FIDO_LOG(ERROR) << "QR decoding failed: " << qr_url; return; } const base::Optional<device::CableDiscoveryData> discovery_data = device::CableDiscoveryData::FromQRData( base::span<const uint8_t, device::kCableQRDataSize>( reinterpret_cast<const uint8_t*>(qr_data_str.data()), qr_data_str.size())); if (!discovery_data) { FIDO_LOG(ERROR) << "Failed to decode QR data from: " << qr_url; return; } auth_state_.qr_psk_gen_key.emplace(discovery_data->v2->psk_gen_key); bssl::UniquePtr<EC_GROUP> p256( EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1)); auth_state_.qr_peer_identity.emplace(EC_POINT_new(p256.get())); CHECK(EC_POINT_oct2point(p256.get(), auth_state_.qr_peer_identity->get(), discovery_data->v2->peer_identity->data(), discovery_data->v2->peer_identity->size(), /*ctx=*/nullptr)); StartAdvertising(discovery_data->v2->eid_gen_key, &auth_state_.qr_advert.emplace()); } void RecordClientMTU(uint64_t client_adr, uint16_t mtu_bytes) { known_mtus_.emplace(client_adr, mtu_bytes); } ScopedJavaLocalRef<jobjectArray> Write(jlong client_addr, const JavaParamRef<jbyteArray>& data) { auto it = clients_.find(client_addr); if (it == clients_.end()) { // If no MTU is negotiated, the GATT default is just 23 bytes. Subtract // three bytes of GATT overhead. static constexpr uint16_t kDefaultMTU = 23 - 3; // TODO: once we only handle a single client, the Java code can ensure // that an MTU has always been set and this code wont need to know a // default. const auto& mtu_it = known_mtus_.find(client_addr); const uint16_t mtu = mtu_it == known_mtus_.end() ? kDefaultMTU : mtu_it->second; it = clients_ .emplace(client_addr, new Client(client_addr, mtu, &auth_state_, this)) .first; } Client* const client = it->second.get(); const size_t data_len = env_->GetArrayLength(data); jbyte* data_bytes = env_->GetByteArrayElements(data, /*iscopy=*/nullptr); base::Optional<std::vector<std::vector<uint8_t>>> response_fragments; const bool process_ok = client->Process(base::span<const uint8_t>( reinterpret_cast<uint8_t*>(data_bytes), data_len), &response_fragments); env_->ReleaseByteArrayElements(data, data_bytes, JNI_ABORT); if (!process_ok) { return nullptr; } static std::vector<std::vector<uint8_t>> kEmptyFragments; return ToJavaArrayOfByteArray( env_, response_fragments ? *response_fragments : kEmptyFragments); } void OnHandshake(Client* client) override { // TODO: ignore other clients and disconnect them Java_BLEHandler_onHandshake(env_, ble_handler_, client->addr()); } void MakeCredential(Client* client, const std::string& origin, const std::string& rp_id, base::span<const uint8_t> challenge, base::span<const uint8_t> user_id, base::span<const int> algorithms, base::span<std::vector<uint8_t>> excluded_credential_ids, bool resident_key_required) override { Java_BLEHandler_makeCredential( env_, ble_handler_, client->addr(), ConvertUTF8ToJavaString(env_, origin), ConvertUTF8ToJavaString(env_, rp_id), ToJavaByteArray(env_, challenge), // TODO: Pass full user entity once resident key support is added. ToJavaByteArray(env_, user_id), ToJavaIntArray(env_, algorithms), ToJavaArrayOfByteArray(env_, excluded_credential_ids), resident_key_required); } void GetAssertion( Client* client, const std::string& origin, const std::string& rp_id, base::span<const uint8_t> challenge, base::span<std::vector<uint8_t>> allowed_credential_ids) override { Java_BLEHandler_getAssertion( env_, ble_handler_, client->addr(), ConvertUTF8ToJavaString(env_, origin), ConvertUTF8ToJavaString(env_, rp_id), ToJavaByteArray(env_, challenge), ToJavaArrayOfByteArray(env_, allowed_credential_ids)); } void OnMakeCredentialResponse(uint64_t client_addr, uint32_t ctap_status, base::span<const uint8_t> client_data_json, base::span<const uint8_t> attestation_object) { DCHECK_LE(ctap_status, 0xFFu); auto it = clients_.find(client_addr); if (it == clients_.end()) { FIDO_LOG(ERROR) << "unknown client " << client_addr; return; } std::vector<uint8_t> response = {base::checked_cast<uint8_t>(ctap_status)}; if (ctap_status == static_cast<uint8_t>(CtapDeviceResponseCode::kSuccess)) { // TODO: pass response parameters from the Java side. base::Optional<cbor::Value> cbor_attestation_object = cbor::Reader::Read(attestation_object); if (!cbor_attestation_object || !cbor_attestation_object->is_map()) { FIDO_LOG(ERROR) << "invalid CBOR attestation object"; return; } AttestationObject attestation_object; if (!device::cbor_extract::Extract<AttestationObject>( &attestation_object, kAttObjParseSteps, cbor_attestation_object->GetMap())) { FIDO_LOG(ERROR) << "attestation object parse failed"; return; } cbor::Value::MapValue response_map; response_map.emplace(1, base::StringPiece(*attestation_object.fmt)); response_map.emplace( 2, base::span<const uint8_t>(*attestation_object.auth_data)); response_map.emplace(3, attestation_object.statement->Clone()); response_map.emplace(device::kAndroidClientDataExtOutputKey, client_data_json); base::Optional<std::vector<uint8_t>> response_payload = cbor::Writer::Write(cbor::Value(std::move(response_map))); if (!response_payload) { return; } response.insert(response.end(), response_payload->begin(), response_payload->end()); } base::Optional<std::vector<std::vector<uint8_t>>> response_fragments = it->second->EncryptAndFragment(response); if (!response_fragments) { FIDO_LOG(ERROR) << "EncryptAndFragment() failed for " << client_addr; return; } Java_BLEHandler_sendNotification( env_, ble_handler_, client_addr, ToJavaArrayOfByteArray(env_, *response_fragments)); } void OnGetAssertionResponse(uint64_t client_addr, uint32_t ctap_status, std::vector<uint8_t> client_data_json, std::vector<uint8_t> credential_id, std::vector<uint8_t> authenticator_data, std::vector<uint8_t> signature) { DCHECK_LE(ctap_status, 0xFFu); auto it = clients_.find(client_addr); if (it == clients_.end()) { FIDO_LOG(ERROR) << "unknown client " << client_addr; return; } std::vector<uint8_t> response = {base::checked_cast<uint8_t>(ctap_status)}; if (ctap_status == static_cast<uint8_t>(CtapDeviceResponseCode::kSuccess)) { cbor::Value::MapValue credential_descriptor; credential_descriptor.emplace("type", device::kPublicKey); credential_descriptor.emplace("id", credential_id); cbor::Value::ArrayValue transports; transports.emplace_back("internal"); transports.emplace_back("cable"); credential_descriptor.emplace("transports", std::move(transports)); cbor::Value::MapValue response_map; response_map.emplace(1, std::move(credential_descriptor)); response_map.emplace(2, authenticator_data); response_map.emplace(3, signature); // TODO: add user entity to support resident keys. response_map.emplace(device::kAndroidClientDataExtOutputKey, client_data_json); base::Optional<std::vector<uint8_t>> response_payload = cbor::Writer::Write(cbor::Value(std::move(response_map))); if (!response_payload) { return; } response.insert(response.end(), response_payload->begin(), response_payload->end()); } base::Optional<std::vector<std::vector<uint8_t>>> response_fragments = it->second->EncryptAndFragment(response); if (!response_fragments) { FIDO_LOG(ERROR) << "EncryptAndFragment() failed for " << client_addr; return; } Java_BLEHandler_sendNotification( env_, ble_handler_, client_addr, ToJavaArrayOfByteArray(env_, *response_fragments)); } private: friend struct base::DefaultSingletonTraits<CableInterface>; CableInterface() = default; void StartAdvertising(const device::CableEidGeneratorKey& eid_gen_key, device::cablev2::NonceAndEID* out_nonce_and_eid) { std::array<uint8_t, device::kCableNonceSize> nonce; crypto::RandBytes(nonce); uint8_t eid_plaintext[device::kCableEphemeralIdSize]; static_assert(sizeof(eid_plaintext) == AES_BLOCK_SIZE, "EIDs are not AES blocks"); AES_KEY key; CHECK(AES_set_encrypt_key(eid_gen_key.data(), /*bits=*/8 * eid_gen_key.size(), &key) == 0); memcpy(eid_plaintext, nonce.data(), nonce.size()); static_assert(sizeof(nonce) < sizeof(eid_plaintext), "Nonces too large"); memset(eid_plaintext + nonce.size(), 0, sizeof(eid_plaintext) - nonce.size()); std::array<uint8_t, AES_BLOCK_SIZE> eid; AES_encrypt(/*in=*/eid_plaintext, /*out=*/eid.data(), &key); out_nonce_and_eid->first = nonce; out_nonce_and_eid->second = eid; Java_BLEHandler_sendBLEAdvert(env_, ble_handler_, ToJavaByteArray(env_, eid)); } bool ParseState(const JavaParamRef<jbyteArray>& state_bytes) { if (!state_bytes) { return false; } base::span<const uint8_t> state_bytes_span( reinterpret_cast<uint8_t*>( env_->GetByteArrayElements(state_bytes, nullptr)), env_->GetArrayLength(state_bytes)); base::Optional<cbor::Value> state = cbor::Reader::Read(state_bytes_span); if (!state || !state->is_map()) { return false; } const cbor::Value::MapValue& state_map(state->GetMap()); device::CableDiscoveryData::V2Data& pairing_data = auth_state_.pairing_data.v2.emplace(); std::array<uint8_t, 32> identity_key_seed; if (!CopyCBORBytestring(&pairing_data.eid_gen_key, state_map, 1) || !CopyCBORBytestring(&pairing_data.psk_gen_key, state_map, 2) || !CopyCBORBytestring(&identity_key_seed, state_map, 3)) { return false; } auth_state_.identity_key = P256KeyFromSeed(identity_key_seed); pairing_data.peer_identity.emplace( X962PublicKeyOf(auth_state_.identity_key.get())); pairing_data.peer_name.emplace(kDeviceName); return true; } void GenerateFreshStateAndStore() { device::CableDiscoveryData::V2Data& pairing_data = auth_state_.pairing_data.v2.emplace(); crypto::RandBytes(pairing_data.eid_gen_key); crypto::RandBytes(pairing_data.psk_gen_key); std::array<uint8_t, 32> identity_key_seed; crypto::RandBytes(identity_key_seed); auth_state_.identity_key = P256KeyFromSeed(identity_key_seed); pairing_data.peer_identity.emplace( X962PublicKeyOf(auth_state_.identity_key.get())); pairing_data.peer_name.emplace(kDeviceName); cbor::Value::MapValue map; map.emplace(1, cbor::Value(pairing_data.eid_gen_key)); map.emplace(2, cbor::Value(pairing_data.psk_gen_key)); map.emplace(3, cbor::Value(identity_key_seed)); base::Optional<std::vector<uint8_t>> bytes = cbor::Writer::Write(cbor::Value(std::move(map))); CHECK(bytes.has_value()); Java_BLEHandler_setState(env_, ble_handler_, ToJavaByteArray(env_, *bytes)); } static bssl::UniquePtr<EC_KEY> P256KeyFromSeed( base::span<const uint8_t, 32> seed) { bssl::UniquePtr<EC_GROUP> p256( EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1)); return bssl::UniquePtr<EC_KEY>( EC_KEY_derive_from_secret(p256.get(), seed.data(), seed.size())); } static device::CableAuthenticatorIdentityKey X962PublicKeyOf( const EC_KEY* ec_key) { device::CableAuthenticatorIdentityKey ret; CHECK_EQ(ret.size(), EC_POINT_point2oct(EC_KEY_get0_group(ec_key), EC_KEY_get0_public_key(ec_key), POINT_CONVERSION_UNCOMPRESSED, ret.data(), ret.size(), /*ctx=*/nullptr)); return ret; } JNIEnv* env_ = nullptr; base::android::ScopedJavaGlobalRef<jobject> ble_handler_; AuthenticatorState auth_state_; std::map<uint64_t, uint16_t> known_mtus_; std::map<uint64_t, std::unique_ptr<Client>> clients_; }; } // anonymous namespace // These functions are the entry points for BLEHandler.java calling into C++. static void JNI_BLEHandler_Start(JNIEnv* env, const JavaParamRef<jobject>& ble_handler, const JavaParamRef<jbyteArray>& state_bytes) { CableInterface::GetInstance()->Start(env, ble_handler, state_bytes); } static void JNI_BLEHandler_Stop(JNIEnv* env) { CableInterface::GetInstance()->Stop(); } static void JNI_BLEHandler_OnQRScanned(JNIEnv* env, const JavaParamRef<jstring>& jvalue) { CableInterface::GetInstance()->OnQRScanned(ConvertJavaStringToUTF8(jvalue)); } static void JNI_BLEHandler_RecordClientMtu(JNIEnv* env, jlong client, jint mtu_bytes) { if (mtu_bytes > 0xffff) { mtu_bytes = 0xffff; } CableInterface::GetInstance()->RecordClientMTU(client, mtu_bytes); } static ScopedJavaLocalRef<jobjectArray> JNI_BLEHandler_Write( JNIEnv* env, jlong client, const JavaParamRef<jbyteArray>& data) { return CableInterface::GetInstance()->Write(client, data); } static void JNI_BLEHandler_OnAuthenticatorAttestationResponse( JNIEnv* env, jlong client, jint ctap_status, const JavaParamRef<jbyteArray>& jclient_data_json, const JavaParamRef<jbyteArray>& jattestation_object) { std::vector<uint8_t> client_data_json; if (jattestation_object) { JavaByteArrayToByteVector(env, jclient_data_json, &client_data_json); } std::vector<uint8_t> attestation_object; if (jattestation_object) { JavaByteArrayToByteVector(env, jattestation_object, &attestation_object); } return CableInterface::GetInstance()->OnMakeCredentialResponse( client, ctap_status, client_data_json, attestation_object); } static void JNI_BLEHandler_OnAuthenticatorAssertionResponse( JNIEnv* env, jlong client, jint ctap_status, const JavaParamRef<jbyteArray>& jclient_data_json, const JavaParamRef<jbyteArray>& jcredential_id, const JavaParamRef<jbyteArray>& jauthenticator_data, const JavaParamRef<jbyteArray>& jsignature) { std::vector<uint8_t> client_data_json; if (jauthenticator_data) { JavaByteArrayToByteVector(env, jclient_data_json, &client_data_json); } std::vector<uint8_t> credential_id; if (jcredential_id) { JavaByteArrayToByteVector(env, jcredential_id, &credential_id); } std::vector<uint8_t> authenticator_data; if (jauthenticator_data) { JavaByteArrayToByteVector(env, jauthenticator_data, &authenticator_data); } std::vector<uint8_t> signature; if (jauthenticator_data) { JavaByteArrayToByteVector(env, jsignature, &signature); } return CableInterface::GetInstance()->OnGetAssertionResponse( client, ctap_status, std::move(client_data_json), std::move(credential_id), std::move(authenticator_data), std::move(signature)); }
37.610667
127
0.632917
sarang-apps
7f944db347c15c981a63e0a15a596c8313f8c51b
14,703
cpp
C++
rcff/src/RCF/ProxyEndpointService.cpp
DayBreakZhang/CXKJ_Code
c7caab736313f029324f1c95714f5a94b2589076
[ "Apache-2.0" ]
null
null
null
rcff/src/RCF/ProxyEndpointService.cpp
DayBreakZhang/CXKJ_Code
c7caab736313f029324f1c95714f5a94b2589076
[ "Apache-2.0" ]
null
null
null
rcff/src/RCF/ProxyEndpointService.cpp
DayBreakZhang/CXKJ_Code
c7caab736313f029324f1c95714f5a94b2589076
[ "Apache-2.0" ]
null
null
null
//****************************************************************************** // RCF - Remote Call Framework // // Copyright (c) 2005 - 2019, Delta V Software. All rights reserved. // http://www.deltavsoft.com // // RCF is distributed under dual licenses - closed source or GPL. // Consult your particular license for conditions of use. // // If you have not purchased a commercial license, you are using RCF // under GPL terms. // // Version: 3.1 // Contact: support <at> deltavsoft.com // //****************************************************************************** #include <RCF/ProxyEndpointService.hpp> #include <RCF/BsdClientTransport.hpp> #include <RCF/Enums.hpp> #include <RCF/Log.hpp> #include <RCF/Uuid.hpp> #include <RCF/ProxyEndpointTransport.hpp> namespace RCF { ProxyEndpointEntry::ProxyEndpointEntry() { } ProxyEndpointEntry::ProxyEndpointEntry(const std::string& endpointName) : mName(endpointName) { } void ProxyEndpointService::onServiceAdded(RCF::RcfServer &server) { mpRcfServer = &server; server.bind<I_ProxyEp>(*this); } void ProxyEndpointService::onServiceRemoved(RCF::RcfServer &server) { RCF_UNUSED_VARIABLE(server); } void ProxyEndpointService::onServerStart(RCF::RcfServer &server) { RCF_UNUSED_VARIABLE(server); } void ProxyEndpointService::onServerStop(RCF::RcfServer &server) { RCF_UNUSED_VARIABLE(server); { Lock lock(mEntriesMutex); mEntries.clear(); } { Lock lock(mEndpointConnectionsMutex); mEndpointConnections.clear(); } } void ProxyEndpointService::enumerateProxyEndpoints(std::vector<std::string>& endpoints) { if ( !mpRcfServer->getEnableProxyEndpoints() ) { RCF_THROW(Exception(RcfError_ProxyEndpointsNotEnabled)); } endpoints.clear(); std::vector<std::string> duds; Lock lock(mEntriesMutex); for ( auto iter : mEntries ) { const std::string& endpointName = iter.first; ProxyEndpointEntry & entry = iter.second; RcfSessionPtr sessionPtr = entry.mSessionWeakPtr.lock(); if ( sessionPtr && sessionPtr->isConnected() ) { endpoints.push_back(endpointName); } else { duds.push_back(endpointName); } } for (auto dud : duds) { mEntries.erase(mEntries.find(dud)); } } ClientTransportUniquePtr ProxyEndpointService::makeProxyEndpointConnection( const std::string& proxyEndpointName) { if ( !mpRcfServer->getEnableProxyEndpoints() ) { RCF_THROW(Exception(RcfError_ProxyEndpointsNotEnabled)); } // If serving a proxy request over the network, the server must be multi-threaded. if ( getCurrentRcfSessionPtr() && mpRcfServer->getThreadPool()->getThreadMaxCount() < 2 ) { RCF_THROW(Exception(RcfError_ProxyServerMultiThreaded)); } std::string requestId = generateUuid(); bool endpointOnline = true; { Lock lock(mEntriesMutex); auto iter = mEntries.find(proxyEndpointName); if (iter != mEntries.end()) { ProxyEndpointEntry & entry = iter->second; RcfSessionPtr sessionPtr = entry.mSessionWeakPtr.lock(); if ( !sessionPtr || !sessionPtr->isConnected() ) { mEntries.erase(iter); endpointOnline = false; } else { entry.mPendingRequests.push_back(requestId); if ( entry.mAmdPtr ) { std::vector<std::string> & amdRequests = entry.mAmdPtr->parameters().a1.get(); amdRequests.clear(); amdRequests.swap(entry.mPendingRequests); entry.mAmdPtr->commit(); entry.mAmdPtr.reset(); } } } else { endpointOnline = false; } } if ( !endpointOnline ) { Exception e(RcfError_ProxyEndpointDown, proxyEndpointName); RCF_THROW(e); } // Wait for a connection to show up. auto requestKey = std::make_pair(proxyEndpointName, requestId); Timer connectTimer; while ( !connectTimer.elapsed(10*1000) ) { Lock lock(mEndpointConnectionsMutex); auto iter = mEndpointConnections.find(requestKey); if ( iter != mEndpointConnections.end() ) { ClientTransportUniquePtr transportPtr = std::move(iter->second); mEndpointConnections.erase(iter); return transportPtr; } using namespace std::chrono_literals; mEndpointConnectionsCond.wait_for(lock, 1000ms); } // If we're here, we've timed out waiting for the proxy endpoint to spool up a connection. Exception e(RcfError_NoProxyConnection, proxyEndpointName); RCF_THROW(e); return ClientTransportUniquePtr(); } class RelaySocket; typedef std::shared_ptr<RelaySocket> RelaySocketPtr; class RelaySocket : public std::enable_shared_from_this<RelaySocket> { public: RelaySocket(TcpSocketPtr socketPtr1, TcpSocketPtr socketPtr2) : mSocketPtr1(socketPtr1), mSocketPtr2(socketPtr2), mBuffer1(4096), mBuffer2(4096) { } ~RelaySocket() { } class ReadHandler { public: ReadHandler(RelaySocketPtr relaySocketPtr, TcpSocketPtr socketPtr) : mRelaySocketPtr(relaySocketPtr), mSocketPtr(socketPtr) {} void operator()(AsioErrorCode err, std::size_t bytes) { mRelaySocketPtr->onReadCompleted(mSocketPtr, err, bytes); } RelaySocketPtr mRelaySocketPtr; TcpSocketPtr mSocketPtr; }; class WriteHandler { public: WriteHandler(RelaySocketPtr relaySocketPtr, TcpSocketPtr socketPtr) : mRelaySocketPtr(relaySocketPtr), mSocketPtr(socketPtr) {} void operator()(AsioErrorCode err, std::size_t bytes) { mRelaySocketPtr->onWriteCompleted(mSocketPtr, err, bytes); } RelaySocketPtr mRelaySocketPtr; TcpSocketPtr mSocketPtr; }; void onReadCompleted(TcpSocketPtr socketPtr, AsioErrorCode err, std::size_t bytes) { RCF_LOG_4()(this)(err)(bytes) << "RelaySocket - read from socket completed."; if ( err ) { if ( socketPtr == mSocketPtr2 ) { AsioErrorCode ec; mSocketPtr1->shutdown(ASIO_NS::ip::tcp::socket::shutdown_send, ec); } else { AsioErrorCode ec; mSocketPtr2->shutdown(ASIO_NS::ip::tcp::socket::shutdown_send, ec); } } else { RCF_LOG_4()(this)(bytes) << "RelaySocket - issuing write on relayed socket."; if ( socketPtr == mSocketPtr1 ) { mBufferLen1 = bytes; ASIO_NS::async_write( *mSocketPtr2, ASIO_NS::buffer(&mBuffer1[0], bytes), WriteHandler(shared_from_this(), mSocketPtr2)); } else { mBufferLen2 = bytes; ASIO_NS::async_write( *mSocketPtr1, ASIO_NS::buffer(&mBuffer2[0], bytes), WriteHandler(shared_from_this(), mSocketPtr1)); } } } void onWriteCompleted(TcpSocketPtr socketPtr, AsioErrorCode err, std::size_t bytes) { RCF_LOG_4()(this)(err)(bytes) << "RelaySocket - write to relayed socket completed."; if ( err ) { if ( socketPtr == mSocketPtr2 ) { AsioErrorCode ec; mSocketPtr1->shutdown(ASIO_NS::ip::tcp::socket::shutdown_send, ec); } else { AsioErrorCode ec; mSocketPtr2->shutdown(ASIO_NS::ip::tcp::socket::shutdown_send, ec); } } else { RCF_LOG_4()(this) << "RelaySocket - issuing read on socket."; if ( socketPtr == mSocketPtr2 ) { mSocketPtr1->async_read_some( ASIO_NS::buffer(&mBuffer1[0], mBuffer1.size()), ReadHandler(shared_from_this(), mSocketPtr1)); } else { mSocketPtr2->async_read_some( ASIO_NS::buffer(&mBuffer2[0], mBuffer2.size()), ReadHandler(shared_from_this(), mSocketPtr2)); } } } void start() { RCF_LOG_3()(this) << "RelaySocket - start relaying."; onWriteCompleted(mSocketPtr1, RCF::AsioErrorCode(), 0); onWriteCompleted(mSocketPtr2, RCF::AsioErrorCode(), 0); } private: TcpSocketPtr mSocketPtr1; std::vector<char> mBuffer1; std::size_t mBufferLen1 = 0; TcpSocketPtr mSocketPtr2; std::vector<char> mBuffer2; std::size_t mBufferLen2 = 0; }; void ProxyEndpointService::setupProxiedConnection(RcfSession& session, ClientTransportPtr proxyTransportPtr) { // Get the socket to the client. ServerTransportEx &serverTransport = dynamic_cast<ServerTransportEx &>(session.getNetworkSession().getServerTransport()); ClientTransportPtr clientTransportPtr(serverTransport.createClientTransport(session.shared_from_this()).release()); BsdClientTransport& clientTransport = dynamic_cast<BsdClientTransport&>(*clientTransportPtr); clientTransport.setRcfSession(RcfSessionWeakPtr()); session.setCloseSessionAfterWrite(true); TcpSocketPtr clientSocketPtr = clientTransport.releaseTcpSocket(); // Get the socket to the target server. BsdClientTransport& proxyTransport = dynamic_cast<BsdClientTransport&>(*proxyTransportPtr); TcpSocketPtr proxySocketPtr = proxyTransport.releaseTcpSocket(); // Start relaying them. RelaySocketPtr relaySocketPtr(new RelaySocket(clientSocketPtr, proxySocketPtr)); relaySocketPtr->start(); } class ProxyEndpointSession { public: ProxyEndpointSession() { } ~ProxyEndpointSession() { } ProxyEndpointService * mpEpService = NULL; std::string mEndpointName; }; void ProxyEndpointService::removeEndpoint(const std::string& endpointName) { Lock lock(mEntriesMutex); auto iter = mEntries.find(endpointName); if ( iter != mEntries.end() ) { mEntries.erase(iter); } } void ProxyEndpointService::SetupProxyEndpoint(const std::string& endpointName, const std::string& password) { if ( !mpRcfServer->getEnableProxyEndpoints() ) { RCF_THROW(Exception(RcfError_ProxyEndpointsNotEnabled)); } // TODO: check password. RCF_UNUSED_VARIABLE(password); ProxyEndpointSession * pEpSession = &getCurrentRcfSession().createSessionObject<ProxyEndpointSession>(); pEpSession->mEndpointName = endpointName; pEpSession->mpEpService = this; Lock lock(mEntriesMutex); mEntries[endpointName] = ProxyEndpointEntry(endpointName); mEntries[endpointName].mSessionWeakPtr = getCurrentRcfSession().shared_from_this(); } void ProxyEndpointService::GetConnectionRequests( std::vector<std::string>& requests) { ProxyEndpointSession * pEpSession = getCurrentRcfSession().querySessionObject<ProxyEndpointSession>(); if ( !pEpSession ) { // TODO: literal Exception e("Invalid proxy endpoint connection."); RCF_THROW(e); } std::string endpointName = pEpSession->mEndpointName; requests.clear(); Lock lock(mEntriesMutex); auto iter = mEntries.find(endpointName); if (iter != mEntries.end()) { ProxyEndpointEntry & entry = iter->second; if ( entry.mSessionWeakPtr.lock() == getCurrentRcfSession().shared_from_this() ) { if ( entry.mPendingRequests.size() > 0 ) { // Synchronous return. requests.clear(); requests.swap(entry.mPendingRequests); } else { // Asynchronous return, once a request is made. entry.mAmdPtr.reset(new AmdGetRequests(getCurrentRcfSession())); entry.mSessionWeakPtr = getCurrentRcfSession().shared_from_this(); } } } } void ProxyEndpointService::onConnectionAvailable( const std::string& endpointName, const std::string& requestId, RCF::RcfSessionPtr sessionPtr, RCF::ClientTransportUniquePtr transportPtr) { Lock lock(mEntriesMutex); mEndpointConnections[std::make_pair(endpointName, requestId)].reset( transportPtr.release() ); mEndpointConnectionsCond.notify_all(); } void ProxyEndpointService::MakeConnectionAvailable( const std::string& endpointName, const std::string& requestId) { RCF::convertRcfSessionToRcfClient( [=](RcfSessionPtr sessionPtr, ClientTransportUniquePtr transportPtr) { onConnectionAvailable(endpointName, requestId, sessionPtr, std::move(transportPtr)); }, RCF::Twoway); } } // namespace RCF
32.172867
129
0.551384
DayBreakZhang
7f951de3a0212335bbfa9fd50ca013c91ad3dc04
309
hpp
C++
visr_bear/src/sh_rotation.hpp
ebu/bear
0e4c4f33dfaea9b7c64991515177eb2099887a5a
[ "Apache-2.0" ]
14
2022-02-01T16:28:53.000Z
2022-02-11T11:24:59.000Z
visr_bear/src/sh_rotation.hpp
ebu/bear
0e4c4f33dfaea9b7c64991515177eb2099887a5a
[ "Apache-2.0" ]
1
2022-03-03T06:49:47.000Z
2022-03-15T13:10:43.000Z
visr_bear/src/sh_rotation.hpp
ebu/bear
0e4c4f33dfaea9b7c64991515177eb2099887a5a
[ "Apache-2.0" ]
null
null
null
#pragma once #include <Eigen/Core> #include <Eigen/Geometry> #include <vector> namespace bear { void quaternion_to_sh_rotation_matrix(const Eigen::Quaterniond &q, int order, Eigen::Ref<Eigen::MatrixXd> sh_mat); } // namespace bear
28.090909
74
0.576052
ebu
7f9788e5cb772ba1fec0b090ca6bbe9dbc5eaa65
2,276
cpp
C++
homework/Petriaikin/05/main.cpp
mtrempoltsev/msu_cpp_autumn_2017
0e87491dc117670b99d2ca2f7e1c5efbc425ae1c
[ "MIT" ]
10
2017-09-21T15:17:33.000Z
2021-01-11T13:11:55.000Z
homework/Petriaikin/05/main.cpp
mtrempoltsev/msu_cpp_autumn_2017
0e87491dc117670b99d2ca2f7e1c5efbc425ae1c
[ "MIT" ]
null
null
null
homework/Petriaikin/05/main.cpp
mtrempoltsev/msu_cpp_autumn_2017
0e87491dc117670b99d2ca2f7e1c5efbc425ae1c
[ "MIT" ]
22
2017-09-21T15:45:08.000Z
2019-02-21T19:15:25.000Z
#include "Matrix.h" #include "Matrix.hpp" #include <time.h> //======================================================================== #define ERROR_CODE 1 #define COUNT_TESTS 10 #define MAX_DIM 100 #define MAX_RAND 10000 #define COUNT_IN_SUM 10 #define RANDOM_T ((T) (rand()%MAX_RAND)) //======================================================================== template<typename T> std::vector<T> RandomVector(size_t size) { std::vector<T> result(size, 0); for (size_t i = 0; i < size; i++) { T divider = RANDOM_T; if (divider == 0) { divider = 1; } result[i] = RANDOM_T*RANDOM_T / divider; } return result; } template<typename T> bool ProcessTestMult() { size_t rows = rand() % MAX_DIM; size_t columns = rand() % MAX_DIM; std::vector<T> matrix_values = RandomVector<T>(rows*columns); std::vector<T> vect = RandomVector<T>(columns); //Умножим матрицу Matrix<T> result({ rows, columns }, matrix_values); result *= vect; //Проверим вручную for (size_t i = 0; i < rows; i++) { T reference = 0; for (size_t j = 0; j < columns; j++) { reference += matrix_values[i*columns + j] * vect[j]; } if (Abs (reference - result[i][0]) > Constants::epsiol) { std::cout << "Failed!"; return false; } } return true; } template<typename T> bool ProcessTestSum() { size_t rows = rand() % MAX_DIM; Matrix<T> result({ rows, 1 }, 0); std::vector<T> vectors[COUNT_IN_SUM]; for (int i = 0; i < COUNT_IN_SUM; i++) { vectors[i] = RandomVector<T>(rows); result += vectors[i]; } for (size_t i = 0; i < rows; i++) { T reference = 0; for (int j = 0; j < COUNT_IN_SUM; j++) { reference += vectors[j][i]; } if (Abs(reference - result[i][0]) > Constants::epsiol) { std::cout << "Failed!"; return false; } } return true; } int main() { srand((unsigned int) time(0)); for (int i = 0; i < COUNT_TESTS; i++) { if (!ProcessTestMult<double>()) { return ERROR_CODE; } if (!ProcessTestSum<double> ()) { return ERROR_CODE; } if (!ProcessTestMult<int>()) { return ERROR_CODE; } if (!ProcessTestSum<int>()) { return ERROR_CODE; } } //Проверим, не утекла ли память if (Matrix<double>::GetMemoryAllocated() != 0) { std::cout << "Memory leak!" << std::endl; return ERROR_CODE; } return 0; }
19.964912
74
0.580404
mtrempoltsev
7f99c07d03ffe2b654eb52a9992b601116452f86
2,258
cpp
C++
source/engine/gui/GeometryBufferGUI.cpp
compix/Monte-Carlo-Raytracer
f27842c40dd380aee78f1579873341ad6cfe0834
[ "MIT" ]
3
2018-09-23T03:12:36.000Z
2021-12-01T08:30:43.000Z
source/engine/gui/GeometryBufferGUI.cpp
compix/Monte-Carlo-Raytracer
f27842c40dd380aee78f1579873341ad6cfe0834
[ "MIT" ]
null
null
null
source/engine/gui/GeometryBufferGUI.cpp
compix/Monte-Carlo-Raytracer
f27842c40dd380aee78f1579873341ad6cfe0834
[ "MIT" ]
1
2018-09-19T01:49:24.000Z
2018-09-19T01:49:24.000Z
#include "GeometryBufferGUI.h" #include "GUI.h" #include "../globals.h" #include <GL/glew.h> #include "../rendering/architecture/RenderPipeline.h" GeometryBufferGUI::GeometryBufferGUI() { window.open = false; window.minSize = ImVec2(250, 250); } void GeometryBufferGUI::update() { if (window.open) { window.begin(); GLuint diffuseTexture = GL_INVALID_INDEX; GLuint normalMap = GL_INVALID_INDEX; GLuint specularMap = GL_INVALID_INDEX; GLuint emissionMap = GL_INVALID_INDEX; GLuint depthTexture = GL_INVALID_INDEX; CurRenderPipeline->tryFetch<GLuint>("DiffuseTexture", diffuseTexture); CurRenderPipeline->tryFetch<GLuint>("NormalMap", normalMap); CurRenderPipeline->tryFetch<GLuint>("SpecularMap", specularMap); CurRenderPipeline->tryFetch<GLuint>("EmissionMap", emissionMap); CurRenderPipeline->tryFetch<GLuint>("DepthTexture", depthTexture); if (specularMap != GL_INVALID_INDEX) { GUI::textures[specularMap] = GUITexture("Specular Map", specularMap, GL_RED, GL_GREEN, GL_BLUE, GL_ONE); } if (depthTexture != GL_INVALID_INDEX) { GUI::textures[depthTexture] = GUITexture("Depth Texture", depthTexture, GL_RED, GL_RED, GL_RED, GL_ONE); } showTextures(window.size, { GUITexture("Diffuse Texture", diffuseTexture), GUITexture("Normal Map", normalMap), GUITexture("Specular Map", specularMap), GUITexture("Emission Map", emissionMap), GUITexture("Depth Texture", depthTexture) }); window.end(); } } void GeometryBufferGUI::showTextures(const ImVec2& canvasSize, std::initializer_list<GUITexture> textures) const { size_t count = textures.size(); size_t nColumns = size_t(ceil(sqrtf(float(count)))); size_t nRows = size_t(ceil(float(count) / nColumns)); auto panelSize = ImVec2(canvasSize.x / nColumns, canvasSize.y / nRows - 25.0f); auto textureSize = ImVec2(canvasSize.x / nColumns, canvasSize.y / nRows - 50.0f); size_t i = 0; for (auto& tex : textures) { if (tex.texID == GL_INVALID_INDEX) continue; if (i % nColumns > 0) ImGui::SameLine(); ImGui::BeginChild(tex.label.c_str(), panelSize); ImGui::Text(tex.label.c_str()); ImGui::Image(ImTextureID(uintptr_t(tex.texID)), textureSize, ImVec2(0.0f, 1.0f), ImVec2(1.0f, 0.0f)); ImGui::EndChild(); ++i; } }
28.225
112
0.721878
compix
7f9d899b0d084cbeeab5dad71ea423b86ff3edea
22,460
cpp
C++
arch/drisc/ICache.cpp
svp-dev/mgsim
0abd708f3c48723fc233f6c53f3e638129d070fa
[ "MIT" ]
7
2016-03-01T13:16:59.000Z
2021-08-20T07:41:43.000Z
arch/drisc/ICache.cpp
svp-dev/mgsim
0abd708f3c48723fc233f6c53f3e638129d070fa
[ "MIT" ]
null
null
null
arch/drisc/ICache.cpp
svp-dev/mgsim
0abd708f3c48723fc233f6c53f3e638129d070fa
[ "MIT" ]
5
2015-04-20T14:29:38.000Z
2018-12-29T11:09:17.000Z
#include "ICache.h" #include "DRISC.h" #include <sim/log2.h> #include <sim/config.h> #include <sim/sampling.h> #include <cassert> #include <cstring> #include <iomanip> #include <iostream> using namespace std; namespace Simulator { namespace drisc { ICache::ICache(const std::string& name, DRISC& parent, Clock& clock) : Object(name, parent), m_memory(NULL), m_selector(IBankSelector::makeSelector(*this, GetConf("BankSelector", string), GetConf("NumSets", size_t))), m_mcid(0), m_lines(), m_data(), InitBuffer(m_outgoing, clock, "OutgoingBufferSize"), InitBuffer(m_incoming, clock, "IncomingBufferSize"), m_lineSize(GetTopConf("CacheLineSize", size_t)), m_assoc (GetConf("Associativity", size_t)), InitSampleVariable(numHits, SVC_CUMULATIVE), InitSampleVariable(numDelayedReads, SVC_CUMULATIVE), InitSampleVariable(numEmptyMisses, SVC_CUMULATIVE), InitSampleVariable(numLoadingMisses, SVC_CUMULATIVE), InitSampleVariable(numInvalidMisses, SVC_CUMULATIVE), InitSampleVariable(numHardConflicts, SVC_CUMULATIVE), InitSampleVariable(numResolvedConflicts, SVC_CUMULATIVE), InitSampleVariable(numStallingMisses, SVC_CUMULATIVE), InitProcess(p_Outgoing, DoOutgoing), InitProcess(p_Incoming, DoIncoming), p_service(clock, GetName() + ".p_service") { RegisterModelObject(parent, "cpu"); m_outgoing.Sensitive( p_Outgoing ); m_incoming.Sensitive( p_Incoming ); // These things must be powers of two if (m_assoc == 0 || !IsPowerOfTwo(m_assoc)) { throw exceptf<InvalidArgumentException>(*this, "Associativity = %zd is not a power of two", m_assoc); } const size_t sets = m_selector->GetNumBanks(); if (!IsPowerOfTwo(sets)) { throw exceptf<InvalidArgumentException>(*this, "NumSets = %zd is not a power of two", sets); } if (!IsPowerOfTwo(m_lineSize)) { throw exceptf<InvalidArgumentException>(*this, "CacheLineSize = %zd is not a power of two", m_lineSize); } // At least a complete register value has to fit in a line if (m_lineSize < sizeof(Integer)) { throw exceptf<InvalidArgumentException>(*this, "CacheLineSize = %zd cannot be less than a word.", m_lineSize); } // Initialize the cache lines m_lines.resize(sets * m_assoc); m_data.resize(m_lineSize * m_lines.size()); RegisterStateVariable(m_data, "data"); for (size_t i = 0; i < m_lines.size(); ++i) { auto& line = m_lines[i]; line.state = LINE_EMPTY; line.data = &m_data[i * m_lineSize]; line.references = 0; line.waiting.head = INVALID_TID; line.creation = false; RegisterStateObject(line, "line" + to_string(i)); } } void ICache::ConnectMemory(IMemory* memory) { assert(m_memory == NULL); // can't register two times assert(memory != NULL); m_memory = memory; StorageTraceSet traces; m_mcid = m_memory->RegisterClient(*this, p_Outgoing, traces, m_incoming); p_Outgoing.SetStorageTraces(traces); } ICache::~ICache() { delete m_selector; } bool ICache::IsEmpty() const { for (size_t i = 0; i < m_lines.size(); ++i) { if (m_lines[i].state != LINE_EMPTY && m_lines[i].references != 0) { return false; } } return true; } // // Finds the line for the specified address. Returns: // SUCCESS - Line found (hit) // DELAYED - Line not found (miss), but empty one allocated // FAILED - Line not found (miss), no empty lines to allocate // Result ICache::FindLine(MemAddr address, Line* &line, bool check_only) { MemAddr tag; size_t setindex; m_selector->Map(address / m_lineSize, tag, setindex); const size_t set = setindex * m_assoc; // Find the line Line* empty = NULL; Line* replace = NULL; for (size_t i = 0; i < m_assoc; ++i) { line = &m_lines[set + i]; if (line->state == LINE_EMPTY) { // Empty line, remember this one empty = line; } else if (line->tag == tag) { // The wanted line was in the cache return SUCCESS; } else if (line->references == 0 && (replace == NULL || line->access < replace->access)) { // The line is available to be replaced and has a lower LRU rating, // remember it for replacing replace = line; } } // The line could not be found, allocate the empty line or replace an existing line line = (empty != NULL) ? empty : replace; if (line == NULL) { // No available line DeadlockWrite("Unable to allocate a cache-line for the request to %#016llx (set %u)", (unsigned long long)address, (unsigned)(set / m_assoc)); return FAILED; } if (!check_only) { COMMIT { // Reset the line line->tag = tag; } } return DELAYED; } bool ICache::ReleaseCacheLine(CID cid) { if (cid != INVALID_CID) { // Once the references hit zero, the line can be replaced by a next request COMMIT { Line& line = m_lines[cid]; assert(line.references > 0); if (--line.references == 0 && line.state == LINE_INVALID) { line.state = LINE_EMPTY; } } } return true; } bool ICache::Read(CID cid, MemAddr address, void* data, MemSize size) const { MemAddr tag; size_t unused; m_selector->Map(address / m_lineSize, tag, unused); size_t offset = (size_t)(address % m_lineSize); if (offset + size > m_lineSize) { throw exceptf<InvalidArgumentException>(*this, "Read (%#016llx, %zd): Address range crosses over cache line boundary", (unsigned long long)address, (size_t)size); } #if MEMSIZE_MAX >= SIZE_MAX if (size > SIZE_MAX) { throw exceptf<InvalidArgumentException>(*this, "Read (%#016llx, %zd): Size argument too big", (unsigned long long)address, (size_t)size); } #endif if (m_lines[cid].state == LINE_EMPTY || m_lines[cid].tag != tag) { throw exceptf<InvalidArgumentException>(*this, "Read (%#016llx, %zd): Attempting to read from an invalid cache line", (unsigned long long)address, (size_t)size); } const Line& line = m_lines[cid]; // Verify that we're actually reading a fetched line assert(line.state == LINE_FULL || line.state == LINE_INVALID); COMMIT{ memcpy(data, line.data + offset, (size_t)size); } return true; } // For family creation Result ICache::Fetch(MemAddr address, MemSize size, CID& cid) { return Fetch(address, size, NULL, &cid); } // For thread activation Result ICache::Fetch(MemAddr address, MemSize size, TID& tid, CID& cid) { return Fetch(address, size, &tid, &cid); } Result ICache::Fetch(MemAddr address, MemSize size, TID* tid, CID* cid) { // Check that we're fetching executable memory auto& cpu = GetDRISC(); if (!cpu.CheckPermissions(address, size, IMemory::PERM_EXECUTE)) { throw exceptf<SecurityException>(*this, "Fetch (%#016llx, %zd): Attempting to execute from non-executable memory", (unsigned long long)address, (size_t)size); } // Validate input size_t offset = (size_t)(address % m_lineSize); if (offset + size > m_lineSize) { throw exceptf<InvalidArgumentException>(*this, "Fetch (%#016llx, %zd): Address range crosses over cache line boundary", (unsigned long long)address, (size_t)size); } #if MEMSIZE_MAX >= SIZE_MAX if (size > SIZE_MAX) { throw exceptf<InvalidArgumentException>(*this, "Fetch (%#016llx, %zd): Size argument too big", (unsigned long long)address, (size_t)size); } #endif if (!p_service.Invoke()) { return FAILED; } // Align the address address = address - offset; // Check the cache Line* line; Result result; if ((result = FindLine(address, line)) == FAILED) { // No cache lines are available // DeadlockWrite was already called in FindLine (which has more information) ++m_numHardConflicts; return FAILED; } // Update access time COMMIT{ line->access = cpu.GetCycleNo(); } // If the caller wants the line index, give it if (cid != NULL) { *cid = line - &m_lines[0]; } if (result == SUCCESS) { // Cache hit if (line->state == LINE_INVALID) { // This line has been invalidated, we have to wait until it's cleared // so we can request a new one ++m_numInvalidMisses; return FAILED; } // Update reference count COMMIT{ line->references++; } if (line->state == LINE_FULL) { // The line was already fetched so we're done. // This is 'true' hit in that we don't have to wait. COMMIT{ ++m_numHits; } return SUCCESS; } // The line is being fetched assert(line->state == LINE_LOADING); COMMIT { if (tid != NULL) { // Add the thread to the queue TID head = line->waiting.head; if (line->waiting.head == INVALID_TID) { line->waiting.tail = *tid; } line->waiting.head = *tid; *tid = head; } else if (cid != NULL) { // Initial line for creation assert(!line->creation); line->creation = true; } // Statistics ++m_numLoadingMisses; } } else { // Cache miss; a line has been allocated, fetch the data if (!m_outgoing.Push(address)) { DeadlockWrite("Unable to put request for I-Cache line into outgoing buffer"); ++m_numStallingMisses; return FAILED; } // Data is being fetched COMMIT { // Statistics if (line->state == LINE_EMPTY) ++m_numEmptyMisses; else ++m_numResolvedConflicts; // Initialize buffer line->creation = false; line->references = 1; line->state = LINE_LOADING; if (tid != NULL) { // Initialize the waiting queue line->waiting.head = *tid; line->waiting.tail = *tid; *tid = INVALID_TID; } else if (cid != NULL) { // Line is used in family creation line->creation = true; } } } COMMIT{ ++m_numDelayedReads; } return DELAYED; } bool ICache::OnMemoryReadCompleted(MemAddr addr, const char *data) { // Instruction cache line returned, store in cache and Buffer // Find the line Line* line; if (FindLine(addr, line, true) == SUCCESS && line->state != LINE_FULL) { // We need this data, store it assert(line->state == LINE_LOADING || line->state == LINE_INVALID); COMMIT { std::copy(data, data + m_lineSize, line->data); } CID cid = line - &m_lines[0]; if (!m_incoming.Push(cid)) { DeadlockWrite("Unable to buffer I-Cache line read completion for line #%u", (unsigned)cid); return false; } } return true; } bool ICache::OnMemoryWriteCompleted(TID /*tid*/) { // The I-Cache never writes UNREACHABLE; } bool ICache::OnMemorySnooped(MemAddr address, const char * data, const bool * mask) { Line* line; // Cache coherency: check if we have the same address if (FindLine(address, line, true) == SUCCESS) { // We do, update the data COMMIT{ line::blit(line->data, data, mask, m_lineSize); } } return true; } bool ICache::OnMemoryInvalidated(MemAddr address) { COMMIT { Line* line; if (FindLine(address, line, true) == SUCCESS) { if (line->state == LINE_FULL) { // Valid lines without references are invalidated by clearing then. Simple. // Otherwise, we invalidate them. line->state = (line->references == 0) ? LINE_EMPTY : LINE_INVALID; } else if (line->state != LINE_INVALID) { // Mark the line as invalidated. After it has been loaded and used it will be cleared assert(line->state == LINE_LOADING); line->state = LINE_INVALID; } } } return true; } Object& ICache::GetMemoryPeer() { return *GetParent(); } Result ICache::DoOutgoing() { assert(!m_outgoing.Empty()); assert(m_memory != NULL); const MemAddr& address = m_outgoing.Front(); if (!m_memory->Read(m_mcid, address)) { // The fetch failed DeadlockWrite("Unable to read %#016llx from memory", (unsigned long long)address); return FAILED; } m_outgoing.Pop(); return SUCCESS; } Result ICache::DoIncoming() { assert(!m_incoming.Empty()); if (!p_service.Invoke()) { return FAILED; } CID cid = m_incoming.Front(); Line& line = m_lines[cid]; COMMIT{ line.state = LINE_FULL; } auto& alloc = GetDRISC().GetAllocator(); if (line.creation) { // Resume family creation if (!alloc.OnICachelineLoaded(cid)) { DeadlockWrite("Unable to resume family creation for C%u", (unsigned)cid); return FAILED; } COMMIT{ line.creation = false; } } if (line.waiting.head != INVALID_TID) { // Reschedule the line's waiting list if (!alloc.QueueActiveThreads(line.waiting)) { DeadlockWrite("Unable to queue active threads T%u through T%u for C%u", (unsigned)line.waiting.head, (unsigned)line.waiting.tail, (unsigned)cid); return FAILED; } // Clear the waiting list COMMIT { line.waiting.head = INVALID_TID; line.waiting.tail = INVALID_TID; } } m_incoming.Pop(); return SUCCESS; } void ICache::Cmd_Info(std::ostream& out, const std::vector<std::string>& /*arguments*/) const { out << "The Instruction Cache stores data from memory that contains instructions for\n" "active threads for faster access. Compared to a traditional cache, this I-Cache\n" "is extended with several fields to support the multiple threads.\n\n" "Supported operations:\n" "- inspect <component>\n" " Reads and displays the cache-lines, and global information such as hit-rate\n" " and cache configuration.\n"; } void ICache::Cmd_Read(std::ostream& out, const std::vector<std::string>& arguments) const { if (arguments.empty()) { out << "Cache type: "; if (m_assoc == 1) { out << "Direct mapped" << endl; } else if (m_assoc == m_lines.size()) { out << "Fully associative" << endl; } else { out << dec << m_assoc << "-way set associative" << endl; } out << "L1 bank mapping: " << m_selector->GetName() << endl << "Cache size: " << dec << (m_lineSize * m_lines.size()) << " bytes" << endl << "Cache line size: " << dec << m_lineSize << " bytes" << endl << endl; uint64_t numRAccesses = m_numHits + m_numDelayedReads; uint64_t numRqst = m_numEmptyMisses + m_numResolvedConflicts; uint64_t numStalls = m_numHardConflicts + m_numInvalidMisses + m_numStallingMisses; #define PRINTVAL(X, q) dec << (X) << " (" << setprecision(2) << fixed << (X) * q << "%)" if (numRAccesses == 0) out << "No accesses so far, cannot provide statistical data." << endl; else { out << "***********************************************************" << endl << " Summary " << endl << "***********************************************************" << endl << endl << "Number of read requests from client: " << numRAccesses << endl << "Number of request to upstream: " << numRqst << endl << "Number of stall cycles: " << numStalls << endl << endl << endl; float r_factor = 100.0f / numRAccesses; out << "***********************************************************" << endl << " Cache reads " << endl << "***********************************************************" << endl << endl << "Number of read requests from client: " << numRAccesses << endl << "Read hits: " << PRINTVAL(m_numHits, r_factor) << endl << "Read misses: " << PRINTVAL(m_numDelayedReads, r_factor) << endl << "Breakdown of read misses:" << endl << "- to an empty line: " << PRINTVAL(m_numEmptyMisses, r_factor) << endl << "- to a loading line with same tag: " << PRINTVAL(m_numLoadingMisses, r_factor) << endl << "- to a reusable line with different tag (conflict): " << PRINTVAL(m_numResolvedConflicts, r_factor) << endl << "(percentages relative to " << numRAccesses << " read requests)" << endl << endl; if (numStalls != 0) { float s_factor = 100.f / numStalls; out << "***********************************************************" << endl << " Stall cycles " << endl << "***********************************************************" << endl << endl << "Number of stall cycles: " << numStalls << endl << "Breakdown:" << endl << "- read conflict to non-reusable line: " << PRINTVAL(m_numHardConflicts, s_factor) << endl << "- read to invalidated line: " << PRINTVAL(m_numInvalidMisses, s_factor) << endl << "- unable to send request upstream: " << PRINTVAL(m_numStallingMisses, s_factor) << endl << "(percentages relative to " << numStalls << " stall cycles)" << endl << endl; } } return; } else if (arguments[0] == "buffers") { out << endl << "Outgoing buffer:" << endl; if (m_outgoing.Empty()) { out << "(Empty)" << endl; } else { out << " Address " << endl; out << "-----------------" << endl; for (Buffer<MemAddr>::const_iterator p = m_outgoing.begin(); p != m_outgoing.end(); ++p) { out << setfill('0') << hex << setw(16) << *p << endl; } } out << endl << "Incoming buffer:"; if (m_incoming.Empty()) { out << " (Empty)"; } else for (Buffer<CID>::const_iterator p = m_incoming.begin(); p != m_incoming.end(); ++p) { out << " C" << dec << *p; } out << endl; } out << "Set | Address | Data | Ref |" << endl; out << "----+---------------------+-------------------------------------------------+-----+" << endl; for (size_t i = 0; i < m_lines.size(); ++i) { const size_t set = i / m_assoc; const Line& line = m_lines[i]; if (i % m_assoc == 0) { out << setw(3) << setfill(' ') << dec << right << set; } else { out << " "; } if (line.state == LINE_EMPTY) { out << " | | | |"; } else { char state = ' '; switch (line.state) { case LINE_LOADING: state = 'L'; break; case LINE_INVALID: state = 'I'; break; default: state = ' '; break; } out << " | " << hex << "0x" << setw(16) << setfill('0') << m_selector->Unmap(line.tag, set) * m_lineSize << state << " |"; if (line.state == LINE_FULL) { // Print the data static const int BYTES_PER_LINE = 16; for (size_t y = 0; y < m_lineSize; y += BYTES_PER_LINE) { out << hex << setfill('0'); for (size_t x = y; x < y + BYTES_PER_LINE; ++x) { out << " " << setw(2) << (unsigned)(unsigned char)line.data[x]; } out << " | "; if (y == 0) { out << setw(3) << dec << setfill(' ') << line.references; } else { out << " "; } out << " |"; if (y + BYTES_PER_LINE < m_lineSize) { // This was not yet the last line out << endl << " | |"; } } } else { out << " | " << setw(3) << dec << setfill(' ') << line.references << " |"; } } out << endl; out << ((i + 1) % m_assoc == 0 ? "----" : " "); out << "+---------------------+-------------------------------------------------+-----+" << endl; } } } }
32.17765
127
0.503963
svp-dev
7f9f551fd176d35ea850812106284c034b597292
15,145
cpp
C++
Y-Engine/Renderer & Math/YEMath/YObb.cpp
Yosbi/YEngine
e9a992919b646f8672c16285b776638ac86f96fa
[ "MIT" ]
null
null
null
Y-Engine/Renderer & Math/YEMath/YObb.cpp
Yosbi/YEngine
e9a992919b646f8672c16285b776638ac86f96fa
[ "MIT" ]
null
null
null
Y-Engine/Renderer & Math/YEMath/YObb.cpp
Yosbi/YEngine
e9a992919b646f8672c16285b776638ac86f96fa
[ "MIT" ]
null
null
null
//------------------------------------------------------------------------------- // YObb.cpp // Yosbi Alves // yosbito@gmail.com // Copyright (c) 2011 //----------------------------------------------------------------------- // Desc: In this file is the definition of the clases, and methods // YObb class //----------------------------------------------------------------------- //----------------------------------------------------------------------- // Includes //----------------------------------------------------------------------- #include "YEMath.h" //-------------------------------------------------------------------- // Name: DeTransform() // Desc: Detransform a obb to the matrix space //-------------------------------------------------------------------- inline void YObb::DeTransform(const YObb &obb, const YMatrix &m) { YMatrix mat = m; YVector vcT; // erase translation from mat vcT.Set(mat._41, mat._42, mat._43); mat._41 = mat._42 = mat._43 = 0.0f; // rotate center and axis to matrix coord.-space this->vcCenter = mat * obb.vcCenter; this->vcA0 = mat * obb.vcA0; this->vcA1 = mat * obb.vcA1; this->vcA2 = mat * obb.vcA2; // set translation this->vcCenter += vcT; // copy axis length fA0 = obb.fA0; fA1 = obb.fA1; fA2 = obb.fA2; } //-------------------------------------------------------------------- // Name: ObbProj() // Desc: helperfunction //-------------------------------------------------------------------- void YObb::ObbProj(const YObb &Obb, const YVector &vcV, float *pfMin, float *pfMax) { float fDP = vcV * Obb.vcCenter; float fR = Obb.fA0 * _fabs(vcV * Obb.vcA0) + Obb.fA0 * _fabs(vcV * Obb.vcA1) + Obb.fA1 * _fabs(vcV * Obb.vcA2); *pfMin = fDP - fR; *pfMax = fDP + fR; } //-------------------------------------------------------------------- // Name: TriProj() // Desc: helperfunction //-------------------------------------------------------------------- void YObb::TriProj(const YVector &v0, const YVector &v1, const YVector &v2, const YVector &vcV, float *pfMin, float *pfMax) { *pfMin = vcV * v0; *pfMax = *pfMin; float fDP = vcV * v1; if (fDP < *pfMin) *pfMin = fDP; else if (fDP > *pfMax) *pfMax = fDP; fDP = vcV * v2; if (fDP < *pfMin) *pfMin = fDP; else if (fDP > *pfMax) *pfMax = fDP; } //-------------------------------------------------------------------- // Name: Intersects() // Desc: Intersects trianlge //-------------------------------------------------------------------- bool YObb::Intersects(const YVector &v0, const YVector &v1, const YVector &v2) { float fMin0, fMax0, fMin1, fMax1; float fD_C; YVector vcV, vcTriEdge[3], vcA[3]; // just for looping vcA[0] = this->vcA0; vcA[1] = this->vcA1; vcA[2] = this->vcA2; // direction of tri-normals vcTriEdge[0] = v1 - v0; vcTriEdge[1] = v2 - v0; vcV.Cross(vcTriEdge[0], vcTriEdge[1]); fMin0 = vcV * v0; fMax0 = fMin0; this->ObbProj((*this), vcV, &fMin1, &fMax1); if ( fMax1 < fMin0 || fMax0 < fMin1 ) return true; // direction of obb planes // ======================= // axis 1: vcV = this->vcA0; this->TriProj(v0, v1, v2, vcV, &fMin0, &fMax0); fD_C = vcV * this->vcCenter; fMin1 = fD_C - this->fA0; fMax1 = fD_C + this->fA0; if ( fMax1 < fMin0 || fMax0 < fMin1 ) return true; // axis 2: vcV = this->vcA1; this->TriProj(v0, v1, v2, vcV, &fMin0, &fMax0); fD_C = vcV * this->vcCenter; fMin1 = fD_C - this->fA1; fMax1 = fD_C + this->fA1; if ( fMax1 < fMin0 || fMax0 < fMin1 ) return true; // axis 3: vcV = this->vcA2; this->TriProj(v0, v1, v2, vcV, &fMin0, &fMax0); fD_C = vcV * this->vcCenter; fMin1 = fD_C - this->fA2; fMax1 = fD_C + this->fA2; if ( fMax1 < fMin0 || fMax0 < fMin1 ) return true; // direction of tri-obb edge-crossproducts vcTriEdge[2] = vcTriEdge[1] - vcTriEdge[0]; for (int j=0; j<3; j++) { for (int k=0; k<3; k++) { vcV.Cross(vcTriEdge[j], vcA[k]); this->TriProj(v0, v1, v2, vcV, &fMin0, &fMax0); this->ObbProj((*this), vcV, &fMin1, &fMax1); if ( (fMax1 < fMin0) || (fMax0 < fMin1) ) return true; } } return true; } //-------------------------------------------------------------------- // Name: Intersects() // Desc: Intersects ray, slaps method //-------------------------------------------------------------------- bool YObb::Intersects(const YRay &Ray, float *t) { float e, f, t1, t2, temp; float tmin = -99999.9f, tmax = +99999.9f; YVector vcP = this->vcCenter - Ray.m_vcOrig; // 1st slap e = this->vcA0 * vcP; f = this->vcA0 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA0) / f; t2 = (e - this->fA0) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA0) > 0.0f) || ((-e + this->fA0) < 0.0f) ) return false; // 2nd slap e = this->vcA1 * vcP; f = this->vcA1 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA1) / f; t2 = (e - this->fA1) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA1) > 0.0f) || ((-e + this->fA1) < 0.0f) ) return false; // 3rd slap e = this->vcA2 * vcP; f = this->vcA2 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA2) / f; t2 = (e - this->fA2) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA2) > 0.0f) || ((-e + this->fA2) < 0.0f) ) return false; if (tmin > 0.0f) { if (t) *t = tmin; return true; } if (t) *t = tmax; return true; } //-------------------------------------------------------------------- // Name: Intersects() // Desc: Intersects ray at certain length (line segment), slaps method //-------------------------------------------------------------------- bool YObb::Intersects(const YRay &Ray, float fL, float *t) { float e, f, t1, t2, temp; float tmin = -99999.9f, tmax = +99999.9f; YVector vcP = this->vcCenter - Ray.m_vcOrig; // 1st slap e = this->vcA0 * vcP; f = this->vcA0 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA0) / f; t2 = (e - this->fA0) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA0) > 0.0f) || ((-e + this->fA0) < 0.0f) ) return false; // 2nd slap e = this->vcA1 * vcP; f = this->vcA1 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA1) / f; t2 = (e - this->fA1) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA1) > 0.0f) || ((-e + this->fA1) < 0.0f) ) return false; // 3rd slap e = this->vcA2 * vcP; f = this->vcA2 * Ray.m_vcDir; if (_fabs(f) > 0.00001f) { t1 = (e + this->fA2) / f; t2 = (e - this->fA2) / f; if (t1 > t2) { temp=t1; t1=t2; t2=temp; } if (t1 > tmin) tmin = t1; if (t2 < tmax) tmax = t2; if (tmin > tmax) return false; if (tmax < 0.0f) return false; } else if ( ((-e - this->fA2) > 0.0f) || ((-e + this->fA2) < 0.0f) ) return false; if ( (tmin > 0.0f) && (tmin <= fL) ) { if (t) *t = tmin; return true; } // intersection on line but not on segment if (tmax > fL) return false; if (t) *t = tmax; return true; } //-------------------------------------------------------------------- // Name: Intersects() // Desc: Intersects another obb //-------------------------------------------------------------------- bool YObb::Intersects(const YObb &Obb) { float T[3]; // difference vector between both obb YVector vcD = Obb.vcCenter - this->vcCenter; float matM[3][3]; // B's axis in relation to A float ra, // radius A rb, // radius B t; // absolute values from T[] // Obb A's axis as separation axis? // ================================ // first axis vcA0 matM[0][0] = this->vcA0 * Obb.vcA0; matM[0][1] = this->vcA0 * Obb.vcA1; matM[0][2] = this->vcA0 * Obb.vcA2; ra = this->fA0; rb = Obb.fA0 * _fabs(matM[0][0]) + Obb.fA1 * _fabs(matM[0][1]) + Obb.fA2 * _fabs(matM[0][2]); T[0] = vcD * this->vcA0; t = _fabs(T[0]); if(t > (ra + rb) ) return false; // second axis vcA1 matM[1][0] = this->vcA1 * Obb.vcA0; matM[1][1] = this->vcA1 * Obb.vcA1; matM[1][2] = this->vcA1 * Obb.vcA2; ra = this->fA1; rb = Obb.fA0 * _fabs(matM[1][0]) + Obb.fA1 * _fabs(matM[1][1]) + Obb.fA2 * _fabs(matM[1][2]); T[1] = vcD * this->vcA1; t = _fabs(T[1]); if(t > (ra + rb) ) return false; // third axis vcA2 matM[2][0] = this->vcA2 * Obb.vcA0; matM[2][1] = this->vcA2 * Obb.vcA1; matM[2][2] = this->vcA2 * Obb.vcA2; ra = this->fA2; rb = Obb.fA0 * _fabs(matM[2][0]) + Obb.fA1 * _fabs(matM[2][1]) + Obb.fA2 * _fabs(matM[2][2]); T[2] = vcD * this->vcA2; t = _fabs(T[2]); if(t > (ra + rb) ) return false; // Obb B's axis as separation axis? // ================================ // first axis vcA0 ra = this->fA0 * _fabs(matM[0][0]) + this->fA1 * _fabs(matM[1][0]) + this->fA2 * _fabs(matM[2][0]); rb = Obb.fA0; t = _fabs( T[0]*matM[0][0] + T[1]*matM[1][0] + T[2]*matM[2][0] ); if(t > (ra + rb) ) return false; // second axis vcA1 ra = this->fA0 * _fabs(matM[0][1]) + this->fA1 * _fabs(matM[1][1]) + this->fA2 * _fabs(matM[2][1]); rb = Obb.fA1; t = _fabs( T[0]*matM[0][1] + T[1]*matM[1][1] + T[2]*matM[2][1] ); if(t > (ra + rb) ) return false; // third axis vcA2 ra = this->fA0 * _fabs(matM[0][2]) + this->fA1 * _fabs(matM[1][2]) + this->fA2 * _fabs(matM[2][2]); rb = Obb.fA2; t = _fabs( T[0]*matM[0][2] + T[1]*matM[1][2] + T[2]*matM[2][2] ); if(t > (ra + rb) ) return false; // other candidates: cross products of axis: // ========================================= // axis A0xB0 ra = this->fA1*_fabs(matM[2][0]) + this->fA2*_fabs(matM[1][0]); rb = Obb.fA1*_fabs(matM[0][2]) + Obb.fA2*_fabs(matM[0][1]); t = _fabs( T[2]*matM[1][0] - T[1]*matM[2][0] ); if( t > ra + rb ) return false; // axis A0xB1 ra = this->fA1*_fabs(matM[2][1]) + this->fA2*_fabs(matM[1][1]); rb = Obb.fA0*_fabs(matM[0][2]) + Obb.fA2*_fabs(matM[0][0]); t = _fabs( T[2]*matM[1][1] - T[1]*matM[2][1] ); if( t > ra + rb ) return false; // axis A0xB2 ra = this->fA1*_fabs(matM[2][2]) + this->fA2*_fabs(matM[1][2]); rb = Obb.fA0*_fabs(matM[0][1]) + Obb.fA1*_fabs(matM[0][0]); t = _fabs( T[2]*matM[1][2] - T[1]*matM[2][2] ); if( t > ra + rb ) return false; // axis A1xB0 ra = this->fA0*_fabs(matM[2][0]) + this->fA2*_fabs(matM[0][0]); rb = Obb.fA1*_fabs(matM[1][2]) + Obb.fA2*_fabs(matM[1][1]); t = _fabs( T[0]*matM[2][0] - T[2]*matM[0][0] ); if( t > ra + rb ) return false; // axis A1xB1 ra = this->fA0*_fabs(matM[2][1]) + this->fA2*_fabs(matM[0][1]); rb = Obb.fA0*_fabs(matM[1][2]) + Obb.fA2*_fabs(matM[1][0]); t = _fabs( T[0]*matM[2][1] - T[2]*matM[0][1] ); if( t > ra + rb ) return false; // axis A1xB2 ra = this->fA0*_fabs(matM[2][2]) + this->fA2*_fabs(matM[0][2]); rb = Obb.fA0*_fabs(matM[1][1]) + Obb.fA1*_fabs(matM[1][0]); t = _fabs( T[0]*matM[2][2] - T[2]*matM[0][2] ); if( t > ra + rb ) return false; // axis A2xB0 ra = this->fA0*_fabs(matM[1][0]) + this->fA1*_fabs(matM[0][0]); rb = Obb.fA1*_fabs(matM[2][2]) + Obb.fA2*_fabs(matM[2][1]); t = _fabs( T[1]*matM[0][0] - T[0]*matM[1][0] ); if( t > ra + rb ) return false; // axis A2xB1 ra = this->fA0*_fabs(matM[1][1]) + this->fA1*_fabs(matM[0][1]); rb = Obb.fA0 *_fabs(matM[2][2]) + Obb.fA2*_fabs(matM[2][0]); t = _fabs( T[1]*matM[0][1] - T[0]*matM[1][1] ); if( t > ra + rb ) return false; // axis A2xB2 ra = this->fA0*_fabs(matM[1][2]) + this->fA1*_fabs(matM[0][2]); rb = Obb.fA0*_fabs(matM[2][1]) + Obb.fA1*_fabs(matM[2][0]); t = _fabs( T[1]*matM[0][2] - T[0]*matM[1][2] ); if( t > ra + rb ) return false; // no separation axis found => intersection return true; } //-------------------------------------------------------------------- // Name: Cull() /* Desc: Culls OBB to n sided frustrum. Normals pointing outwards. * -> IN: ZFXPlane - array of planes building frustrum * int - number of planes in array * OUT: ZFXVISIBLE - obb totally inside frustrum * ZFXCLIPPED - obb clipped by frustrum * ZFXCULLED - obb totally outside frustrum */ //-------------------------------------------------------------------- int YObb::Cull(const YPlane *pPlanes, int nNumPlanes) { YVector vN; int nResult = YVISIBLE; float fRadius, fTest; // for all planes for (int i=0; i<nNumPlanes; i++) { // frustrum normals pointing outwards, we need inwards vN = pPlanes[i].m_vcN * -1.0f; // calculate projected box radius fRadius = _fabs(fA0 * (vN * vcA0)) + _fabs(fA1 * (vN * vcA1)) + _fabs(fA2 * (vN * vcA2)); // testvalue: (N*C - d) (#) fTest = vN * this->vcCenter - pPlanes[i].m_fD; // obb totally outside of at least one plane: (#) < -r if (fTest < -fRadius) return YCULLED; // or maybe intersecting this plane? else if (!(fTest > fRadius)) nResult = YCLIPPED; } // for // if not culled then clipped or inside return nResult; }
30.720081
82
0.4414
Yosbi
7fa06c3c42dd1c3a82cf9f5d36b1fbd07dfa8eaa
2,704
hxx
C++
main/chart2/source/controller/inc/ItemPropertyMap.hxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
679
2015-01-06T06:34:58.000Z
2022-03-30T01:06:03.000Z
main/chart2/source/controller/inc/ItemPropertyMap.hxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
102
2017-11-07T08:51:31.000Z
2022-03-17T12:13:49.000Z
main/chart2/source/controller/inc/ItemPropertyMap.hxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
331
2015-01-06T11:40:55.000Z
2022-03-14T04:07:51.000Z
/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ #ifndef CHART_ITEMPROPERTYMAP_HXX #define CHART_ITEMPROPERTYMAP_HXX #include <comphelper/InlineContainer.hxx> #include "ItemConverter.hxx" #define IPM_MAP_ENTRY(wid,uno,mid) (wid, ::std::make_pair< ::comphelper::ItemConverter::tPropertyNameType, ::comphelper::ItemConverter::tMemberIdType >(\ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(uno)), mid)) namespace comphelper { typedef ::std::map< ItemConverter::tWhichIdType, ::std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > > ItemPropertyMapType; typedef ::comphelper::MakeMap< ItemConverter::tWhichIdType, ::std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > > MakeItemPropertyMap; class FillItemSetFunc : public ::std::unary_function< ItemConverter *, void > { public: explicit FillItemSetFunc( SfxItemSet & rOutItemSet ) : m_rOutItemSet( rOutItemSet ) {} void operator() ( ItemConverter * pConv ) { pConv->FillItemSet( m_rOutItemSet ); } private: SfxItemSet & m_rOutItemSet; }; class ApplyItemSetFunc : public ::std::unary_function< ItemConverter *, void > { public: explicit ApplyItemSetFunc( const SfxItemSet & rItemSet, bool & rOutResult ) : m_rItemSet( rItemSet ), m_rOutResult( rOutResult ) {} void operator() ( ItemConverter * pConv ) { m_rOutResult = pConv->ApplyItemSet( m_rItemSet ) || m_rOutResult; } private: const SfxItemSet & m_rItemSet; bool & m_rOutResult; }; struct DeleteItemConverterPtr : public ::std::unary_function< ItemConverter *, void > { void operator() ( ItemConverter * pConv ) { delete pConv; } }; } // namespace comphelper // CHART_ITEMPROPERTYMAP_HXX #endif
31.08046
153
0.679734
Grosskopf
7fa0d4420a4f16abe70e04c2980e94259d3fe6c6
6,566
cpp
C++
src/PIDController.cpp
rahulsalvi/PIDController
75a8f3735dda752d57c0fba8a12556914f2e5aa8
[ "MIT" ]
null
null
null
src/PIDController.cpp
rahulsalvi/PIDController
75a8f3735dda752d57c0fba8a12556914f2e5aa8
[ "MIT" ]
null
null
null
src/PIDController.cpp
rahulsalvi/PIDController
75a8f3735dda752d57c0fba8a12556914f2e5aa8
[ "MIT" ]
null
null
null
/* The MIT License (MIT) Copyright (c) 2016 Rahul Salvi 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 "PIDController.h" inline double absoluteValue(double x) { if (x < 0) { return -x; } return x; } PIDController::PIDController() : PIDController(nullptr, 0, 0, 0, 0) {} PIDController::PIDController(Timer* timer, double p, double i, double d, double f) : _timer(timer), _p(p), _i(i), _d(d), _f(f) { reset(); _minOutput = 0; _maxOutput = 0; _minInput = 0; _minOutput = 0; _isContinuous = false; _absoluteTolerance = 0; _percentTolerance = 0; _isWithinTolerance = false; _integratorLimit = 0; _isRunning = false; } void PIDController::start() { if (_timer) { _timer->start(); } _isRunning = true; } void PIDController::reset() { _error = 0; _previousError = 0; _integral = 0; _derivative = 0; _setpoint = 0; _output = 0; if (_timer) { _timer->reset(); } } void PIDController::setTimer(Timer* timer) { _timer = timer; } void PIDController::setPIDF(double p, double i, double d, double f) { _p = p; _i = i; _d = d; _f = f; } void PIDController::setP(double p) { _p = p; } void PIDController::setI(double i) { _i = i; if (_i) { _integratorLimit /= _i; } } void PIDController::setD(double d) { _d = d; } void PIDController::setF(double f) { _f = f; } void PIDController::setOutputLimits(double min, double max) { _minOutput = min; _maxOutput = max; } void PIDController::setInputLimits(double min, double max) { _minInput = min; _maxInput = max; } void PIDController::setContinuous(bool isContinuous) { _isContinuous = isContinuous; } void PIDController::setAbsoluteTolerance(double tolerance) { _absoluteTolerance = tolerance; } void PIDController::setPercentTolerance(double tolerance) { _percentTolerance = tolerance; } void PIDController::setIntegratorLimit(double limit) { _integratorLimit = limit; if (_i) { _integratorLimit /= _i; } } Timer* PIDController::timer() const { return _timer; } double PIDController::p() const { return _p; } double PIDController::i() const { return _i; } double PIDController::d() const { return _d; } double PIDController::f() const { return _f; } double PIDController::minOutput() const { return _minOutput; } double PIDController::maxOutput() const { return _maxOutput; } double PIDController::minInput() const { return _minInput; } double PIDController::maxInput() const { return _maxInput; } bool PIDController::isContinuous() const { return _isContinuous; } bool PIDController::isWithinTolerance() const { return _isWithinTolerance; } bool PIDController::isRunning() const { return _isRunning; } double PIDController::error() const { return _error; } double PIDController::integral() const { return _integral; } double PIDController::derivative() const { return _derivative; } double PIDController::setpoint() const { return _setpoint; } double PIDController::output() const { return _output; } double PIDController::getOutput(double input, double setpoint, double dt) { if (_minInput && _maxInput) { if (input > _maxInput) { input = _maxInput; } else if (input < _minInput) { input = _minInput; } } _setpoint = setpoint; _error = _setpoint - input; if (_absoluteTolerance) { if ((input > (_setpoint - _absoluteTolerance)) && (input < (_setpoint + _absoluteTolerance))) { _isWithinTolerance = true; } else { _isWithinTolerance = false; } } else if (_percentTolerance) { double tolerance = _percentTolerance * _setpoint; if ((input > (_setpoint - tolerance)) && (input < (_setpoint + tolerance))) { _isWithinTolerance = true; } else { _isWithinTolerance = false; } } else { _isWithinTolerance = false; } if (dt) { _dt = dt; return calculateOutput(false); } return calculateOutput(true); } double PIDController::getOutput(double error, double dt) { _error = error; _setpoint = 0; _isWithinTolerance = false; if (dt) { _dt = dt; return calculateOutput(false); } return calculateOutput(true); } double PIDController::calculateOutput(bool useTimer) { if (_isContinuous) { if (absoluteValue(_error) > ((absoluteValue(_minInput) + absoluteValue(_maxInput)) / 2)) { if (_error > 0) { _error = _error - _maxInput + _minInput; } else { _error = _error + _maxInput - _minInput; } } } if (useTimer && _timer) { _dt = _timer->dt(); } _integral += _error * _dt; _derivative = ((_error - _previousError) / _dt); _previousError = _error; if (_integratorLimit && (absoluteValue(_integral) > _integratorLimit)) { if (_integral < 0) { _integral = -_integratorLimit; } else { _integral = _integratorLimit; } } _output = (_p * _error) + (_i * _integral) + (_d * _derivative) + (_f * _setpoint); if (_minOutput && _maxOutput) { if (_output > _maxOutput) { _output = _maxOutput; } else if (_output < _minOutput) { _output = _minOutput; } } return _output; }
22.719723
103
0.634328
rahulsalvi
7fa52836ad4eefa17105ab0320c3f7d03ea5f7c9
32,386
cpp
C++
pyoptsparse/pyNOMAD/source/nomad_src/Evaluator.cpp
robfalck/pyoptsparse
c99f4bfe8961492d0a1879f9ecff7a2fbb3c8c1d
[ "CNRI-Python" ]
26
2020-08-25T16:16:21.000Z
2022-03-10T08:23:57.000Z
pyoptsparse/pyNOMAD/source/nomad_src/Evaluator.cpp
robfalck/pyoptsparse
c99f4bfe8961492d0a1879f9ecff7a2fbb3c8c1d
[ "CNRI-Python" ]
90
2020-08-24T23:02:47.000Z
2022-03-29T13:48:15.000Z
pyoptsparse/pyNOMAD/source/nomad_src/Evaluator.cpp
robfalck/pyoptsparse
c99f4bfe8961492d0a1879f9ecff7a2fbb3c8c1d
[ "CNRI-Python" ]
25
2020-08-24T19:28:24.000Z
2022-01-27T21:17:37.000Z
/*-------------------------------------------------------------------------------------*/ /* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct search - version 3.7.1 */ /* */ /* Copyright (C) 2001-2015 Mark Abramson - the Boeing Company, Seattle */ /* Charles Audet - Ecole Polytechnique, Montreal */ /* Gilles Couture - Ecole Polytechnique, Montreal */ /* John Dennis - Rice University, Houston */ /* Sebastien Le Digabel - Ecole Polytechnique, Montreal */ /* Christophe Tribes - Ecole Polytechnique, Montreal */ /* */ /* funded in part by AFOSR and Exxon Mobil */ /* */ /* Author: Sebastien Le Digabel */ /* */ /* Contact information: */ /* Ecole Polytechnique de Montreal - GERAD */ /* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */ /* e-mail: nomad@gerad.ca */ /* phone : 1-514-340-6053 #6928 */ /* fax : 1-514-340-5665 */ /* */ /* This program is free software: you can redistribute it and/or modify it under the */ /* terms of the GNU Lesser General Public License as published by the Free Software */ /* Foundation, either version 3 of the License, or (at your option) any later */ /* version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ /* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License along */ /* with this program. If not, see <http://www.gnu.org/licenses/>. */ /* */ /* You can find information on the NOMAD software at www.gerad.ca/nomad */ /*-------------------------------------------------------------------------------------*/ /** \file Evaluator.cpp \brief Evaluation of blackbox functions (implementation) \author Sebastien Le Digabel \date 2010-04-14 \see Evaluator.hpp */ #include "Evaluator.hpp" /*-----------------------------------*/ /* static members initialization */ /*-----------------------------------*/ bool NOMAD::Evaluator::_force_quit = false; /*-----------------------------------------------------------------*/ /* constructor */ /*-----------------------------------------------------------------*/ /* Parameters::_bb_exe is used to construct _bb_exe and _bb_nbo: */ /* Parameters::_bb_exe can have similar blackbox names, while */ /* . _bb_exe will have unique blackbox names */ /* . _bb_exe includes the blackbox path */ /*-----------------------------------------------------------------*/ NOMAD::Evaluator::Evaluator ( const NOMAD::Parameters & p ) : _p ( p ) , _is_multi_obj ( false ) , _is_model_evaluator ( false ) { NOMAD::Evaluator::_force_quit = false; if ( _p.get_bb_exe().empty() ) return; // _bbe_exe and _bb_nbo construction: std::list<std::string>::const_iterator it = _p.get_bb_exe().begin(); _bb_exe.push_back(*it); _bb_nbo.push_back(1); ++it; std::list<std::string>::const_iterator end = _p.get_bb_exe().end(); while ( it != end ) { if ( *it != _bb_exe[_bb_exe.size()-1] ) { _bb_exe.push_back(*it); _bb_nbo.push_back(1); } else ++_bb_nbo[_bb_exe.size()-1]; ++it; } // we check that _bb_exe contains unique names and we add the problem path: size_t k , l , n = _bb_exe.size() , nm1 = n-1; for ( k = 0 ; k < nm1 ; ++k ) { for ( l = k+1 ; l < n ; ++l ) if ( _bb_exe[k] == _bb_exe[l] ) throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , "problem with executable names" ); } // construction of _sgte_exe: bool has_sgte_exe = _p.has_sgte_exe(); std::string err; if ( has_sgte_exe ) { for ( k = 0 ; k < n ; ++k ) { _sgte_exe.push_back ( _p.get_sgte_exe(_bb_exe[k]) ); if ( _sgte_exe[_sgte_exe.size()-1].empty() ) { err = "blackbox executable \'" + _bb_exe[k] + "\' has no surrogate"; throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , err ); } } } // process blakc-box executables (check and add problem path): for ( k = 0 ; k < n ; ++k ) { process_bb_exe_name ( _bb_exe[k] ); if ( has_sgte_exe ) process_bb_exe_name ( _sgte_exe[k] ); } // blackbox names and indexes display: #ifdef DEBUG #ifdef USE_MPI int rank; MPI_Comm_rank ( MPI_COMM_WORLD, &rank); if ( rank == 0 ) { #else { #endif const NOMAD::Display & out = _p.out(); if ( !_bb_exe.empty() ) { out << std::endl << NOMAD::open_block ( "blackbox executables" ); for ( k = 0 ; k < n ; ++k ) { out << NOMAD::open_block ( "bb #" + NOMAD::itos(k) ) << _bb_exe[k] << std::endl << "number of outputs=" << _bb_nbo[k] << std::endl << NOMAD::close_block(); } out.close_block(); } if ( !_sgte_exe.empty() ) { out << std::endl << NOMAD::open_block ( "surrogate executables" ); for ( k = 0 ; k < n ; ++k ) out << "sgte #" << static_cast<int>(k) << ": " << _sgte_exe[k] << std::endl; out.close_block(); } } #endif } /*----------------------------------------------------------------*/ /* process a blackbox executable name (private) */ /*----------------------------------------------------------------*/ void NOMAD::Evaluator::process_bb_exe_name ( std::string & bb_exe ) const { std::string err; std::list<std::string> bb_exe_words; NOMAD::get_words ( bb_exe , bb_exe_words ); if ( bb_exe_words.empty() ) { err = "problem with executable \'" + bb_exe + "\'"; throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , err ); } std::string problem_dir = _p.get_problem_dir(); // bb_exe is composed of several words (it is a command): if ( bb_exe_words.size() > 1 ) { bb_exe.clear(); std::list<std::string>::const_iterator it = bb_exe_words.begin() , end = bb_exe_words.end(); while (true) { if ( (*it)[0] != '$' ) { bb_exe += "\"" + problem_dir; bb_exe += *it + "\""; } else bb_exe += it->substr ( 1 , it->size()-1 ); ++it; if ( it == end ) break; bb_exe += " "; } } // bb_exe is just composed of one name (it is an executable): else { if ( bb_exe[0] != '$' ) bb_exe = problem_dir + bb_exe; else bb_exe = bb_exe.substr ( 1 , bb_exe.size()-1 ); if ( !NOMAD::check_exe_file ( bb_exe ) ) { err = "\'" + bb_exe + "\' is not a valid executable file"; throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , err ); } if ( bb_exe[0] != '$' ) bb_exe = "\"" + bb_exe + "\""; } } /*-----------------------------------------------------------------------*/ /* check the constraints to decide if an evaluation have to be stopped */ /*-----------------------------------------------------------------------*/ /* . checked when h > h_max or if a 'EB' constraint is violated */ /* . private method */ /*-----------------------------------------------------------------------*/ bool NOMAD::Evaluator::interrupt_evaluations ( const NOMAD::Eval_Point & x , const NOMAD::Double & h_max ) const { int nbo = _p.get_bb_nb_outputs(); const NOMAD::Point & bbo = x.get_bb_outputs(); const std::vector<NOMAD::bb_output_type> & bbot = _p.get_bb_output_type(); NOMAD::Double h = 0.0; bool check_h = h_max.is_defined(); for ( int i = 0 ; i < nbo ; ++i ) { if ( bbo[i].is_defined() && ( bbot[i] == NOMAD::EB || bbot[i] == NOMAD::PEB_E ) && bbo[i] > _p.get_h_min() ) return true; if ( check_h && bbo[i].is_defined() && (bbot[i] == NOMAD::FILTER || bbot[i] == NOMAD::PB || bbot[i] == NOMAD::PEB_P ) ) { if ( bbo[i] > _p.get_h_min() ) { switch ( _p.get_h_norm() ) { case NOMAD::L1: h += bbo[i]; break; case NOMAD::L2: h += bbo[i].pow2(); break; case NOMAD::LINF: if ( bbo[i] > h ) h = bbo[i]; break; } if ( _p.get_h_norm() == NOMAD::L2 ) { if ( h > h_max.pow2() ) return true; } else if ( h > h_max ) return true; } } } return false; } /*--------------------------------------------------------*/ /* compute f(x) from the blackbox outputs of a point */ /* (define a Multi_Obj_Evaluator to treat more than */ /* one objective) */ /*--------------------------------------------------------*/ void NOMAD::Evaluator::compute_f ( NOMAD::Eval_Point & x ) const { if ( x.get_bb_outputs().size() != _p.get_bb_nb_outputs() ) { std::ostringstream err; err << "Evaluator::compute_f(x): x has a wrong number of blackbox outputs (" << x.get_bb_outputs().size() << " != " << _p.get_bb_nb_outputs() << ")"; throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , err.str() ); } x.set_f ( x.get_bb_outputs()[*(_p.get_index_obj().begin())] ); } /*--------------------------------------------------------*/ /* compute h(x) from the blackbox outputs of a point */ /* set also the flag 'EB_ok' of the point */ /*--------------------------------------------------------*/ void NOMAD::Evaluator::compute_h ( NOMAD::Eval_Point & x ) const { if ( x.get_bb_outputs().size() != _p.get_bb_nb_outputs() ) { std::ostringstream err; err << "Evaluator::compute_h(x): x has a wrong number of blackbox outputs (" << x.get_bb_outputs().size() << " != " << _p.get_bb_nb_outputs() << ")"; throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , err.str() ); } int nbo = _p.get_bb_nb_outputs(); const std::vector<NOMAD::bb_output_type> & bbot = _p.get_bb_output_type(); const NOMAD::Point & bbo = x.get_bb_outputs(); NOMAD::Double h = 0.0 , bboi; x.set_EB_ok ( true ); for ( int i = 0 ; i < nbo ; ++i ) { bboi = bbo[i]; if ( bboi.is_defined() && (bbot[i] == NOMAD::EB || bbot[i] == NOMAD::PEB_E ) && bboi > _p.get_h_min() ) { h.clear(); x.set_h ( h ); x.set_EB_ok ( false ); return; } if ( bboi.is_defined() && ( bbot[i] == NOMAD::FILTER || bbot[i] == NOMAD::PB || bbot[i] == NOMAD::PEB_P ) ) { if ( bboi > _p.get_h_min() ) { switch ( _p.get_h_norm() ) { case NOMAD::L1: h += bboi; break; case NOMAD::L2: h += bboi * bboi; break; case NOMAD::LINF: if ( bboi > h ) h = bboi; break; } } } } if ( _p.get_h_norm() == NOMAD::L2 ) h = h.sqrt(); x.set_h ( h ); } /*-------------------------------------------------------------------*/ /* . evaluate the black boxes at a given Eval_Point */ /* . the function returns true if the evaluation did not fail */ /* . set count_eval=true to count the evaluation */ /* (unless the output value CNT_EVAL is defined and set to 1 */ /* by the blackbox) */ /*-------------------------------------------------------------------*/ bool NOMAD::Evaluator::eval_x ( NOMAD::Eval_Point & x , const NOMAD::Double & h_max , bool & count_eval ) const { count_eval = false; if ( _bb_exe.empty() || !x.is_complete() ) throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , "Evaluator: no BB_EXE is defined (blackbox executable names)" ); bool sgte = x.get_eval_type() == NOMAD::SGTE; if ( sgte && _sgte_exe.empty() ) throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , "Evaluator: no SGTE_EXE is defined (surrogate executable names)" ); int pid = NOMAD::get_pid(); int seed = _p.get_seed(); std::string tmp_dir = _p.get_tmp_dir(); std::ostringstream oss; oss << "." << seed; if ( pid != seed ) oss << "." << pid; oss << "." << x.get_tag() << "."; const std::string & sint = oss.str(); // for the parallel version: no need to include the process rank in the names // as the point tags are unique for all the processes: each process creates // its own points and uses Eval_Point::set_tag() // blackbox input file writing: // ---------------------------- std::string bb_input_file_name = tmp_dir + NOMAD::BLACKBOX_INPUT_FILE_PREFIX + sint + NOMAD::BLACKBOX_INPUT_FILE_EXT; std::string bb_output_file_name = tmp_dir + NOMAD::BLACKBOX_OUTPUT_FILE_PREFIX + sint + NOMAD::BLACKBOX_OUTPUT_FILE_EXT; std::ofstream fout ( bb_input_file_name.c_str() ); if ( fout.fail() ) { std::string err = "could not create file blackbox input file " + bb_input_file_name + ". \n \n #### Please check that write permission are granted for the working directory. #### "; throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , err ); } // include seed: if ( _p.get_bb_input_include_seed() ) fout << seed << " "; // include tag: if ( _p.get_bb_input_include_tag() ) fout << x.get_tag() << " "; fout.setf ( std::ios::fixed ); fout.precision ( NOMAD::DISPLAY_PRECISION_BB ); x.Point::display ( fout , " " , -1 , -1 ); fout << std::endl; fout.close(); if ( fout.fail() ) return false; x.set_eval_status ( NOMAD::EVAL_IN_PROGRESS ); std::string cmd , bb_exe; std::ifstream fin; bool failed; NOMAD::Double d; int j , nbbok; int ibbo = 0; // system call to evaluate the blackbox: // ------------------------------------- size_t bn = _bb_exe.size(); for ( size_t k = 0 ; k < bn ; ++k ) { // executable name: bb_exe = ( sgte ) ? _sgte_exe[k] : _bb_exe[k]; // system command: cmd = bb_exe + " " + bb_input_file_name; // redirection ? if no, the blackbox has to create // the output file 'bb_output_file_name': if ( _p.get_bb_redirection() ) cmd += " > " + bb_output_file_name; #ifdef DEBUG #ifdef USE_MPI int rank; MPI_Comm_rank ( MPI_COMM_WORLD, &rank); _p.out() << "command(rank=" << rank << ") = \'" << cmd << "\'" << std::endl; #else _p.out() << "command=\'" << cmd << "\'" << std::endl; #endif #endif // the evaluation: { int signal = system ( cmd.c_str() ); // catch the ctrl-c signal: if ( signal == SIGINT ) raise ( SIGINT ); // other evaluation error: failed = ( signal != 0 ); count_eval = true; } // the evaluation failed (we stop the evaluations): if ( failed ) { x.set_eval_status ( NOMAD::EVAL_FAIL ); break; } // reading of the blackbox output file: // ------------------------------------ else { // bb-output file reading: fin.open ( bb_output_file_name.c_str() ); failed = false; bool is_defined = true; bool is_inf = false; // loop on the number of outputs for this blackbox: nbbok = _bb_nbo[k]; for ( j = 0 ; j < nbbok ; ++j ) { fin >> d; if ( !d.is_defined() ) { is_defined = false; break; } if ( fin.fail() ) { failed = true; break; } if ( d.value() >= NOMAD::INF ) { is_inf = true; break; } x.set_bb_output ( ibbo++ , d ); } fin.close(); // the evaluation failed: if ( failed || !is_defined || is_inf ) { x.set_eval_status ( NOMAD::EVAL_FAIL ); break; } // stop the evaluations if h > h_max or if a 'EB' constraint is violated: if ( k < _bb_exe.size() - 1 && interrupt_evaluations ( x , h_max ) ) break; } } if ( x.get_eval_status() == NOMAD::EVAL_IN_PROGRESS ) x.set_eval_status ( NOMAD::EVAL_OK ); // delete the blackbox input and output files: // ------------------------------------------- remove ( bb_input_file_name.c_str () ); remove ( bb_output_file_name.c_str() ); // check the CNT_EVAL output: // -------------------------- int index_cnt_eval = _p.get_index_cnt_eval(); if ( index_cnt_eval >= 0 && x.get_bb_outputs()[index_cnt_eval] == 0.0 ) count_eval = false; return x.is_eval_ok(); } /*-------------------------------------------------------------------*/ /* . evaluate the black boxes at a list of given Eval_Points */ /*-------------------------------------------------------------------*/ bool NOMAD::Evaluator::eval_x ( std::list<NOMAD::Eval_Point *> & list_eval, const NOMAD::Double & h_max , std::list<bool> & list_count_eval) const { std::list<NOMAD::Eval_Point *>::iterator it; std::list<NOMAD::Eval_Point *>::iterator it_begin=list_eval.begin(); std::list<NOMAD::Eval_Point *>::iterator it_end=list_eval.end(); std::list<bool>::iterator it_count=list_count_eval.begin(); if ( list_eval.size() !=list_count_eval.size()) throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , "Evaluator: inconsistent size of list" ); if ( _bb_exe.empty()) throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , "Evaluator: no BB_EXE is defined (blackbox executable names)" ); bool sgte = ((*it_begin)->get_eval_type() == NOMAD::SGTE); if ( sgte && _sgte_exe.empty() ) throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , "Evaluator: no SGTE_EXE is defined (surrogate executable names)" ); int pid = NOMAD::get_pid(); int seed = _p.get_seed(); std::string tmp_dir = _p.get_tmp_dir(); std::ostringstream oss; oss << "." << seed; if ( pid != seed ) oss << "." << pid; for (it=it_begin;it!=it_end;++it) { if (!(*it)->is_complete() ) throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , "Evaluator: points provided for evaluations are incomplete " ); } // add the tag of the first point oss << "." << (*it_begin)->get_tag(); oss << "." ; const std::string & sint = oss.str(); // for the parallel version: no need to include the process rank in the names // as the point tags are unique for all the processes: each process creates // its own points and uses Eval_Point::set_tag() // blackbox input file writing: // ---------------------------- std::string bb_input_file_name = tmp_dir + NOMAD::BLACKBOX_INPUT_FILE_PREFIX + sint + NOMAD::BLACKBOX_INPUT_FILE_EXT; std::string bb_output_file_name = tmp_dir + NOMAD::BLACKBOX_OUTPUT_FILE_PREFIX + sint + NOMAD::BLACKBOX_OUTPUT_FILE_EXT; std::ofstream fout ( bb_input_file_name.c_str() ); if ( fout.fail() ) { std::string err = "could not open file blackbox input file " + bb_input_file_name; throw NOMAD::Exception ( "Evaluator.cpp" , __LINE__ , err ); } for (it=it_begin;it!=it_end;++it) { // include seed: if ( _p.get_bb_input_include_seed() ) fout << seed << " "; // include tag: if ( _p.get_bb_input_include_tag() ) fout << (*it)->get_tag() << " "; fout.setf ( std::ios::fixed ); fout.precision ( NOMAD::DISPLAY_PRECISION_BB ); (*it)->Point::display ( fout , " " , -1 , -1 ); fout << std::endl; } fout.close(); if ( fout.fail() ) return false; for (it=it_begin;it!=it_end;++it) (*it)->set_eval_status ( NOMAD::EVAL_IN_PROGRESS ); std::string cmd , bb_exe; std::ifstream fin; bool failed; NOMAD::Double d; int j , nbbok; int ibbo = 0; // system call to evaluate the blackboxes: // ------------------------------------- size_t bn = _bb_exe.size(); for ( size_t k = 0 ; k < bn ; ++k ) { // executable name: bb_exe = ( sgte ) ? _sgte_exe[k] : _bb_exe[k]; // system command: cmd = bb_exe + " " + bb_input_file_name; // redirection ? if no, the blackbox has to create // the output file 'bb_output_file_name': if ( _p.get_bb_redirection() ) cmd += " > " + bb_output_file_name; // the evaluation: { int signal = system ( cmd.c_str() ); // catch the ctrl-c signal: if ( signal == SIGINT ) raise ( SIGINT ); // other evaluation error: failed = ( signal != 0 ); } // the evaluation failed (we stop the evaluations): if ( failed ) { it_count=list_count_eval.begin(); for (it=it_begin;it!=it_end;++it,++it_count) { (*it)->set_eval_status ( NOMAD::EVAL_FAIL ); (*it_count)=true; // } break; } // reading of the blackbox output file: // ------------------------------------ else { // bb-output file reading: fin.open ( bb_output_file_name.c_str() ); string s; bool is_defined,is_inf; bool list_all_failed_eval=true; bool list_all_interrupt=true; // loop on the points it_count=list_count_eval.begin(); for (it=it_begin;it!=it_end;++it,++it_count) { failed = false; is_defined = true; is_inf = false; // loop on the number of outputs for this blackbox: nbbok = _bb_nbo[k]; ibbo=0; for ( j = 0 ; j < nbbok ; ++j ) { fin >> s; if ( fin.fail() ) { failed = true; break; } toupper(s); if (s.compare("REJECT")==0) { *it_count=false; // Rejected points are not counted (*it)->set_eval_status(NOMAD::EVAL_USER_REJECT); break; } else { d.atof(s); (*it_count)=true; } // if (s.compare("FAIL")==0) { failed = true; break; } if ( !d.is_defined() ) { is_defined = false; break; } if ( d.value() >= NOMAD::INF ) { is_inf = true; break; } (*it)->set_bb_output ( ibbo++ , d ); } // the evaluation failed: if ( failed || !is_defined || is_inf ) { (*it)->set_eval_status ( NOMAD::EVAL_FAIL ); } else list_all_failed_eval=false; // stop the evaluations if h > h_max or if a 'EB' constraint is violated: if ( !( k < _bb_exe.size() - 1 && interrupt_evaluations ( *(*it) , h_max ) && list_all_interrupt )) list_all_interrupt=false; } fin.close(); if (list_all_failed_eval || list_all_interrupt) break; } } // delete the blackbox input and output files: // ------------------------------------------- remove ( bb_input_file_name.c_str () ); remove ( bb_output_file_name.c_str() ); bool at_least_one_eval_ok=false; int index_cnt_eval = _p.get_index_cnt_eval(); // update eval status and check that at least one was ok it_count=list_count_eval.begin(); for (it=it_begin;it!=it_end;++it,++it_count) { if ( (*it)->get_eval_status() == NOMAD::EVAL_IN_PROGRESS ) (*it)->set_eval_status ( NOMAD::EVAL_OK ); if (!at_least_one_eval_ok && (*it)->is_eval_ok()) at_least_one_eval_ok=true; // count_eval from bb_outputs: // -------------------------- if ( index_cnt_eval >= 0 && (*it)->get_bb_outputs()[index_cnt_eval]==0) *it_count=false; } return at_least_one_eval_ok; }
39.019277
193
0.377694
robfalck
7fa7d589086f017978ace85e09100b88d6502400
11,821
cxx
C++
admin/netui/common/src/lmobj/lmoenum/lmoefile.cxx
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
admin/netui/common/src/lmobj/lmoenum/lmoefile.cxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
admin/netui/common/src/lmobj/lmoenum/lmoefile.cxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
/**********************************************************************/ /** Microsoft LAN Manager **/ /** Copyright(c) Microsoft Corp., 1990, 1991 **/ /**********************************************************************/ /* lmoefile.cxx This file contains the class definitions for the FILE3_ENUM and FILE3_ENUM_ITER classes. FILE3_ENUM is an enumeration class used to enumerate the open resources on a particular server. FILE3_ENUM_ITER is an iterator used to iterate the open resources from the FILE3_ENUM class. FILE HISTORY: KeithMo 29-May-1991 Created for the Server Manager. KeithMo 13-Aug-1991 Cleanup. KeithMo 19-Aug-1991 Code review revisions (code review attended by ChuckC, Hui-LiCh, JimH, JonN, KevinL). KeithMo 07-Oct-1991 Win32 Conversion. JonN 30-Jan-1992 Split LOC_LM_RESUME_ENUM from LM_RESUME_ENUM */ #include "pchlmobj.hxx" // // These are the buffer sizes used when growing the enumeration // buffer. The buffer is initially SMALL_BUFFER_SIZE bytes long. // If this is insufficient for the enumeration, the buffer is // grown to LARGE_BUFFER_SIZE. // #define SMALL_BUFFER_SIZE ( 4 * 1024 ) #define LARGE_BUFFER_SIZE ( 16 * 1024 ) /******************************************************************* NAME: FILE_ENUM :: FILE_ENUM SYNOPSIS: FILE_ENUM class constructor. ENTRY: pszServerName - The name of the server to execute the enumeration on. NULL = execute locally. pszBasePath - The root directory for the enumeration. NULL = enumerate all open files. pszUserName - The name of the user to enumerate the files for. NULL = enumerate for all users. usLevel - The information level. EXIT: The object is constructed. RETURNS: No return value. NOTES: HISTORY: KeithMo 29-May-1991 Created for the Server Manager. KeithMo 13-Aug-1991 Cleanup. ********************************************************************/ FILE_ENUM :: FILE_ENUM( const TCHAR * pszServerName, const TCHAR * pszBasePath, const TCHAR * pszUserName, UINT uLevel ) : LOC_LM_RESUME_ENUM( pszServerName, uLevel ), _nlsBasePath( pszBasePath ), _nlsUserName( pszUserName ), _fBigBuffer( FALSE ) { // // Ensure everything constructed properly. // if( QueryError() != NERR_Success ) { return; } if( !_nlsBasePath ) { ReportError( _nlsBasePath.QueryError() ); return; } if( !_nlsUserName ) { ReportError( _nlsUserName.QueryError() ); return; } } // FILE_ENUM :: FILE_ENUM /******************************************************************* NAME: FILE_ENUM :: ~FILE_ENUM SYNOPSIS: FILE_ENUM class destructor. EXIT: The object is destroyed. HISTORY: KeithMo 11-Sep-1992 Created. ********************************************************************/ FILE_ENUM :: ~FILE_ENUM( VOID ) { NukeBuffers(); } // FILE_ENUM :: ~FILE_ENUM /******************************************************************* NAME: FILE_ENUM :: CallAPI SYNOPSIS: Invokes the enumeration API (NetFileEnum2()). ENTRY: fRestartEnum - Indicates whether to start at the beginning. The first call to CallAPI will always pass TRUE. ppbBuffer - Pointer to a pointer to the enumeration buffer. pcEntriesRead - Will receive the number of entries read from the API. EXIT: The enumeration API has been invoked. RETURNS: APIERR - Any errors encountered. NOTES: HISTORY: KeithMo 29-May-1991 Created for the Server Manager. KeithMo 13-Aug-1991 Cleanup. ********************************************************************/ APIERR FILE_ENUM :: CallAPI( BOOL fRestartEnum, BYTE ** ppbBuffer, UINT * pcEntriesRead ) { // // Restart the enumeration if fRestartEnum is TRUE // if ( fRestartEnum ) { FRK_INIT( _frk ); } // // Most LanMan API treat a NULL pointer the same as a // NULL string (pointer to '\0'). Unfortunately, // NetFileEnum2() does not work this way. If all files // opened by all users are to be enumerated, then // NULLs must be passed for the base path and user name. // However, a NULL passed to the NLS_STR constructor // will result in NLS_STR::QueryPch() returning an // empty string. // // To get around this behaviour, we must explicitly // convert empty strings to NULL pointers before // passing them to NetFileEnum2(). // const TCHAR * pszBasePath = _nlsBasePath.QueryPch(); const TCHAR * pszUserName = _nlsUserName.QueryPch(); UINT cTotalAvailable; APIERR err = ::MNetFileEnum( QueryServer(), ( *pszBasePath == TCH('\0') ) ? NULL : pszBasePath, ( *pszUserName == TCH('\0') ) ? NULL : pszUserName, QueryInfoLevel(), ppbBuffer, (_fBigBuffer) ? LARGE_BUFFER_SIZE : SMALL_BUFFER_SIZE, pcEntriesRead, &cTotalAvailable, &_frk ); // // At first, the enumeration API is attempted with // a small buffer. If the buffer is too small, we // pass this data back to the caller, then use a // larger buffer in future. // switch (err) { case NERR_BufTooSmall: case ERROR_MORE_DATA: _fBigBuffer = TRUE; // fall through case NERR_Success: default: break; } return err; } // FILE_ENUM :: CallAPI /******************************************************************* NAME: FILE_ENUM :: FreeBuffer SYNOPSIS: Frees the API buffer. ENTRY: ppbBuffer - Points to a pointer to the enumeration buffer. HISTORY: KeithMo 31-Mar-1992 Created. ********************************************************************/ VOID FILE_ENUM :: FreeBuffer( BYTE ** ppbBuffer ) { UIASSERT( ppbBuffer != NULL ); ::MNetApiBufferFree( ppbBuffer ); } // FILE_ENUM :: FreeBuffer /******************************************************************* NAME: FILE2_ENUM :: FILE2_ENUM SYNOPSIS: FILE2_ENUM class constructor. ENTRY: pszServerName - The name of the server to execute the enumeration on. NULL = execute locally. pszBasePath - The root directory for the enumeration. NULL = enumerate all open files. pszUserName - The name of the user to enumerate the files for. NULL = enumerate for all users. EXIT: The object is constructed. RETURNS: No return value. NOTES: HISTORY: KeithMo 29-May-1991 Created for the Server Manager. KeithMo 13-Aug-1991 Cleanup. ********************************************************************/ FILE2_ENUM :: FILE2_ENUM( const TCHAR * pszServerName, const TCHAR * pszBasePath, const TCHAR * pszUserName ) : FILE_ENUM( pszServerName, pszBasePath, pszUserName, 2 ) { // // This space intentionally left blank. // } // FILE2_ENUM :: FILE2_ENUM /******************************************************************* NAME: FILE2_ENUM_OBJ :: SetBufferPtr SYNOPSIS: Saves the buffer pointer for this enumeration object. ENTRY: pBuffer - Pointer to the new buffer. EXIT: The pointer has been saved. NOTES: Will eventually handle OemToAnsi conversions. HISTORY: KeithMo 09-Oct-1991 Created. ********************************************************************/ VOID FILE2_ENUM_OBJ :: SetBufferPtr( const struct file_info_2 * pBuffer ) { ENUM_OBJ_BASE :: SetBufferPtr( (const BYTE *)pBuffer ); } // FILE2_ENUM_OBJ :: SetBufferPtr DEFINE_LM_RESUME_ENUM_ITER_OF( FILE2, struct file_info_2 ); /******************************************************************* NAME: FILE3_ENUM :: FILE3_ENUM SYNOPSIS: FILE3_ENUM class constructor. ENTRY: pszServerName - The name of the server to execute the enumeration on. NULL = execute locally. pszBasePath - The root directory for the enumeration. NULL = enumerate all open files. pszUserName - The name of the user to enumerate the files for. NULL = enumerate for all users. EXIT: The object is constructed. RETURNS: No return value. NOTES: HISTORY: KeithMo 29-May-1991 Created for the Server Manager. KeithMo 13-Aug-1991 Cleanup. ********************************************************************/ FILE3_ENUM :: FILE3_ENUM( const TCHAR * pszServerName, const TCHAR * pszBasePath, const TCHAR * pszUserName ) : FILE_ENUM( pszServerName, pszBasePath, pszUserName, 3 ) { // // This space intentionally left blank. // } // FILE3_ENUM :: FILE3_ENUM /******************************************************************* NAME: FILE3_ENUM_OBJ :: SetBufferPtr SYNOPSIS: Saves the buffer pointer for this enumeration object. ENTRY: pBuffer - Pointer to the new buffer. EXIT: The pointer has been saved. NOTES: Will eventually handle OemToAnsi conversions. HISTORY: KeithMo 09-Oct-1991 Created. ********************************************************************/ VOID FILE3_ENUM_OBJ :: SetBufferPtr( const struct file_info_3 * pBuffer ) { ENUM_OBJ_BASE :: SetBufferPtr( (const BYTE *)pBuffer ); } // FILE3_ENUM_OBJ :: SetBufferPtr DEFINE_LM_RESUME_ENUM_ITER_OF( FILE3, struct file_info_3 );
31.606952
85
0.458083
npocmaka
7fa83bb617e528da05444fc8fffa76d25fafa057
2,521
hpp
C++
game_files/game_engine/game_engine.hpp
sakumo7/zpr
7b9cdbec1ff8d8179a96bb6e1e88f54ee84d138e
[ "MIT" ]
null
null
null
game_files/game_engine/game_engine.hpp
sakumo7/zpr
7b9cdbec1ff8d8179a96bb6e1e88f54ee84d138e
[ "MIT" ]
null
null
null
game_files/game_engine/game_engine.hpp
sakumo7/zpr
7b9cdbec1ff8d8179a96bb6e1e88f54ee84d138e
[ "MIT" ]
null
null
null
#ifndef GAME_ENGINE_HPP #define GAME_ENGINE_HPP #include "../typedefs.hpp" #include "../tcp/tcp.hpp" #include "../game_state/game_state.hpp" #include <string> #include <boost/regex.hpp> #include <iostream> #include <memory> #include <vector> #include <thread> #include <queue> /** * \class GameEngine * * Definicja klasy GameEngine, która jest instancją gry. * \author $Author: Michał Murawski, Marcin Brzykcy $ * * */ class GameEngine{ private: // wektor wskaźników na graczy GameState _gameState; //std::vector<player_ptr> _players; //stany gry enum state {WAIT_FOR_PLAYERS=0,WAIT_FOR_MOVE=1,COMPUTE_NEW_STATE=2,GAME_OVER=3}; //obecny stan gry state _currentState=WAIT_FOR_PLAYERS; //następny stan gry state _nxtState; public: std::string _name; //kolejka przetwarzanych danych przez instacje gry std::queue<std::string> _queue; //funkcja uruchamijąca wątek prztwarzania kolejki void run(); //funkcja zatrzymująca wątek przetwarzania kolejki void stop(); //wskaźnik na wątek przetwarzający kolejke std::thread *_thread = nullptr; //pole stanu przetwarzania kolejki bool _is_running=true; //funkcja wysyłająca komendy do graczy i serwera void sendCmd(std::string input); //funkcja uruchamijąca gre void start(); //fukcja przetwarzające dane w kolejce void processInput(std::string input); //funkcja usuwająca gracza z gry int removePlayer(const std::shared_ptr<tcp::tcp_client>& client); //funkcja dodająca gracza do gry void addPlayer( std::string name,const std::shared_ptr<tcp::tcp_client>& _client_ptr); std::vector<player_ptr> getPlayers(); /** * funkcja zwracająca stan gry * * \return liczba reperezentująca stan gry */ int state(); /** * Konstruktor klasy * * \param name Nazwa gry * \param nazwa gracza który utworzył gre * \param referencja na wskaźnik klienta tcp który utworzył gre * */ GameEngine(std::string _name,std::string _mastername,const std::shared_ptr<tcp::tcp_client>& master); /** * Destruktor klasy */ ~GameEngine(); protected: /** * Funkcja dołaczająca gracza do gry na podstawie stringa * \return odpowiedź gry */ std::string join(std::string _str); /** * Funkcja inicjalizująca gre * \return odpowiedź gry */ std::string gameInit(); /** * Funkcja obliczająca nowy stan gry */ void execute(); std::string playing(std::string _str); }; #endif //GAME_ENGINE_HPP
25.989691
105
0.689409
sakumo7
7fa9e7dbdab74bafeba3d270798ff3c6c1477ea1
6,212
cc
C++
src/pfs_core/pfs_trace.cc
qiuyuhang/PolarDB-FileSystem
a18067ef9294c2f509decd80b2b9231c9f950e21
[ "Apache-2.0" ]
35
2021-11-08T03:24:50.000Z
2022-03-24T12:39:12.000Z
src/pfs_core/pfs_trace.cc
qiuyuhang/PolarDB-FileSystem
a18067ef9294c2f509decd80b2b9231c9f950e21
[ "Apache-2.0" ]
2
2021-11-30T02:29:53.000Z
2022-03-17T06:57:53.000Z
src/pfs_core/pfs_trace.cc
qiuyuhang/PolarDB-FileSystem
a18067ef9294c2f509decd80b2b9231c9f950e21
[ "Apache-2.0" ]
18
2021-11-08T08:43:06.000Z
2022-02-28T09:38:09.000Z
/* * Copyright (c) 2017-2021, Alibaba Group Holding Limited * 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 <sys/stat.h> #include <sys/syscall.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <string.h> #include <time.h> #include <stdlib.h> #include "pfs_admin.h" #include "pfs_impl.h" #include "pfs_trace.h" //static int tracelvl_threshold = PFS_TRACE_ERROR; #define PFS_TRACE_LEN 1024 #define PFS_TRACE_NUM 16384 /* must be power of 2 */ typedef struct pfs_tracebuf { char tb_trace[PFS_TRACE_LEN]; } pfs_tracebuf_t; static pfs_tracebuf_t pfs_trace_buf[PFS_TRACE_NUM]; static uint64_t pfs_trace_idx = 0; char pfs_trace_pbdname[PFS_MAX_PBDLEN]; bool pfs_check_ival_trace_level(void *data) { int64_t integer_val = *(int64_t*)data; if ((integer_val != PFS_TRACE_OFF) && (integer_val != PFS_TRACE_ERROR) && (integer_val != PFS_TRACE_WARN) && (integer_val != PFS_TRACE_INFO) && (integer_val != PFS_TRACE_DBG) && (integer_val != PFS_TRACE_VERB)) return false; return true; } /* print level of trace */ int64_t trace_plevel = PFS_TRACE_INFO; PFS_OPTION_REG(trace_plevel, pfs_check_ival_trace_level); /* * Create a dummy tracectl to INIT trace sector. * Otherwise, if pfs_verbtrace() isn't called, trace sector may be not created * when compiling. */ static tracectl_t dummy_tracectl = { __FILE__, "dummy", __LINE__, PFS_TRACE_DBG, false, "dummy\n", }; static tracectl_t *dummy_tracectl_ptr DATA_SET_ATTR(_tracectl) = &dummy_tracectl; static inline const char * pfs_trace_levelname(int level) { switch (level) { case PFS_TRACE_ERROR: return "ERR"; case PFS_TRACE_WARN: return "WRN"; case PFS_TRACE_INFO: return "INF"; case PFS_TRACE_DBG: return "DBG"; default: return "UNKNOWN"; } return NULL; /* unreachable */ } /* * pfs_trace_redirect * * Redirect trace to log file. Before the redirection, log is * is printed on stderr tty. After redirection, stderr points * to the log file. */ void pfs_trace_redirect(const char *pbdname, int hostid) { int fd, nprint; char logfile[128]; nprint = snprintf(logfile, sizeof(logfile), "/var/log/pfs-%s.log", pbdname); if (nprint >= (int)sizeof(logfile)) { fprintf(stderr, "log file name too long, truncated as %s\n", logfile); return; } /* * Open the log file, redirect stderr to the log file, * and finally close the log file fd. stderr now is the * only user of the log file. */ fd = open(logfile, O_CREAT | O_WRONLY | O_APPEND, 0666); if (fd < 0) { fprintf(stderr, "cant open file %s\n", logfile); return; } if (dup2(fd, 2) < 0) { fprintf(stderr, "cant dup fd %d to stderr\n", fd); close(fd); fd = -1; return; } chmod(logfile, 0666); close(fd); pfs_itrace("host %d redirect trace to %s\n", hostid, logfile); } pfs_log_func_t *pfs_log_functor; void pfs_vtrace(int level, const char *fmt, ...) { static const char mon_name[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; struct timeval tv; struct tm tm; uint64_t ti; int len; char *buf; int errno_save = errno; va_list ap; ti = __atomic_fetch_add(&pfs_trace_idx, 1, __ATOMIC_ACQ_REL); ti = (ti & (PFS_TRACE_NUM - 1)); buf = pfs_trace_buf[ti].tb_trace; gettimeofday(&tv, NULL); localtime_r(&tv.tv_sec, &tm); len = snprintf(buf, PFS_TRACE_LEN, "[PFS_LOG] " "%.3s%3d %.2d:%.2d:%.2d.%06ld %s [%ld] ", mon_name[tm.tm_mon], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tv.tv_usec, pfs_trace_levelname(level), (long)syscall(SYS_gettid)); if (len < PFS_TRACE_LEN) { va_start(ap, fmt); vsnprintf(buf + len, PFS_TRACE_LEN - len, fmt, ap); va_end(ap); } if (pfs_log_functor != NULL) pfs_log_functor(buf); else fputs(buf, stderr); errno = errno_save; } static bool pfs_trace_match(tracectl_t *tc, const char *file, int line) { /* * File is not wildcard and doesn't match. */ if (strcmp(file, "*") != 0 && strcmp(file, tc->tc_file) != 0) return false; /* * Line is not wildcard and doesn't match. */ if (line && line != tc->tc_line) return false; return true; } int pfs_trace_list(const char *file, int line, admin_buf_t *ab) { DATA_SET_DECL(tracectl, _tracectl); tracectl_t **tcp, *tc; int n; /* * Walk through the tracectl set to show the trace point * with corresponding line & file */ n = pfs_adminbuf_printf(ab, "function\t\tfile\t\tline\t\tlevel\n"); if (n < 0) return n; DATA_SET_FOREACH(tcp, _tracectl) { tc = *tcp; if (!pfs_trace_match(tc, file, line)) continue; n = pfs_adminbuf_printf(ab, "%-26s\t%-20s\t%-6d\t%-3d\t%c\t%s", tc->tc_func, tc->tc_file, tc->tc_line, tc->tc_level, tc->tc_enable ? 'y' : '-', tc->tc_format); if (n < 0) return n; } return 0; } int pfs_trace_set(const char *file, int line, bool enable, admin_buf_t *ab) { DATA_SET_DECL(tracectl, _tracectl); tracectl_t **tcp, *tc; int n; DATA_SET_FOREACH(tcp, _tracectl) { tc = *tcp; if (!pfs_trace_match(tc, file, line)) continue; tc->tc_enable = enable; } n = pfs_adminbuf_printf(ab, "succeeded\n"); return n < 0 ? n : 0; } int pfs_trace_handle(int sock, msg_header_t *mh, msg_trace_t *tr) { int err; admin_buf_t *ab; ab = pfs_adminbuf_create(sock, mh->mh_type, mh->mh_op + 1, 32 << 10); if (ab == NULL) { ERR_RETVAL(ENOMEM); } switch (mh->mh_op) { case TRACE_LIST_REQ: err = pfs_trace_list(tr->tr_file, tr->tr_line, ab); break; case TRACE_SET_REQ: err = pfs_trace_set(tr->tr_file, tr->tr_line, tr->tr_enable, ab); break; default: err = -1; break; } pfs_adminbuf_destroy(ab, err); return err; }
22.754579
81
0.678042
qiuyuhang
7faca1396aa5321b9fa33aea232d82d5593a73c0
1,258
cpp
C++
UVaOnlineJudge/Problem_Set_Volumes_(100...1999)/Volume4(400-499)/495/code.cpp
luiscbr92/algorithmic-challenges
bc35729e54e4284e9ade1aa61b51a1c2d72aa62c
[ "MIT" ]
3
2015-10-21T18:56:43.000Z
2017-06-06T10:44:22.000Z
UVaOnlineJudge/Problem_Set_Volumes_(100...1999)/Volume4(400-499)/495/code.cpp
luiscbr92/algorithmic-challenges
bc35729e54e4284e9ade1aa61b51a1c2d72aa62c
[ "MIT" ]
null
null
null
UVaOnlineJudge/Problem_Set_Volumes_(100...1999)/Volume4(400-499)/495/code.cpp
luiscbr92/algorithmic-challenges
bc35729e54e4284e9ade1aa61b51a1c2d72aa62c
[ "MIT" ]
null
null
null
#include <iostream> #include <string> #include <vector> using namespace std; string sum(string a, string b){ string result = ""; int carry_over = 0; int index_a = a.size() -1; int index_b = b.size() -1; int a_digit, b_digit, amount; while(index_a > -1 || index_b > -1 || carry_over != 0){ a_digit = 0; if(index_a > -1) a_digit += int(a[index_a]) - 48; b_digit = 0; if(index_b > -1) b_digit += int(b[index_b]) - 48; amount = a_digit + b_digit + carry_over; if(amount > 9){ carry_over = 1; amount -= 10; } else carry_over = 0; result = char(amount+48) + result; index_a--; index_b--; } return result; } int main(){ ios_base::sync_with_stdio (false); int input; vector<string> fibonacci; fibonacci.push_back("0"); fibonacci.push_back("1"); int fibonacci_length = 2; while(fibonacci_length < 5001){ fibonacci.push_back(sum(fibonacci.at(fibonacci_length-1), fibonacci.at(fibonacci_length-2))); fibonacci_length++; } while(cin >> input){ cout << "The Fibonacci number for " << input << " is " << fibonacci.at(input) << "\n"; } return 0; }
22.070175
101
0.558029
luiscbr92
7facbde9579211d221d0cdc34e7d6e5ffb7bad3e
657
cpp
C++
Quicksort.cpp
amitsat27/hacktoberfest2021-1
8b11a7f64cab279cda0e13f55853f260b1f24987
[ "CC0-1.0" ]
null
null
null
Quicksort.cpp
amitsat27/hacktoberfest2021-1
8b11a7f64cab279cda0e13f55853f260b1f24987
[ "CC0-1.0" ]
null
null
null
Quicksort.cpp
amitsat27/hacktoberfest2021-1
8b11a7f64cab279cda0e13f55853f260b1f24987
[ "CC0-1.0" ]
null
null
null
//QUICK SORT #include<bits/stdc++.h> using namespace std; int partition(int arr[], int l,int r){ int pivot=arr[r]; int i=l-1; for(int j=l;j<r;j++){ if(arr[j]<pivot){ i++;swap(arr[i],arr[j]); } } swap(arr[i+1],arr[r]); return i+1; } void quicksort(int arr[],int l,int r){ if(l<r){ int pi=partition(arr,l,r); quicksort(arr,l,pi-1); quicksort(arr,pi+1,r); } } int main(){ int n;cin>>n; int arr[n]; for(int i=0;i<n;i++)cin>>arr[i]; quicksort(arr,0,n-1); for(int i=0;i<n;i++)cout<<arr[i]<<endl; return 0; }
16.846154
43
0.47032
amitsat27
7faf0bfb64bf4e2f2422a99384185fd5e742d635
8,071
hpp
C++
src/buffer_cache/blob.hpp
zadcha/rethinkdb
bb4f5cc28242dc1e29e9a46a8a931ec54420070c
[ "Apache-2.0" ]
21,684
2015-01-01T03:42:20.000Z
2022-03-30T13:32:44.000Z
src/buffer_cache/blob.hpp
RethonkDB/rethonkdb
8c9c1ddc71b1b891fdb8aad7ca5891fc036b80ee
[ "Apache-2.0" ]
4,067
2015-01-01T00:04:51.000Z
2022-03-30T13:42:56.000Z
src/buffer_cache/blob.hpp
RethonkDB/rethonkdb
8c9c1ddc71b1b891fdb8aad7ca5891fc036b80ee
[ "Apache-2.0" ]
1,901
2015-01-01T21:05:59.000Z
2022-03-21T08:14:25.000Z
// Copyright 2010-2014 RethinkDB, all rights reserved. #ifndef BUFFER_CACHE_BLOB_HPP_ #define BUFFER_CACHE_BLOB_HPP_ #include <stdint.h> #include <stddef.h> #include <string> #include <vector> #include <utility> #include "buffer_cache/types.hpp" #include "concurrency/access.hpp" #include "containers/buffer_group.hpp" #include "errors.hpp" #include "serializer/types.hpp" class buffer_group_t; /* An explanation of blobs. If we want to store values larger than 250 bytes (or some arbitrary inline value size limit), we must split them into large numbers of blocks. Some kind of tree structure is used. The blob_t type handles both kinds of values. Here's how it's used. const int mrl = 251; std::string x = ...; // value_in_leafnode does not point to a buffer that has 251 bytes you can use. char *ref = get_blob_ref_from_something(); // Create a buffer of the maxreflen char tmp[mrl]; memcpy(tmp, ref, blob::ref_size(bs, ref, mrl)); { blob_t b(tmp, mrl); int64_t old_size = b.valuesize(); tmp.append_region(leafnode, x.size()); { // group holds pointers to buffers. acq maintains the buf_lock_t // ownership itself. You cannot use group outside the // lifetime of acq. blob_acq_t acq; buffer_group_t group; tmp.expose_region(leafnode, access_t::write, old_size, x.size(), &group, &acq); // There are better ways to shovel data into a buffer group if it's not // already in a string -- please avoid excessive copying! copy_string_to_buffer_group(&group, x); } } // The ref size changed because we modified the blob. write_blob_ref_to_something(tmp, blob::ref_size(bs, ref, mrl)); */ class buf_lock_t; class buf_parent_t; class buf_read_t; class buf_write_t; // Represents an acquisition of buffers owned by the blob. class blob_acq_t { public: blob_acq_t() { } ~blob_acq_t(); void add_buf(buf_lock_t *buf, buf_write_t *write) { bufs_.push_back(buf); writes_.push_back(write); } void add_buf(buf_lock_t *buf, buf_read_t *read) { bufs_.push_back(buf); reads_.push_back(read); } private: std::vector<buf_lock_t *> bufs_; // One of writes_ or reads_ will be empty. std::vector<buf_write_t *> writes_; std::vector<buf_read_t *> reads_; // disable copying blob_acq_t(const blob_acq_t&); void operator=(const blob_acq_t&); }; union temporary_acq_tree_node_t; namespace blob { struct traverse_helper_t; // Returns the number of bytes actually used by the blob reference. // Returns a value in the range [1, maxreflen]. int ref_size(max_block_size_t block_size, const char *ref, int maxreflen); // Returns true if the size of the blob reference is less than or // equal to data_length, only reading memory in the range [ref, ref + // data_length). bool ref_fits(max_block_size_t block_size, int data_length, const char *ref, int maxreflen); // Returns what the maxreflen would be, given the desired number of // block ids in the blob ref. int maxreflen_from_blockid_count(int count); // The step size of a blob. int64_t stepsize(max_block_size_t block_size, int levels); // The internal node block ids of an internal node. const block_id_t *internal_node_block_ids(const void *buf); // Returns offset and size, clamped to and relative to the index'th subtree. void shrink(max_block_size_t block_size, int levels, int64_t offset, int64_t size, int index, int64_t *suboffset_out, int64_t *subsize_out); // The maxreflen value (allegedly) appropriate for use with rdb_protocol btrees. // It's 251. This should be renamed. extern int btree_maxreflen; // The size of a blob, equivalent to blob_t(ref, maxreflen).valuesize(). int64_t value_size(const char *ref, int maxreflen); struct ref_info_t { // The ref_size of a ref. int refsize; // the number of levels in the underlying tree of buffers. int levels; }; ref_info_t ref_info(max_block_size_t block_size, const char *ref, int maxreflen); // Returns the internal block ids of a non-inlined blob ref. const block_id_t *block_ids(const char *ref, int maxreflen); // Returns the char bytes of a leaf node. const char *leaf_node_data(const void *buf); } // namespace blob class blob_t { public: // This is a really confusing api. In order for this to create a // new blob you need to manually bzero ref. Otherwise, it will // interpret the garbage data as a valid ref. // If you're going to modify the blob, ref must be a pointer to an // array of length maxreflen. If you're going to use the blob // in-place, it does not need to be so. (For example, blob refs // in leaf nodes usually take much less space -- the average size // for a large blob would be half the space (or less, thanks to // Benford's law), and the size for a small blob is 1 plus the // size of the blob, or maybe 2 plus the size of the blob. blob_t(max_block_size_t block_size, char *ref, int maxreflen); // Returns ref_size(block_size, ref, maxreflen), the number of // bytes actually used in the blob ref. A value in the internal // [1, maxreflen_]. int refsize(max_block_size_t block_size) const; // Returns the actual size of the value, some number >= 0 and less // than one gazillion. int64_t valuesize() const; // Detaches the blob's subtrees from the root node (see // buf_lock_t::detach_child). void detach_subtrees(buf_parent_t root); // Acquires internal buffers and copies pointers to internal // buffers to the buffer_group_t, initializing acq_group_out so // that it holds the acquisition of such buffers. acq_group_out // must not be destroyed until the buffers are finished being // used. If you want to expose the region in a _readonly_ // fashion, use a const_cast! I am so sorry. void expose_region(buf_parent_t root, access_t mode, int64_t offset, int64_t size, buffer_group_t *buffer_group_out, blob_acq_t *acq_group_out); void expose_all(buf_parent_t root, access_t mode, buffer_group_t *buffer_group_out, blob_acq_t *acq_group_out); // Appends size bytes of garbage data to the blob. void append_region(buf_parent_t root, int64_t size); // Removes size bytes of data from the end of the blob. size must // be <= valuesize(). void unappend_region(buf_parent_t root, int64_t size); // Empties the blob, making its valuesize() be zero. Equivalent to // unappend_region(txn, valuesize()). In particular, you can be sure that the // blob holds no internal blocks, once it has been cleared. void clear(buf_parent_t root); // Writes over the portion of the blob, starting at offset, with // the contents of the string val. Caller is responsible for making // sure this portion of the blob exists void write_from_string(const std::string &val, buf_parent_t root, int64_t offset); private: bool traverse_to_dimensions(buf_parent_t parent, int levels, int64_t smaller_size, int64_t bigger_size, blob::traverse_helper_t *helper); bool allocate_to_dimensions(buf_parent_t parent, int levels, int64_t new_size); bool shift_at_least(buf_parent_t parent, int levels, int64_t min_shift); void consider_big_shift(buf_parent_t parent, int levels, int64_t *min_shift); void consider_small_shift(buf_parent_t parent, int levels, int64_t *min_shift); void deallocate_to_dimensions(buf_parent_t parent, int levels, int64_t new_size); int add_level(buf_parent_t parent, int levels); bool remove_level(buf_parent_t parent, int *levels_ref); char *ref_; int maxreflen_; DISABLE_COPYING(blob_t); }; #endif // BUFFER_CACHE_BLOB_HPP_
35.244541
140
0.692355
zadcha
7fb0d676f768bd4ac6ea7241c2a910be474f5a4a
12,144
cpp
C++
subsetting_strategies.cpp
mikemag/Mastermind
d32a4bbe62600a3dc257b6b692df64f2afbc8575
[ "MIT" ]
null
null
null
subsetting_strategies.cpp
mikemag/Mastermind
d32a4bbe62600a3dc257b6b692df64f2afbc8575
[ "MIT" ]
null
null
null
subsetting_strategies.cpp
mikemag/Mastermind
d32a4bbe62600a3dc257b6b692df64f2afbc8575
[ "MIT" ]
null
null
null
// Copyright (c) Michael M. Magruder (https://github.com/mikemag) // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. #include "utils.hpp" using namespace std; // -------------------------------------------------------------------------------------------------------------------- // Base for all subsetting strategies template <uint8_t p, uint8_t c, bool log> Codeword<p, c> StrategySubsetting<p, c, log>::selectNextGuess() { // Add the last guess from the list of used codewords. usedCodewords = savedUsedCodewords; usedCodewords.emplace_back(this->guess.packedCodeword()); Codeword<p, c> bestGuess; size_t bestScore = 0; bool bestIsPossibleSolution = false; int allCount = 0; // For metrics only for (const auto &g : Codeword<p, c>::getAllCodewords()) { bool isPossibleSolution = false; for (const auto &ps : this->possibleSolutions) { Score r = g.score(ps); subsetSizes[r.result]++; if (r == Codeword<p, c>::winningScore) { isPossibleSolution = true; // Remember if this guess is in the set of possible solutions } } this->rootData->scoreCounterCPU += this->possibleSolutions.size(); if (this->rootData->enableSmallPSMetrics) allCount++; // Shortcut small sets. Note, we've already done this check for possible solutions. if (Strategy<p, c, log>::enableSmallPSShortcut && !isPossibleSolution && this->possibleSolutions.size() <= Strategy<p, c, log>::totalScores) { int subsetsCount = computeTotalSubsets(); if (subsetsCount == this->possibleSolutions.size()) { if (log) { cout << "Selecting fully discriminating guess: " << g << ", subsets: " << subsetsCount << endl; } fill(begin(subsetSizes), end(subsetSizes), 0); // Done implicitly in computeSubsetScore, which we're skipping ++this->rootData->smallPSInnerShortcuts; this->rootData->smallPSInnerScoresSkipped += (Codeword<p, c>::getAllCodewords().size() - allCount) * this->possibleSolutions.size(); return g; } ++this->rootData->smallPSInnerWasted; } size_t score = computeSubsetScore(); if (score > bestScore || (!bestIsPossibleSolution && isPossibleSolution && score == bestScore)) { if (find(usedCodewords.cbegin(), usedCodewords.cend(), g.packedCodeword()) != usedCodewords.end()) { continue; // Ignore codewords we've already used } bestScore = score; bestGuess = g; bestIsPossibleSolution = isPossibleSolution; } } if (log) { cout << "Selecting best guess: " << bestGuess << "\tscore: " << bestScore << endl; } return bestGuess; } template <uint8_t p, uint8_t c, bool log> int StrategySubsetting<p, c, log>::computeTotalSubsets() { int totalSubsets = 0; for (auto s : subsetSizes) { if (s > 0) { totalSubsets++; } } return totalSubsets; } // -------------------------------------------------------------------------------------------------------------------- // Base for all subsetting GPU strategies template <uint8_t p, uint8_t c, bool log> Codeword<p, c> StrategySubsettingGPU<p, c, log>::selectNextGuess() { // Cut off "small" work and just do it on the CPU. if (mode == CPU || (mode == Both && Codeword<p, c>::getAllCodewords().size() * this->possibleSolutions.size() < 4 * 1024)) { return StrategySubsetting<p, c, log>::selectNextGuess(); } // Add the last guess from the list of used codewords. this->usedCodewords = this->savedUsedCodewords; this->usedCodewords.emplace_back(this->guess.packedCodeword()); // Pull out the codewords and colors into individual arrays // TODO: if this were separated into these two arrays throughout the Strategy then we could use a target-optimized // memcpy to blit them into the buffers, which would be much faster. uint32_t *psw = gpuRootData->gpuInterface->getPossibleSolutionssBuffer(); unsigned __int128 *psc = gpuRootData->gpuInterface->getPossibleSolutionsColorsBuffer(); for (int i = 0; i < this->possibleSolutions.size(); i++) { psw[i] = this->possibleSolutions[i].packedCodeword(); psc[i] = this->possibleSolutions[i].packedColors8(); } gpuRootData->gpuInterface->setPossibleSolutionsCount((uint32_t)this->possibleSolutions.size()); gpuRootData->gpuInterface->sendComputeCommand(); gpuRootData->kernelsExecuted++; this->rootData->scoreCounterGPU += Codeword<p, c>::getAllCodewords().size() * this->possibleSolutions.size(); uint32_t *maxScoreCounts = gpuRootData->gpuInterface->getScores(); bool *remainingIsPossibleSolution = gpuRootData->gpuInterface->getRemainingIsPossibleSolution(); if (Strategy<p, c, log>::enableSmallPSShortcutGPU) { // Shortcut small sets with fully discriminating codewords. Certain versions of the GPU kernels look for these and // pass them back in a list of useful codewords per SIMD group. Running through the list in-order and taking the // first one gives the first lexically ordered option. uint32_t discriminatingCount = 0; uint32_t *smallOptsOut = gpuRootData->gpuInterface->getFullyDiscriminatingCodewords(discriminatingCount); for (int i = 0; i < discriminatingCount; i++) { if (smallOptsOut[i] > 0) { Codeword<p, c> g = Codeword<p, c>::getAllCodewords()[smallOptsOut[i]]; if (log) { cout << "Selecting fully discriminating guess from GPU: " << g << ", subsets: " << this->possibleSolutions.size() << ", isPossibleSolution: " << remainingIsPossibleSolution[smallOptsOut[i]] << ", small opts index: " << i << endl; } return g; } } } Codeword<p, c> bestGuess; size_t bestScore = 0; bool bestIsPossibleSolution = false; for (int i = 0; i < Codeword<p, c>::getAllCodewords().size(); i++) { size_t score = maxScoreCounts[i]; if (score > bestScore || (!bestIsPossibleSolution && remainingIsPossibleSolution[i] && score == bestScore)) { auto &codeword = Codeword<p, c>::getAllCodewords()[i]; if (find(this->usedCodewords.cbegin(), this->usedCodewords.cend(), codeword.packedCodeword()) != this->usedCodewords.end()) { continue; // Ignore codewords we've already used } bestScore = score; bestGuess = codeword; bestIsPossibleSolution = remainingIsPossibleSolution[i]; } } if (log) { cout << "Selecting best guess: " << bestGuess << "\tscore: " << bestScore << " (GPU)" << endl; } return bestGuess; } // This moves all the codewords into the correct device-private buffers just once, since it's a) read only and b) // quite large. template <uint8_t p, uint8_t c, bool l> void StrategySubsettingGPU<p, c, l>::copyAllCodewordsToGPU() { if (!gpuRootData->gpuInterface->gpuAvailable()) { return; } // Pull out the codewords and color into individual arrays uint32_t *acw = gpuRootData->gpuInterface->getAllCodewordsBuffer(); unsigned __int128 *acc = gpuRootData->gpuInterface->getAllCodewordsColorsBuffer(); for (int i = 0; i < Codeword<p, c>::getAllCodewords().size(); i++) { acw[i] = Codeword<p, c>::getAllCodewords()[i].packedCodeword(); acc[i] = Codeword<p, c>::getAllCodewords()[i].packedColors8(); } gpuRootData->gpuInterface->setAllCodewordsCount((uint32_t)Codeword<p, c>::getAllCodewords().size()); // This shoves both buffers over into GPU memory just once, where they remain constant after that. No need to touch // them again. gpuRootData->gpuInterface->syncAllCodewords((uint32_t)Codeword<p, c>::getAllCodewords().size()); } template <uint8_t p, uint8_t c, bool l> void StrategySubsettingGPU<p, c, l>::printStats(chrono::duration<float, milli> elapsedMS) { StrategySubsetting<p, c, l>::printStats(elapsedMS); if (mode != CPU && gpuRootData->gpuInterface->gpuAvailable()) { cout << "GPU kernels executed: " << commaString(gpuRootData->kernelsExecuted) << " FPS: " << commaString((float)gpuRootData->kernelsExecuted / (elapsedMS.count() / 1000.0)) << endl; } } template <uint8_t p, uint8_t c, bool l> void StrategySubsettingGPU<p, c, l>::recordStats(StatsRecorder &sr, std::chrono::duration<float, std::milli> elapsedMS) { StrategySubsetting<p, c, l>::recordStats(sr, elapsedMS); sr.add("GPU Mode", GPUModeNames[mode]); sr.add("GPU Kernels", gpuRootData->kernelsExecuted); sr.add("GPU FPS", (float)gpuRootData->kernelsExecuted / (elapsedMS.count() / 1000.0)); if (gpuRootData->gpuInterface && gpuRootData->gpuInterface->gpuAvailable()) { sr.add("GPU Name", gpuRootData->gpuInterface->getGPUName()); } } StrategySubsettingGPURootData::~StrategySubsettingGPURootData() { delete gpuInterface; gpuInterface = nullptr; } // -------------------------------------------------------------------------------------------------------------------- // Knuth template <uint8_t p, uint8_t c, bool l> size_t StrategyKnuth<p, c, l>::computeSubsetScore() { int largestSubsetSize = 0; // Maximum number of codewords that could be retained by using this guess for (auto &s : this->subsetSizes) { if (s > largestSubsetSize) { largestSubsetSize = s; } s = 0; } // Invert largestSubsetSize, and return the minimum number of codewords that could be eliminated by using this guess return this->possibleSolutions.size() - largestSubsetSize; } template <uint8_t p, uint8_t c, bool l> shared_ptr<Strategy<p, c, l>> StrategyKnuth<p, c, l>::createNewMove(Score r, Codeword<p, c> nextGuess) { auto next = make_shared<StrategyKnuth<p, c, l>>(*this, nextGuess, this->possibleSolutions, this->usedCodewords); next->mode = this->mode; return next; } // -------------------------------------------------------------------------------------------------------------------- // Most Parts template <uint8_t p, uint8_t c, bool l> size_t StrategyMostParts<p, c, l>::computeSubsetScore() { int totalUsedSubsets = 0; for (auto &s : this->subsetSizes) { if (s > 0) { totalUsedSubsets++; } s = 0; } return totalUsedSubsets; } template <uint8_t p, uint8_t c, bool l> shared_ptr<Strategy<p, c, l>> StrategyMostParts<p, c, l>::createNewMove(Score r, Codeword<p, c> nextGuess) { auto next = make_shared<StrategyMostParts<p, c, l>>(*this, nextGuess, this->possibleSolutions, this->usedCodewords); next->mode = this->mode; return next; } // -------------------------------------------------------------------------------------------------------------------- // Expected Size template <uint8_t p, uint8_t c, bool l> size_t StrategyExpectedSize<p, c, l>::computeSubsetScore() { double expectedSize = 0; for (auto &s : this->subsetSizes) { if (s > 0) { expectedSize += ((double)s * (double)s) / (double)this->possibleSolutions.size(); } s = 0; } return -round(expectedSize * 10'000'000'000'000'000.0); // 16 digits of precision } template <uint8_t p, uint8_t c, bool l> shared_ptr<Strategy<p, c, l>> StrategyExpectedSize<p, c, l>::createNewMove(Score r, Codeword<p, c> nextGuess) { auto next = make_shared<StrategyExpectedSize<p, c, l>>(*this, nextGuess, this->possibleSolutions, this->usedCodewords); next->mode = this->mode; return next; } // -------------------------------------------------------------------------------------------------------------------- // Entropy template <uint8_t p, uint8_t c, bool l> size_t StrategyEntropy<p, c, l>::computeSubsetScore() { double entropySum = 0.0; for (auto &s : this->subsetSizes) { if (s > 0) { double pi = (double)s / this->possibleSolutions.size(); entropySum -= pi * log(pi); } s = 0; } return round(entropySum * 10'000'000'000'000'000.0); // 16 digits of precision } template <uint8_t p, uint8_t c, bool l> shared_ptr<Strategy<p, c, l>> StrategyEntropy<p, c, l>::createNewMove(Score r, Codeword<p, c> nextGuess) { auto next = make_shared<StrategyEntropy<p, c, l>>(*this, nextGuess, this->possibleSolutions, this->usedCodewords); next->mode = this->mode; return next; }
40.888889
119
0.637846
mikemag
7fb1723734a07230a8438cc56927811004354647
677
hpp
C++
modules/sdk-core/include/Tanker/DbModels/ProvisionalUserKeys.hpp
TankerHQ/sdk-native
5d9eb7c2048fdefae230590a3110e583f08c2c49
[ "Apache-2.0" ]
19
2018-12-05T12:18:02.000Z
2021-07-13T07:33:22.000Z
modules/sdk-core/include/Tanker/DbModels/ProvisionalUserKeys.hpp
TankerHQ/sdk-native
5d9eb7c2048fdefae230590a3110e583f08c2c49
[ "Apache-2.0" ]
3
2020-03-16T15:52:06.000Z
2020-08-01T11:14:30.000Z
modules/sdk-core/include/Tanker/DbModels/ProvisionalUserKeys.hpp
TankerHQ/sdk-native
5d9eb7c2048fdefae230590a3110e583f08c2c49
[ "Apache-2.0" ]
3
2020-01-07T09:55:32.000Z
2020-08-01T01:29:28.000Z
#pragma once #include <sqlpp11/ppgen.h> #include <sqlpp11/sqlpp11.h> #include <Tanker/DataStore/Connection.hpp> namespace Tanker { namespace DbModels { // clang-format off SQLPP_DECLARE_TABLE( (provisional_user_keys) , (app_pub_sig_key , blob , SQLPP_PRIMARY_KEY) (tanker_pub_sig_key , blob , SQLPP_PRIMARY_KEY) (app_enc_pub , blob , SQLPP_NOT_NULL ) (app_enc_priv , blob , SQLPP_NOT_NULL ) (tanker_enc_pub , blob , SQLPP_NOT_NULL ) (tanker_enc_priv , blob , SQLPP_NOT_NULL ) ) // clang-format on namespace provisional_user_keys { void createTable(DataStore::Connection&, provisional_user_keys const& = {}); } } }
21.83871
76
0.701625
TankerHQ
7fb6379cb36d3266964954e61cbe62c202000f8b
3,889
hpp
C++
sol/state.hpp
a1ien/sol2
358c34e5e978524d7c0dbf3f69987f57dfb30da6
[ "MIT" ]
null
null
null
sol/state.hpp
a1ien/sol2
358c34e5e978524d7c0dbf3f69987f57dfb30da6
[ "MIT" ]
null
null
null
sol/state.hpp
a1ien/sol2
358c34e5e978524d7c0dbf3f69987f57dfb30da6
[ "MIT" ]
null
null
null
// sol2 // The MIT License (MIT) // Copyright (c) 2013-2017 Rapptz, ThePhD and contributors // 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 SOL_STATE_HPP #define SOL_STATE_HPP #include "state_view.hpp" #include "thread.hpp" namespace sol { namespace detail { inline int default_at_panic(lua_State* L) { #ifdef SOL_NO_EXCEPTIONS (void)L; return -1; #else size_t messagesize; const char* message = lua_tolstring(L, -1, &messagesize); if (message) { std::string err(message, messagesize); lua_settop(L, 0); throw error(err); } lua_settop(L, 0); throw error(std::string("An unexpected error occurred and forced the lua state to call atpanic")); #endif } inline int default_traceback_error_handler(lua_State* L) { using namespace sol; std::string msg = "An unknown error has triggered the default error handler"; optional<string_view> maybetopmsg = stack::check_get<string_view>(L, 1); if (maybetopmsg) { const string_view& topmsg = maybetopmsg.value(); msg.assign(topmsg.data(), topmsg.size()); } luaL_traceback(L, L, msg.c_str(), 1); optional<string_view> maybetraceback = stack::check_get<string_view>(L, -1); if (maybetraceback) { const string_view& traceback = maybetraceback.value(); msg.assign(traceback.data(), traceback.size()); } return stack::push(L, msg); } } // namespace detail class state : private std::unique_ptr<lua_State, detail::state_deleter>, public state_view { private: typedef std::unique_ptr<lua_State, detail::state_deleter> unique_base; public: state(lua_CFunction panic = detail::default_at_panic) : unique_base(luaL_newstate()), state_view(unique_base::get()) { set_panic(panic); lua_CFunction f = c_call<decltype(&detail::default_traceback_error_handler), &detail::default_traceback_error_handler>; protected_function::set_default_handler(object(lua_state(), in_place, f)); stack::register_main_thread(unique_base::get()); stack::luajit_exception_handler(unique_base::get()); } state(lua_CFunction panic, lua_Alloc alfunc, void* alpointer = nullptr) : unique_base(lua_newstate(alfunc, alpointer)), state_view(unique_base::get()) { set_panic(panic); lua_CFunction f = c_call<decltype(&detail::default_traceback_error_handler), &detail::default_traceback_error_handler>; protected_function::set_default_handler(object(lua_state(), in_place, f)); stack::register_main_thread(unique_base::get()); stack::luajit_exception_handler(unique_base::get()); } state(const state&) = delete; state(state&&) = default; state& operator=(const state&) = delete; state& operator=(state&& that) { state_view::operator=(std::move(that)); unique_base::operator=(std::move(that)); return *this; } using state_view::get; ~state() { } }; } // namespace sol #endif // SOL_STATE_HPP
36.009259
122
0.732322
a1ien
7fbadb2439d8fa21192433febe174d13f810249a
7,562
cpp
C++
RenderDrivers/GL/src/GLMaterial.cpp
katoun/kg_engine
fdcc6ec01b191d07cedf7a8d6c274166e25401a8
[ "Unlicense" ]
2
2015-04-21T05:36:12.000Z
2017-04-16T19:31:26.000Z
RenderDrivers/GL/src/GLMaterial.cpp
katoun/kg_engine
fdcc6ec01b191d07cedf7a8d6c274166e25401a8
[ "Unlicense" ]
null
null
null
RenderDrivers/GL/src/GLMaterial.cpp
katoun/kg_engine
fdcc6ec01b191d07cedf7a8d6c274166e25401a8
[ "Unlicense" ]
null
null
null
/* ----------------------------------------------------------------------------- KG game engine (http://katoun.github.com/kg_engine) is made available under the MIT License. Copyright (c) 2006-2013 Catalin Alexandru Nastase 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 <GLMaterial.h> #include <GLShader.h> #include <render/Shader.h> #include <resource/ResourceEvent.h> #define PARAMETER_NAME_BUFFERSIZE 255 namespace render { GLShaderParameter::GLShaderParameter(): ShaderParameter() { ParameterID = 0; } GLShaderVertexParameter::GLShaderVertexParameter(): ShaderVertexParameter() { ParameterID = 0; } GLMaterial::GLMaterial(const std::string& name, resource::Serializer* serializer): Material(name, serializer) { mGLHandle = 0; } GLMaterial::~GLMaterial() {} void GLMaterial::resourceLoaded(const resource::ResourceEvent& evt) { if (evt.source != nullptr) { if (evt.source == mVertexShader) { GLShader* pGLShader = static_cast<GLShader*>(mVertexShader); if (pGLShader != nullptr) { glAttachShader(mGLHandle, pGLShader->getGLHandle()); } } if (evt.source == mFragmentShader) { GLShader* pGLShader = static_cast<GLShader*>(mFragmentShader); if (pGLShader != nullptr) { glAttachShader(mGLHandle, pGLShader->getGLHandle()); } } if (evt.source == mGeometryShader) { GLShader* pGLShader = static_cast<GLShader*>(mGeometryShader); if (pGLShader != nullptr) { glAttachShader(mGLHandle, pGLShader->getGLHandle()); } } if (((mVertexShader == nullptr) || (mVertexShader != nullptr && mVertexShader->getState() == resource::RESOURCE_STATE_LOADED)) && ((mFragmentShader == nullptr) || (mFragmentShader != nullptr && mFragmentShader->getState() == resource::RESOURCE_STATE_LOADED)) && ((mGeometryShader == nullptr) || (mGeometryShader != nullptr && mGeometryShader->getState() == resource::RESOURCE_STATE_LOADED))) { GLint linked; glLinkProgram(mGLHandle); glGetProgramiv(mGLHandle, GL_LINK_STATUS, &linked); if (linked == 1) { char uniformName[PARAMETER_NAME_BUFFERSIZE]; GLenum type; GLint size; GLint count; glGetProgramiv(mGLHandle, GL_ACTIVE_UNIFORMS, &count); for (GLint idx=0; idx<count; idx++) { glGetActiveUniform(mGLHandle, idx, PARAMETER_NAME_BUFFERSIZE, NULL, &size, &type, uniformName); if (type != GL_SAMPLER_1D && type != GL_SAMPLER_2D && type != GL_SAMPLER_3D) continue; ShaderParameterType paramType = SHADER_PARAMETER_TYPE_UNKNOWN; switch (type) { case GL_SAMPLER_1D: paramType = SHADER_PARAMETER_TYPE_SAMPLER1D; break; case GL_SAMPLER_2D: paramType = SHADER_PARAMETER_TYPE_SAMPLER2D; break; case GL_SAMPLER_3D: paramType = SHADER_PARAMETER_TYPE_SAMPLER3D; break; } addTextureParameter(std::string(uniformName), paramType); } ////////////////////////////////// for (unsigned int i = 0; i < mVertexParameters.size(); i++) { GLShaderVertexParameter* pGLShaderVertexParameter = static_cast<GLShaderVertexParameter*>(mVertexParameters[i]); if (pGLShaderVertexParameter == nullptr) continue; pGLShaderVertexParameter->ParameterID = glGetAttribLocation(mGLHandle, pGLShaderVertexParameter->mName.c_str()); } hashmap<std::string, ShaderParameter*>::iterator pi; for (pi = mParameters.begin(); pi != mParameters.end(); ++pi) { GLShaderParameter* pGLShaderParameter = static_cast<GLShaderParameter*>(pi->second); if (pGLShaderParameter == nullptr) continue; pGLShaderParameter->ParameterID = glGetUniformLocation(mGLHandle, pi->first.c_str()); } ////////////////////////////////// } } } } void GLMaterial::resourceUnloaded(const resource::ResourceEvent& evt) {} GLhandleARB GLMaterial::getGLHandle() const { return mGLHandle; } bool GLMaterial::loadImpl() { if (!Material::loadImpl()) return false; mGLHandle = glCreateProgram(); return true; } void GLMaterial::unloadImpl() { glDeleteProgram(mGLHandle); } ShaderVertexParameter* GLMaterial::createVertexParameterImpl() { return new GLShaderVertexParameter(); } ShaderParameter* GLMaterial::createParameterImpl() { return new GLShaderParameter(); } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const Color& col) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniform4f(glParam->ParameterID, col.r, col.g, col.b, col.a); } } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const core::vector2d& vec) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniform2f(glParam->ParameterID, vec.x, vec.y); } } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const core::vector3d& vec) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniform3f(glParam->ParameterID, vec.x, vec.y, vec.z); } } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const core::vector4d& vec) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniform4f(glParam->ParameterID, vec.x, vec.y, vec.z, vec.w); } } void GLMaterial::setParameterImpl(ShaderParameter* parameter, const core::matrix4& m) { GLShaderParameter* glParam = static_cast<GLShaderParameter*>(parameter); if (glParam != nullptr) { glUniformMatrix4fv(glParam->ParameterID, 1, GL_TRUE/*GL_FALSE*/, m.get()); } } GLenum GLMaterial::getGLType(ShaderParameterType type) { switch(type) { case SHADER_PARAMETER_TYPE_FLOAT: return GL_FLOAT; case SHADER_PARAMETER_TYPE_FLOAT2: return GL_FLOAT_VEC2; case SHADER_PARAMETER_TYPE_FLOAT3: return GL_FLOAT_VEC3; case SHADER_PARAMETER_TYPE_FLOAT4: return GL_FLOAT_VEC4; case SHADER_PARAMETER_TYPE_INT: return GL_INT; case SHADER_PARAMETER_TYPE_INT2: return GL_INT_VEC2; case SHADER_PARAMETER_TYPE_INT3: return GL_INT_VEC3; case SHADER_PARAMETER_TYPE_INT4: return GL_INT_VEC4; case SHADER_PARAMETER_TYPE_MATRIX2: return GL_FLOAT_MAT2; case SHADER_PARAMETER_TYPE_MATRIX3: return GL_FLOAT_MAT3; case SHADER_PARAMETER_TYPE_MATRIX4: return GL_FLOAT_MAT4; case SHADER_PARAMETER_TYPE_SAMPLER1D: return GL_SAMPLER_1D; case SHADER_PARAMETER_TYPE_SAMPLER2D: return GL_SAMPLER_2D; case SHADER_PARAMETER_TYPE_SAMPLER3D: return GL_SAMPLER_3D; default: return 0; } } } //namespace render
28.535849
134
0.720709
katoun
7fc764fc3925bb75b0599800665eb75bbb34afe0
3,374
cpp
C++
Source/Driver/API/SQLSetEnvAttr.cpp
yichenghuang/bigobject-odbc
c6d947ea3d18d79684adfbac1c492282a075d48d
[ "MIT" ]
null
null
null
Source/Driver/API/SQLSetEnvAttr.cpp
yichenghuang/bigobject-odbc
c6d947ea3d18d79684adfbac1c492282a075d48d
[ "MIT" ]
null
null
null
Source/Driver/API/SQLSetEnvAttr.cpp
yichenghuang/bigobject-odbc
c6d947ea3d18d79684adfbac1c492282a075d48d
[ "MIT" ]
null
null
null
/* * ---------------------------------------------------------------------------- * Copyright (c) 2014-2015 BigObject Inc. * All Rights Reserved. * * Use of, copying, modifications to, and distribution of this software * and its documentation without BigObject's written permission can * result in the violation of U.S., Taiwan and China Copyright and Patent laws. * Violators will be prosecuted to the highest extent of the applicable laws. * * BIGOBJECT MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. * ---------------------------------------------------------------------------- */ #include "Driver.hpp" /* https://msdn.microsoft.com/en-us/library/ms709285%28v=vs.85%29.aspx Example calls: CLR (Demo/CSharp/Shell.exe): SQLSetEnvAttr(0x007c6298, 200, 0x00000003, -6) SQL_SUCCESS SQLSetEnvAttr(0x007c6298, 201, 0x00000002, -6) SQL_SUCCESS */ SQLRETURN SQL_API SQLSetEnvAttr( SQLHENV EnvironmentHandle, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTEGER StringLength) { HDRVENV hEnv = (HDRVENV)EnvironmentHandle; SQLINTEGER val; LOG_DEBUG_F_FUNC( TEXT("%s: EnvironmentHandle = 0x%08lX, Attribute = %d, ") TEXT("Value = 0x%08lX, StringLength = %d"), LOG_FUNCTION_NAME, (long)EnvironmentHandle, Attribute, (long)Value, StringLength); /* SANITY CHECKS */ ODBCAPIHelper helper(hEnv, SQL_HANDLE_ENV); if(!helper.IsValid()) return SQL_INVALID_HANDLE; helper.Lock(); API_HOOK_ENTRY(SQLSetEnvAttr, EnvironmentHandle, Attribute, Value, StringLength); /* These cases permit null env handles */ /* We may do something with these later */ if(!hEnv && (Attribute == SQL_ATTR_CONNECTION_POOLING || Attribute == SQL_ATTR_CP_MATCH)) { goto __SQLSetEnvAttr_End; } switch(Attribute) { case SQL_ATTR_CONNECTION_POOLING: LOG_DEBUG_F_FUNC(TEXT("Setting SQL_ATTR_CONNECTION_POOLING: Value=%u"), (SQLUINTEGER)((std::size_t)Value)); hEnv->hEnvExtras->attrConnPooling = (SQLINTEGER)((std::size_t)Value); break; case SQL_ATTR_CP_MATCH: LOG_DEBUG_F_FUNC(TEXT("Setting SQL_ATTR_CP_MATCH: Value=%u"), (SQLUINTEGER)((std::size_t)Value)); hEnv->hEnvExtras->attrCPMatch = (SQLINTEGER)((std::size_t)Value); break; case SQL_ATTR_ODBC_VERSION: LOG_DEBUG_F_FUNC(TEXT("Setting SQL_ATTR_ODBC_VERSION: Value=%d"), (SQLUINTEGER)((std::size_t)Value)); val = (SQLINTEGER)((std::size_t)Value); if(val != SQL_OV_ODBC2 && val != SQL_OV_ODBC3) { #if (ODBCVER >= 0x0380) if(val != SQL_OV_ODBC3_80) #endif LOG_WARN_F_FUNC(TEXT("Unrecognized ODBC version=%d"), val); } hEnv->hEnvExtras->attrODBCVersion = (SQLINTEGER)((std::size_t)Value); break; case SQL_ATTR_OUTPUT_NTS: LOG_DEBUG_F_FUNC(TEXT("Setting SQL_ATTR_OUTPUT_NTS: Value=%d"), (SQLUINTEGER)((std::size_t)Value)); hEnv->hEnvExtras->attrOutputNTS = (SQLINTEGER)((std::size_t)Value); break; default: LOG_ERROR_F_FUNC( TEXT("Setting Invalid Environment Attribute=%d"), Attribute); API_HOOK_RETURN(SQL_ERROR); } __SQLSetEnvAttr_End: LOG_DEBUG_F_FUNC(TEXT("%s: SQL_SUCCESS"), LOG_FUNCTION_NAME); API_HOOK_RETURN(SQL_SUCCESS); }
30.125
79
0.681387
yichenghuang
7fca7b67177c2caceae05b66056875ec0885b75e
2,148
hxx
C++
Legolas/Algorithm/ATLASDenseMatrixVectorProduct.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Algorithm/ATLASDenseMatrixVectorProduct.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Algorithm/ATLASDenseMatrixVectorProduct.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
1
2021-02-11T14:43:25.000Z
2021-02-11T14:43:25.000Z
/** * project DESCARTES * * @file ATLASDenseMatrixVectorProduct.hxx * * @author Laurent PLAGNE * @date june 2004 - january 2005 * * @par Modifications * - author date object * * (c) Copyright EDF R&D - CEA 2001-2005 */ #ifndef __LEGOLAS_ATLASDENSEMATRIXVECTORPRODUCT_HXX__ #define __LEGOLAS_ATLASDENSEMATRIXVECTORPRODUCT_HXX__ #include <vector> #include "Legolas/Algorithm/SparseMatrixVectorProduct.hxx" #ifdef GLASS_USE_ATLAS namespace Legolas{ #include "UTILITES.hxx" #include "Legolas/Algorithm/CBlasGemvTraits.hxx" class ATLASDenseMatrixVectorProduct{ public: template <class ASSIGN_MODE> class Engine{ public: template <class MATRIX,class VECTOR, class VECTOR_INOUT> static inline void apply(const MATRIX & A , const VECTOR & X , VECTOR_INOUT & Y) { int N=X.size(); typedef typename MATRIX::RealType RealType; const RealType * AData = A.getDataReference().matrix().getPointer(); const RealType * XData = X.getDataReference().getPointer(); RealType * YData = Y.getDataReference().getPointer(); RealType a=ASSIGN_MODE::alpha(); RealType b=ASSIGN_MODE::beta(); gemvTraits<RealType>::apply(CblasRowMajor,CblasNoTrans,N,N,a,AData,N,XData,1,b,YData,1); } }; class Transpose{ public: template <class ASSIGN_MODE> class Engine{ public: template <class MATRIX,class VECTOR, class VECTOR_INOUT> static inline void apply(const MATRIX & A , const VECTOR & X , VECTOR_INOUT & Y) { int N=X.size(); typedef typename MATRIX::RealType RealType; const RealType * AData = A.getDataReference().matrix().getPointer(); const RealType * XData = X.getDataReference().getPointer(); RealType * YData = Y.getDataReference().getPointer(); RealType a=ASSIGN_MODE::alpha(); RealType b=ASSIGN_MODE::beta(); gemvTraits<RealType>::apply(CblasRowMajor,CblasTrans,N,N,a,AData,N,XData,1,b,YData,1); } }; }; }; } #else namespace Legolas{ typedef SparseMatrixVectorProduct ATLASDenseMatrixVectorProduct; } #endif // GLASS_USE_ATLAS #endif
20.653846
89
0.684823
LaurentPlagne
7fcc2a0db0e38216a3a5ccef9bf3ea085aa562e7
620
cpp
C++
ACM-ICPC/16288.cpp
KimBoWoon/ACM-ICPC
146c36999488af9234d73f7b4b0c10d78486604f
[ "MIT" ]
null
null
null
ACM-ICPC/16288.cpp
KimBoWoon/ACM-ICPC
146c36999488af9234d73f7b4b0c10d78486604f
[ "MIT" ]
null
null
null
ACM-ICPC/16288.cpp
KimBoWoon/ACM-ICPC
146c36999488af9234d73f7b4b0c10d78486604f
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int person[101]; stack<int> s[101]; int main() { int n, k; scanf("%d %d", &n, &k); for(int i = 0; i < n; i++) { scanf("%d", &person[i]); } reverse(person, person + n); for(int i = 0; i < 100; i++) { s[i].push(101); } for(int i = 0; i < n; i++) { int idx = 0, j; for(j = 0; j < k; j++) { if(s[j].top() > person[i]) { break; } } if(j == k) { printf("NO\n"); return 0; } s[j].push(person[i]); } printf("YES\n"); }
15.5
33
0.375806
KimBoWoon
7fd092f85796b17743f720381aa2db2a0903e82e
2,569
cpp
C++
src/TableIndexer.cpp
NDelt/Mini-Search-Engine
c7c64a7d365e5112e0a6eb320d3ff3e399bd9e18
[ "Apache-2.0" ]
null
null
null
src/TableIndexer.cpp
NDelt/Mini-Search-Engine
c7c64a7d365e5112e0a6eb320d3ff3e399bd9e18
[ "Apache-2.0" ]
null
null
null
src/TableIndexer.cpp
NDelt/Mini-Search-Engine
c7c64a7d365e5112e0a6eb320d3ff3e399bd9e18
[ "Apache-2.0" ]
1
2019-04-11T03:02:05.000Z
2019-04-11T03:02:05.000Z
#include "TableIndexer.hpp" /** * 역색인 테이블 생성기 * 1) CSV 파싱 * 2) 'BASIC QUALIFICATIONS' 컬럼에 대해 토큰 단위로 문자열 파싱 * 3) 문자열 파싱 후 반환되는 vector를 순회하며 (토큰, ID) 형식으로 해시 테이블에 데이터 추가 */ void TableIndexer::createIndex(const std::string& filePath, HashMap& hashMap) { clock_t start, end, loopStart, loopEnd; double result; std::cout << std::fixed; std::cout.precision(4); std::cout << ">>>>> Parsing CSV file....\n"; start = clock(); std::cout << "* File path : " << "\"" << filePath << "\"\n"; std::vector<std::vector<std::string>> matrix = CSVParser::parse(filePath); end = clock(); result = (double)(end - start); std::cout << ">>>>> CSV parsing complete. [" << result / CLOCKS_PER_SEC << "s]\n\n"; int wordsParsingCount = 1; loopStart = clock(); // 사용하는 CSV 파일 컬럼: ID(0), TITLE(1), BASIC QUALIFICATIONS(5) // 토큰 분석 대상 컬럼: BASIC QUALIFICATIONS(5) for (const std::vector<std::string>& row : matrix) { std::cout << ">>>>> (" << wordsParsingCount << ") Parsing words...\n"; start = clock(); this->id = std::atoi(row[0].c_str()); this->title = row[1]; this->qualif = row[5]; std::cout << "* ID : " << this->id << "\n"; std::cout << "* Job Title : " << this->title << "\n"; std::cout << "* Qualifications : " << this->qualif << "\n\n"; std::vector<std::string> retVec = QueryParser::parse(this->qualif); int interCount = 1; for (const std::string& str : retVec) { if (str.empty()) { std::cout << "(empty) / "; } else if (str.size() == 1) { std::cout << "(1 letter) / "; } else if (str == "an" || str == "the") { std::cout << "(stopword) / "; } else { std::cout << str << " / "; hashMap.add(str, this->id); // 해시 테이블에 데이터 삽입 } ++interCount; } std::cout << "\n"; end = clock(); result = (double)(end - start); std::cout << ">>>>> (" << wordsParsingCount << ") Words parsing complete. [" << result / CLOCKS_PER_SEC << "s]\n\n"; ++wordsParsingCount; } loopEnd = clock(); result = (double)(loopEnd - loopStart); std::cout << ">>>>> Inverted index table is created : " << hashMap.getCurrentRowCount() << " rows. [" << result / CLOCKS_PER_SEC << "s]\n\n"; }
32.1125
124
0.474114
NDelt
7fd2d7d17449a143010ed5bcd33add9faa85b1bf
11,537
cpp
C++
IccProfLib/IccPcc.cpp
petervwyatt/DemoIccMAX
f07a85a87269a7c0c4507012ea9f547edca723e6
[ "RSA-MD" ]
56
2016-02-24T20:43:57.000Z
2021-02-06T04:31:34.000Z
IccProfLib/IccPcc.cpp
petervwyatt/DemoIccMAX
f07a85a87269a7c0c4507012ea9f547edca723e6
[ "RSA-MD" ]
24
2016-02-01T16:50:58.000Z
2021-01-17T03:51:00.000Z
IccProfLib/IccPcc.cpp
petervwyatt/DemoIccMAX
f07a85a87269a7c0c4507012ea9f547edca723e6
[ "RSA-MD" ]
25
2016-02-02T15:26:09.000Z
2020-10-05T07:21:19.000Z
/** @file File: IccPcc.cpp Contains: Implementation of the IIccProfileConnectionConditions interface class. Version: V1 Copyright: (c) see ICC Software License */ /* * The ICC Software License, Version 0.2 * * * Copyright (c) 2003-2012 The International Color Consortium. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. In the absence of prior written permission, the names "ICC" and "The * International Color Consortium" must not be used to imply that the * ICC organization endorses or promotes products derived from this * software. * * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 INTERNATIONAL COLOR CONSORTIUM OR * ITS CONTRIBUTING MEMBERS 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. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the The International Color Consortium. * * * Membership in the ICC is encouraged when this software is used for * commercial purposes. * * * For more information on The International Color Consortium, please * see <http://www.color.org/>. * * */ ////////////////////////////////////////////////////////////////////// // HISTORY: // // -Initial implementation by Max Derhak 5-15-2003 // ////////////////////////////////////////////////////////////////////// #ifdef WIN32 #pragma warning( disable: 4786) //disable warning in <list.h> #endif #include "IccPcc.h" #include "IccProfile.h" #include "IccTag.h" #include "IccCmm.h" bool IIccProfileConnectionConditions::isEquivalentPcc(IIccProfileConnectionConditions &IPCC) { icIlluminant illum = getPccIlluminant(); icStandardObserver obs = getPccObserver(); if (illum!=IPCC.getPccIlluminant() || obs!= IPCC.getPccObserver()) return false; if ((illum==icIlluminantDaylight || illum==icIlluminantBlackBody) && getPccCCT()!=IPCC.getPccCCT()) return false; if (illum==icIlluminantUnknown) return false; if (obs==icStdObsCustom) { if (!hasIlluminantSPD() && !IPCC.hasIlluminantSPD()) { icFloatNumber XYZ1[3], XYZ2[3]; getNormIlluminantXYZ(&XYZ1[0]); IPCC.getNormIlluminantXYZ(&XYZ2[0]); if (XYZ1[0]!=XYZ2[0] || XYZ1[1]!=XYZ2[1] || XYZ1[2]!=XYZ2[2]) return false; } else { return false; } } return true; } icIlluminant IIccProfileConnectionConditions::getPccIlluminant() { const CIccTagSpectralViewingConditions *pCond = getPccViewingConditions(); if (!pCond) return icIlluminantD50; return pCond->getStdIllumiant(); } icFloatNumber IIccProfileConnectionConditions::getPccCCT() { const CIccTagSpectralViewingConditions *pCond = getPccViewingConditions(); if (!pCond) return 0.0f; return pCond->getIlluminantCCT(); } icStandardObserver IIccProfileConnectionConditions::getPccObserver() { const CIccTagSpectralViewingConditions *pCond = getPccViewingConditions(); if (!pCond) return icStdObs1931TwoDegrees; return pCond->getStdObserver(); } bool IIccProfileConnectionConditions::isStandardPcc() { if (getPccIlluminant()==icIlluminantD50 && getPccObserver()==icStdObs1931TwoDegrees) return true; return false; } bool IIccProfileConnectionConditions::hasIlluminantSPD() { const CIccTagSpectralViewingConditions *pCond = getPccViewingConditions(); if (!pCond) return false; icSpectralRange illumRange; const icFloatNumber *illum = pCond->getIlluminant(illumRange); if (!illumRange.steps || !illum) return false; return true; } icFloatNumber IIccProfileConnectionConditions::getObserverIlluminantScaleFactor() { const CIccTagSpectralViewingConditions *pView = getPccViewingConditions(); if (!pView) return 1.0; icSpectralRange illumRange; const icFloatNumber *illum = pView->getIlluminant(illumRange); icSpectralRange obsRange; const icFloatNumber *obs = pView->getObserver(obsRange); int i, n = illumRange.steps; CIccMatrixMath *mapRange=CIccMatrixMath::rangeMap(obsRange, illumRange); icFloatNumber rv=0; if (mapRange) { icFloatNumber *Ycmf = new icFloatNumber[illumRange.steps]; mapRange->VectorMult(Ycmf, &obs[obsRange.steps]); delete mapRange; for (i=0; i<n; i++) { rv += Ycmf[i]*illum[i]; } delete [] Ycmf; } else { const icFloatNumber *Ycmf = &obs[obsRange.steps]; for (i=0; i<n; i++) { rv += Ycmf[i]*illum[i]; } } return rv; } icFloatNumber IIccProfileConnectionConditions::getObserverWhiteScaleFactor(const icFloatNumber *pWhite, const icSpectralRange &whiteRange) { const CIccTagSpectralViewingConditions *pView = getPccViewingConditions(); if (!pView) return 1.0; icSpectralRange obsRange; const icFloatNumber *obs = pView->getObserver(obsRange); int i, n = whiteRange.steps; CIccMatrixMath *mapRange=CIccMatrixMath::rangeMap(obsRange, whiteRange); icFloatNumber rv=0; if (mapRange) { icFloatNumber *Ycmf = new icFloatNumber[whiteRange.steps]; mapRange->VectorMult(Ycmf, &obs[obsRange.steps]); delete mapRange; for (i=0; i<n; i++) { rv += Ycmf[i]*pWhite[i]; } delete [] Ycmf; } else { const icFloatNumber *Ycmf = &obs[obsRange.steps]; for (i=0; i<n; i++) { rv += Ycmf[i]*pWhite[i]; } } return rv; } icFloatNumber *IIccProfileConnectionConditions::getEmissiveObserver(const icSpectralRange &range, const icFloatNumber *pWhite, icFloatNumber *obs) { const CIccTagSpectralViewingConditions *pView = getPccViewingConditions(); if (!pView || !pWhite) return NULL; int i, n = range.steps, size = 3*n; const icFloatNumber *fptr; icFloatNumber *tptr; icSpectralRange observerRange; const icFloatNumber *observer = pView->getObserver(observerRange); if (!obs) obs = (icFloatNumber*)malloc(size*sizeof(icFloatNumber)); if (obs) { CIccMatrixMath *mapRange=CIccMatrixMath::rangeMap(observerRange, range); //Copy observer while adjusting to range if (mapRange) { if (obs) { fptr = &observer[0]; tptr = obs; for (i=0; i<3; i++) { mapRange->VectorMult(tptr, fptr); fptr += observerRange.steps; tptr += range.steps; } } delete mapRange; } else { memcpy(obs, observer, size*sizeof(icFloatNumber)); } //Calculate scale constant icFloatNumber k=0.0f; fptr = &obs[range.steps]; //Using second color matching function for (i=0; i<(int)range.steps; i++) { k += fptr[i]*pWhite[i]; } //Scale observer so application of observer against white results in 1.0. for (i=0; i<size; i++) { obs[i] = obs[i] / k; } CIccMatrixMath observerMtx(3,range.steps); memcpy(observerMtx.entry(0), obs, size*sizeof(icFloatNumber)); icFloatNumber xyz[3]; observerMtx.VectorMult(xyz, pWhite); } return obs; } CIccMatrixMath *IIccProfileConnectionConditions::getReflectanceObserver(const icSpectralRange &rangeRef) { CIccMatrixMath *pAdjust=NULL, *pMtx; const CIccTagSpectralViewingConditions *pView = getPccViewingConditions(); icSpectralRange illumRange; const icFloatNumber *illum = pView->getIlluminant(illumRange); pMtx = CIccMatrixMath::rangeMap(rangeRef, illumRange); if (pMtx) pAdjust = pMtx; pMtx = pView->getObserverMatrix(illumRange); if (pAdjust) { pMtx = pAdjust->Mult(pMtx); delete pAdjust; } pAdjust = pMtx; pAdjust->VectorScale(illum); pAdjust->Scale(1.0f / pAdjust->RowSum(1)); return pAdjust; } CIccCombinedConnectionConditions::CIccCombinedConnectionConditions(CIccProfile *pProfile, IIccProfileConnectionConditions *pAppliedPCC, bool bReflectance/*=false*/) { const CIccTagSpectralViewingConditions *pView = pAppliedPCC ? pAppliedPCC->getPccViewingConditions() : NULL; if (bReflectance) { m_pPCC = pAppliedPCC; m_pViewingConditions = NULL; m_illuminantXYZ[0] = pView->m_illuminantXYZ.X / pView->m_illuminantXYZ.Y; m_illuminantXYZ[1] = pView->m_illuminantXYZ.Y / pView->m_illuminantXYZ.Y; m_illuminantXYZ[2] = pView->m_illuminantXYZ.Z / pView->m_illuminantXYZ.Y; m_illuminantXYZLum[0] = pView->m_illuminantXYZ.X; m_illuminantXYZLum[1] = pView->m_illuminantXYZ.Y; m_illuminantXYZLum[2] = pView->m_illuminantXYZ.Z; m_bValidMediaXYZ = pProfile->calcMediaWhiteXYZ(m_mediaXYZ, pAppliedPCC); } else if (pView) { m_pPCC = NULL; m_pViewingConditions = (CIccTagSpectralViewingConditions*)pView->NewCopy(); icSpectralRange illumRange; const icFloatNumber *illum = pView->getIlluminant(illumRange); m_pViewingConditions->setIlluminant(pView->getStdIllumiant(), illumRange, illum, pView->getIlluminantCCT()); pProfile->calcNormIlluminantXYZ(m_illuminantXYZ, this); pProfile->calcLumIlluminantXYZ(m_illuminantXYZLum, this); m_bValidMediaXYZ = pProfile->calcMediaWhiteXYZ(m_mediaXYZ, this); } else { m_pPCC = NULL; m_pViewingConditions = NULL; m_bValidMediaXYZ = false; } } CIccCombinedConnectionConditions::~CIccCombinedConnectionConditions() { if (m_pViewingConditions) delete m_pViewingConditions; } const CIccTagSpectralViewingConditions *CIccCombinedConnectionConditions::getPccViewingConditions() { if (m_pViewingConditions) return m_pViewingConditions; if (m_pPCC) return m_pPCC->getPccViewingConditions(); return NULL; } CIccTagMultiProcessElement *CIccCombinedConnectionConditions::getCustomToStandardPcc() { if (m_pPCC) return m_pPCC->getCustomToStandardPcc(); return NULL; } CIccTagMultiProcessElement *CIccCombinedConnectionConditions::getStandardToCustomPcc() { if (m_pPCC) return m_pPCC->getStandardToCustomPcc(); return NULL; } void CIccCombinedConnectionConditions::getNormIlluminantXYZ(icFloatNumber *pXYZ) { memcpy(pXYZ, m_illuminantXYZ, 3*sizeof(icFloatNumber)); } void CIccCombinedConnectionConditions::getLumIlluminantXYZ(icFloatNumber *pXYZLum) { memcpy(pXYZLum, m_illuminantXYZLum, 3 * sizeof(icFloatNumber)); } bool CIccCombinedConnectionConditions::getMediaWhiteXYZ(icFloatNumber *pXYZ) { if (m_pPCC || m_pViewingConditions) { memcpy(pXYZ, m_mediaXYZ, 3*sizeof(icFloatNumber)); return m_bValidMediaXYZ; } return false; }
28.699005
146
0.698362
petervwyatt
7fdb134ff556dbd9460f427e710f9f343d187332
15,933
cpp
C++
tests/pub/StackPackBufferTests.cpp
redradist/Transport_Buffers
142133ec55465cc08d04c28cb6efbae4cbb620b7
[ "MIT" ]
4
2019-11-14T02:38:59.000Z
2021-07-24T19:58:10.000Z
tests/pub/StackPackBufferTests.cpp
redradist/Transport_Buffers
142133ec55465cc08d04c28cb6efbae4cbb620b7
[ "MIT" ]
null
null
null
tests/pub/StackPackBufferTests.cpp
redradist/Transport_Buffers
142133ec55465cc08d04c28cb6efbae4cbb620b7
[ "MIT" ]
1
2020-01-08T19:43:54.000Z
2020-01-08T19:43:54.000Z
// // Created by redra on 29.04.17. // #include <gtest/gtest.h> #include "pub/StackPackBuffer.hpp" #include "pub/UnpackBuffer.hpp" using buffers::StackPackBuffer; using buffers::UnpackBuffer; struct StackPackBufferIntTest : testing::Test { StackPackBuffer<12> * buffer; virtual void SetUp() { buffer = new StackPackBuffer<12>(); }; virtual void TearDown() { delete buffer; }; }; struct StackPackBufferStringTest : testing::Test { StackPackBuffer<30> * buffer; virtual void SetUp() { buffer = new StackPackBuffer<30>(); }; virtual void TearDown() { delete buffer; }; }; struct StackPackBufferVectorTest : testing::Test { StackPackBuffer<120> * buffer; virtual void SetUp() { buffer = new StackPackBuffer<120>(); }; virtual void TearDown() { delete buffer; }; }; struct StackPackBufferMixedDataTest : testing::Test { StackPackBuffer<200> * buffer; virtual void SetUp() { buffer = new StackPackBuffer<200>(); }; virtual void TearDown() { delete buffer; }; }; TEST_F(StackPackBufferIntTest, ValidIntTest) { ASSERT_EQ(buffer->put(uint8_t{ 1 }), true); ASSERT_EQ(buffer->put(uint8_t{ 2 }), true); ASSERT_EQ(buffer->put(uint8_t{ 3 }), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get<uint8_t>(), 1); ASSERT_EQ(unbuffer.get<uint8_t>(), 2); ASSERT_EQ(unbuffer.get<uint8_t>(), 3); } TEST_F(StackPackBufferIntTest, OverflowIntTest) { ASSERT_EQ(buffer->put(uint8_t{ 1 }), true); ASSERT_EQ(buffer->put(uint8_t{ 2 }), true); ASSERT_EQ(buffer->put(uint8_t{ 3 }), true); ASSERT_EQ(buffer->put(uint8_t{ 4 }), false); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get<uint8_t>(), 1); ASSERT_EQ(unbuffer.get<uint8_t>(), 2); ASSERT_EQ(unbuffer.get<uint8_t>(), 3); } TEST_F(StackPackBufferIntTest, CrashIntTest0) { ASSERT_EQ(buffer->put(uint8_t{ 1 }), true); ASSERT_EQ(buffer->put(uint8_t{ 2 }), true); // ASSERT_EQ(buffer->put(nullptr), false); // Compilation error ASSERT_EQ(buffer->put(uint8_t{ 4 }), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get<uint8_t>(), 1); ASSERT_EQ(unbuffer.get<uint8_t>(), 2); ASSERT_EQ(unbuffer.get<uint8_t>(), 4); } TEST_F(StackPackBufferIntTest, CrashIntTest1) { // ASSERT_EQ(buffer->put(nullptr), false); // Compilation error ASSERT_EQ(buffer->put(uint8_t{ 2 }), true); ASSERT_EQ(buffer->put(uint8_t{ 3 }), true); ASSERT_EQ(buffer->put(uint8_t{ 4 }), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get<uint8_t>(), 2); ASSERT_EQ(unbuffer.get<uint8_t>(), 3); ASSERT_EQ(unbuffer.get<uint8_t>(), 4); } TEST_F(StackPackBufferIntTest, CrashIntTest2) { // ASSERT_EQ(buffer->put(nullptr), false); // Compilation error // ASSERT_EQ(buffer->put(nullptr), false); // Compilation error } TEST_F(StackPackBufferStringTest, ValidStringTest0) { ASSERT_EQ(buffer->put(std::string{"Hi"}), true); ASSERT_EQ(buffer->put(std::string{"Hello"}), true); ASSERT_EQ(buffer->put(std::string{"Hi vs Hello"}), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hi"}); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get(), std::string{"Hi vs Hello"}); } TEST_F(StackPackBufferStringTest, ValidStringTest1) { ASSERT_EQ(buffer->put(std::string{"Hi"}), true); ASSERT_EQ(buffer->put(std::string{}), true); ASSERT_EQ(buffer->put(std::string{"Hi vs Hello"}), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hi"}); ASSERT_EQ(unbuffer.get(), std::string{}); ASSERT_EQ(unbuffer.get(), std::string{"Hi vs Hello"}); } TEST_F(StackPackBufferStringTest, OverflowStringTest) { ASSERT_EQ(buffer->put(std::string{"Hi"}), true); ASSERT_EQ(buffer->put(std::string{"Hello"}), true); ASSERT_EQ(buffer->put(std::string{"Hi vs Hello"}), true); ASSERT_EQ(buffer->put(std::string{"Hi not vs Hello but vs Hi"}), false); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hi"}); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get(), std::string{"Hi vs Hello"}); } TEST_F(StackPackBufferStringTest, ValidCStringTest0) { ASSERT_EQ(buffer->put("Hi"), true); ASSERT_EQ(buffer->put("Hello"), true); ASSERT_EQ(buffer->put("Hi vs Hello"), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hi"}); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get(), std::string{"Hi vs Hello"}); } TEST_F(StackPackBufferStringTest, ValidCStringTest1) { ASSERT_EQ(buffer->put("Hi"), true); ASSERT_EQ(buffer->put(""), true); ASSERT_EQ(buffer->put("Hi vs Hello"), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hi"}); ASSERT_EQ(unbuffer.get(), std::string{}); ASSERT_EQ(unbuffer.get(), std::string{"Hi vs Hello"}); } TEST_F(StackPackBufferStringTest, OverflowCStringTest) { ASSERT_EQ(buffer->put("Hi"), true); ASSERT_EQ(buffer->put("Hello"), true); ASSERT_EQ(buffer->put("Hi vs Hello"), true); ASSERT_EQ(buffer->put("Hi not vs Hello but vs Hi"), false); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hi"}); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get(), std::string{"Hi vs Hello"}); } TEST_F(StackPackBufferStringTest, InvalidCStringTest) { ASSERT_EQ(buffer->put("Hi"), true); ASSERT_EQ(buffer->put("Hello"), true); ASSERT_EQ(buffer->put("Hi vs Hello"), true); ASSERT_EQ(buffer->put((char *) nullptr), false); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hi"}); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get(), std::string{"Hi vs Hello"}); } TEST_F(StackPackBufferVectorTest, ValidVectorgTest0) { std::vector<int> vec0 = {1, 2, 3}; std::vector<float> vec1 = {3, 2, 1}; ASSERT_EQ(buffer->put(vec0), true); ASSERT_EQ(buffer->put(vec1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get<std::vector<int>>(), vec0); ASSERT_EQ(unbuffer.get<std::vector<float>>(), vec1); } TEST_F(StackPackBufferVectorTest, ValidVectorgTest1) { std::vector<double> vec0 = {1, 2, 3}; std::vector<float> vec1 = {3, 2, 1}; ASSERT_EQ(buffer->put(vec0.data(), vec0.size()), true); ASSERT_EQ(buffer->put(vec1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get<std::vector<double>>(), vec0); ASSERT_EQ(unbuffer.get<std::vector<float>>(), vec1); } TEST_F(StackPackBufferVectorTest, ValidListTest0) { std::list<int> lst0 = {1, 2, 3}; std::list<float> lst1 = {3, 2, 1}; ASSERT_EQ(buffer->put(lst0), true); ASSERT_EQ(buffer->put(lst1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get<std::list<int>>(), lst0); ASSERT_EQ(unbuffer.get<std::list<float>>(), lst1); } TEST_F(StackPackBufferVectorTest, ValidListTest1) { std::list<double> lst0 = {1, 2, 3}; std::list<float> lst1 = {3, 2, 1}; ASSERT_EQ(buffer->put(lst0), true); ASSERT_EQ(buffer->put(lst1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get<std::list<double>>(), lst0); ASSERT_EQ(unbuffer.get<std::list<float>>(), lst1); } TEST_F(StackPackBufferVectorTest, ValidSetTest0) { std::set<std::string> set0; set0.insert("4"); set0.insert("5"); set0.insert("8"); ASSERT_EQ(buffer->put(set0), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto res0 = unbuffer.get<std::set<std::string>>(); ASSERT_EQ(res0, set0); } TEST_F(StackPackBufferVectorTest, ValidSetTest1) { std::set<std::string> set0; set0.insert("4"); set0.insert("5"); set0.insert("8"); std::set<std::string> set1; set1.insert("8"); set1.insert("11"); set1.insert("16"); ASSERT_EQ(buffer->put(set0), true); ASSERT_EQ(buffer->put(set1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto res0 = unbuffer.get<std::set<std::string>>(); ASSERT_EQ(res0, set0); auto res2 = unbuffer.get<std::set<std::string>>(); ASSERT_EQ(res2, set1); } TEST_F(StackPackBufferVectorTest, ValidPairTest0) { std::pair<int, std::string> pair0; pair0.first = 8; pair0.second = "8"; ASSERT_EQ(buffer->put(pair0), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto result = unbuffer.get<std::pair<int, std::string>>(); ASSERT_EQ(result, pair0); } TEST_F(StackPackBufferVectorTest, ValidPairTest1) { std::pair<int, std::string> pair0; pair0.first = 8; pair0.second = "8"; std::pair<std::string, int> pair1; pair1.first = "18"; pair1.second = 18; ASSERT_EQ(buffer->put(pair0), true); ASSERT_EQ(buffer->put(pair1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto res0 = unbuffer.get<std::pair<int, std::string>>(); ASSERT_EQ(res0, pair0); auto res1 = unbuffer.get<std::pair<std::string, int>>(); ASSERT_EQ(res1, pair1); } TEST_F(StackPackBufferVectorTest, ValidMapTest0) { std::map<int, std::string> map0; map0[8] = "4"; map0[2] = "5"; map0[3] = "8"; ASSERT_EQ(buffer->put(map0), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto result = unbuffer.get<std::map<int, std::string>>(); ASSERT_EQ(result, map0); } TEST_F(StackPackBufferVectorTest, ValidMapTest1) { std::map<int, std::string> map0; map0[8] = "4"; map0[2] = "5"; map0[3] = "8"; std::map<std::string, int> map1; map1["1"] = 1; map1["8"] = 6; map1["5"] = 9; ASSERT_EQ(buffer->put(map0), true); ASSERT_EQ(buffer->put(map1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto res0 = unbuffer.get<std::map<int, std::string>>(); ASSERT_EQ(res0, map0); auto res1 = unbuffer.get<std::map<std::string, int>>(); ASSERT_EQ(res1, map1); } TEST_F(StackPackBufferVectorTest, ValidHashSetTest0) { std::unordered_set<std::string> set0; set0.insert("4"); set0.insert("5"); set0.insert("8"); ASSERT_EQ(buffer->put(set0), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto res0 = unbuffer.get<std::unordered_set<std::string>>(); ASSERT_EQ(res0, set0); } TEST_F(StackPackBufferVectorTest, ValidHashSetTest1) { std::unordered_set<std::string> set0; set0.insert("4"); set0.insert("5"); set0.insert("8"); std::unordered_set<std::string> set1; set1.insert("8"); set1.insert("11"); set1.insert("16"); ASSERT_EQ(buffer->put(set0), true); ASSERT_EQ(buffer->put(set1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto res0 = unbuffer.get<std::unordered_set<std::string>>(); ASSERT_EQ(res0, set0); auto res2 = unbuffer.get<std::unordered_set<std::string>>(); ASSERT_EQ(res2, set1); } TEST_F(StackPackBufferVectorTest, ValidHashMapTest0) { std::unordered_map<int, std::string> map0; map0[8] = "4"; map0[2] = "5"; map0[3] = "8"; ASSERT_EQ(buffer->put(map0), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto result = unbuffer.get<std::unordered_map<int, std::string>>(); ASSERT_EQ(result, map0); } TEST_F(StackPackBufferVectorTest, ValidHashMapTest1) { std::unordered_map<int, std::string> map0; map0[8] = "4"; map0[2] = "5"; map0[3] = "8"; std::unordered_map<std::string, int> map1; map1["1"] = 1; map1["8"] = 6; map1["5"] = 9; ASSERT_EQ(buffer->put(map0), true); ASSERT_EQ(buffer->put(map1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); auto res0 = unbuffer.get<std::unordered_map<int, std::string>>(); ASSERT_EQ(res0, map0); auto res1 = unbuffer.get<std::unordered_map<std::string, int>>(); ASSERT_EQ(res1, map1); } TEST_F(StackPackBufferMixedDataTest, MixedDataTest0) { ASSERT_EQ(buffer->put<uint8_t>(8), true); ASSERT_EQ(buffer->put("Hello"), true); ASSERT_EQ(buffer->put<double>(8.), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get<uint8_t>(), 8); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get<double>(), 8.); } TEST_F(StackPackBufferMixedDataTest, MixedDataTest1) { ASSERT_EQ(buffer->put("Hello"), true); ASSERT_EQ(buffer->put<uint8_t>(8), true); ASSERT_EQ(buffer->put<float>(8.), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get<uint8_t>(), 8); ASSERT_EQ(unbuffer.get<float>(), 8.); } TEST_F(StackPackBufferMixedDataTest, MixedDataTest2) { std::list<double> lst = {1, 2, 3}; std::vector<int> vec = {1, 2, 3}; ASSERT_EQ(buffer->put("Hello"), true); ASSERT_EQ(buffer->put(lst), true); ASSERT_EQ(buffer->put<uint8_t>(8), true); ASSERT_EQ(buffer->put(vec), true); ASSERT_EQ(buffer->put<float>(8.), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get<std::list<double>>(), lst); ASSERT_EQ(unbuffer.get<uint8_t>(), 8); ASSERT_EQ(unbuffer.get<std::vector<int>>(), vec); ASSERT_EQ(unbuffer.get<float>(), 8.); } TEST_F(StackPackBufferMixedDataTest, MixedDataTest3) { std::list<double> lst = {1, 2, 3}; std::vector<int> vec = {1, 2, 3}; std::set<std::string> set; set.insert("4"); set.insert("5"); set.insert("8"); std::map<std::string, int> map; map["1"] = 1; map["8"] = 6; map["5"] = 9; ASSERT_EQ(buffer->put("Hello"), true); ASSERT_EQ(buffer->put(lst), true); ASSERT_EQ(buffer->put<uint8_t>(8), true); ASSERT_EQ(buffer->put(vec), true); ASSERT_EQ(buffer->put(set), true); ASSERT_EQ(buffer->put<float>(8.), true); ASSERT_EQ(buffer->put(map), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get<std::list<double>>(), lst); ASSERT_EQ(unbuffer.get<uint8_t>(), 8); ASSERT_EQ(unbuffer.get<std::vector<int>>(), vec); ASSERT_EQ(unbuffer.get<std::set<std::string>>(), set); ASSERT_EQ(unbuffer.get<float>(), 8.); auto res0 = unbuffer.get<std::map<std::string, int>>(); ASSERT_EQ(res0, map); } TEST_F(StackPackBufferMixedDataTest, MixedDataTest4) { std::list<double> lst = {1, 2, 3}; std::unordered_set<std::string> set0; set0.insert("4"); set0.insert("5"); set0.insert("8"); std::vector<int> vec = {1, 2, 3}; std::unordered_map<std::string, int> map0; map0["1"] = 1; map0["8"] = 6; map0["5"] = 9; std::set<std::string> set1; set1.insert("4"); set1.insert("5"); set1.insert("8"); std::map<std::string, int> map1; map1["1"] = 1; map1["8"] = 6; map1["5"] = 9; ASSERT_EQ(buffer->put("Hello"), true); ASSERT_EQ(buffer->put(set0), true); ASSERT_EQ(buffer->put(lst), true); ASSERT_EQ(buffer->put<uint8_t>(8), true); ASSERT_EQ(buffer->put(vec), true); ASSERT_EQ(buffer->put(map0), true); ASSERT_EQ(buffer->put(set1), true); ASSERT_EQ(buffer->put<float>(8.), true); ASSERT_EQ(buffer->put(map1), true); UnpackBuffer unbuffer(buffer->getData(), buffer->getDataSize()); ASSERT_EQ(unbuffer.get(), std::string{"Hello"}); ASSERT_EQ(unbuffer.get<std::unordered_set<std::string>>(), set0); ASSERT_EQ(unbuffer.get<std::list<double>>(), lst); ASSERT_EQ(unbuffer.get<uint8_t>(), 8); ASSERT_EQ(unbuffer.get<std::vector<int>>(), vec); auto res0 = unbuffer.get<std::unordered_map<std::string, int>>(); ASSERT_EQ(res0, map0); ASSERT_EQ(unbuffer.get<std::set<std::string>>(), set1); ASSERT_EQ(unbuffer.get<float>(), 8.); auto res1 = unbuffer.get<std::map<std::string, int>>(); ASSERT_EQ(res1, map1); }
31.866
74
0.677587
redradist
7fdd5d831876ce18a9f26304ee3a4bdbeb045d6e
2,623
cpp
C++
mathClasses & Doc/src/Point.cpp
udit01/qGL
81aa4cdc7a271099c9ba8bee53e6aeba33c2901c
[ "MIT" ]
1
2020-07-27T13:11:34.000Z
2020-07-27T13:11:34.000Z
src/Point.cpp
udit01/3d_cad
91a22db07171ba149db52ef9820f80912d729f95
[ "MIT" ]
null
null
null
src/Point.cpp
udit01/3d_cad
91a22db07171ba149db52ef9820f80912d729f95
[ "MIT" ]
null
null
null
/************************ * Point class * Different point operations in 3d space. * Contains Vector operations *************************/ #include <bool> #include <float> #include <string> #include "DirectionCosines.hpp" #include "Graph.hpp" #include "Line.hpp" #include "Model3d.hpp" #include "OrthographicViews.hpp" #include "Plane.hpp" #include "Point.hpp" #include "Projection.hpp" //Different Constructors for 2D ///Constructor for unlabelled 2D point Point::Point(float x, float y) { } ///Constructor for labelled 2D point Point::Point(float x, float y, string label) { } ///Constructor for unlabelled 3D point Point::Point(float x, float y, float z) { } ///Constructor for labelled 3D point Point::Point(float x, float y, float z, string label) { } ///Destructor for the point object Point::~Point(){ } ///Returns distance from given Point float Point::distanceFromPoint(Point p){ } ///Returns distance from given Line float Point::distanceFromLine(Line L){ } ///Returns distance from given Plane float Point::distanceFromPlane(Plane P){ } ///Returns True if Point lies on given Line bool Point::liesOnLine(Line L){ } ///Returns True if Point lies on given Plane bool Point::liesOnPlane(Plane P){ } ///Returns projection of point on given Line Point Point::projectionOnLine(Line L){ } ///Returns mirror image of point in given Line Point Point::imageInLine(Line L){ } ///Returns projection of point on the given Plane Point Point::projectionOnPlane(Plane P){ } ///Returns image of point on the given Plane Point Point::imageInPlane(Plane P){ } ///Returns the added point, treating them as vectors. Doesn't change coordinates of current point. [this + p] Point Point::add(Point p){ } ///Returns the subtracted point, treating them as vectors. Doesn't change coordinates of current point. [this - p] Point Point::sub(Point p) { } ///Returns the dot product with given point, treating them as vectors. [this . p] float Point::dotProduct(Point p) { } ///Returns the point obtained from cross product, treating them as vectors. [this x p] Point Point::crossProduct(Point p) { } ///Returns the translated point. Changes the coordinates of current point. Point Point::translate(float x, float y, float z) { } ///Returns the translated point. Changes the coordinates of current point. Point Point::rotate(DirectionCosines dc) { } };
21.677686
118
0.647732
udit01
8f0cd47089fedf5da8af0975426f96a51877abfa
1,368
hpp
C++
include/fcppt/cast/bad_dynamic.hpp
vinzenz/fcppt
3f8cc5babdee178a9bbd06ca3ce7ad405d19aa6a
[ "BSL-1.0" ]
null
null
null
include/fcppt/cast/bad_dynamic.hpp
vinzenz/fcppt
3f8cc5babdee178a9bbd06ca3ce7ad405d19aa6a
[ "BSL-1.0" ]
null
null
null
include/fcppt/cast/bad_dynamic.hpp
vinzenz/fcppt
3f8cc5babdee178a9bbd06ca3ce7ad405d19aa6a
[ "BSL-1.0" ]
null
null
null
// Copyright Carl Philipp Reh 2009 - 2016. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef FCPPT_CAST_BAD_DYNAMIC_HPP_INCLUDED #define FCPPT_CAST_BAD_DYNAMIC_HPP_INCLUDED #include <fcppt/exception.hpp> #include <fcppt/config/external_begin.hpp> #include <typeindex> #include <fcppt/config/external_end.hpp> namespace fcppt { namespace cast { /** \brief May be thrown by \link fcppt::cast::dynamic \endlink if the cast fails \ingroup fcpptcasts This class provides more type information than <code>std::bad_cast</code> does. It stores an std::type_index for the source and the destination type. \see fcppt::cast::dynamic */ class bad_dynamic : public fcppt::exception { public: /** \brief Constructs a bad_dynamic_cast exception \param source The source type information \param dest The destination type information */ bad_dynamic( std::type_index const &source, std::type_index const &dest ); /** \brief Returns the source type information */ std::type_index const & source() const; /** \brief Returns the destination type information */ std::type_index const & destination() const; private: std::type_index source_, destination_; }; } } #include <fcppt/cast/impl/bad_dynamic.hpp> #endif
19.267606
79
0.739035
vinzenz
8f16dcdf4469a82484e7ebb4932249d97c61901a
1,860
hpp
C++
src/base/include/scripts/behaviour_script.hpp
N4G170/generic
29c8be184b1420b811e2a3db087f9bd6b76ed8bf
[ "MIT" ]
null
null
null
src/base/include/scripts/behaviour_script.hpp
N4G170/generic
29c8be184b1420b811e2a3db087f9bd6b76ed8bf
[ "MIT" ]
null
null
null
src/base/include/scripts/behaviour_script.hpp
N4G170/generic
29c8be184b1420b811e2a3db087f9bd6b76ed8bf
[ "MIT" ]
null
null
null
#ifndef BEHAVIOUR_SCRIPT_HPP #define BEHAVIOUR_SCRIPT_HPP #include "script.hpp" class BehaviourScript : public Script { public: //<f> Constructors & operator= /** brief Default constructor */ BehaviourScript() : Script{}, m_input_event{} {} /** brief Default destructor */ virtual ~BehaviourScript() noexcept {} /** brief Copy constructor */ BehaviourScript(const BehaviourScript& other): Script{other}, m_input_event{other.m_input_event} {} /** brief Move constructor */ BehaviourScript(BehaviourScript&& other) noexcept : Script{std::move(other)}, m_input_event{std::move(other.m_input_event)} {} /** brief Copy operator */ BehaviourScript& operator= (const BehaviourScript& other) { if(this != &other) { Script::operator=(other); m_input_event = other.m_input_event; } return *this; } /** brief Move operator */ BehaviourScript& operator= (BehaviourScript&& other) noexcept { if(this != &other) { Script::operator=(std::move(other)); m_input_event = std::move(other.m_input_event); } return *this; } //</f> /Constructors & operator= //<f> Methods void Input(const SDL_Event& event) { m_input_event = event; } //</f> /Methods //<f> Virtual Methods virtual Script* Clone() = 0; virtual void FixedUpdate(float fixed_delta_time){}; virtual void Update(float delta_time){}; //</f> /Virtual Methods //<f> Getters/Setters //</f> /Getters/Setters protected: // vars and stuff SDL_Event m_input_event; private: }; #endif //BEHAVIOUR_SCRIPT_HPP
29.52381
134
0.568817
N4G170
8f1820ee1e7f321c33bc7a0da2708585b1656a87
693
hpp
C++
include/Core/Mathf.hpp
Ursanon/RayTracing
8cc51b9b7845ccd2ef99704d7cfebc301f36b315
[ "MIT" ]
2
2020-01-06T14:31:16.000Z
2020-01-07T08:15:51.000Z
include/Core/Mathf.hpp
Ursanon/RayTracing
8cc51b9b7845ccd2ef99704d7cfebc301f36b315
[ "MIT" ]
null
null
null
include/Core/Mathf.hpp
Ursanon/RayTracing
8cc51b9b7845ccd2ef99704d7cfebc301f36b315
[ "MIT" ]
null
null
null
#ifndef MATHF_HPP_ #define MATHF_HPP_ #include "Core/Vector3.hpp" namespace rt { namespace mathf { static constexpr float PI = 3.14159265358979f; float clamp(const float& value, const float& min, const float& max); float clamp01(const float& value); float lerp(const float& a, const float& b, const float t); float schlick_approx(const float& n1, const float& n2, const float& cosine); /** * checks is value between minimum (exclusive) and maximum (exclusive) * @returns */ template<typename T> bool is_between(const T& value, const T& minimum, const T& maximum) { return value > minimum && value < maximum; } } } #endif // !MATHF_HPP_
21.65625
78
0.678211
Ursanon
8f1cd44c1eb759fa35bf34a340e431fe4dc1a4fb
14,367
cpp
C++
matlab/panoContext_code/Toolbox/SketchTokens-master/toolbox/channels/private/gradientMex.cpp
imamik/LayoutNet
f68eb214e793b9786f2582f9244bac4f8f98a816
[ "MIT" ]
380
2018-02-23T02:58:35.000Z
2022-03-21T06:34:33.000Z
matlab/panoContext_code/Toolbox/SketchTokens-master/toolbox/channels/private/gradientMex.cpp
imamik/LayoutNet
f68eb214e793b9786f2582f9244bac4f8f98a816
[ "MIT" ]
36
2018-04-11T03:49:42.000Z
2021-01-21T01:25:47.000Z
matlab/panoContext_code/Toolbox/SketchTokens-master/toolbox/channels/private/gradientMex.cpp
imamik/LayoutNet
f68eb214e793b9786f2582f9244bac4f8f98a816
[ "MIT" ]
94
2018-02-25T05:23:51.000Z
2022-02-11T02:00:47.000Z
/******************************************************************************* * Piotr's Image&Video Toolbox Version 3.00 * Copyright 2012 Piotr Dollar & Ron Appel. [pdollar-at-caltech.edu] * Please email me if you find bugs, or have suggestions or questions! * Licensed under the Simplified BSD License [see external/bsd.txt] *******************************************************************************/ #include "wrappers.hpp" #include <math.h> #include "string.h" #include "sse.hpp" #define PI 3.1415926535897931f // compute x and y gradients for just one column (uses sse) void grad1( float *I, float *Gx, float *Gy, int h, int w, int x ) { int y, y1; float *Ip, *In, r; __m128 *_Ip, *_In, *_G, _r; // compute column of Gx Ip=I-h; In=I+h; r=.5f; if(x==0) { r=1; Ip+=h; } else if(x==w-1) { r=1; In-=h; } if( h<4 || h%4>0 || (size_t(I)&15) || (size_t(Gx)&15) ) { for( y=0; y<h; y++ ) *Gx++=(*In++-*Ip++)*r; } else { _G=(__m128*) Gx; _Ip=(__m128*) Ip; _In=(__m128*) In; _r = SET(r); for(y=0; y<h; y+=4) *_G++=MUL(SUB(*_In++,*_Ip++),_r); } // compute column of Gy #define GRADY(r) *Gy++=(*In++-*Ip++)*r; Ip=I; In=Ip+1; // GRADY(1); Ip--; for(y=1; y<h-1; y++) GRADY(.5f); In--; GRADY(1); y1=((~((size_t) Gy) + 1) & 15)/4; if(y1==0) y1=4; if(y1>h-1) y1=h-1; GRADY(1); Ip--; for(y=1; y<y1; y++) GRADY(.5f); _r = SET(.5f); _G=(__m128*) Gy; for(; y+4<h-1; y+=4, Ip+=4, In+=4, Gy+=4) *_G++=MUL(SUB(LDu(*In),LDu(*Ip)),_r); for(; y<h-1; y++) GRADY(.5f); In--; GRADY(1); #undef GRADY } // compute x and y gradients at each location (uses sse) void grad2( float *I, float *Gx, float *Gy, int h, int w, int d ) { int o, x, c, a=w*h; for(c=0; c<d; c++) for(x=0; x<w; x++) { o=c*a+x*h; grad1( I+o, Gx+o, Gy+o, h, w, x ); } } // build lookup table a[] s.t. a[dx/2.02*n]~=acos(dx) float* acosTable() { int i, n=25000, n2=n/2; float t, ni; static float a[25000]; static bool init=false; if( init ) return a+n2; ni = 2.02f/(float) n; for( i=0; i<n; i++ ) { t = i*ni - 1.01f; t = t<-1 ? -1 : (t>1 ? 1 : t); t = (float) acos( t ); a[i] = (t <= PI-1e-5f) ? t : 0; } init=true; return a+n2; } // compute gradient magnitude and orientation at each location (uses sse) void gradMag( float *I, float *M, float *O, int h, int w, int d ) { int x, y, y1, c, h4, s; float *Gx, *Gy, *M2; __m128 *_Gx, *_Gy, *_M2, _m; float *acost = acosTable(), acMult=25000/2.02f; // allocate memory for storing one column of output (padded so h4%4==0) h4=(h%4==0) ? h : h-(h%4)+4; s=d*h4*sizeof(float); M2=(float*) alMalloc(s,16); _M2=(__m128*) M2; Gx=(float*) alMalloc(s,16); _Gx=(__m128*) Gx; Gy=(float*) alMalloc(s,16); _Gy=(__m128*) Gy; // compute gradient magnitude and orientation for each column for( x=0; x<w; x++ ) { // compute gradients (Gx, Gy) and squared magnitude (M2) for each channel for( c=0; c<d; c++ ) grad1( I+x*h+c*w*h, Gx+c*h4, Gy+c*h4, h, w, x ); for( y=0; y<d*h4/4; y++ ) _M2[y]=ADD(MUL(_Gx[y],_Gx[y]),MUL(_Gy[y],_Gy[y])); // store gradients with maximum response in the first channel for(c=1; c<d; c++) { for( y=0; y<h4/4; y++ ) { y1=h4/4*c+y; _m = CMPGT( _M2[y1], _M2[y] ); _M2[y] = OR( AND(_m,_M2[y1]), ANDNOT(_m,_M2[y]) ); _Gx[y] = OR( AND(_m,_Gx[y1]), ANDNOT(_m,_Gx[y]) ); _Gy[y] = OR( AND(_m,_Gy[y1]), ANDNOT(_m,_Gy[y]) ); } } // compute gradient mangitude (M) and normalize Gx for( y=0; y<h4/4; y++ ) { _m = MIN( RCPSQRT(_M2[y]), SET(1e10f) ); _M2[y] = RCP(_m); _Gx[y] = MUL( MUL(_Gx[y],_m), SET(acMult) ); _Gx[y] = XOR( _Gx[y], AND(_Gy[y], SET(-0.f)) ); }; memcpy( M+x*h, M2, h*sizeof(float) ); // compute and store gradient orientation (O) via table lookup if(O!=0) for( y=0; y<h; y++ ) O[x*h+y] = acost[(int)Gx[y]]; } alFree(Gx); alFree(Gy); alFree(M2); } // normalize gradient magnitude at each location (uses sse) void gradMagNorm( float *M, float *S, int h, int w, float norm ) { __m128 *_M, *_S, _norm; int i=0, n=h*w, n4=n/4; _S = (__m128*) S; _M = (__m128*) M; _norm = SET(norm); bool sse = !(size_t(M)&15) && !(size_t(S)&15); if(sse) { for(; i<n4; i++) *_M++=MUL(*_M,RCP(ADD(*_S++,_norm))); i*=4; } for(; i<n; i++) M[i] /= (S[i] + norm); } // helper for gradHist, quantize O and M into O0, O1 and M0, M1 (uses sse) void gradQuantize( float *O, float *M, int *O0, int *O1, float *M0, float *M1, int nOrients, int nb, int n, float norm ) { // assumes all *OUTPUT* matrices are 4-byte aligned int i, o0, o1; float o, od, m; __m128i _o0, _o1, *_O0, *_O1; __m128 _o, _o0f, _m, *_M0, *_M1; // define useful constants const float oMult=(float)nOrients/PI; const int oMax=nOrients*nb; const __m128 _norm=SET(norm), _oMult=SET(oMult), _nbf=SET((float)nb); const __m128i _oMax=SET(oMax), _nb=SET(nb); // perform the majority of the work with sse _O0=(__m128i*) O0; _O1=(__m128i*) O1; _M0=(__m128*) M0; _M1=(__m128*) M1; for( i=0; i<=n-4; i+=4 ) { _o=MUL(LDu(O[i]),_oMult); _o0f=CVT(CVT(_o)); _o0=CVT(MUL(_o0f,_nbf)); _o1=ADD(_o0,_nb); _o1=AND(CMPGT(_oMax,_o1),_o1); *_O0++=_o0; *_O1++=_o1; _m=MUL(LDu(M[i]),_norm); *_M1=MUL(SUB(_o,_o0f),_m); *_M0=SUB(_m,*_M1); _M0++; _M1++; } // compute trailing locations without sse for( i; i<n; i++ ) { o=O[i]*oMult; m=M[i]*norm; o0=(int) o; od=o-o0; o0*=nb; o1=o0+nb; if(o1==oMax) o1=0; O0[i]=o0; O1[i]=o1; M1[i]=od*m; M0[i]=m-M1[i]; } } // compute nOrients gradient histograms per bin x bin block of pixels void gradHist( float *M, float *O, float *H, int h, int w, int bin, int nOrients, bool softBin ) { const int hb=h/bin, wb=w/bin, h0=hb*bin, w0=wb*bin, nb=wb*hb; const float s=(float)bin, sInv=1/s, sInv2=1/s/s; float *H0, *H1, *M0, *M1; int x, y; int *O0, *O1; O0=(int*)alMalloc(h*sizeof(int),16); M0=(float*) alMalloc(h*sizeof(float),16); O1=(int*)alMalloc(h*sizeof(int),16); M1=(float*) alMalloc(h*sizeof(float),16); // main loop for( x=0; x<w0; x++ ) { // compute target orientation bins for entire column - very fast gradQuantize( O+x*h, M+x*h, O0, O1, M0, M1, nOrients, nb, h0, sInv2 ); if( !softBin || bin==1 ) { // interpolate w.r.t. orientation only, not spatial bin H1=H+(x/bin)*hb; #define GH H1[O0[y]]+=M0[y]; H1[O1[y]]+=M1[y]; y++; if( bin==1 ) for(y=0; y<h0;) { GH; H1++; } else if( bin==2 ) for(y=0; y<h0;) { GH; GH; H1++; } else if( bin==3 ) for(y=0; y<h0;) { GH; GH; GH; H1++; } else if( bin==4 ) for(y=0; y<h0;) { GH; GH; GH; GH; H1++; } else for( y=0; y<h0;) { for( int y1=0; y1<bin; y1++ ) { GH; } H1++; } #undef GH } else { // interpolate using trilinear interpolation float ms[4], xyd, xb, yb, xd, yd, init; __m128 _m, _m0, _m1; bool hasLf, hasRt; int xb0, yb0; if( x==0 ) { init=(0+.5f)*sInv-0.5f; xb=init; } hasLf = xb>=0; xb0 = hasLf?(int)xb:-1; hasRt = xb0 < wb-1; xd=xb-xb0; xb+=sInv; yb=init; y=0; // macros for code conciseness #define GHinit yd=yb-yb0; yb+=sInv; H0=H+xb0*hb+yb0; xyd=xd*yd; \ ms[0]=1-xd-yd+xyd; ms[1]=yd-xyd; ms[2]=xd-xyd; ms[3]=xyd; #define GH(H,ma,mb) H1=H; STRu(*H1,ADD(LDu(*H1),MUL(ma,mb))); // leading rows, no top bin for( ; y<bin/2; y++ ) { yb0=-1; GHinit; if(hasLf) { H0[O0[y]+1]+=ms[1]*M0[y]; H0[O1[y]+1]+=ms[1]*M1[y]; } if(hasRt) { H0[O0[y]+hb+1]+=ms[3]*M0[y]; H0[O1[y]+hb+1]+=ms[3]*M1[y]; } } // main rows, has top and bottom bins, use SSE for minor speedup for( ; ; y++ ) { yb0 = (int) yb; if(yb0>=hb-1) break; GHinit; _m0=SET(M0[y]); _m1=SET(M1[y]); if(hasLf) { _m=SET(0,0,ms[1],ms[0]); GH(H0+O0[y],_m,_m0); GH(H0+O1[y],_m,_m1); } if(hasRt) { _m=SET(0,0,ms[3],ms[2]); GH(H0+O0[y]+hb,_m,_m0); GH(H0+O1[y]+hb,_m,_m1); } } // final rows, no bottom bin for( ; y<h0; y++ ) { yb0 = (int) yb; GHinit; if(hasLf) { H0[O0[y]]+=ms[0]*M0[y]; H0[O1[y]]+=ms[0]*M1[y]; } if(hasRt) { H0[O0[y]+hb]+=ms[2]*M0[y]; H0[O1[y]+hb]+=ms[2]*M1[y]; } } #undef GHinit #undef GH } } alFree(O0); alFree(O1); alFree(M0); alFree(M1); } // compute HOG features given gradient histograms void hog( float *H, float *G, int h, int w, int bin, int nOrients, float clip ){ float *N, *N1, *H1; int o, x, y, hb=h/bin, wb=w/bin, nb=wb*hb; float eps = 1e-4f/4/bin/bin/bin/bin; // precise backward equality // compute 2x2 block normalization values N = (float*) wrCalloc(nb,sizeof(float)); for( o=0; o<nOrients; o++ ) for( x=0; x<nb; x++ ) N[x]+=H[x+o*nb]*H[x+o*nb]; for( x=0; x<wb-1; x++ ) for( y=0; y<hb-1; y++ ) { N1=N+x*hb+y; *N1=1/float(sqrt( N1[0] + N1[1] + N1[hb] + N1[hb+1] +eps )); } // perform 4 normalizations per spatial block (handling boundary regions) #define U(a,b) Gs[a][y]=H1[y]*N1[y-(b)]; if(Gs[a][y]>clip) Gs[a][y]=clip; for( o=0; o<nOrients; o++ ) for( x=0; x<wb; x++ ) { H1=H+o*nb+x*hb; N1=N+x*hb; float *Gs[4]; Gs[0]=G+o*nb+x*hb; for( y=1; y<4; y++ ) Gs[y]=Gs[y-1]+nb*nOrients; bool lf, md, rt; lf=(x==0); rt=(x==wb-1); md=(!lf && !rt); y=0; if(!rt) U(0,0); if(!lf) U(2,hb); if(lf) for( y=1; y<hb-1; y++ ) { U(0,0); U(1,1); } if(md) for( y=1; y<hb-1; y++ ) { U(0,0); U(1,1); U(2,hb); U(3,hb+1); } if(rt) for( y=1; y<hb-1; y++ ) { U(2,hb); U(3,hb+1); } y=hb-1; if(!rt) U(1,1); if(!lf) U(3,hb+1); } wrFree(N); #undef U } /******************************************************************************/ #ifdef MATLAB_MEX_FILE // Create [hxwxd] mxArray array, initialize to 0 if c=true mxArray* mxCreateMatrix3( int h, int w, int d, mxClassID id, bool c, void **I ){ const int dims[3]={h,w,d}, n=h*w*d; int b; mxArray* M; if( id==mxINT32_CLASS ) b=sizeof(int); else if( id==mxDOUBLE_CLASS ) b=sizeof(double); else if( id==mxSINGLE_CLASS ) b=sizeof(float); else mexErrMsgTxt("Unknown mxClassID."); *I = c ? mxCalloc(n,b) : mxMalloc(n*b); M = mxCreateNumericMatrix(0,0,id,mxREAL); mxSetData(M,*I); mxSetDimensions(M,dims,3); return M; } // Check inputs and outputs to mex, retrieve first input I void checkArgs( int nl, mxArray *pl[], int nr, const mxArray *pr[], int nl0, int nl1, int nr0, int nr1, int *h, int *w, int *d, mxClassID id, void **I ) { const int *dims; int nDims; if( nl<nl0 || nl>nl1 ) mexErrMsgTxt("Incorrect number of outputs."); if( nr<nr0 || nr>nr1 ) mexErrMsgTxt("Incorrect number of inputs."); nDims = mxGetNumberOfDimensions(pr[0]); dims = mxGetDimensions(pr[0]); *h=dims[0]; *w=dims[1]; *d=(nDims==2) ? 1 : dims[2]; *I = mxGetPr(pr[0]); if( nDims!=2 && nDims!=3 ) mexErrMsgTxt("I must be a 2D or 3D array."); if( mxGetClassID(pr[0])!=id ) mexErrMsgTxt("I has incorrect type."); } // [Gx,Gy] = grad2(I) - see gradient2.m void mGrad2( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int h, w, d; float *I, *Gx, *Gy; checkArgs(nl,pl,nr,pr,1,2,1,1,&h,&w,&d,mxSINGLE_CLASS,(void**)&I); if(h<2 || w<2) mexErrMsgTxt("I must be at least 2x2."); pl[0]= mxCreateMatrix3( h, w, d, mxSINGLE_CLASS, 0, (void**) &Gx ); pl[1]= mxCreateMatrix3( h, w, d, mxSINGLE_CLASS, 0, (void**) &Gy ); grad2( I, Gx, Gy, h, w, d ); } // [M,O] = gradMag( I, [channel] ) - see gradientMag.m void mGradMag( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int h, w, d, c; float *I, *M, *O=0; checkArgs(nl,pl,nr,pr,1,2,1,2,&h,&w,&d,mxSINGLE_CLASS,(void**)&I); if(h<2 || w<2) mexErrMsgTxt("I must be at least 2x2."); c = (nr>=2) ? (int) mxGetScalar(pr[1]) : 0; if( c>0 && c<=d ) { I += h*w*(c-1); d=1; } pl[0] = mxCreateMatrix3(h,w,1,mxSINGLE_CLASS,0,(void**)&M); if(nl>=2) pl[1] = mxCreateMatrix3(h,w,1,mxSINGLE_CLASS,0,(void**)&O); gradMag(I, M, O, h, w, d ); } // gradMagNorm( M, S, norm ) - operates on M - see gradientMag.m void mGradMagNorm( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int h, w, d; float *M, *S, norm; checkArgs(nl,pl,nr,pr,0,0,3,3,&h,&w,&d,mxSINGLE_CLASS,(void**)&M); if( mxGetM(pr[1])!=h || mxGetN(pr[1])!=w || d!=1 || mxGetClassID(pr[1])!=mxSINGLE_CLASS ) mexErrMsgTxt("M or S is bad."); S = (float*) mxGetPr(pr[1]); norm = (float) mxGetScalar(pr[2]); gradMagNorm(M,S,h,w,norm); } // H=gradHist(M,O,[bin],[nOrients],[softBin],[useHog],[clip])-see gradientHist.m void mGradHist( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int h, w, d, hb, wb, bin, nOrients; bool softBin, useHog; float *M, *O, *H, *G, clip; checkArgs(nl,pl,nr,pr,1,3,2,7,&h,&w,&d,mxSINGLE_CLASS,(void**)&M); O = (float*) mxGetPr(pr[1]); if( mxGetM(pr[1])!=h || mxGetN(pr[1])!=w || d!=1 || mxGetClassID(pr[1])!=mxSINGLE_CLASS ) mexErrMsgTxt("M or O is bad."); bin = (nr>=3) ? (int) mxGetScalar(pr[2]) : 8; nOrients = (nr>=4) ? (int) mxGetScalar(pr[3]) : 9; softBin = (nr>=5) ? (bool) (mxGetScalar(pr[4])>0) : true; useHog = (nr>=6) ? (bool) (mxGetScalar(pr[5])>0) : false; clip = (nr>=7) ? (float) mxGetScalar(pr[6]) : 0.2f; hb=h/bin; wb=w/bin; if( useHog==false ) { pl[0] = mxCreateMatrix3(hb,wb,nOrients,mxSINGLE_CLASS,1,(void**)&H); gradHist( M, O, H, h, w, bin, nOrients, softBin ); } else { pl[0] = mxCreateMatrix3(hb,wb,nOrients*4,mxSINGLE_CLASS,1,(void**)&G); H = (float*) mxCalloc(wb*hb*nOrients,sizeof(float)); gradHist( M, O, H, h, w, bin, nOrients, softBin ); hog( H, G, h, w, bin, nOrients, clip ); mxFree(H); } } // inteface to various gradient functions (see corresponding Matlab functions) void mexFunction( int nl, mxArray *pl[], int nr, const mxArray *pr[] ) { int f; char action[1024]; f=mxGetString(pr[0],action,1024); nr--; pr++; if(f) mexErrMsgTxt("Failed to get action."); else if(!strcmp(action,"gradient2")) mGrad2(nl,pl,nr,pr); else if(!strcmp(action,"gradientMag")) mGradMag(nl,pl,nr,pr); else if(!strcmp(action,"gradientMagNorm")) mGradMagNorm(nl,pl,nr,pr); else if(!strcmp(action,"gradientHist")) mGradHist(nl,pl,nr,pr); else mexErrMsgTxt("Invalid action."); } #endif
45.46519
81
0.545347
imamik
8f1ced35b5d81a6a885bbc87b442a79de40f711e
838
cc
C++
chrome/browser/extensions/extension_get_views_apitest.cc
SlimKatLegacy/android_external_chromium
bc611cda58cc18d0dbaa8a7aee05eb3c0742e573
[ "BSD-3-Clause" ]
2
2017-09-02T19:08:28.000Z
2021-11-15T15:15:14.000Z
chrome/browser/extensions/extension_get_views_apitest.cc
SlimKatLegacy/android_external_chromium
bc611cda58cc18d0dbaa8a7aee05eb3c0742e573
[ "BSD-3-Clause" ]
2
2017-07-25T09:37:22.000Z
2017-08-04T07:18:56.000Z
chrome/browser/extensions/extension_get_views_apitest.cc
SlimKatLegacy/android_external_chromium
bc611cda58cc18d0dbaa8a7aee05eb3c0742e573
[ "BSD-3-Clause" ]
2
2020-01-12T00:55:53.000Z
2020-11-04T06:36:41.000Z
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" #if defined(TOOLKIT_VIEWS) // Need to port ExtensionInfoBarDelegate::CreateInfoBar() to other platforms. // See http://crbug.com/39916 for details. #define MAYBE_GetViews GetViews #else #define MAYBE_GetViews DISABLED_GetViews #endif IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_GetViews) { // TODO(finnur): Remove once infobars are no longer experimental (bug 39511). CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableExperimentalExtensionApis); ASSERT_TRUE(RunExtensionTest("get_views")) << message_; }
34.916667
79
0.78401
SlimKatLegacy
8f1e4115eb5239c7700383c1296f7c3df9e55f66
1,543
cpp
C++
Framework/Common/Scene.cpp
lishaojiang/GameEngineFromScratch
7769d3916a9ffabcfdaddeba276fdf964d8a86ee
[ "MIT" ]
1,217
2017-08-18T02:41:11.000Z
2022-03-30T01:48:46.000Z
Framework/Common/Scene.cpp
lishaojiang/GameEngineFromScratch
7769d3916a9ffabcfdaddeba276fdf964d8a86ee
[ "MIT" ]
16
2017-09-05T15:04:37.000Z
2021-09-09T13:59:38.000Z
Framework/Common/Scene.cpp
lishaojiang/GameEngineFromScratch
7769d3916a9ffabcfdaddeba276fdf964d8a86ee
[ "MIT" ]
285
2017-08-18T04:53:55.000Z
2022-03-30T00:02:15.000Z
#include "Scene.hpp" using namespace My; using namespace std; shared_ptr<SceneObjectCamera> Scene::GetCamera(const std::string& key) const { auto i = Cameras.find(key); if (i == Cameras.end()) { return nullptr; } return i->second; } shared_ptr<SceneObjectLight> Scene::GetLight(const std::string& key) const { auto i = Lights.find(key); if (i == Lights.end()) { return nullptr; } return i->second; } shared_ptr<SceneObjectGeometry> Scene::GetGeometry( const std::string& key) const { auto i = Geometries.find(key); if (i == Geometries.end()) { return nullptr; } return i->second; } shared_ptr<SceneObjectMaterial> Scene::GetMaterial( const std::string& key) const { auto i = Materials.find(key); if (i == Materials.end()) { return m_pDefaultMaterial; } return i->second; } shared_ptr<SceneObjectMaterial> Scene::GetFirstMaterial() const { return (Materials.empty() ? nullptr : Materials.cbegin()->second); } shared_ptr<SceneGeometryNode> Scene::GetFirstGeometryNode() const { return (GeometryNodes.empty() ? nullptr : GeometryNodes.cbegin()->second.lock()); } shared_ptr<SceneLightNode> Scene::GetFirstLightNode() const { return (LightNodes.empty() ? nullptr : LightNodes.cbegin()->second.lock()); } shared_ptr<SceneCameraNode> Scene::GetFirstCameraNode() const { return (CameraNodes.empty() ? nullptr : CameraNodes.cbegin()->second.lock()); }
25.295082
79
0.642255
lishaojiang
8f2004b70aacac7b0de29fd137144e6d818aada1
1,086
cc
C++
gpu/ipc/service/gpu_memory_tracking.cc
google-ar/chromium
2441c86a5fd975f09a6c30cddb57dfb7fc239699
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
gpu/ipc/service/gpu_memory_tracking.cc
harrymarkovskiy/WebARonARCore
2441c86a5fd975f09a6c30cddb57dfb7fc239699
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
gpu/ipc/service/gpu_memory_tracking.cc
harrymarkovskiy/WebARonARCore
2441c86a5fd975f09a6c30cddb57dfb7fc239699
[ "Apache-2.0", "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gpu/ipc/service/gpu_memory_tracking.h" #include "gpu/ipc/service/gpu_memory_manager.h" namespace gpu { GpuMemoryTrackingGroup::GpuMemoryTrackingGroup( base::ProcessId pid, gles2::MemoryTracker* memory_tracker, GpuMemoryManager* memory_manager) : pid_(pid), size_(0), hibernated_(false), memory_tracker_(memory_tracker), memory_manager_(memory_manager) { } GpuMemoryTrackingGroup::~GpuMemoryTrackingGroup() { memory_manager_->OnDestroyTrackingGroup(this); } void GpuMemoryTrackingGroup::TrackMemoryAllocatedChange(uint64_t old_size, uint64_t new_size) { memory_manager_->TrackMemoryAllocatedChange( this, old_size, new_size); } bool GpuMemoryTrackingGroup::EnsureGPUMemoryAvailable(uint64_t size_needed) { return memory_manager_->EnsureGPUMemoryAvailable(size_needed); } } // namespace gpu
28.578947
77
0.730203
google-ar
8f21f0fcc56d16472b85a71bf04761558672f9d6
1,365
cpp
C++
snap/eclipse-workspace/CMPE320_prototype1/src/CookBook.cpp
ETSnider/PantryPal
8239c37701497195878ec07db37ccca61b23d2bb
[ "MIT" ]
null
null
null
snap/eclipse-workspace/CMPE320_prototype1/src/CookBook.cpp
ETSnider/PantryPal
8239c37701497195878ec07db37ccca61b23d2bb
[ "MIT" ]
null
null
null
snap/eclipse-workspace/CMPE320_prototype1/src/CookBook.cpp
ETSnider/PantryPal
8239c37701497195878ec07db37ccca61b23d2bb
[ "MIT" ]
null
null
null
#include <iostream> #include <string> #include "curl/curl.h" #include "CookBook.h" using namespace std; size_t CookBook::jsonStore(char *data, size_t size, size_t nmemb, std::string *buffer_in) { if (buffer_in != NULL) { // Append the data to the buffer buffer_in->append(data, size * nmemb); // How much did we write? recipe = buffer_in; printf("%c", &recipe); return size * nmemb; } return 0; } int main(int argc, char* argv[]) { curl_global_init(CURL_GLOBAL_ALL); CURL* easyHandle = curl_easy_init(); CURLcode res; struct curl_slist* headers = NULL; headers = curl_slist_append(headers, "Content-Type: application/json"); if (easyHandle) { curl_easy_setopt(easyHandle, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(easyHandle, CURLOPT_URL, "https://api.spoonacular.com/recipes/complexSearch?query=pasta&maxFat=25&number=2"); curl_easy_setopt(easyHandle, CURLOPT_HTTPGET, 1); //curl_easy_setopt(easyHandle, CURLOPT_WRITEFUNCTION, jsonStore); res = curl_easy_perform(easyHandle); if (res != CURLE_OK) { fprintf(stderr, "something went wrong\n"); } } curl_slist_free_all(headers); curl_easy_cleanup(easyHandle); return 0; }
30.333333
135
0.627839
ETSnider
8f2681bacb7b8b1a14831f640dd17f67c4523c3b
3,224
cpp
C++
src/vkfw_core/gfx/vk/rt/TopLevelAccelerationStructure.cpp
dasmysh/VulkanFramework_Lib
baeaeb3158d23187f2ffa5044e32d8a5145284aa
[ "MIT" ]
null
null
null
src/vkfw_core/gfx/vk/rt/TopLevelAccelerationStructure.cpp
dasmysh/VulkanFramework_Lib
baeaeb3158d23187f2ffa5044e32d8a5145284aa
[ "MIT" ]
null
null
null
src/vkfw_core/gfx/vk/rt/TopLevelAccelerationStructure.cpp
dasmysh/VulkanFramework_Lib
baeaeb3158d23187f2ffa5044e32d8a5145284aa
[ "MIT" ]
null
null
null
/** * @file TopLevelAccelerationStructure.cpp * @author Sebastian Maisch <sebastian.maisch@googlemail.com> * @date 2020.11.22 * * @brief Implementation of the top level acceleration structure. */ #include "gfx/vk/rt/TopLevelAccelerationStructure.h" namespace vkfw_core::gfx::rt { TopLevelAccelerationStructure::TopLevelAccelerationStructure(vkfw_core::gfx::LogicalDevice* device, std::string_view name, vk::BuildAccelerationStructureFlagsKHR flags) : AccelerationStructure{device, name, vk::AccelerationStructureTypeKHR::eTopLevel, flags} { } TopLevelAccelerationStructure::TopLevelAccelerationStructure(TopLevelAccelerationStructure&& rhs) noexcept = default; TopLevelAccelerationStructure& TopLevelAccelerationStructure::operator=(TopLevelAccelerationStructure&& rhs) noexcept = default; TopLevelAccelerationStructure::~TopLevelAccelerationStructure() {} void TopLevelAccelerationStructure::AddBottomLevelAccelerationStructureInstance( const vk::AccelerationStructureInstanceKHR& blasInstance) { m_blasInstances.emplace_back(blasInstance); } void TopLevelAccelerationStructure::BuildAccelerationStructure(CommandBuffer& cmdBuffer) { m_instancesBuffer = std::make_unique<HostBuffer>(GetDevice(), fmt::format("InstanceBuffer:{}", GetName()), vk::BufferUsageFlagBits::eShaderDeviceAddress | vk::BufferUsageFlagBits::eAccelerationStructureBuildInputReadOnlyKHR); m_instancesBuffer->InitializeData(m_blasInstances); PipelineBarrier barrier{GetDevice()}; vk::AccelerationStructureGeometryInstancesDataKHR asGeometryDataInstances{ VK_FALSE, m_instancesBuffer->GetDeviceAddressConst( vk::AccessFlagBits2KHR::eAccelerationStructureRead, vk::PipelineStageFlagBits2KHR::eAccelerationStructureBuild, barrier)}; vk::AccelerationStructureGeometryDataKHR asGeometryData{asGeometryDataInstances}; vk::AccelerationStructureGeometryKHR asGeometry{vk::GeometryTypeKHR::eInstances, asGeometryData, vk::GeometryFlagBitsKHR::eOpaque}; vk::AccelerationStructureBuildRangeInfoKHR asBuildRange{static_cast<std::uint32_t>(m_blasInstances.size()), 0x0, 0, 0x0}; AddGeometry(asGeometry, asBuildRange); barrier.Record(cmdBuffer); AccelerationStructure::BuildAccelerationStructure(cmdBuffer); } void TopLevelAccelerationStructure::FinalizeBuild() { m_instancesBuffer = nullptr; AccelerationStructure::FinalizeBuild(); } vk::AccelerationStructureKHR TopLevelAccelerationStructure::GetAccelerationStructure( vk::AccessFlags2KHR access, vk::PipelineStageFlags2KHR pipelineStages, PipelineBarrier& barrier) const { AccessBarrier(access, pipelineStages, barrier); return GetHandle(); } }
42.986667
117
0.674007
dasmysh
8f28b3303d2326c37d05846fc0b98bef81410ee8
5,480
cc
C++
IDE/TVHelpWindow.cc
paule32/forth2asm
b1208581cd94017f8207b4b3bff28f0bce81ff7e
[ "MIT" ]
null
null
null
IDE/TVHelpWindow.cc
paule32/forth2asm
b1208581cd94017f8207b4b3bff28f0bce81ff7e
[ "MIT" ]
1
2019-12-09T00:20:36.000Z
2019-12-09T00:20:36.000Z
IDE/TVHelpWindow.cc
paule32/forth2asm
b1208581cd94017f8207b4b3bff28f0bce81ff7e
[ "MIT" ]
1
2019-11-30T15:10:31.000Z
2019-11-30T15:10:31.000Z
// -------------------------------------------------------------------------------- // MIT License // // Copyright (c) 2019 Jens Kallup // // 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 <assert.h> #include "zlib.h" #include "TVHelpWindow.h" #include "TVTranspiller.h" #include <algorithm> #include <iostream> #include <iterator> #include <vector> #include "help.h" using namespace std; //const int maxLineLength = maxViewWidth+1; const int maxLines = 100; char *Lines[maxLines]; int LineCount = 0; extern bool helpActive; extern class TVTranspillerApplicationIDE *IDEapp; static short winNumber = 0; TVHelpWindow::TVHelpWindow(TRect r) : TWindowInit( &TVHelpWindow::initFrame ) , TWindow(r, "Help", winNumber++) { check_zip("debug.hlp"); options |= ofTileable | ofFramed; state |= sfCursorVis; TRect rec(getExtent()); rec.grow(-1, -1); TVHelpViewer *viewer = new TVHelpViewer(rec , standardScrollBar(sbHorizontal | sbHandleKeyboard) , standardScrollBar(sbVertical | sbHandleKeyboard)); insert(viewer); /* TRect er(getExtent()); er.grow(-1,-1); TEditWindow *editor = new TEditWindow(er,0,100); insert(editor); */ } void TVHelpWindow::check_zip(std::string filename) { // ---------------- // write help() ... // ---------------- std::string helpstr = "Hallo und Willkommen!"; class help_header *hdr = new help_header; hdr->file_type = 0x1949; hdr->version_ = 0x1501; hdr->entry_point = 0x0201; hdr->password = std::string("passkey"); hdr->password_len = hdr->password.size(); hdr->topics_no = 1; class help_topic *top1 = new help_topic; top1->topic_idx = 1; top1->topic_str = std::string("Index"); top1->topic_len_str = std::string("Index").size(); top1->topic_txt = helpstr; top1->topic_len_txt = top1->topic_txt.size(); std::ofstream out(filename, std::ofstream::binary); boost::archive::binary_oarchive oa(out); oa << hdr; oa << top1; out.close(); delete top1; delete hdr; } TVHelpViewer::~TVHelpViewer() { helpActive = false; } Boolean TVHelpViewer::valid(ushort) { return isValid; } TVHelpViewer::TVHelpViewer( const TRect& bounds, TScrollBar *aHScrollBar, TScrollBar *aVScrollBar) : TScroller( bounds, aHScrollBar, aVScrollBar ) { growMode = gfGrowHiX | gfGrowHiY; options |= ofSelectable; eventMask = evMouseDown | evKeyDown | evCommand | evBroadcast; showCursor(); isValid = True; } void TVHelpViewer::scrollDraw() { TScroller::scrollDraw(); draw(); } void TVHelpViewer::draw() // modified for scroller { static int disp = 0; char buffer[2048]; ushort color = getColor(0x0301); if (disp == 0) { disp = 1; std::ifstream in("fort.hlp", std::ifstream::binary); boost::archive::binary_iarchive ia(in); class help_header *hdr = new help_header; class help_topic *top = new help_topic; ia >> hdr; ia >> top; strcpy(buffer,top->topic_str.c_str()); } cout << buffer << endl; TDrawBuffer db; char c; int i = 0; while ((c = buffer[i])) { db.moveChar(i++, c, color, 1); } #ifdef _OLDDDD_ ushort color = getColor(0x0301); char buffer[20]; for( int i = 0; i < size.y; i++ ) // for each line: { sprintf(buffer,"%6d",i+1); TDrawBuffer b,c,d; //b.moveStr(0, buffer, color, 6); //c.moveChar(0, 133, color, 1); d.moveChar(0, ' ', color, size.x); // fill line buffer with spaces int j = delta.y + i; // delta is scroller offset if( j < LineCount && Lines[j] != 0 ) { char s[maxLineLength]; if( delta.x > (int)strlen(Lines[j] ) ) s[0] = EOS; else { strncpy( s, Lines[j]+delta.x, size.x ); s[size.x] = EOS; } b.moveCStr( 0, s, color ); } //writeLine(0, i, 6, 1, b); //writeLine(6, i, 2, 1, c); //writeLine(7, i, size.x, 1, d); writeLine(0, i, size.x, 1, d); } #endif } void TVHelpViewer::handleEvent(TEvent &event) { TScroller::handleEvent(event); }
25.253456
83
0.593978
paule32
8f2db0876d17a72f47a07f75f108b783d3d869d1
1,792
hpp
C++
include/node.hpp
Kazz47/cs445
eb991eda50e395a2f10ea943eabe7f74b30f38f7
[ "MIT" ]
null
null
null
include/node.hpp
Kazz47/cs445
eb991eda50e395a2f10ea943eabe7f74b30f38f7
[ "MIT" ]
null
null
null
include/node.hpp
Kazz47/cs445
eb991eda50e395a2f10ea943eabe7f74b30f38f7
[ "MIT" ]
null
null
null
#ifndef NODE_H #define NODE_H #include <cstddef> #include <iostream> #include <vector> #include "stream.hpp" #include <glog/logging.h> enum class Topology {RING, GRID, CUBE, SIZE}; class Node { private: size_t x; size_t y; size_t z; size_t iteration; size_t num_packets_to_send; size_t num_packets_to_receive; bool ready_to_compute = false; double mean_iteration_time = 0; double previous_iteration_duration = 0; double previous_compute_time = 0; double total_wait_time = 0; double total_compute_time = 0; size_t current_iteration_packets = 0; size_t next_iteration_packets = 0; // Out-bound queues std::vector<Stream*> streams; public: Node(size_t x, size_t y, size_t z, size_t iteration, size_t num_packets_to_send, size_t num_packets_to_receive); ~Node(); size_t getX(); size_t getY(); size_t getZ(); size_t getIteration(); size_t getNumPacketsToSend(); bool readyToCompute(); double getWaitTime(); double getComputeTime(); double getComputeRatio(); void startNextIteration(); void updateComputeTime(double sim_time, double compute_duration); void receivePacket(Packet* packet); Stream* enqueuePacket(Packet* packet, Topology topology, size_t num_nodes); Node* getNextNode(Stream *stream, Topology topology, size_t num_nodes, std::vector<std::vector<std::vector<Node*>*>*> node_mat); void writeStats(size_t pass_num); bool operator==(const Node& j) const; bool operator!=(const Node& j) const; friend std::ostream& operator<< (std::ostream& out, Node& node); }; #endif //NODE_H
27.569231
136
0.643415
Kazz47
8f2deded733a34983b8dd130499b2a5b23a713d0
3,136
cpp
C++
source/graphics/texture.cpp
TheCandianVendingMachine/TacticalShooter
3ef34a0cb7be3db75e31e19b3ed3e3ff3804f67f
[ "MIT" ]
null
null
null
source/graphics/texture.cpp
TheCandianVendingMachine/TacticalShooter
3ef34a0cb7be3db75e31e19b3ed3e3ff3804f67f
[ "MIT" ]
null
null
null
source/graphics/texture.cpp
TheCandianVendingMachine/TacticalShooter
3ef34a0cb7be3db75e31e19b3ed3e3ff3804f67f
[ "MIT" ]
null
null
null
#include "texture.hpp" #include <stb_image.h> #include <glad/glad.h> #include <utility> void texture::loadFromMemoryInternal(unsigned char *pixels, bool useSRGB) { glGenTextures(1, &m_id); glBindTexture(GL_TEXTURE_2D, m_id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if (pixels) { constexpr GLint possibleFormats[] = { GL_NONE, GL_RED, GL_RG, GL_RGB, GL_RGBA }; GLint sourceFormat = possibleFormats[m_channels]; GLint destFormat = possibleFormats[m_channels]; if (useSRGB) { sourceFormat = GL_SRGB; if (m_channels == 4) { sourceFormat = GL_SRGB_ALPHA; destFormat = GL_RGBA; } } glTexImage2D(GL_TEXTURE_2D, 0, sourceFormat, width, height, 0, destFormat, GL_UNSIGNED_BYTE, pixels); glGenerateMipmap(GL_TEXTURE_2D); } } texture::texture(const char *file, bool useSRGB) { loadFromFile(file, useSRGB); } texture::texture(const texture &rhs) { *this = rhs; } texture::texture(texture &&rhs) { *this = std::move(rhs); } void texture::loadFromFile(const char *file, bool useSRGB) { stbi_set_flip_vertically_on_load(true); unsigned char *pixels = stbi_load(file, &m_width, &m_height, &m_channels, 0); loadFromMemoryInternal(pixels, useSRGB); stbi_image_free(pixels); } void texture::loadFromMemory(unsigned char *pixels, std::size_t length, bool useSRGB) { unsigned char *memoryPixels = stbi_load_from_memory(pixels, length, &m_width, &m_height, &m_channels, 0); loadFromMemoryInternal(memoryPixels, useSRGB); stbi_image_free(memoryPixels); } void texture::bind(int textureUnit) const { glActiveTexture(textureUnit); glBindTexture(GL_TEXTURE_2D, id); } texture &texture::operator=(const texture &rhs) { if (&rhs != this) { m_width = rhs.width; m_height = rhs.height; m_channels = rhs.channels; m_id = rhs.id; type = rhs.type; } return *this; } texture &texture::operator=(texture &&rhs) { if (&rhs != this) { m_width = std::move(rhs.m_width); m_height = std::move(rhs.m_height); m_channels = std::move(rhs.m_channels); m_id = std::move(rhs.m_id); type = std::move(rhs.type); } return *this; }
29.866667
117
0.539222
TheCandianVendingMachine
8f30bbcccb1590e21c60c0666869d0ea9baa0d33
19,940
cpp
C++
lib/AFE-APIs/AFE-API-MQTT-Standard.cpp
lukasz-pekala/AFE-Firmware
59e10dd2f9665ba816c22905e63eaa60ec8fda09
[ "MIT" ]
null
null
null
lib/AFE-APIs/AFE-API-MQTT-Standard.cpp
lukasz-pekala/AFE-Firmware
59e10dd2f9665ba816c22905e63eaa60ec8fda09
[ "MIT" ]
null
null
null
lib/AFE-APIs/AFE-API-MQTT-Standard.cpp
lukasz-pekala/AFE-Firmware
59e10dd2f9665ba816c22905e63eaa60ec8fda09
[ "MIT" ]
null
null
null
/* AFE Firmware for smart home devices, Website: https://afe.smartnydom.pl/ */ #include "AFE-API-MQTT-Standard.h" #ifndef AFE_CONFIG_API_DOMOTICZ_ENABLED AFEAPIMQTTStandard::AFEAPIMQTTStandard() : AFEAPI(){}; #ifdef AFE_CONFIG_HARDWARE_LED void AFEAPIMQTTStandard::begin(AFEDataAccess *Data, AFEDevice *Device, AFELED *Led) { AFEAPI::begin(Data, Device, Led); } #else void AFEAPIMQTTStandard::begin(AFEDataAccess *Data, AFEDevice *Device) { AFEAPI::begin(Data, Device); } #endif void AFEAPIMQTTStandard::listener() { if (Mqtt.listener()) { #ifdef AFE_CONFIG_API_PROCESS_REQUESTS processRequest(); #endif } } void AFEAPIMQTTStandard::synchronize() { #ifdef DEBUG Serial << endl << F("INFO: Sending current device state to MQTT Broker ..."); #endif Mqtt.publish(Mqtt.configuration.lwt.topic, "connected"); /* Synchronize: Relay */ #ifdef AFE_CONFIG_HARDWARE_RELAY for (uint8_t i = 0; i < _Device->configuration.noOfRelays; i++) { if (!_Relay[i]->setRelayAfterRestoringMQTTConnection()) { /* Requesting state from MQTT Broker / service */ Mqtt.publish(_Relay[i]->mqttStateTopic, "get"); } else { /* Updating relay state after setting default value after MQTT connected */ publishRelayState(i); } } #endif /* Synchronize: Switch */ #ifdef AFE_CONFIG_HARDWARE_SWITCH for (uint8_t i = 0; i < _Device->configuration.noOfSwitches; i++) { publishSwitchState(i); } #endif /* Synchronize: Gate */ #ifdef AFE_CONFIG_HARDWARE_GATE for (uint8_t i = 0; i < _Device->configuration.noOfGates; i++) { publishGateState(i); } #endif /* Synchronize: Contactron */ #ifdef AFE_CONFIG_HARDWARE_CONTACTRON for (uint8_t i = 0; i < _Device->configuration.noOfContactrons; i++) { publishContactronState(i); } #endif } void AFEAPIMQTTStandard::subscribe() { #ifdef DEBUG Serial << endl << F("INFO: Subsribing to MQTT Topics ..."); #endif /* Subscribe: Relay */ #ifdef AFE_CONFIG_HARDWARE_RELAY for (uint8_t i = 0; i < _Device->configuration.noOfRelays; i++) { Mqtt.subscribe(_Relay[i]->mqttCommandTopic); if (strlen(_Relay[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _Relay[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_RELAY; currentCacheSize++; } } #endif /* Subscribe: Switch */ #ifdef AFE_CONFIG_HARDWARE_SWITCH for (uint8_t i = 0; i < _Device->configuration.noOfSwitches; i++) { Mqtt.subscribe(_Switch[i]->mqttCommandTopic); if (strlen(_Switch[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _Switch[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_SWITCH; currentCacheSize++; } } #endif /* Subscribe: ADC */ #ifdef AFE_CONFIG_HARDWARE_ADC_VCC if (_Device->configuration.isAnalogInput) { Mqtt.subscribe(_AnalogInput->mqttCommandTopic); if (strlen(_AnalogInput->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _AnalogInput->mqttCommandTopic); mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_ADC; currentCacheSize++; } } #endif /* Subscribe: BMx80 */ #ifdef AFE_CONFIG_HARDWARE_BMEX80 for (uint8_t i = 0; i < _Device->configuration.noOfBMEX80s; i++) { Mqtt.subscribe(_BMx80Sensor[i]->mqttCommandTopic); if (strlen(_BMx80Sensor[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _BMx80Sensor[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_BMX80; currentCacheSize++; } } #endif /* Subscribe: BH1750 */ #ifdef AFE_CONFIG_HARDWARE_BH1750 for (uint8_t i = 0; i < _Device->configuration.noOfBH1750s; i++) { Mqtt.subscribe(_BH1750Sensor[i]->mqttCommandTopic); if (strlen(_BH1750Sensor[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _BH1750Sensor[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_BH1750; currentCacheSize++; } } #endif /* Subscribe: AS3935 */ #ifdef AFE_CONFIG_HARDWARE_AS3935 for (uint8_t i = 0; i < _Device->configuration.noOfAS3935s; i++) { Mqtt.subscribe(_AS3935Sensor[i]->mqttCommandTopic); if (strlen(_AS3935Sensor[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _AS3935Sensor[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_AS3935; currentCacheSize++; } } #endif /* Subscribe: HPMA115S0 */ #ifdef AFE_CONFIG_HARDWARE_HPMA115S0 for (uint8_t i = 0; i < _Device->configuration.noOfHPMA115S0s; i++) { Mqtt.subscribe(_HPMA115S0Sensor[i]->mqttCommandTopic); if (strlen(_HPMA115S0Sensor[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _HPMA115S0Sensor[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_HPMA115S0; currentCacheSize++; } } #endif /* Subscribe: ANEMOMETER */ #ifdef AFE_CONFIG_HARDWARE_ANEMOMETER_SENSOR if (_Device->configuration.noOfAnemometerSensors > 0) { Mqtt.subscribe(_AnemometerSensor->mqttCommandTopic); if (strlen(_AnemometerSensor->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _AnemometerSensor->mqttCommandTopic); mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_ANEMOMETER; currentCacheSize++; } } #endif /* Subscribe: RAIN */ #ifdef AFE_CONFIG_HARDWARE_RAINMETER_SENSOR if (_Device->configuration.noOfRainmeterSensors > 0) { Mqtt.subscribe(_RainmeterSensor->mqttCommandTopic); if (strlen(_RainmeterSensor->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _RainmeterSensor->mqttCommandTopic); mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_RAINMETER; currentCacheSize++; } } #endif /* Subscribe: Contactron */ #ifdef AFE_CONFIG_HARDWARE_CONTACTRON for (uint8_t i = 0; i < _Device->configuration.noOfContactrons; i++) { Mqtt.subscribe(_Contactron[i]->mqttCommandTopic); if (strlen(_Contactron[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _Contactron[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_CONTACTRON; currentCacheSize++; } } #endif /* Subscribe: Contactron */ #ifdef AFE_CONFIG_HARDWARE_GATE for (uint8_t i = 0; i < _Device->configuration.noOfGates; i++) { Mqtt.subscribe(_Gate[i]->mqttCommandTopic); if (strlen(_Gate[i]->mqttCommandTopic) > 0) { sprintf(mqttTopicsCache[currentCacheSize].message.topic, _Gate[i]->mqttCommandTopic); mqttTopicsCache[currentCacheSize].id = i; mqttTopicsCache[currentCacheSize].type = AFE_MQTT_DEVICE_GATE; currentCacheSize++; } } #endif } #ifdef AFE_CONFIG_API_PROCESS_REQUESTS void AFEAPIMQTTStandard::processRequest() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Got message: ") << Mqtt.message.topic << F(" | "); for (uint8_t i = 0; i < Mqtt.message.length; i++) { Serial << (char)Mqtt.message.content[i]; } #endif for (uint8_t i = 0; i < currentCacheSize; i++) { if (strcmp(Mqtt.message.topic, mqttTopicsCache[i].message.topic) == 0) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Found topic in cache: Device Type=") << mqttTopicsCache[i].type; #endif switch (mqttTopicsCache[i].type) { #ifdef AFE_CONFIG_HARDWARE_RELAY case AFE_MQTT_DEVICE_RELAY: // RELAY processRelay(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_SWITCH case AFE_MQTT_DEVICE_SWITCH: processSwitch(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_ADC_VCC case AFE_MQTT_DEVICE_ADC: // ADC processADC(); break; #endif #ifdef AFE_CONFIG_HARDWARE_BH1750 case AFE_MQTT_DEVICE_BH1750: processBH1750(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_BMEX80 case AFE_MQTT_DEVICE_BMX80: processBMEX80(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_AS3935 case AFE_MQTT_DEVICE_AS3935: processAS3935(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_ANEMOMETER_SENSOR case AFE_MQTT_DEVICE_ANEMOMETER: processAnemometerSensor(); break; #endif #ifdef AFE_CONFIG_HARDWARE_RAINMETER_SENSOR case AFE_MQTT_DEVICE_RAINMETER: processRainSensor(); break; #endif #ifdef AFE_CONFIG_HARDWARE_HPMA115S0 case AFE_MQTT_DEVICE_HPMA115S0: processHPMA115S0(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_GATE case AFE_MQTT_DEVICE_GATE: processGate(&mqttTopicsCache[i].id); break; #endif #ifdef AFE_CONFIG_HARDWARE_CONTACTRON case AFE_MQTT_DEVICE_CONTACTRON: processContactron(&mqttTopicsCache[i].id); break; #endif default: #ifdef DEBUG Serial << endl << F("ERROR: Device type ") << mqttTopicsCache[i].type << F(" not found"); #endif break; } break; } } } #endif // AFE_CONFIG_API_PROCESS_REQUESTS #ifdef AFE_CONFIG_HARDWARE_RELAY boolean AFEAPIMQTTStandard::publishRelayState(uint8_t id) { boolean publishStatus = false; if (enabled) { publishStatus = Mqtt.publish(_Relay[id]->mqttStateTopic, _Relay[id]->get() == AFE_RELAY_ON ? "on" : "off"); } return publishStatus; } #endif // AFE_CONFIG_HARDWARE_RELAY #if defined(AFE_CONFIG_HARDWARE_RELAY) && \ defined(AFE_CONFIG_API_PROCESS_REQUESTS) void AFEAPIMQTTStandard::processRelay(uint8_t *id) { boolean publishState = true; #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Relay ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'o' && Mqtt.message.length == 2) { _Relay[*id]->on(); } else if ((char)Mqtt.message.content[0] == 'o' && Mqtt.message.length == 3) { _Relay[*id]->off(); } else if ((char)Mqtt.message.content[0] == 't' && Mqtt.message.length == 6) { _Relay[*id]->toggle(); } else if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { } else { publishState = false; #ifdef DEBUG Serial << endl << F("WARN: MQTT: Command not implemented"); #endif } if (publishState) { publishRelayState(*id); } } #endif // AFE_CONFIG_HARDWARE_RELAY && AFE_CONFIG_API_PROCESS_REQUESTS #ifdef AFE_CONFIG_HARDWARE_SWITCH void AFEAPIMQTTStandard::processSwitch(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Switch ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishSwitchState(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } #endif // AFE_CONFIG_HARDWARE_SWITCH #ifdef AFE_CONFIG_HARDWARE_SWITCH boolean AFEAPIMQTTStandard::publishSwitchState(uint8_t id) { boolean publishStatus = false; if (enabled) { publishStatus = Mqtt.publish(_Switch[id]->mqttStateTopic, _Switch[id]->getPhisicalState() ? "open" : "closed"); } return publishStatus; } #endif // AFE_CONFIG_HARDWARE_SWITCH #ifdef AFE_CONFIG_HARDWARE_ADC_VCC void AFEAPIMQTTStandard::publishADCValues() { if (enabled) { char message[AFE_CONFIG_API_JSON_ADC_DATA_LENGTH]; _AnalogInput->getJSON(message); Mqtt.publish(_AnalogInput->configuration.mqtt.topic, message); } } #endif // AFE_CONFIG_HARDWARE_ADC_VCC #if defined(AFE_CONFIG_HARDWARE_ADC_VCC) && \ defined(AFE_CONFIG_API_PROCESS_REQUESTS) void AFEAPIMQTTStandard::processADC() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing ADC: "); #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishADCValues(); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } #endif // AFE_CONFIG_HARDWARE_ADC_VCC && AFE_CONFIG_API_PROCESS_REQUESTS #ifdef AFE_CONFIG_FUNCTIONALITY_BATTERYMETER void AFEAPIMQTTStandard::processBatteryMeter() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing BatteryMeter: "); #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishBatteryMeterValues(); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishBatteryMeterValues() { boolean _ret = false; if (enabled) { char message[AFE_CONFIG_API_JSON_BATTERYMETER_DATA_LENGTH]; _AnalogInput->getBatteryMeterJSON(message); _ret = Mqtt.publish(_AnalogInput->configuration.battery.mqtt.topic, message); } return _ret; } #endif // AFE_CONFIG_FUNCTIONALITY_BATTERYMETER #ifdef AFE_CONFIG_HARDWARE_BMEX80 void AFEAPIMQTTStandard::processBMEX80(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing BMX80 ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishBMx80SensorData(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishBMx80SensorData(uint8_t id) { boolean publishStatus = false; if (enabled) { char message[AFE_CONFIG_API_JSON_BMEX80_DATA_LENGTH]; _BMx80Sensor[id]->getJSON(message); publishStatus = Mqtt.publish(_BMx80Sensor[id]->configuration.mqtt.topic, message); } return publishStatus; } #endif #ifdef AFE_CONFIG_HARDWARE_HPMA115S0 void AFEAPIMQTTStandard::processHPMA115S0(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing HPMA115S0 ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishHPMA115S0SensorData(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishHPMA115S0SensorData(uint8_t id) { boolean publishStatus = false; if (enabled) { char message[AFE_CONFIG_API_JSON_HPMA115S0_DATA_LENGTH]; _HPMA115S0Sensor[id]->getJSON(message); publishStatus = Mqtt.publish(_HPMA115S0Sensor[id]->configuration.mqtt.topic, message); } return publishStatus; } #endif #ifdef AFE_CONFIG_HARDWARE_BH1750 void AFEAPIMQTTStandard::processBH1750(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing BH1750 ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishBH1750SensorData(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishBH1750SensorData(uint8_t id) { boolean publishStatus = false; if (enabled) { char message[AFE_CONFIG_API_JSON_BH1750_DATA_LENGTH]; _BH1750Sensor[id]->getJSON(message); publishStatus = Mqtt.publish(_BH1750Sensor[id]->configuration.mqtt.topic, message); } return publishStatus; } #endif #ifdef AFE_CONFIG_HARDWARE_AS3935 void AFEAPIMQTTStandard::processAS3935(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing AS3935 ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishAS3935SensorData(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishAS3935SensorData(uint8_t id) { boolean publishStatus = false; if (enabled) { char message[AFE_CONFIG_API_JSON_AS3935_DATA_LENGTH]; _AS3935Sensor[id]->getJSON(message); publishStatus = Mqtt.publish(_AS3935Sensor[id]->configuration.mqtt.topic, message); } return publishStatus; } #endif #ifdef AFE_CONFIG_HARDWARE_ANEMOMETER_SENSOR void AFEAPIMQTTStandard::publishAnemometerSensorData() { if (enabled) { char message[AFE_CONFIG_API_JSON_ANEMOMETER_DATA_LENGTH]; _AnemometerSensor->getJSON(message); Mqtt.publish(_AnemometerSensor->configuration.mqtt.topic, message); } } void AFEAPIMQTTStandard::processAnemometerSensor() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Anemometer: "); #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishAnemometerSensorData(); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } #endif // AFE_CONFIG_HARDWARE_ANEMOMETER_SENSOR #ifdef AFE_CONFIG_HARDWARE_RAINMETER_SENSOR void AFEAPIMQTTStandard::publishRainSensorData() { if (enabled) { char message[AFE_CONFIG_API_JSON_RAINMETER_DATA_LENGTH]; _RainmeterSensor->getJSON(message); Mqtt.publish(_RainmeterSensor->configuration.mqtt.topic, message); } } void AFEAPIMQTTStandard::processRainSensor() { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Rain: "); #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishRainSensorData(); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } #endif // AFE_CONFIG_HARDWARE_RAINMETER_SENSOR #ifdef AFE_CONFIG_HARDWARE_GATE void AFEAPIMQTTStandard::processGate(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Gate ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 't' && Mqtt.message.length == 6) { _Gate[*id]->toggle(); } else if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishGateState(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishGateState(uint8_t id) { boolean publishStatus = false; if (enabled) { uint8_t _state = _Gate[id]->get(); publishStatus = Mqtt.publish(_Gate[id]->mqttStateTopic, _state == AFE_GATE_OPEN ? AFE_MQTT_GATE_OPEN : _state == AFE_GATE_CLOSED ? AFE_MQTT_GATE_CLOSED : _state == AFE_GATE_PARTIALLY_OPEN ? AFE_MQTT_GATE_PARTIALLY_OPEN : AFE_MQTT_GATE_UNKNOWN); } return publishStatus; } #endif // AFE_CONFIG_HARDWARE_GATE #ifdef AFE_CONFIG_HARDWARE_CONTACTRON void AFEAPIMQTTStandard::processContactron(uint8_t *id) { #ifdef DEBUG Serial << endl << F("INFO: MQTT: Processing Contactron ID: ") << *id; #endif if ((char)Mqtt.message.content[0] == 'g' && Mqtt.message.length == 3) { publishContactronState(*id); } #ifdef DEBUG else { Serial << endl << F("WARN: MQTT: Command not implemented"); } #endif } boolean AFEAPIMQTTStandard::publishContactronState(uint8_t id) { boolean publishStatus = false; if (enabled) { publishStatus = Mqtt.publish(_Contactron[id]->mqttStateTopic, _Contactron[id]->get() == AFE_CONTACTRON_OPEN ? AFE_MQTT_CONTACTRON_OPEN : AFE_MQTT_CONTACTRON_CLOSED); } return publishStatus; } #endif // AFE_CONFIG_HARDWARE_CONTACTRON #endif // AFE_CONFIG_API_DOMOTICZ_ENABLED
30.489297
80
0.683751
lukasz-pekala
8f32b6f0fa3f7058f2ba2296338d8bab8e45641f
1,000
cpp
C++
0155_Min Stack.cpp
RickTseng/Cpp_LeetCode
6a710b8abc268eba767bc17d91d046b90a7e34a9
[ "MIT" ]
1
2021-09-13T00:58:59.000Z
2021-09-13T00:58:59.000Z
0155_Min Stack.cpp
RickTseng/Cpp_LeetCode
6a710b8abc268eba767bc17d91d046b90a7e34a9
[ "MIT" ]
null
null
null
0155_Min Stack.cpp
RickTseng/Cpp_LeetCode
6a710b8abc268eba767bc17d91d046b90a7e34a9
[ "MIT" ]
null
null
null
#include <vector> #include <stdio.h> #include <stdlib.h> #include <string> #include <map> #include <algorithm> #include <stack> using namespace std; class MinStack { public: stack<pair<int,int>> rec; MinStack() { } void push(int val) { if(rec.empty()||rec.top().second>=val){ rec.push({val,val}); } else{ rec.push({val,rec.top().second}); } } void pop() { rec.pop(); } int top() { return rec.top().first; } int getMin() { return rec.top().second; } }; /** * Your MinStack object will be instantiated and called as such: * MinStack* obj = new MinStack(); * obj->push(val); * obj->pop(); * int param_3 = obj->top(); * int param_4 = obj->getMin(); * * * -2^31 <= val <= 2^31 - 1 * Methods pop, top and getMin operations will always be called on non-empty stacks. * At most 3 * 10^4 calls will be made to push, pop, top, and getMin. */
19.607843
84
0.54
RickTseng
8f366a1d514f1fc6c8f8f1d16e6c6e2e56c1e447
1,177
cpp
C++
codeforces/gym/PSUT Coding Marathon 2019/g.cpp
tysm/cpsols
262212646203e516d1706edf962290de93762611
[ "MIT" ]
4
2020-10-05T19:24:10.000Z
2021-07-15T00:45:43.000Z
codeforces/gym/PSUT Coding Marathon 2019/g.cpp
tysm/cpsols
262212646203e516d1706edf962290de93762611
[ "MIT" ]
null
null
null
codeforces/gym/PSUT Coding Marathon 2019/g.cpp
tysm/cpsols
262212646203e516d1706edf962290de93762611
[ "MIT" ]
null
null
null
#include <cpplib/stdinc.hpp> int32_t main(){ desync(); int n, b; cin >> n >> b; set<int> st; for(int i=0; i<b; ++i) st.insert(i); vi arr(n); int rep = 0; map<int, int> cnt; for(int &i:arr){ cin >> i; st.erase(i); cnt[i]++; if(cnt[i] == 2) rep++; } reverse(all(arr)); bool ok = false; for(int i=0; i<n and !ok; ++i){ int cur = arr[i]; cnt[cur]--; if(cnt[cur] == 1) rep--; else if(cnt[cur] == 0) st.insert(cur); if(cur == b-1 or rep) continue; auto it = st.upper_bound(cur); if(it == st.end()) continue; ok = true; int res = *it; st.erase(it); arr[i] = res; for(int j=i-1; j>=0; --j){ arr[j] = *st.begin(); st.erase(st.begin()); } } if(ok){ reverse(all(arr)); cout << arr << endl; } else{ vi ans(n+1); ans[0] = 1; ans[1] = 0; for(int i=2; i<n+1; ++i) ans[i] = i; cout << ans << endl; } return 0; }
18.107692
38
0.373832
tysm
8f3a4296444341957903dddfbc0933a8848de5a0
35
hpp
C++
src/boost_static_assert.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
10
2018-03-17T00:58:42.000Z
2021-07-06T02:48:49.000Z
src/boost_static_assert.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
2
2021-03-26T15:17:35.000Z
2021-05-20T23:55:08.000Z
src/boost_static_assert.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
4
2019-05-28T21:06:37.000Z
2021-07-06T03:06:52.000Z
#include <boost/static_assert.hpp>
17.5
34
0.8
miathedev
8f3e6dd6d5ccfa4d82830d586b958c994817d712
1,539
cpp
C++
cpsapi/core/cpsapiContainer.cpp
copasi/copasi-api
3e09ad8b33f602981471104b553ebaf14e9ae4b1
[ "Artistic-2.0" ]
1
2021-04-08T12:39:39.000Z
2021-04-08T12:39:39.000Z
cpsapi/core/cpsapiContainer.cpp
copasi/copasi-api
3e09ad8b33f602981471104b553ebaf14e9ae4b1
[ "Artistic-2.0" ]
1
2021-05-17T15:33:13.000Z
2021-08-30T21:26:04.000Z
cpsapi/core/cpsapiContainer.cpp
copasi/copasi-api
3e09ad8b33f602981471104b553ebaf14e9ae4b1
[ "Artistic-2.0" ]
1
2021-08-13T09:47:49.000Z
2021-08-13T09:47:49.000Z
// BEGIN: Copyright // Copyright (C) 2021 by Pedro Mendes, Rector and Visitors of the // University of Virginia, University of Heidelberg, and University // of Connecticut School of Medicine. // All rights reserved // END: Copyright // BEGIN: License // Licensed under the Artistic License 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 // https://opensource.org/licenses/Artistic-2.0 // END: License #include "cpsapi/core/cpsapiContainer.h" #include <copasi/core/CDataContainer.h> #include <copasi/core/CDataObjectReference.h> #include <copasi/model/CModel.h> #include <algorithm> #include <typeindex> CPSAPI_NAMESPACE_USE // static const cpsapiContainer::Properties cpsapiContainer::SupportedProperties = {}; cpsapiContainer::cpsapiContainer(wrapped * pWrapped, const cpsapiObject::Type & type) : base(pWrapped, type) {} cpsapiContainer::cpsapiContainer(const cpsapiContainer & src) : base(src) {} // virtual cpsapiContainer::~cpsapiContainer() {} // virtual void cpsapiContainer::accept(cpsapiVisitor & visitor) { if (!operator bool()) return; visitor.visit(this, Type::Container); wrapped::objectMap & Objects = static_cast< wrapped * >(getObject())->getObjects(); for (CDataObject * pDataObject : Objects) { std::shared_ptr< cpsapiObject > pObject = cpsapiFactory::make_shared< cpsapiObject >(pDataObject); if (pObject) pObject->accept(visitor); } base::accept(visitor); }
25.229508
104
0.721897
copasi
8f40a6e2659a5f1ab86b44133b9e11fb73f31649
1,776
cpp
C++
test/type_traits/add_rvalue_reference_test.cpp
nekko1119/nek
be43faf5c541fa067ab1e1bcb7a43ebcfefe34e7
[ "BSD-3-Clause" ]
null
null
null
test/type_traits/add_rvalue_reference_test.cpp
nekko1119/nek
be43faf5c541fa067ab1e1bcb7a43ebcfefe34e7
[ "BSD-3-Clause" ]
null
null
null
test/type_traits/add_rvalue_reference_test.cpp
nekko1119/nek
be43faf5c541fa067ab1e1bcb7a43ebcfefe34e7
[ "BSD-3-Clause" ]
null
null
null
#include <nek/type_traits/add_rvalue_reference.hpp> #include <gtest/gtest.h> #include "static_assert.hpp" TEST(add_rvalue_reference_test, normal) { // non-spec, lref, rref STATIC_ASSERT_EQ(nek::add_rvalue_reference<int>::type, int&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int&>::type, int&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int&&>::type, int&&); // cv-spec, lref, rref STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const>::type, int const&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int volatile>::type, int volatile&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const volatile>::type, int const volatile&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const&>::type, int const&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int volatile&>::type, int volatile&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const volatile&>::type, int const volatile&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const&&>::type, int const&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int volatile&&>::type, int volatile&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int const volatile&&>::type, int const volatile&&); // void STATIC_ASSERT_EQ(nek::add_rvalue_reference<void>::type, void); STATIC_ASSERT_EQ(nek::add_rvalue_reference<void const>::type, void const); STATIC_ASSERT_EQ(nek::add_rvalue_reference<void volatile>::type, void volatile); STATIC_ASSERT_EQ(nek::add_rvalue_reference<void const volatile>::type, void const volatile); // others STATIC_ASSERT_EQ(nek::add_rvalue_reference<int*>::type, int*&&); STATIC_ASSERT_EQ(nek::add_rvalue_reference<int[]>::type, int(&&)[]); STATIC_ASSERT_EQ(nek::add_rvalue_reference<void()>::type, void(&&)()); }
48
98
0.736486
nekko1119
8f427b7b609e5b6bb7713da937170ccd47daf325
721
cpp
C++
Algorithms/04-MST/MST/main.cpp
Dinlon5566/CS-learning
e83920b761f487af3ca37811497e795ec01077c7
[ "MIT" ]
null
null
null
Algorithms/04-MST/MST/main.cpp
Dinlon5566/CS-learning
e83920b761f487af3ca37811497e795ec01077c7
[ "MIT" ]
null
null
null
Algorithms/04-MST/MST/main.cpp
Dinlon5566/CS-learning
e83920b761f487af3ca37811497e795ec01077c7
[ "MIT" ]
null
null
null
#include <iostream> #include "bits/stdc++.h" using namespace std; struct edge{ int x,y; int cost; }; int cmp(edge e1,edge e2){ return e1.cost<e2.cost; } int findCost(vector<int>& graph,int n){ if(graph[n]==n) return n; return 0; } int main() { int m,n; cin>>m>>n;//m=edge count,n=line count int todo=m-1; vector<int> graph(m,0); vector<edge> edgepool; for(int i=0;i<m;i++){ graph[i]=i; } int x,y,z; for(int i=0;i<n;i++){ cin>>x>>y>>z; edgepool.push_back({x,y,z}); } for(edge tmp:edgepool){ x=findCost(graph,tmp.x); y=findCost(graph,tmp.y); if(x==y) continue; } return 0; }
15.340426
41
0.51595
Dinlon5566
8f4682ce749e72ae89d9a6d4a8dfea693fb3b0e7
979
cpp
C++
myApps/mylibs/Range.cpp
room7364/EVcalculator
958bd1dd3453ab07939c2783b154181ed2ccdbf7
[ "Zlib", "0BSD" ]
null
null
null
myApps/mylibs/Range.cpp
room7364/EVcalculator
958bd1dd3453ab07939c2783b154181ed2ccdbf7
[ "Zlib", "0BSD" ]
null
null
null
myApps/mylibs/Range.cpp
room7364/EVcalculator
958bd1dd3453ab07939c2783b154181ed2ccdbf7
[ "Zlib", "0BSD" ]
null
null
null
#include "../mylibs/HodlemCalc.h" namespace hc { void Range::gethands(std::string& require) { omp::CardRange range(require); comblist combs = range.combinations(); for (int i = 0; i < combs.size(); i++) { std::string comb = combtostring(combs[i]); addhand(comb, 0.0); } } void Range::getequties(std::string range, std::string board) { for (int i = 0; i < hands.size(); i++) { omp::EquityCalculator ec; std::vector<omp::CardRange> ranges; ranges.push_back(hands[i].getvalue()); ranges.push_back(range); uint64_t board_mask = board == "preflop" ? 0 : omp::CardRange::getCardMask(board); ec.start(ranges, board_mask); ec.wait(); auto results = ec.getResults(); hands[i].setequity(results.equity[0]); std::cout << "hand " << i << "from" << hands.size() << "set\n"; } } }
33.758621
94
0.52809
room7364
8f4a16efa26cfe6874a74b655b2eb0e4287d16a0
12,022
cpp
C++
Nebula-Storm/src/EditorLayer.cpp
GalacticKittenSS/Nebula
1620a1dab815d6721b1ae1e3e390ae16313309da
[ "Apache-2.0" ]
3
2021-11-21T21:05:44.000Z
2021-12-27T20:44:08.000Z
Nebula-Storm/src/EditorLayer.cpp
GalacticKittenSS/Nebula
1620a1dab815d6721b1ae1e3e390ae16313309da
[ "Apache-2.0" ]
null
null
null
Nebula-Storm/src/EditorLayer.cpp
GalacticKittenSS/Nebula
1620a1dab815d6721b1ae1e3e390ae16313309da
[ "Apache-2.0" ]
null
null
null
#include "EditorLayer.h" namespace Nebula { extern const std::filesystem::path s_AssetPath = "assets"; EditorLayer::EditorLayer() : Layer("Editor") { } void EditorLayer::Attach() { NB_PROFILE_FUNCTION(); m_PlayIcon = Texture2D::Create("Resources/Icons/PlayButton.png"); m_StopIcon = Texture2D::Create("Resources/Icons/StopButton.png"); FrameBufferSpecification fbSpec; fbSpec.Attachments = { FramebufferTextureFormat::RGBA8, FramebufferTextureFormat::RED_INT, FramebufferTextureFormat::Depth }; fbSpec.Width = 1280; fbSpec.Height = 720; frameBuffer = FrameBuffer::Create(fbSpec); timer = Timer(); auto commandLineArgs = Application::Get().GetCommandLineArgs(); if (commandLineArgs.Count > 1) { auto sceneFilePath = commandLineArgs[1]; SceneSerializer serializer(m_ActiveScene); serializer.Deserialize(sceneFilePath); } m_EditorCam = EditorCamera(60.0f, 16.0f / 9.0f, 0.01f, 1000.0f); m_ActiveScene = CreateRef<Scene>(); m_ActiveScene->OnViewportResize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_SceneHierarchy.SetContext(m_ActiveScene); SceneSerializer(m_ActiveScene).Deserialize("assets/scenes/PinkCube.nebula"); } void EditorLayer::Detach() { } void EditorLayer::Update(Timestep ts) { NB_PROFILE_FUNCTION(); FrameBufferSpecification spec = frameBuffer->GetFrameBufferSpecifications(); if (m_GameViewSize.x > 0.0f && m_GameViewSize.y > 0.0f && (spec.Width != m_GameViewSize.x || spec.Height != m_GameViewSize.y)) { frameBuffer->Resize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_ActiveScene->OnViewportResize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_EditorCam.SetViewPortSize(m_GameViewSize.x, m_GameViewSize.y); } if (!m_UsingGizmo && m_GameViewHovered && m_SceneState == SceneState::Edit) m_EditorCam.Update(); if (m_GameViewFocus) m_ActiveScene->UpdateRuntime(); } void EditorLayer::Render() { NB_PROFILE_FUNCTION(); frameBuffer->Bind(); RenderCommand::SetClearColour({ 0.1f, 0.1f, 0.1f, 1.0f }); RenderCommand::Clear(); frameBuffer->ClearAttachment(1, -1); switch (m_SceneState) { case SceneState::Edit: { m_ActiveScene->UpdateEditor(m_EditorCam); auto [mx, my] = ImGui::GetMousePos(); mx -= m_ViewPortBounds[0].x; my -= m_ViewPortBounds[0].y; vec2 viewportSize = m_ViewPortBounds[1] - m_ViewPortBounds[0]; my = viewportSize.y - my; if (mx >= 0 && my >= 0 && mx < viewportSize.x && my < viewportSize.y) { int pixelData = frameBuffer->ReadPixel(1, (int)mx, (int)my); m_HoveredEntity = pixelData == -1 ? Entity() : Entity((entt::entity)pixelData, m_ActiveScene.get()); } break; } case SceneState::Play: { m_ActiveScene->RenderRuntime(); break; } } frameBuffer->Unbind(); } void EditorLayer::ImGuiRender() { static bool dockspaceOpen = true; static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None; ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking; ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(viewport->Pos); ImGui::SetNextWindowSize(viewport->Size); ImGui::SetNextWindowViewport(viewport->ID); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove; window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus; ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::Begin("Nebula Storm", &dockspaceOpen, window_flags); ImGui::PopStyleVar(3); ImGuiStyle& style = ImGui::GetStyle(); float minWinSize = style.WindowMinSize.x; style.WindowMinSize.x = 370.0f; ImGuiID dockspace_id = ImGui::GetID("Nebula Storm"); ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags); style.WindowMinSize.x = minWinSize; if (ImGui::BeginMenuBar()) { if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("New", "Ctrl+N")) NewScene(); if (ImGui::MenuItem("Open...", "Ctrl+O")) LoadScene(); if (ImGui::MenuItem("Save As...", "Ctrl+Shift+S")) SaveSceneAs(); if (ImGui::MenuItem("Quit")) Application::Get().Close(); ImGui::EndMenu(); } if (ImGui::BeginMenu("Create Entity")) { if (ImGui::MenuItem("Empty")) auto& sprite = m_ActiveScene->CreateEntity("Entity"); if (ImGui::MenuItem("Sprite")) { auto& sprite = m_ActiveScene->CreateEntity("Sprite"); sprite.AddComponent<SpriteRendererComponent>(); } if (ImGui::MenuItem("Camera")) { auto& sprite = m_ActiveScene->CreateEntity("Camera"); sprite.AddComponent<CameraComponent>(); } ImGui::EndMenu(); } ImGui::EndMenuBar(); } m_SceneHierarchy.OnImGuiRender(); m_ContentBrowser.OnImGuiRender(); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::Begin("Game View", nullptr, ImGuiWindowFlags_NoCollapse); auto viewportMinRegion = ImGui::GetWindowContentRegionMin(); auto viewportMaxRegion = ImGui::GetWindowContentRegionMax(); auto viewportOffset = ImGui::GetWindowPos(); m_ViewPortBounds[0] = { viewportMinRegion.x + viewportOffset.x, viewportMinRegion.y + viewportOffset.y }; m_ViewPortBounds[1] = { viewportMaxRegion.x + viewportOffset.x, viewportMaxRegion.y + viewportOffset.y }; m_GameViewFocus = ImGui::IsWindowFocused(); m_GameViewHovered = ImGui::IsWindowHovered(); Application::Get().GetImGuiLayer()->SetBlockEvents(!m_GameViewFocus && !m_GameViewHovered); ImVec2 panelSize = ImGui::GetContentRegionAvail(); m_GameViewSize = { panelSize.x, panelSize.y }; uint32_t textureID = frameBuffer->GetColourAttachmentRendererID(); ImGui::Image((void*)textureID, panelSize, ImVec2{ 0, 1 }, ImVec2{ 1, 0 }); if (ImGui::BeginDragDropTarget()) { if (const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("CONTENT_BROWSER_ITEM")) { const wchar_t* path = (const wchar_t*)payload->Data; LoadScene(s_AssetPath / path); } ImGui::EndDragDropTarget(); } m_UsingGizmo = ImGuizmo::IsOver(); //Gizmos if (m_SceneState == SceneState::Edit) { Entity selectedEntity = m_SceneHierarchy.GetSelectedEntity(); if (selectedEntity && m_GizmoType != -1) { ImGuizmo::SetOrthographic(false); ImGuizmo::SetDrawlist(); ImGuizmo::SetRect(m_ViewPortBounds[0].x, m_ViewPortBounds[0].y, m_ViewPortBounds[1].x - m_ViewPortBounds[0].x, m_ViewPortBounds[1].y - m_ViewPortBounds[0].y); float windowWidth = (float)ImGui::GetWindowWidth(); float windowHeight = (float)ImGui::GetWindowHeight(); ImGuizmo::SetRect(ImGui::GetWindowPos().x, ImGui::GetWindowPos().y, windowWidth, windowHeight); const mat4& cameraProj = m_EditorCam.GetProjection(); mat4 cameraView = m_EditorCam.GetViewMatrix(); auto& tc = selectedEntity.GetComponent<TransformComponent>(); mat4 transform = tc.CalculateMatrix(); bool snap = Input::IsKeyPressed(Key::LeftControl); float snapValue = 0.25f; if (m_GizmoType == ImGuizmo::OPERATION::ROTATE) snapValue = 22.5f; float snapValues[3] = { snapValue, snapValue, snapValue }; ImGuizmo::Manipulate(value_ptr(cameraView), value_ptr(cameraProj), (ImGuizmo::OPERATION)m_GizmoType, ImGuizmo::LOCAL, value_ptr(transform), nullptr, snap ? snapValues : nullptr); if (ImGuizmo::IsUsing()) { vec3 translation, rotation, scale; DecomposeTransform(transform, translation, rotation, scale); vec3 deltaRotation = rotation - tc.Rotation; tc.Translation = translation; tc.Rotation += deltaRotation; tc.Scale = scale; } } } ImGui::End(); ImGui::PopStyleVar(); UI_Toolbar(); ImGui::End(); } void EditorLayer::UI_Toolbar() { ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 2)); ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); auto& colours = ImGui::GetStyle().Colors; const auto& buttonHovered = colours[ImGuiCol_ButtonHovered]; ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(buttonHovered.x, buttonHovered.y, buttonHovered.z, 0.5f)); const auto& buttonActive = colours[ImGuiCol_ButtonActive]; ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(buttonActive.x, buttonActive.y, buttonActive.z, 0.5f)); ImGui::Begin("##toolbar", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); float size = ImGui::GetWindowHeight() - 4.0f; Ref<Texture2D> icon = m_SceneState == SceneState::Edit ? m_PlayIcon : m_StopIcon; ImGui::SetCursorPosX((ImGui::GetWindowContentRegionMax().x * 0.5f) - (size * 0.5f)); if (ImGui::ImageButton((ImTextureID)icon->GetRendererID(), ImVec2(size, size), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (m_SceneState == SceneState::Edit) OnScenePlay(); else if (m_SceneState == SceneState::Play) OnSceneStop(); } ImGui::PopStyleVar(2); ImGui::PopStyleColor(3); ImGui::End(); } void EditorLayer::OnEvent(Event& e) { m_EditorCam.OnEvent(e); Dispatcher d(e); d.Dispatch<KeyPressedEvent>(BIND_EVENT(EditorLayer::OnKeyPressed)); d.Dispatch<MouseButtonPressedEvent>(BIND_EVENT(EditorLayer::OnMousePressed)); } bool EditorLayer::OnKeyPressed(KeyPressedEvent& e) { if (e.GetRepeatCount() > 0) return false; bool control = Input::IsKeyPressed(KeyCode::LeftControl) || Input::IsKeyPressed(KeyCode::RightControl); bool shift = Input::IsKeyPressed(KeyCode::LeftShift) || Input::IsKeyPressed(KeyCode::RightShift); switch (e.GetKeyCode()) { //Scene Saving/Loading case KeyCode::S: if (control && shift) SaveSceneAs(); break; case KeyCode::N: if (control) NewScene(); break; case KeyCode::O: if (control) LoadScene(); break; //Gizmos case KeyCode::Q: if (!m_UsingGizmo) m_GizmoType = -1; break; case KeyCode::W: if (!m_UsingGizmo) m_GizmoType = ImGuizmo::OPERATION::TRANSLATE; break; case KeyCode::E: if (!m_UsingGizmo) m_GizmoType = ImGuizmo::OPERATION::ROTATE; break; case KeyCode::R: if (!m_UsingGizmo) m_GizmoType = ImGuizmo::OPERATION::SCALE; break; } return true; } bool EditorLayer::OnMousePressed(MouseButtonPressedEvent& e) { if (e.GetMouseButton() == Mouse::Button0 && !m_UsingGizmo && m_GameViewHovered && m_SceneState == SceneState::Edit) m_SceneHierarchy.SetSelectedEntity(m_HoveredEntity); return false; } void EditorLayer::NewScene() { m_ActiveScene = CreateRef<Scene>(); m_ActiveScene->OnViewportResize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_SceneHierarchy.SetContext(m_ActiveScene); m_HoveredEntity = { }; } void EditorLayer::SaveSceneAs() { std::string filepath = FileDialogs::SaveFile("Nebula Scene (*.nebula)\0*.nebula\0"); std::string ending = ".nebula"; if (!equal(ending.rbegin(), ending.rend(), filepath.rbegin())) filepath += ending; if (!filepath.empty()) SceneSerializer(m_ActiveScene).Serialize(filepath); } void EditorLayer::LoadScene() { std::string filepath = FileDialogs::OpenFile("Nebula Scene (*.nebula)\0*.nebula\0"); if (!filepath.empty()) { LoadScene(filepath); } } void EditorLayer::LoadScene(const std::filesystem::path& path) { if (path.extension().string() != ".nebula") { NB_WARN("Could not load {0} - not a scene file", path.filename().string()); return; } Ref<Scene> empty = CreateRef<Scene>(); if (SceneSerializer(empty).Deserialize(path.string())) { m_ActiveScene = empty; m_ActiveScene->OnViewportResize((uint32_t)m_GameViewSize.x, (uint32_t)m_GameViewSize.y); m_SceneHierarchy.SetContext(m_ActiveScene); } } void EditorLayer::OnScenePlay() { m_SceneState = SceneState::Play; } void EditorLayer::OnSceneStop() { m_SceneState = SceneState::Edit; } }
31.553806
162
0.708451
GalacticKittenSS
8f4afcf80ff9c86669cef010ede171adf81acf63
48,325
hpp
C++
test/unittests/lib/validator/validate_Instr_Control_unittest.hpp
yuhao-kuo/WasmVM
b4dcd4f752f07ba4180dc275d47764c363776301
[ "BSD-3-Clause" ]
125
2018-10-22T19:00:25.000Z
2022-03-14T06:33:25.000Z
test/unittests/lib/validator/validate_Instr_Control_unittest.hpp
yuhao-kuo/WasmVM
b4dcd4f752f07ba4180dc275d47764c363776301
[ "BSD-3-Clause" ]
80
2018-10-18T06:35:07.000Z
2020-04-20T02:40:22.000Z
test/unittests/lib/validator/validate_Instr_Control_unittest.hpp
yuhao-kuo/WasmVM
b4dcd4f752f07ba4180dc275d47764c363776301
[ "BSD-3-Clause" ]
27
2018-11-04T12:05:35.000Z
2021-09-06T05:11:50.000Z
#include <skypat/skypat.h> #define _Bool bool extern "C" { #include <stdint.h> #include <stdlib.h> #include <dataTypes/Value.h> #include <dataTypes/vector_p.h> #include <dataTypes/stack_p.h> #include <dataTypes/FuncType.h> #include <structures/instrs/Control.h> #include <structures/WasmFunc.h> #include <structures/WasmTable.h> #include <structures/WasmModule.h> #include <Validates.h> #include <Opcodes.h> #include <Context.h> } #undef _Bool static void clean(stack_p opds, stack_p ctrls) { free_stack_p(opds); free_stack_p(ctrls); } SKYPAT_F(Validate_Instr_nop, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_nop; // Check EXPECT_EQ(validate_Instr_nop(instr, context, opds, ctrls), 0); // Clean free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_block, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_block; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_block(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 2); ctrl_frame* frame = stack_top(ctrl_frame*, ctrls); EXPECT_EQ(vector_size(frame->label_types), 2); EXPECT_EQ(vector_size(frame->end_types), 2); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_loop, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_loop; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_loop(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 2); ctrl_frame* frame = stack_top(ctrl_frame*, ctrls); EXPECT_EQ(vector_size(frame->label_types), 0); EXPECT_EQ(vector_size(frame->end_types), 2); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_if, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_if; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); // Check EXPECT_EQ(validate_Instr_if(instr, context, opds, ctrls), -1); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_if, wrong_type_of_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_if; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_if(instr, context, opds, ctrls), -1); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_if, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_if; ValueType* resType1 = (ValueType*)malloc(sizeof(ValueType)); *resType1 = Value_i32; vector_push_back(instr->resultTypes, resType1); ValueType* resType2 = (ValueType*)malloc(sizeof(ValueType)); *resType2 = Value_i64; vector_push_back(instr->resultTypes, resType2); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_if(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 2); ctrl_frame* frame = stack_top(ctrl_frame*, ctrls); EXPECT_EQ(vector_size(frame->label_types), 2); EXPECT_EQ(vector_size(frame->end_types), 2); // Clean free(resType2); free(resType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_end, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); ValueType* endType2 = (ValueType*)malloc(sizeof(ValueType)); *endType2 = Value_f32; vector_push_back(frame->end_types, endType2); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_end; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 0); EXPECT_EQ(stack_size(opds), 2); // Clean free(endType2); free(endType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_end, no_frame_to_end) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_end; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), -1); // Clean free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_end, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); ValueType* endType2 = (ValueType*)malloc(sizeof(ValueType)); *endType2 = Value_f32; vector_push_back(frame->end_types, endType2); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_end; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), -2); // Clean free(endType2); free(endType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_end, too_much_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_end; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), -3); // Clean free_WasmControlInstr(instr); free(endType1); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_else, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); ValueType* endType2 = (ValueType*)malloc(sizeof(ValueType)); *endType2 = Value_f32; vector_push_back(frame->end_types, endType2); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_else; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_else(instr, context, opds, ctrls), 0); EXPECT_EQ(stack_size(ctrls), 1); EXPECT_EQ(stack_size(opds), 0); // Clean free(endType2); free(endType1); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_else, no_frame_to_end) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_else; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_f32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_else(instr, context, opds, ctrls), -1); // Clean free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_else, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); ValueType* endType2 = (ValueType*)malloc(sizeof(ValueType)); *endType2 = Value_f32; vector_push_back(frame->end_types, endType2); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_else; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_else(instr, context, opds, ctrls), -2); // Clean free_WasmControlInstr(instr); free(endType2); free(endType1); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_else, too_much_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); ctrl_frame* frame = new_ctrl_frame(opds); ValueType* endType1 = (ValueType*)malloc(sizeof(ValueType)); *endType1 = Value_i32; vector_push_back(frame->end_types, endType1); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_else; ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_end(instr, context, opds, ctrls), -3); // Clean free_WasmControlInstr(instr); free(endType1); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_i32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br(instr, context, opds, ctrls), 0); EXPECT_TRUE(frame->unreachable); EXPECT_EQ(stack_size(opds), 0); // Clean free(labelType1); free_WasmControlInstr(instr); free(index); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_i32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br(instr, context, opds, ctrls), -1); // Clean free(labelType1); free_WasmControlInstr(instr); free(index); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_i32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br(instr, context, opds, ctrls), -2); // Clean free(labelType1); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br_if, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_if; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_f32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br_if(instr, context, opds, ctrls), 0); EXPECT_FALSE(frame->unreachable); EXPECT_EQ(stack_size(opds), 1); // Clean free(labelType1); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br_if, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_if; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_br_if(instr, context, opds, ctrls), -1); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_if, no_condition_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_if; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); // Check EXPECT_EQ(validate_Instr_br_if(instr, context, opds, ctrls), -2); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(Validate_Instr_br_if, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_if; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); ValueType* labelType1 = (ValueType*)malloc(sizeof(ValueType)); *labelType1 = Value_f32; vector_push_back(frame->label_types, labelType1); vector_push_back(frame->end_types, labelType1); // Check EXPECT_EQ(validate_Instr_br_if(instr, context, opds, ctrls), -3); // Clean free(labelType1); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), 0); EXPECT_TRUE(frame2->unreachable); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 5; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -1); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, index_in_table_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 5; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -2); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, other_frame_no_enough_label) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); *labelType = Value_f64; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -3); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, other_frame_wrong_type_label) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f64; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); ValueType* opdType2 = (ValueType*)malloc(sizeof(ValueType)); *opdType2 = Value_i32; stack_push(opds, opdType2); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -4); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_f32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -5); // Clean free(labelType); free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_br_table, no_enough_label) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); ctrl_frame* frame = new_ctrl_frame(opds); stack_push(ctrls, frame); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_br_table; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); *index = 0; vector_push_back(instr->indices, index); *index = 1; vector_push_back(instr->indices, index); ValueType* labelType = (ValueType*)malloc(sizeof(ValueType)); *labelType = Value_f32; vector_push_back(frame->label_types, labelType); vector_push_back(frame->end_types, labelType); ctrl_frame* frame1 = new_ctrl_frame(opds); stack_push(ctrls, frame1); *labelType = Value_f32; vector_push_back(frame1->label_types, labelType); vector_push_back(frame1->end_types, labelType); ctrl_frame* frame2 = new_ctrl_frame(opds); stack_push(ctrls, frame2); *labelType = Value_f32; vector_push_back(frame2->label_types, labelType); vector_push_back(frame2->end_types, labelType); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_br_table(instr, context, opds, ctrls), -6); // Clean free(index); free(labelType); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmFunc(func); free_WasmModule(module); } SKYPAT_F(validate_Instr_return, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func = new_WasmFunc(); func->type = 0; FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_return; // Check EXPECT_EQ(validate_Instr_return(instr, context, opds, ctrls), 0); // Clean free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); WasmFunc* func2 = new_WasmFunc(); func2->type = 0; vector_push_back(module->funcs, func2); FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); // Check EXPECT_EQ(validate_Instr_call(instr, context, opds, ctrls), 0); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); WasmFunc* func2 = new_WasmFunc(); func2->type = 0; vector_push_back(module->funcs, func2); FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 2; vector_push_back(instr->indices, index); // Check EXPECT_EQ(validate_Instr_call(instr, context, opds, ctrls), -1); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call_indirect, valid) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); FuncType type = new_FuncType(); vector_push_back(module->types, type); WasmTable* table = (WasmTable*) malloc(sizeof(WasmTable)); table->min = 0; table->max = 1; vector_push_back(module->tables, table); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call_indirect; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_call_indirect(instr, context, opds, ctrls), 0); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call_indirect, no_table) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); FuncType type = new_FuncType(); vector_push_back(module->types, type); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call_indirect; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_call_indirect(instr, context, opds, ctrls), -1); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call_indirect, index_out_of_range) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); FuncType type = new_FuncType(); vector_push_back(module->types, type); WasmTable* table = (WasmTable*) malloc(sizeof(WasmTable)); table->min = 0; table->max = 1; vector_push_back(module->tables, table); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call_indirect; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 1; vector_push_back(instr->indices, index); ValueType* opdType1 = (ValueType*)malloc(sizeof(ValueType)); *opdType1 = Value_i32; stack_push(opds, opdType1); // Check EXPECT_EQ(validate_Instr_call_indirect(instr, context, opds, ctrls), -2); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); } SKYPAT_F(validate_Instr_call_indirect, no_enough_operand) { // Prepare WasmModule* module = new_WasmModule(NULL); WasmFunc* func1 = new_WasmFunc(); func1->type = 0; vector_push_back(module->funcs, func1); FuncType type = new_FuncType(); vector_push_back(module->types, type); WasmTable* table = (WasmTable*) malloc(sizeof(WasmTable)); table->min = 0; table->max = 1; vector_push_back(module->tables, table); Context* context = new_Context(module, func1); stack_p opds = new_stack_p(free); stack_p ctrls = new_stack_p((void (*)(void*))free_ctrl_frame); stack_push(ctrls, new_ctrl_frame(opds)); WasmControlInstr* instr = new_WasmControlInstr(); instr->parent.opcode = Op_call_indirect; uint32_t* index = (uint32_t*) malloc(sizeof(uint32_t)); *index = 0; vector_push_back(instr->indices, index); // Check EXPECT_EQ(validate_Instr_call_indirect(instr, context, opds, ctrls), -4); // Clean free(index); free_WasmControlInstr(instr); clean(opds, ctrls); free_Context(context); free_WasmModule(module); }
31.750986
77
0.691278
yuhao-kuo
8f4cfc93e5f38c6b768bad606f7860ce54e1022f
3,311
cpp
C++
src/GVis/RenderTextureTarget.cpp
matthew-reid/Graphtane
3148039993da185cfb328f89b96c9e5a5b384197
[ "MIT" ]
38
2015-01-01T05:55:38.000Z
2022-03-12T23:19:50.000Z
src/GVis/RenderTextureTarget.cpp
matthew-reid/Graphtane
3148039993da185cfb328f89b96c9e5a5b384197
[ "MIT" ]
1
2019-07-29T21:48:40.000Z
2020-01-13T12:08:08.000Z
src/GVis/RenderTextureTarget.cpp
matthew-reid/Graphtane
3148039993da185cfb328f89b96c9e5a5b384197
[ "MIT" ]
8
2016-04-22T06:41:47.000Z
2021-11-23T23:44:22.000Z
// Copyright (c) 2013-2014 Matthew Paul Reid // 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 "RenderTextureTarget.h" #include "Texture.h" #include "Convert.h" #include <stdexcept> namespace GVis { RenderTextureTarget::RenderTextureTarget(const RenderTextureTargetConfig& config) : m_texture(config.texture), m_techniqueCategory(config.techniqueCategory), m_depthBuffer(0), m_colorAttachmentCount(0) { glGenFramebuffers(1, &m_framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer); // Create depth buffer if (config.attachment == FrameBufferAttachment_Color) { glGenRenderbuffers(1, &m_depthBuffer); glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, config.texture->getWidth(), config.texture->getHeight()); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer); } glFramebufferTexture(GL_FRAMEBUFFER, toGlFrameBufferAttachment(config.attachment), config.texture->_getGlTextureId(), 0); switch(config.attachment) { case FrameBufferAttachment_Color: glDrawBuffer(GL_COLOR_ATTACHMENT0); ++m_colorAttachmentCount; break; case FrameBufferAttachment_Depth: glDrawBuffer(GL_NONE); // No color buffer is drawn to. break; } if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { throw std::runtime_error("Could not create RenderTextureTarget"); } } RenderTextureTarget::~RenderTextureTarget() { if (m_depthBuffer) glDeleteRenderbuffers(1, &m_depthBuffer); glDeleteFramebuffers(1, &m_framebuffer); } void RenderTextureTarget::addColorAttachment(const Texture& texture) { glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffer); glFramebufferTexture(GL_FRAMEBUFFER, toGlFrameBufferAttachment(FrameBufferAttachment_Color) + m_colorAttachmentCount, texture._getGlTextureId(), 0); ++m_colorAttachmentCount; std::vector<GLenum> buffers; for (int i = 0; i < m_colorAttachmentCount; ++i) { buffers.push_back(GL_COLOR_ATTACHMENT0_EXT + i); } assert(!buffers.empty()); glDrawBuffers(m_colorAttachmentCount, &buffers[0]); } int RenderTextureTarget::getWidth() const { return m_texture->getWidth(); } int RenderTextureTarget::getHeight() const { return m_texture->getHeight(); } } // namespace GVis
33.11
149
0.783449
matthew-reid
8f4e48f45b497e56814cc89ad136bb0f25aa47ce
383
cpp
C++
python/extensions/pybind_isce3/cuda/matchtemplate/matchtemplate.cpp
isce3-testing/isce3-circleci-poc
ec1dfb6019bcdc7afb7beee7be0fa0ce3f3b87b3
[ "Apache-2.0" ]
64
2019-08-06T19:22:22.000Z
2022-03-20T17:11:46.000Z
python/extensions/pybind_isce3/cuda/matchtemplate/matchtemplate.cpp
isce-framework/isce3
59cdd2c659a4879367db5537604b0ca93d26b372
[ "Apache-2.0" ]
8
2020-09-01T22:46:53.000Z
2021-11-04T00:05:28.000Z
python/extensions/pybind_isce3/cuda/matchtemplate/matchtemplate.cpp
isce-framework/isce3
59cdd2c659a4879367db5537604b0ca93d26b372
[ "Apache-2.0" ]
29
2019-08-05T21:40:55.000Z
2022-03-23T00:17:03.000Z
#include "matchtemplate.h" #include <isce3/cuda/matchtemplate/pycuampcor/cuAmpcorController.h> #include <isce3/cuda/matchtemplate/pycuampcor/cuAmpcorParameter.h> #include "pycuampcor.h" namespace py = pybind11; void addsubmodule_cuda_matchtemplate(py::module& m) { py::module m_matchtemplate = m.def_submodule("matchtemplate"); addbinding_pycuampcor(m_matchtemplate); }
23.9375
67
0.791123
isce3-testing
8f4e9848506820c86aaf976a1fd9f58a01caa48d
9,447
cc
C++
src/scripting-v8.cc
h0x91b/redis
76b25a2546ed457265df32bee905006eafbad0e5
[ "BSD-3-Clause" ]
null
null
null
src/scripting-v8.cc
h0x91b/redis
76b25a2546ed457265df32bee905006eafbad0e5
[ "BSD-3-Clause" ]
null
null
null
src/scripting-v8.cc
h0x91b/redis
76b25a2546ed457265df32bee905006eafbad0e5
[ "BSD-3-Clause" ]
null
null
null
#include "scripting-v8.h" extern "C" { #include "server.h" #include "cluster.h" } #include <stdio.h> #include <stdlib.h> #include <string.h> #include "libplatform/libplatform.h" #include "v8.h" #include "../deps/hiredis/hiredis.h" using namespace v8; v8::Platform* platform; sds wrapped_script; Isolate* isolate; class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { public: virtual void* Allocate(size_t length) { void* data = AllocateUninitialized(length); return data == NULL ? data : memset(data, 0, length); } virtual void* AllocateUninitialized(size_t length) { return zmalloc(length); } virtual void Free(void* data, size_t) { zfree(data); } }; void redisLog(const v8::FunctionCallbackInfo<v8::Value>& args) { serverLog(LL_NOTICE, "V8 redisLog()"); for (int i = 0; i < args.Length(); i++) { v8::HandleScope handle_scope(args.GetIsolate()); v8::String::Utf8Value str( args[i]->ToString() ); serverLogRaw(LL_NOTICE, *str); } } Local<Value> parseResponse(redisReply *reply) { EscapableHandleScope scope(isolate); Local<Value> resp; Local<Array> arr = Array::New(isolate); switch(reply->type) { case REDIS_REPLY_NIL: resp = Null(isolate); break; case REDIS_REPLY_INTEGER: resp = Integer::New(isolate, reply->integer); break; case REDIS_REPLY_STATUS: case REDIS_REPLY_STRING: resp = String::NewFromUtf8(isolate, reply->str, v8::NewStringType::kNormal, reply->len).ToLocalChecked(); break; case REDIS_REPLY_ARRAY: for (size_t i=0; i<reply->elements; i++) { arr->Set(Integer::New(isolate, i), parseResponse(reply->element[i])); } resp = arr; break; default: serverLog(LL_WARNING, "Redis rotocol error, unknown type %d\n", reply->type); } return scope.Escape(resp); } void redisCall(const v8::FunctionCallbackInfo<v8::Value>& args) { //printf("redisCall %d args\n", args.Length()); HandleScope handle_scope(isolate); client *c = server.v8_client; sds reply = NULL; int reply_len = 0; struct redisCommand *cmd; static robj **argv = NULL; static int argv_size = 0; int argc = args.Length(); redisReader *reader = redisReaderCreate(); redisReply *redisReaderResponse = NULL; v8::Handle<v8::Value> ret_value; int call_flags = CMD_CALL_SLOWLOG | CMD_CALL_STATS; if (argv_size < argc) { argv = (robj **)zrealloc(argv,sizeof(robj*)*argc); argv_size = argc; } for (int i = 0; i < args.Length(); i++) { v8::HandleScope handle_scope(isolate); v8::String::Utf8Value str( args[i]->ToString() ); argv[i] = createStringObject(*str, str.length()); } c->argv = argv; c->argc = argc; /* If this is a Redis Cluster node, we need to make sure Lua is not * trying to access non-local keys, with the exception of commands * received from our master. */ if (server.cluster_enabled && !(server.v8_caller->flags & CLIENT_MASTER)) { /* Duplicate relevant flags in the lua client. */ c->flags &= ~(CLIENT_READONLY|CLIENT_ASKING); c->flags |= server.v8_caller->flags & (CLIENT_READONLY|CLIENT_ASKING); if (getNodeByQuery(c,c->cmd,c->argv,c->argc,NULL,NULL) != server.cluster->myself) { args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, "Lua script attempted to access a non local key in a cluster node", v8::NewStringType::kNormal).ToLocalChecked() )); goto cleanup; } } cmd = lookupCommand((sds)argv[0]->ptr); if (!cmd || ((cmd->arity > 0 && cmd->arity != argc) || (argc < -cmd->arity))) { if (cmd) { args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, "Wrong number of args calling Redis command From Lua script", v8::NewStringType::kNormal).ToLocalChecked() )); } else { args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, "Unknown Redis command called from Lua script", v8::NewStringType::kNormal).ToLocalChecked() )); } goto cleanup; } c->cmd = c->lastcmd = cmd; if (cmd->flags & CMD_NOSCRIPT) { args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, "This Redis command is not allowed from scripts", v8::NewStringType::kNormal).ToLocalChecked() )); goto cleanup; } call(c, call_flags); /* Convert the result of the Redis command into a suitable Lua type. * The first thing we need is to create a single string from the client * output buffers. */ if (listLength(c->reply) == 0 && c->bufpos < PROTO_REPLY_CHUNK_BYTES) { /* This is a fast path for the common case of a reply inside the * client static buffer. Don't create an SDS string but just use * the client buffer directly. */ reply_len = c->bufpos; c->buf[c->bufpos] = '\0'; reply = c->buf; c->bufpos = 0; } else { reply_len = c->bufpos; reply = sdsnewlen(c->buf,c->bufpos); c->bufpos = 0; while(listLength(c->reply)) { sds o = (sds)listNodeValue(listFirst(c->reply)); reply_len += sdslen(o); reply = sdscatsds(reply,o); listDelNode(c->reply,listFirst(c->reply)); } } //printf("reply: `%s`\n", reply); redisReaderFeed(reader, reply, reply_len); redisReaderGetReply(reader, (void**)&redisReaderResponse); if(redisReaderResponse->type == REDIS_REPLY_ERROR) { serverLog(LL_WARNING, "reply error %s", redisReaderResponse->str); args.GetReturnValue().Set(Exception::Error( v8::String::NewFromUtf8(isolate, redisReaderResponse->str, v8::NewStringType::kNormal, redisReaderResponse->len).ToLocalChecked() )); goto cleanup; } else { ret_value = parseResponse(redisReaderResponse); } args.GetReturnValue().Set(ret_value); cleanup: if(redisReaderResponse != NULL) freeReplyObject(redisReaderResponse); redisReaderFree(reader); for (int j = 0; j < c->argc; j++) { robj *o = c->argv[j]; decrRefCount(o); } if (c->argv != argv) { zfree(c->argv); argv = NULL; argv_size = 0; } if(reply != NULL && reply != c->buf) sdsfree(reply); } void initV8() { // Initialize V8. V8::InitializeICU(); // V8::InitializeExternalStartupData(""); ::platform = v8::platform::CreateDefaultPlatform(); V8::InitializePlatform(::platform); V8::Initialize(); wrapped_script = sdsempty(); ArrayBufferAllocator allocator; Isolate::CreateParams create_params; create_params.array_buffer_allocator = &allocator; isolate = Isolate::New(create_params); serverLog(LL_WARNING,"V8 initialized"); } void shutdownV8() { isolate->Dispose(); V8::Dispose(); V8::ShutdownPlatform(); delete ::platform; sdsfree(wrapped_script); serverLog(LL_WARNING,"V8 destroyed"); } void jsEvalCommand(client *c) { Isolate::Scope isolate_scope(isolate); HandleScope handle_scope(isolate); server.v8_caller = c; server.v8_time_start = mstime(); v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate); global->Set( v8::String::NewFromUtf8(isolate, "log", v8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, redisLog) ); global->Set( v8::String::NewFromUtf8(isolate, "redisCall", v8::NewStringType::kNormal).ToLocalChecked(), v8::FunctionTemplate::New(isolate, redisCall) ); Local<Context> context = Context::New(isolate, NULL, global); Context::Scope context_scope(context); //flush previous data wrapped_script[0] = '\0'; sdsupdatelen(wrapped_script); wrapped_script = sdscatlen(wrapped_script, "JSON.stringify((function wrap(){\n", 33); wrapped_script = sdscatlen(wrapped_script, (const char*)c->argv[1]->ptr, sdslen((const sds)c->argv[1]->ptr)); wrapped_script = sdscatlen(wrapped_script, "\n})(), null, '\\t');", 19); Local<String> source = String::NewFromUtf8( isolate, wrapped_script, NewStringType::kNormal, sdslen((const sds)c->argv[1]->ptr) + 33 + 19 ).ToLocalChecked(); TryCatch trycatch(isolate); Local<Script> script; if(!Script::Compile(context, source).ToLocal(&script)) { String::Utf8Value error(trycatch.Exception()); serverLog(LL_WARNING, "JS Compile exception %s\n", *error); addReplyErrorFormat(c, "JS Compile exception %s", *error); return; } Local<Value> result; if(!script->Run(context).ToLocal(&result)) { String::Utf8Value error(trycatch.Exception()); serverLog(LL_WARNING, "JS Runtime exception %s\n", *error); addReplyErrorFormat(c, "JS Runtime exception %s", *error); } else { String::Utf8Value utf8(result); robj *o; o = createObject(OBJ_STRING,sdsnew(*utf8)); addReplyBulk(c,o); decrRefCount(o); } }
33.264085
160
0.614057
h0x91b
8f5043e17e6c193b0aa74680cf975a43c80b2b56
89,815
hpp
C++
Blocks/Game/Assets/bh22.hpp
salindersidhu/Blocks
b36c916717873cf43e61afb4e978d65025953a33
[ "MIT" ]
5
2018-06-16T06:54:59.000Z
2021-12-23T15:24:42.000Z
Blocks/Game/Assets/bh22.hpp
salindersidhu/Blocks
b36c916717873cf43e61afb4e978d65025953a33
[ "MIT" ]
1
2016-01-15T08:04:18.000Z
2016-01-15T08:04:18.000Z
Blocks/Game/Assets/bh22.hpp
SalinderSidhu/Blocks
b36c916717873cf43e61afb4e978d65025953a33
[ "MIT" ]
null
null
null
#ifndef BH22_HPP #define BH22_HPP static const unsigned char bh22[] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x39, 0x08, 0x06, 0x00, 0x00, 0x00, 0x15, 0xCC, 0x98, 0x75, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0B, 0x13, 0x00, 0x00, 0x0B, 0x13, 0x01, 0x00, 0x9A, 0x9C, 0x18, 0x00, 0x00, 0x0A, 0x4F, 0x69, 0x43, 0x43, 0x50, 0x50, 0x68, 0x6F, 0x74, 0x6F, 0x73, 0x68, 0x6F, 0x70, 0x20, 0x49, 0x43, 0x43, 0x20, 0x70, 0x72, 0x6F, 0x66, 0x69, 0x6C, 0x65, 0x00, 0x00, 0x78, 0xDA, 0x9D, 0x53, 0x67, 0x54, 0x53, 0xE9, 0x16, 0x3D, 0xF7, 0xDE, 0xF4, 0x42, 0x4B, 0x88, 0x80, 0x94, 0x4B, 0x6F, 0x52, 0x15, 0x08, 0x20, 0x52, 0x42, 0x8B, 0x80, 0x14, 0x91, 0x26, 0x2A, 0x21, 0x09, 0x10, 0x4A, 0x88, 0x21, 0xA1, 0xD9, 0x15, 0x51, 0xC1, 0x11, 0x45, 0x45, 0x04, 0x1B, 0xC8, 0xA0, 0x88, 0x03, 0x8E, 0x8E, 0x80, 0x8C, 0x15, 0x51, 0x2C, 0x0C, 0x8A, 0x0A, 0xD8, 0x07, 0xE4, 0x21, 0xA2, 0x8E, 0x83, 0xA3, 0x88, 0x8A, 0xCA, 0xFB, 0xE1, 0x7B, 0xA3, 0x6B, 0xD6, 0xBC, 0xF7, 0xE6, 0xCD, 0xFE, 0xB5, 0xD7, 0x3E, 0xE7, 0xAC, 0xF3, 0x9D, 0xB3, 0xCF, 0x07, 0xC0, 0x08, 0x0C, 0x96, 0x48, 0x33, 0x51, 0x35, 0x80, 0x0C, 0xA9, 0x42, 0x1E, 0x11, 0xE0, 0x83, 0xC7, 0xC4, 0xC6, 0xE1, 0xE4, 0x2E, 0x40, 0x81, 0x0A, 0x24, 0x70, 0x00, 0x10, 0x08, 0xB3, 0x64, 0x21, 0x73, 0xFD, 0x23, 0x01, 0x00, 0xF8, 0x7E, 0x3C, 0x3C, 0x2B, 0x22, 0xC0, 0x07, 0xBE, 0x00, 0x01, 0x78, 0xD3, 0x0B, 0x08, 0x00, 0xC0, 0x4D, 0x9B, 0xC0, 0x30, 0x1C, 0x87, 0xFF, 0x0F, 0xEA, 0x42, 0x99, 0x5C, 0x01, 0x80, 0x84, 0x01, 0xC0, 0x74, 0x91, 0x38, 0x4B, 0x08, 0x80, 0x14, 0x00, 0x40, 0x7A, 0x8E, 0x42, 0xA6, 0x00, 0x40, 0x46, 0x01, 0x80, 0x9D, 0x98, 0x26, 0x53, 0x00, 0xA0, 0x04, 0x00, 0x60, 0xCB, 0x63, 0x62, 0xE3, 0x00, 0x50, 0x2D, 0x00, 0x60, 0x27, 0x7F, 0xE6, 0xD3, 0x00, 0x80, 0x9D, 0xF8, 0x99, 0x7B, 0x01, 0x00, 0x5B, 0x94, 0x21, 0x15, 0x01, 0xA0, 0x91, 0x00, 0x20, 0x13, 0x65, 0x88, 0x44, 0x00, 0x68, 0x3B, 0x00, 0xAC, 0xCF, 0x56, 0x8A, 0x45, 0x00, 0x58, 0x30, 0x00, 0x14, 0x66, 0x4B, 0xC4, 0x39, 0x00, 0xD8, 0x2D, 0x00, 0x30, 0x49, 0x57, 0x66, 0x48, 0x00, 0xB0, 0xB7, 0x00, 0xC0, 0xCE, 0x10, 0x0B, 0xB2, 0x00, 0x08, 0x0C, 0x00, 0x30, 0x51, 0x88, 0x85, 0x29, 0x00, 0x04, 0x7B, 0x00, 0x60, 0xC8, 0x23, 0x23, 0x78, 0x00, 0x84, 0x99, 0x00, 0x14, 0x46, 0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 0x08, 0x9E, 0xC1, 0x28, 0xBC, 0x81, 0x09, 0x04, 0x41, 0xC8, 0x08, 0x13, 0x61, 0x21, 0xDA, 0x88, 0x01, 0x62, 0x8A, 0x58, 0x23, 0x8E, 0x08, 0x17, 0x99, 0x85, 0xF8, 0x21, 0xC1, 0x48, 0x04, 0x12, 0x8B, 0x24, 0x20, 0xC9, 0x88, 0x14, 0x51, 0x22, 0x4B, 0x91, 0x35, 0x48, 0x31, 0x52, 0x8A, 0x54, 0x20, 0x55, 0x48, 0x1D, 0xF2, 0x3D, 0x72, 0x02, 0x39, 0x87, 0x5C, 0x46, 0xBA, 0x91, 0x3B, 0xC8, 0x00, 0x32, 0x82, 0xFC, 0x86, 0xBC, 0x47, 0x31, 0x94, 0x81, 0xB2, 0x51, 0x3D, 0xD4, 0x0C, 0xB5, 0x43, 0xB9, 0xA8, 0x37, 0x1A, 0x84, 0x46, 0xA2, 0x0B, 0xD0, 0x64, 0x74, 0x31, 0x9A, 0x8F, 0x16, 0xA0, 0x9B, 0xD0, 0x72, 0xB4, 0x1A, 0x3D, 0x8C, 0x36, 0xA1, 0xE7, 0xD0, 0xAB, 0x68, 0x0F, 0xDA, 0x8F, 0x3E, 0x43, 0xC7, 0x30, 0xC0, 0xE8, 0x18, 0x07, 0x33, 0xC4, 0x6C, 0x30, 0x2E, 0xC6, 0xC3, 0x42, 0xB1, 0x38, 0x2C, 0x09, 0x93, 0x63, 0xCB, 0xB1, 0x22, 0xAC, 0x0C, 0xAB, 0xC6, 0x1A, 0xB0, 0x56, 0xAC, 0x03, 0xBB, 0x89, 0xF5, 0x63, 0xCF, 0xB1, 0x77, 0x04, 0x12, 0x81, 0x45, 0xC0, 0x09, 0x36, 0x04, 0x77, 0x42, 0x20, 0x61, 0x1E, 0x41, 0x48, 0x58, 0x4C, 0x58, 0x4E, 0xD8, 0x48, 0xA8, 0x20, 0x1C, 0x24, 0x34, 0x11, 0xDA, 0x09, 0x37, 0x09, 0x03, 0x84, 0x51, 0x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ersidhu
8f50dd5c91a9bcfa653793e41df592033a3136b4
3,418
cpp
C++
middleware/transaction/source/manager/admin/server.cpp
tompis/casual
d838716c7052a906af8a19e945a496acdc7899a2
[ "MIT" ]
null
null
null
middleware/transaction/source/manager/admin/server.cpp
tompis/casual
d838716c7052a906af8a19e945a496acdc7899a2
[ "MIT" ]
null
null
null
middleware/transaction/source/manager/admin/server.cpp
tompis/casual
d838716c7052a906af8a19e945a496acdc7899a2
[ "MIT" ]
null
null
null
#include "transaction/manager/admin/server.h" #include "transaction/manager/admin/transform.h" #include "transaction/manager/state.h" #include "transaction/manager/manager.h" #include "transaction/manager/action.h" // // xatmi // #include <xatmi.h> // // sf // #include "sf/server.h" #include "sf/service/interface.h" namespace casual { namespace transaction { namespace admin { namespace local { namespace { casual::sf::server::type server; } } int tpsvrinit(int argc, char **argv) { try { local::server = casual::sf::server::create( argc, argv); } catch( ...) { return -1; } return 0; } void tpsvrdone() { casual::sf::server::sink( local::server); } void transaction_state( TPSVCINFO *serviceInfo, State& state) { casual::sf::service::reply::State reply; try { auto service_io = local::server->createService( serviceInfo); auto serviceReturn = transform::state( state); service_io << CASUAL_MAKE_NVP( serviceReturn); reply = service_io.finalize(); } catch( ...) { local::server->handleException( serviceInfo, reply); } tpreturn( reply.value, reply.code, reply.data, reply.size, reply.flags); } void update_instances( TPSVCINFO *serviceInfo, State& state) { casual::sf::service::reply::State reply; try { auto service_io = local::server->createService( serviceInfo); std::vector< vo::update::Instances> instances; service_io >> CASUAL_MAKE_NVP( instances); auto serviceReturn = action::resource::insances( state, std::move( instances)); service_io << CASUAL_MAKE_NVP( serviceReturn); reply = service_io.finalize(); } catch( ...) { local::server->handleException( serviceInfo, reply); } tpreturn( reply.value, reply.code, reply.data, reply.size, reply.flags); } common::server::Arguments services( State& state) { common::server::Arguments result{ { common::process::path()}}; result.server_init = &tpsvrinit; result.server_done = &tpsvrdone; result.services.emplace_back( ".casual.transaction.state", std::bind( &transaction_state, std::placeholders::_1, std::ref( state)), common::server::Service::Type::cCasualAdmin, common::server::Service::Transaction::none); result.services.emplace_back( ".casual.transaction.update.instances", std::bind( &update_instances, std::placeholders::_1, std::ref( state)), common::server::Service::Type::cCasualAdmin, common::server::Service::Transaction::none); return result; } } // admin } // transaction } // casual
25.132353
107
0.507022
tompis
8f554b17373363848ba03cadd47a7a4c9663306a
111
cpp
C++
source/ashes/renderer/GlRenderer/Core/GlIcdObject.cpp
DragonJoker/Ashes
a6ed950b3fd8fb9626c60b4291fbd52ea75ac66e
[ "MIT" ]
227
2018-09-17T16:03:35.000Z
2022-03-19T02:02:45.000Z
source/ashes/renderer/GlRenderer/Core/GlIcdObject.cpp
DragonJoker/RendererLib
0f8ad8edec1b0929ebd10247d3dd0a9ee8f8c91a
[ "MIT" ]
39
2018-02-06T22:22:24.000Z
2018-08-29T07:11:06.000Z
source/ashes/renderer/GlRenderer/Core/GlIcdObject.cpp
DragonJoker/Ashes
a6ed950b3fd8fb9626c60b4291fbd52ea75ac66e
[ "MIT" ]
8
2019-05-04T10:33:32.000Z
2021-04-05T13:19:27.000Z
/** *\author * Sylvain Doremus */ #include "renderer/GlRenderer/Core/GlIcdObject.hpp" namespace ashes::gl { }
11.1
51
0.711712
DragonJoker
8f59878b1ce6baf080508c86eafba9366174ba30
480
cc
C++
libs/render/src/render/light.cc
madeso/euphoria
59b72d148a90ae7a19e197e91216d4d42f194fd5
[ "MIT" ]
24
2015-07-27T14:32:18.000Z
2021-11-15T12:11:31.000Z
libs/render/src/render/light.cc
madeso/euphoria
59b72d148a90ae7a19e197e91216d4d42f194fd5
[ "MIT" ]
27
2021-07-09T21:18:40.000Z
2021-07-14T13:39:56.000Z
libs/render/src/render/light.cc
madeso/euphoria
59b72d148a90ae7a19e197e91216d4d42f194fd5
[ "MIT" ]
null
null
null
#include "render/light.h" namespace euphoria::render { Light::Light() : light_type(Type::directional) , position(core::Vec3f::zero()) , direction(core::Vec3f {-0.2f, -1.0f, -0.3f}.get_normalized()) , ambient(0.3f) , diffuse(core::NamedColor::white) , specular(core::NamedColor::white) , cutoff_angle_outer(core::Angle::from_degrees(18.0f)) , cutoff_angle_inner(core::Angle::from_degrees(13.37f)) { } }
26.666667
71
0.602083
madeso
8f5a120f2d8abb9e0329b3b1401a8c971b138b82
3,282
hpp
C++
src/matching.hpp
HE-Xinyu/algorithms
009b8a9786192001dab0ce48bf8088a5ff62556e
[ "MIT" ]
1
2020-06-11T11:44:40.000Z
2020-06-11T11:44:40.000Z
src/matching.hpp
HE-Xinyu/algorithms
009b8a9786192001dab0ce48bf8088a5ff62556e
[ "MIT" ]
null
null
null
src/matching.hpp
HE-Xinyu/algorithms
009b8a9786192001dab0ce48bf8088a5ff62556e
[ "MIT" ]
1
2021-01-28T12:30:08.000Z
2021-01-28T12:30:08.000Z
#include <vector> #include <unordered_set> #include "max_flow.hpp" #pragma once using std::vector; using std::pair; using std::unordered_set; class MaximumBipartiteMatching { public: using Edges = vector<pair<int, int>>; /* * elements are edges (u, v) in E. * * It does not need to be (x, y). (y, x) is also fine. * The index should be continuous. */ Edges e; explicit MaximumBipartiteMatching(Edges _e) : e(_e) {} Edges compute() const { /* * Calculate the maximum matching using the Edmonds-Karp (Ford-Fulkerson) algorithm * * Although for normal graphs the time complexity is O(|E|^2 |V|), in bipartite matching it is * O(|E||V|), because there are only O(|V|) augmenting paths. * * We denote the bipartite sets of vertices as X and Y. Suppose X + Y is continuous and starting from 0. * We have source vertex s = |X| + |Y|, t = |X| + |Y| + 1. * We add (s, x) and (y, t) to the graph, each having capacity 1. * * It is guaranteed that if the input edges ((x_1, y_1), (x_2, y_2), ..., (x_n, y_n)) can be separated by * X = unique(x_1, x_2, ... x_n}), Y = unique({y_1, y_2, ... y_n}), * the algorithm will make the desired separation. */ unordered_set<int> X, Y; for (const auto& p : e) { // if u or v has already been added, // the other vertex has no choice. if (X.count(p.first)) { Y.insert(p.second); } else if (X.count(p.second)) { Y.insert(p.first); } else if (Y.count(p.first)) { X.insert(p.second); } else if (Y.count(p.second)) { X.insert(p.first); } else { // either u or v is assigned. // we can choose arbitrarily. X.insert(p.first); Y.insert(p.second); } } // The entire graph contains |X| + |Y| + 2 vertices. size_t total_num = X.size() + Y.size(); int s = static_cast<int>(total_num); int t = static_cast<int>(total_num + 1); vector<vector<int>> adj(total_num + 2); vector<vector<int>> cap(total_num + 2, vector<int>(total_num + 2, 0)); for (const auto& p : e) { int u = p.first, v = p.second; if (X.count(u)) { cap[u][v] = 1; } else { cap[v][u] = 1; } adj[u].push_back(v); adj[v].push_back(u); } for (int x : X) { // x -> s is useless. cap[s][x] = 1; adj[s].push_back(x); } for (int y : Y) { // t -> y is useless. cap[y][t] = 1; adj[y].push_back(t); } EdmondsKarp<int> EK(adj, cap, s, t); EK.compute(); vector<vector<int>> flow = EK.getFlow(); Edges ret; for (int x: X) { for (int y: Y) { if (flow[x][y]) { ret.push_back({ x, y }); } } } return ret; } };
29.303571
114
0.462523
HE-Xinyu
8f5c17999d992a1091bb3bf968c1a82f0831db3a
2,496
cpp
C++
AdamAttack/src/utilities.cpp
TheAdamProject/adams
697cf865725229335c860fe034d02637dbb5deb3
[ "MIT" ]
15
2021-02-23T19:47:15.000Z
2022-02-17T17:23:13.000Z
AdamAttack/src/utilities.cpp
TheAdamProject/adams
697cf865725229335c860fe034d02637dbb5deb3
[ "MIT" ]
1
2021-12-13T07:15:13.000Z
2021-12-22T14:38:42.000Z
AdamAttack/src/utilities.cpp
TheAdamProject/adams
697cf865725229335c860fe034d02637dbb5deb3
[ "MIT" ]
2
2022-02-15T07:05:30.000Z
2022-02-17T17:29:59.000Z
#include "utilities.h" void *Malloc(size_t sz, const char *name) { void *ptr; ptr = malloc(sz); if (!ptr) { fprintf(stderr, "Cannot allocate %zu bytes for %s\n\n", sz, name); exit(EXIT_FAILURE); } return ptr; } void *Calloc(size_t nmemb, size_t size, const char *name){ void *ptr; ptr=calloc(nmemb,size); if (!ptr) { fprintf(stderr, "Cannot allocate %zu bytes for %s\n\n", (nmemb*size), name); exit(EXIT_FAILURE); } return ptr; } FILE *Fopen(const char *path, const char *mode){ FILE *fp = NULL; fp = fopen(path, mode); if (!fp) { fprintf(stderr, "Cannot open file %s...\n", path); exit(EXIT_FAILURE); } return fp; } void Mkdir(char * path, mode_t mode){ int status = 0; status = mkdir(path,mode); if( status != 0 && errno != EEXIST){ fprintf(stderr,"Cannot create dir %s\n",path); exit(EXIT_FAILURE); } } char *printDate(){ time_t now; time(&now); char *timeString = ctime(&now); int l = strlen(timeString); timeString[l-1] ='\0'; return timeString; } namespace fs = std::experimental::filesystem; void getModelFromDir(const char* home, char **modelpath, char **rulespath, float *budget){ char buf[BUFFER_SIZE]; sprintf(buf, "%s/%s", home, MODEL); if(*modelpath == NULL) *modelpath = strdup(buf); sprintf(buf, "%s/%s", home, RULES); if (*rulespath == NULL) *rulespath = strdup(buf); sprintf(buf, "%s/%s", home, PARAMS); if(*budget == 0.0){ FILE *f; if ((f = fopen(buf, "r")) == NULL){ printf("[ERROR] opening PARAMS\n"); exit(1); } if(!fscanf(f,"%f", budget)){ printf("[ERROR] reading PARAMS\n"); exit(1); } fclose(f); } } ssize_t Read(int fd, void *buf, size_t count){ if(count==0){return 0;} ssize_t bs = recv(fd,buf,count,MSG_WAITALL); if(bs == -1){ fprintf(stderr,"[ERROR]: read failed with error %d\n",errno); exit(EXIT_FAILURE); } if(bs != count){ fprintf(stderr,"[WARN]: read returned %lu\n",count); } return bs; } ssize_t Write(int fd, const void *buf, size_t count){ if (count == 0){return 0;} ssize_t bs=send(fd,buf,count,0); if(bs == -1){ fprintf(stderr,"[ERROR]: write failed with error %d\n",errno); exit(EXIT_FAILURE); } if(bs != count){ fprintf(stderr,"[WARN]: write returned %lu\n",count); } return bs; }
21.704348
90
0.564904
TheAdamProject
8f5c58159743f519ace8de6ffb0ca41a2e208252
1,781
hpp
C++
include/boost/url/pct_encoding_types.hpp
TankerHQ/url
336917aca8d09b950b85c2cabdd46375aa0f0fb7
[ "BSL-1.0" ]
null
null
null
include/boost/url/pct_encoding_types.hpp
TankerHQ/url
336917aca8d09b950b85c2cabdd46375aa0f0fb7
[ "BSL-1.0" ]
null
null
null
include/boost/url/pct_encoding_types.hpp
TankerHQ/url
336917aca8d09b950b85c2cabdd46375aa0f0fb7
[ "BSL-1.0" ]
null
null
null
// // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Official repository: https://github.com/CPPAllinace/url // #ifndef BOOST_URL_PCT_ENCODING_TYPES_HPP #define BOOST_URL_PCT_ENCODING_TYPES_HPP #include <boost/url/detail/config.hpp> #include <boost/url/string.hpp> #include <cstddef> namespace boost { namespace urls { /** A valid percent-encoded string */ struct pct_encoded_str { /** A string holding the encoded characters */ string_view str; /** The number of bytes needed to hold the decoded string */ std::size_t decoded_size = 0; }; //------------------------------------------------ /** Options for removing percent-encoding from strings */ struct pct_decode_opts { /** True if null characters are allowed in decoded output */ bool allow_null = true; /** True if PLUS ('+') decodes into SP (space, ' ') @par Specification @li <a href="https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1"> application/x-www-form-urlencoded (w3.org)</a> */ bool plus_to_space = true; /** True if decoding a non-normal string is an error */ bool non_normal_is_error = false; }; //------------------------------------------------ /** Options for applying percent-encoding to strings */ struct pct_encode_opts { /** True if SP (space, ' ') encodes into PLUS ('+') @par Specification @li <a href="https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1"> application/x-www-form-urlencoded (w3.org)</a> */ bool space_to_plus = false; }; } // urls } // boost #endif
23.746667
84
0.628299
TankerHQ
8f5f645cbce8703c935996d09cac977a10b10cff
1,914
cpp
C++
open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CFullPackageElemDoc.cpp
mrehman29/open-vm-tools
03f35e3209b3a73cf8e43a74ac764f22526723a0
[ "X11" ]
2
2020-07-23T06:01:37.000Z
2021-02-25T06:48:42.000Z
open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CFullPackageElemDoc.cpp
mrehman29/open-vm-tools
03f35e3209b3a73cf8e43a74ac764f22526723a0
[ "X11" ]
null
null
null
open-vm-tools/common-agent/Cpp/Framework/Framework/src/Doc/DocDoc/CafInstallRequestDoc/CFullPackageElemDoc.cpp
mrehman29/open-vm-tools
03f35e3209b3a73cf8e43a74ac764f22526723a0
[ "X11" ]
1
2020-11-11T12:54:06.000Z
2020-11-11T12:54:06.000Z
/* * Author: bwilliams * Created: April 6, 2012 * * Copyright (C) 2012-2016 VMware, Inc. All rights reserved. -- VMware Confidential * * */ #include "stdafx.h" #include "Doc/CafInstallRequestDoc/CPackageDefnDoc.h" #include "Doc/CafInstallRequestDoc/CFullPackageElemDoc.h" using namespace Caf; /// A simple container for objects of type FullPackageElem CFullPackageElemDoc::CFullPackageElemDoc() : _index(0), _isInitialized(false) {} CFullPackageElemDoc::~CFullPackageElemDoc() {} /// Initializes the object with everything required by this /// container. Once initialized, this object cannot /// be changed (i.e. it is immutable). void CFullPackageElemDoc::initialize( const int32 index, const std::string packageNamespace, const std::string packageName, const std::string packageVersion, const SmartPtrCPackageDefnDoc installPackage, const SmartPtrCPackageDefnDoc uninstallPackage) { if (! _isInitialized) { _index = index; _packageNamespace = packageNamespace; _packageName = packageName; _packageVersion = packageVersion; _installPackage = installPackage; _uninstallPackage = uninstallPackage; _isInitialized = true; } } /// Accessor for the Index int32 CFullPackageElemDoc::getIndex() const { return _index; } /// Accessor for the PackageNamespace std::string CFullPackageElemDoc::getPackageNamespace() const { return _packageNamespace; } /// Accessor for the PackageName std::string CFullPackageElemDoc::getPackageName() const { return _packageName; } /// Accessor for the PackageVersion std::string CFullPackageElemDoc::getPackageVersion() const { return _packageVersion; } /// Accessor for the InstallPackage SmartPtrCPackageDefnDoc CFullPackageElemDoc::getInstallPackage() const { return _installPackage; } /// Accessor for the UninstallPackage SmartPtrCPackageDefnDoc CFullPackageElemDoc::getUninstallPackage() const { return _uninstallPackage; }
24.227848
85
0.775862
mrehman29
8f62d015c9138d0884ff8618ad7cea3445a664d8
31,826
cxx
C++
ds/adsi/nw312/getobj.cxx
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
ds/adsi/nw312/getobj.cxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
ds/adsi/nw312/getobj.cxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
//--------------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 1992 - 1995 // // File: getobj.cxx // // Contents: NetWare 3.12 GetObject functionality // // History: //---------------------------------------------------------------------------- #include "NWCOMPAT.hxx" #pragma hdrstop //+--------------------------------------------------------------------------- // Function: GetObject // // Synopsis: Called by ResolvePathName to return an object // // Arguments: [LPWSTR szBuffer] // [LPVOID *ppObject] // // Returns: HRESULT // // Modifies: - // // History: 11-Jan-96 t-ptam Created. // //---------------------------------------------------------------------------- HRESULT GetObject( LPWSTR szBuffer, LPVOID * ppObject ) { OBJECTINFO ObjectInfo; POBJECTINFO pObjectInfo = &ObjectInfo; CLexer Lexer(szBuffer); HRESULT hr = S_OK; memset(pObjectInfo, 0, sizeof(OBJECTINFO)); hr = Object(&Lexer, pObjectInfo); BAIL_ON_FAILURE(hr); hr = ValidateProvider(pObjectInfo); BAIL_ON_FAILURE(hr); if (pObjectInfo->NumComponents >= 1) { hr = NWApiLoginToServer(pObjectInfo->ComponentArray[0], NULL, NULL) ; BAIL_ON_FAILURE(hr); } switch (pObjectInfo->ObjectType) { case TOKEN_COMPUTER: hr = GetComputerObject(pObjectInfo, ppObject); break; case TOKEN_USER: hr = GetUserObject(pObjectInfo, ppObject); break; case TOKEN_GROUP: hr = GetGroupObject(pObjectInfo, ppObject); break; case TOKEN_SCHEMA: hr = GetSchemaObject(pObjectInfo, ppObject); break; case TOKEN_CLASS: hr = GetClassObject(pObjectInfo, ppObject); break; case TOKEN_PROPERTY: hr = GetPropertyObject(pObjectInfo, ppObject); break; case TOKEN_SYNTAX: hr = GetSyntaxObject(pObjectInfo, ppObject); break; case TOKEN_FILESERVICE: hr = GetFileServiceObject(pObjectInfo, ppObject); break; case TOKEN_FILESHARE: hr = GetFileShareObject(pObjectInfo, ppObject); break; case TOKEN_PRINTER: hr = GetPrinterObject(pObjectInfo, ppObject); break; default: hr = HeuristicGetObject(pObjectInfo, ppObject); break; } error: FreeObjectInfo( &ObjectInfo, TRUE ); RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: HeuristicGetObject // // Synopsis: Get object of yet undetermined type. // // Arguments: [POBJECTINFO pObjectInfo] // [LPVOID *ppObject] // // Returns: HRESULT // // Modifies: // // History: 11-Jan-96 t-ptam Created. // //---------------------------------------------------------------------------- HRESULT HeuristicGetObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { HRESULT hr = S_OK; // // Case 0: No componenet - Namespace object. // if (pObjectInfo->NumComponents == 0) { RRETURN(GetNamespaceObject(pObjectInfo, ppObject)); } // // Case 1: Single component - Computer object. // if (pObjectInfo->NumComponents == 1) { RRETURN(GetComputerObject(pObjectInfo, ppObject)); } // // Case 2: Two components - FileService object // Group object // Schema object // User object // Printer object // if (pObjectInfo->NumComponents == 2) { hr = GetSchemaObject(pObjectInfo, ppObject); if (FAILED(hr)) { hr = GetUserObject(pObjectInfo, ppObject); if (FAILED(hr)) { hr = GetGroupObject(pObjectInfo, ppObject); if (FAILED(hr)) { hr = GetFileServiceObject(pObjectInfo, ppObject); if (FAILED(hr)) { hr = GetPrinterObject(pObjectInfo, ppObject); } } } } if (FAILED(hr)) { hr = E_ADS_UNKNOWN_OBJECT; } else { RRETURN(S_OK); } } // // Case 3: Three components - FileShare object // Schema Class object // Schema FunctionSet object // Schema Syntax object // if (pObjectInfo->NumComponents == 3) { hr = GetFileShareObject(pObjectInfo, ppObject); if (FAILED(hr)) { if ( _wcsicmp( pObjectInfo->ComponentArray[1], SCHEMA_NAME ) == 0 ){ hr = GetClassObject(pObjectInfo, ppObject); if (FAILED(hr)) { hr = GetPropertyObject(pObjectInfo, ppObject); } if (FAILED(hr)) { hr = GetSyntaxObject(pObjectInfo, ppObject); } } } if (FAILED(hr)) { hr = E_ADS_UNKNOWN_OBJECT; } else { RRETURN(S_OK); } } // // Case 4: Four components - Schema FunctionSetAlias object // Schema Property object // RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetNamespaceObject // // Synopsis: // // Arguments: POBJECTINFO pObjectInfo // LPVOID * ppObject // // Returns: HRESULT // // Modifies: // // History: 04-Mar-96 t-ptam Created. // //---------------------------------------------------------------------------- HRESULT GetNamespaceObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { HRESULT hr = S_OK; hr = ValidateNamespaceObject( pObjectInfo ); BAIL_ON_FAILURE(hr); hr = CoCreateInstance( CLSID_NWCOMPATNamespace, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **)ppObject ); RRETURN(hr); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetComputerObject // // Synopsis: // // Arguments: POBJECTINFO pObjectInfo // LPVOID * ppObject // // Returns: HRESULT // // Modifies: // // History: 11-Jan-96 t-ptam Created. // //---------------------------------------------------------------------------- HRESULT GetComputerObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { HRESULT hr = S_OK; WCHAR ADsParent[MAX_ADS_PATH]; hr = ValidateComputerObject( pObjectInfo ); BAIL_ON_FAILURE(hr); hr = BuildParent( pObjectInfo, ADsParent ); BAIL_ON_FAILURE(hr); hr = CNWCOMPATComputer::CreateComputer( ADsParent, pObjectInfo->ComponentArray[0], ADS_OBJECT_BOUND, IID_IUnknown, ppObject ); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetUserObject // // Synopsis: // // Arguments: POBJECTINFO pObjectInfo // LPVOID * ppObject // // Returns: HRESULT // // Modifies: // // History: 29-Feb-96 t-ptam Created. // //---------------------------------------------------------------------------- HRESULT GetUserObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { HRESULT hr = S_OK; WCHAR ADsParent[MAX_ADS_PATH]; hr = ValidateUserObject( pObjectInfo ); BAIL_ON_FAILURE(hr); hr = BuildParent( pObjectInfo, ADsParent ); BAIL_ON_FAILURE(hr); hr = CNWCOMPATUser::CreateUser( ADsParent, NWCOMPAT_COMPUTER_ID, pObjectInfo->ComponentArray[0], pObjectInfo->ComponentArray[1], ADS_OBJECT_BOUND, IID_IUnknown, ppObject ); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetGroupObject // // Synopsis: // // Arguments: POBJECTINFO pObjectInfo // LPVOID * ppObject // // Returns: HRESULT // // Modifies: // // History: 29-Feb-96 t-ptam Created. // //---------------------------------------------------------------------------- HRESULT GetGroupObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { HRESULT hr = S_OK; WCHAR ADsParent[MAX_ADS_PATH]; hr = ValidateGroupObject( pObjectInfo ); BAIL_ON_FAILURE(hr); hr = BuildParent( pObjectInfo, ADsParent ); BAIL_ON_FAILURE(hr); hr = CNWCOMPATGroup::CreateGroup( ADsParent, NWCOMPAT_COMPUTER_ID, pObjectInfo->ComponentArray[0], pObjectInfo->ComponentArray[1], ADS_OBJECT_BOUND, IID_IUnknown, ppObject ); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetSchemaObject // // Synopsis: // // Arguments: // // Returns: // // Modifies: // // History: 1-17-96 yihsins Created. // //---------------------------------------------------------------------------- HRESULT GetSchemaObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { LPUNKNOWN pUnknown = NULL; WCHAR ADsParent[MAX_ADS_PATH]; HRESULT hr = S_OK; if (pObjectInfo->NumComponents != 2) RRETURN(E_ADS_BAD_PATHNAME); if ( _wcsicmp( pObjectInfo->ComponentArray[1], SCHEMA_NAME ) != 0 ) { hr = E_ADS_BAD_PATHNAME; BAIL_ON_FAILURE(hr); } hr = BuildParent(pObjectInfo, ADsParent); BAIL_ON_FAILURE(hr); hr = CNWCOMPATSchema::CreateSchema( ADsParent, pObjectInfo->ComponentArray[1], ADS_OBJECT_BOUND, IID_IUnknown, (void **)&pUnknown ); BAIL_ON_FAILURE(hr); *ppObject = pUnknown; RRETURN(hr); error: if (pUnknown) pUnknown->Release(); *ppObject = NULL; RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetClassObject // // Synopsis: // // Arguments: // // Returns: // // Modifies: // // History: 1-17-96 yihsins Created. // //---------------------------------------------------------------------------- HRESULT GetClassObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { LPUNKNOWN pUnknown = NULL; WCHAR ADsParent[MAX_ADS_PATH]; HRESULT hr = S_OK; DWORD i; if (pObjectInfo->NumComponents != 3) RRETURN(E_ADS_BAD_PATHNAME); if ( _wcsicmp( pObjectInfo->ComponentArray[1], SCHEMA_NAME ) != 0 ) { hr = E_ADS_BAD_PATHNAME; BAIL_ON_FAILURE(hr); } // // Look for the given class name // for ( i = 0; i < g_cNWCOMPATClasses; i++ ) { if ( _wcsicmp( g_aNWCOMPATClasses[i].bstrName, pObjectInfo->ComponentArray[2] ) == 0 ) break; } if ( i == g_cNWCOMPATClasses ) { // // Class name not found, return error // hr = E_ADS_BAD_PATHNAME; BAIL_ON_FAILURE(hr); } // // Class name found, create and return the object // hr = BuildParent(pObjectInfo, ADsParent); BAIL_ON_FAILURE(hr); hr = CNWCOMPATClass::CreateClass( ADsParent, &g_aNWCOMPATClasses[i], ADS_OBJECT_BOUND, IID_IUnknown, (void **)&pUnknown ); BAIL_ON_FAILURE(hr); *ppObject = pUnknown; RRETURN(hr); error: if (pUnknown) pUnknown->Release(); *ppObject = NULL; RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetSyntaxObject // // Synopsis: // // Arguments: // // Returns: // // Modifies: // // History: 1-17-96 yihsins Created. // //---------------------------------------------------------------------------- HRESULT GetSyntaxObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { LPUNKNOWN pUnknown = NULL; WCHAR ADsParent[MAX_ADS_PATH]; HRESULT hr = S_OK; DWORD i; if (pObjectInfo->NumComponents != 3) RRETURN(E_ADS_BAD_PATHNAME); if ( _wcsicmp( pObjectInfo->ComponentArray[1], SCHEMA_NAME ) != 0 ) { hr = E_ADS_BAD_PATHNAME; BAIL_ON_FAILURE(hr); } // // Look for the given syntax name // for ( i = 0; i < g_cNWCOMPATSyntax; i++ ) { if ( _wcsicmp( g_aNWCOMPATSyntax[i].bstrName, pObjectInfo->ComponentArray[2] ) == 0 ) break; } if ( i == g_cNWCOMPATSyntax ) { // // Syntax name not found, return error // hr = E_ADS_BAD_PATHNAME; BAIL_ON_FAILURE(hr); } // // Syntax name found, create and return the object // hr = BuildParent(pObjectInfo, ADsParent); BAIL_ON_FAILURE(hr); hr = CNWCOMPATSyntax::CreateSyntax( ADsParent, &g_aNWCOMPATSyntax[i], ADS_OBJECT_BOUND, IID_IUnknown, (void **)&pUnknown ); BAIL_ON_FAILURE(hr); *ppObject = pUnknown; RRETURN(hr); error: if (pUnknown) pUnknown->Release(); *ppObject = NULL; RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetPropertyObject // // Synopsis: // // Arguments: // // Returns: // // Modifies: // // History: 1-17-96 yihsins Created. // //---------------------------------------------------------------------------- HRESULT GetPropertyObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { LPUNKNOWN pUnknown = NULL; WCHAR ADsParent[MAX_ADS_PATH]; WCHAR ADsGrandParent[MAX_ADS_PATH]; HRESULT hr = S_OK; DWORD nClass, nProp; if (pObjectInfo->NumComponents != 3) RRETURN(E_ADS_BAD_PATHNAME); if ( _wcsicmp( pObjectInfo->ComponentArray[1], SCHEMA_NAME ) != 0 ) { hr = E_ADS_BAD_PATHNAME; BAIL_ON_FAILURE(hr); } // // We found the specified functional set, now see if we can locate // the given property name // for ( nProp = 0; nProp < g_cNWCOMPATProperties; nProp++ ) { if ( _wcsicmp(g_aNWCOMPATProperties[nProp].szPropertyName, pObjectInfo->ComponentArray[2] ) == 0 ) break; } if ( nProp == g_cNWCOMPATProperties ) { // Return error because the given property name is not found hr = E_ADS_BAD_PATHNAME; BAIL_ON_FAILURE(hr); } // // Property name is found, so create and return the object // hr = BuildParent(pObjectInfo, ADsParent); BAIL_ON_FAILURE(hr); hr = BuildGrandParent(pObjectInfo, ADsGrandParent); BAIL_ON_FAILURE(hr); hr = CNWCOMPATProperty::CreateProperty( ADsParent, &(g_aNWCOMPATProperties[nProp]), ADS_OBJECT_BOUND, IID_IUnknown, (void **)&pUnknown ); BAIL_ON_FAILURE(hr); *ppObject = pUnknown; RRETURN(hr); error: if (pUnknown) pUnknown->Release(); *ppObject = NULL; RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetFileServiceObject // // Synopsis: // // Arguments: POBJECTINFO pObjectInfo // LPVOID * ppObject // // Returns: HRESULT // // Modifies: // // History: 22-Apr-96 t-ptam Created. // //---------------------------------------------------------------------------- HRESULT GetFileServiceObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { HRESULT hr = S_OK; WCHAR ADsParent[MAX_ADS_PATH]; hr = ValidateFileServiceObject( pObjectInfo ); BAIL_ON_FAILURE(hr); hr = BuildParent( pObjectInfo, ADsParent ); BAIL_ON_FAILURE(hr); hr = CNWCOMPATFileService::CreateFileService( ADsParent, pObjectInfo->ComponentArray[0], pObjectInfo->ComponentArray[1], ADS_OBJECT_BOUND, IID_IUnknown, ppObject ); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetFileShareObject // // Synopsis: // // Arguments: POBJECTINFO pObjectInfo // LPVOID * ppObject // // Returns: HRESULT // // Modifies: // // History: 22-Apr-96 t-ptam Created. // //---------------------------------------------------------------------------- HRESULT GetFileShareObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { HRESULT hr = S_OK; WCHAR ADsParent[MAX_ADS_PATH]; hr = ValidateFileShareObject( pObjectInfo ); BAIL_ON_FAILURE(hr); hr = BuildParent( pObjectInfo, ADsParent ); BAIL_ON_FAILURE(hr); hr = CNWCOMPATFileShare::CreateFileShare( ADsParent, pObjectInfo->ComponentArray[2], ADS_OBJECT_BOUND, IID_IUnknown, ppObject ); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: GetPrinterObject // // Synopsis: // // Arguments: POBJECTINFO pObjectInfo // LPVOID * ppObject // // Returns: HRESULT // // Modifies: // // History: 2-May-96 t-ptam Created. // //---------------------------------------------------------------------------- HRESULT GetPrinterObject( POBJECTINFO pObjectInfo, LPVOID * ppObject ) { HRESULT hr = S_OK; WCHAR ADsParent[MAX_ADS_PATH]; hr = ValidatePrinterObject( pObjectInfo ); BAIL_ON_FAILURE(hr); hr = BuildParent( pObjectInfo, ADsParent ); BAIL_ON_FAILURE(hr); hr = CNWCOMPATPrintQueue::CreatePrintQueue( ADsParent, pObjectInfo->ComponentArray[1], ADS_OBJECT_BOUND, IID_IUnknown, ppObject ); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: ValidateNamespaceObject // // Synopsis: // // Arguments: POBJECTINFO pObjectInfo // // Returns: HRESULT // // Modifies: // // History: 16-Jan-96 t-ptam (Patrick) Created. // //---------------------------------------------------------------------------- HRESULT ValidateNamespaceObject( POBJECTINFO pObjectInfo ) { if (!_wcsicmp(pObjectInfo->ProviderName, bstrProviderName)) { } RRETURN(S_OK); } //+--------------------------------------------------------------------------- // Function: ValidateComputerObject // // Synopsis: Validate the existence of a computer object by obtaining // a handle to it. A computer object must exist if a handle // to it can be obtained. // // Arguments: [LPWSTR szComputerName] // // Returns: HRESULT // // Modifies: // // History: 16-Jan-96 t-ptam (Patrick) Created. // //---------------------------------------------------------------------------- HRESULT ValidateComputerObject( POBJECTINFO pObjectInfo ) { // // A handle of a certain bindery can only be obtained if the bindery // exist. Therefore we used this fact to validate the existence of // a computer object. // NWCONN_HANDLE hConn = NULL; HRESULT hr = S_OK; if (pObjectInfo->NumComponents != 1) { RRETURN(E_ADS_BAD_PATHNAME); } // // Try to obtain a handle to a NWCOMPAT Server. // hr = NWApiGetBinderyHandle( &hConn, pObjectInfo->ComponentArray[0] ); BAIL_ON_FAILURE(hr); // // Detach handle. // hr = NWApiReleaseBinderyHandle( hConn ); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: ValidateUserObject // // Synopsis: Validate the existence of a computer object by obtaining // a handle to it. A computer object must exist if a handle // to it can be obtained. // // Arguments: [LPWSTR szComputerName] // // Returns: HRESULT // // Modifies: pObjectInfo->ComponentArray[1] is upper-cased // // History: 29-Feb-96 t-ptam (Patrick) Created. // 29-Jul-96 t-danal Uppercase fix. // // Note: Netware will let you create a lowercase user name but will // internally store only uppercase. However, it will not // return the uppercase user name on a lowercase request. // //---------------------------------------------------------------------------- HRESULT ValidateUserObject( POBJECTINFO pObjectInfo ) { NWCONN_HANDLE hConn = NULL; HRESULT hr = S_OK; DWORD dwResumeObjectID = 0xffffffff; if (pObjectInfo->NumComponents != 2) { RRETURN(E_ADS_BAD_PATHNAME); } // // Obtain a handle to a NetWare Server. // hr = NWApiGetBinderyHandle( &hConn, pObjectInfo->ComponentArray[0] ); BAIL_ON_FAILURE(hr); // // Get the specified (uppercased) user object. // hr = NWApiValidateObject( hConn, OT_USER, _wcsupr(pObjectInfo->ComponentArray[1]), &dwResumeObjectID ); BAIL_ON_FAILURE(hr); error: if (hConn) { NWApiReleaseBinderyHandle(hConn); } RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: ValidateGroupObject // // Synopsis: Validate the existence of a group object by scanning // for it in the bindery. // // Arguments: [POBJECTINFO pObjectInfo] // // Returns: HRESULT // // Modifies: pObjectInfo->ComponentArray[1] is upper-cased // // History: 29-Feb-96 t-ptam (Patrick) Created. // 29-Jul-96 t-danal Uppercase fix. // // Note: Netware will let you create a lowercase user name but will // internally store only uppercase. However, it will not // return the uppercase user name on a lowercase request. // //---------------------------------------------------------------------------- HRESULT ValidateGroupObject( POBJECTINFO pObjectInfo ) { NWCONN_HANDLE hConn = NULL; HRESULT hr = S_OK; DWORD dwResumeObjectID = 0xffffffff; if (pObjectInfo->NumComponents != 2) { RRETURN(E_ADS_BAD_PATHNAME); } // // Obtain a handle to a NetWare Server. // hr = NWApiGetBinderyHandle( &hConn, pObjectInfo->ComponentArray[0] ); BAIL_ON_FAILURE(hr); // // Get the specified (uppercased) group object. // hr = NWApiValidateObject( hConn, OT_USER_GROUP, _wcsupr(pObjectInfo->ComponentArray[1]), &dwResumeObjectID ); BAIL_ON_FAILURE(hr); error: if (hConn) { NWApiReleaseBinderyHandle(hConn); } RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: ValidateFileServiceObject // // Synopsis: // // Arguments: [POBJECTINFO pObjectInfo] // // Returns: HRESULT // // Modifies: // // History: 22-Apr-96 t-ptam (Patrick) Created. // //---------------------------------------------------------------------------- HRESULT ValidateFileServiceObject( POBJECTINFO pObjectInfo ) { // // In NetWare, a FileService object represents a bindery, which is also // represented as a computer object. Therefore validation of file service // object can be done the same way as the computer object. // // // A handle of a certain bindery can only be obtained if the bindery exist. // Therefore we used this fact to validate the existence of a computer // object. // NWCONN_HANDLE hConn = NULL; HRESULT hr = S_OK; if (pObjectInfo->NumComponents != 2) { RRETURN(E_ADS_BAD_PATHNAME); } // // Check for valid NetWare File Server name. // if (_wcsicmp(pObjectInfo->ComponentArray[1], bstrNWFileServiceName)) { RRETURN(E_ADS_BAD_PATHNAME); } // // Try to obtain a handle to a NWCOMPAT Server. // hr = NWApiGetBinderyHandle( &hConn, pObjectInfo->ComponentArray[0] ); BAIL_ON_FAILURE(hr); // // Detach handle. // hr = NWApiReleaseBinderyHandle( hConn ); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: ValidateFileShareObject // // Synopsis: // // Arguments: [POBJECTINFO pObjectInfo] // // Returns: HRESULT // // Modifies: // // History: 29-Apr-96 t-ptam (Patrick) Created. // //---------------------------------------------------------------------------- HRESULT ValidateFileShareObject( POBJECTINFO pObjectInfo ) { HRESULT hr = S_OK; DWORD dwResumeObjectID = 0xffffffff; NWCONN_HANDLE hConn = NULL; NWVOL_NUM VolumeNumber = 0; if (pObjectInfo->NumComponents != 3) { RRETURN(E_ADS_BAD_PATHNAME); } // // Obtain a handle to a NetWare Server. // hr = NWApiGetBinderyHandle( &hConn, pObjectInfo->ComponentArray[0] ); BAIL_ON_FAILURE(hr); // // Try to get the Volume ID that correspond to the Volume name. If it // succeeds, the FileShare is valid. // hr = NWApiGetVolumeNumber( hConn, pObjectInfo->ComponentArray[2], &VolumeNumber ); BAIL_ON_FAILURE(hr); error: if (hConn) { NWApiReleaseBinderyHandle(hConn); } RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: ValidatePrinterObject // // Synopsis: // // Arguments: [POBJECTINFO pObjectInfo] // // Returns: HRESULT // // Modifies: // // History: 2-May-96 t-ptam (Patrick) Created. // //---------------------------------------------------------------------------- HRESULT ValidatePrinterObject( POBJECTINFO pObjectInfo ) { HANDLE hPrinter = NULL; HRESULT hr = S_OK; WCHAR szUncName[MAX_PATH]; if (pObjectInfo->NumComponents != 2) { RRETURN(E_ADS_BAD_PATHNAME); } // // Build UNC name from ObjectInfo. // wsprintf( szUncName, L"\\\\%s\\%s", pObjectInfo->ComponentArray[0], pObjectInfo->ComponentArray[1] ); // // Get a handle of the printer. // hr = NWApiOpenPrinter( szUncName, &hPrinter, PRINTER_ACCESS_USE ); BAIL_ON_FAILURE(hr); // // Release it. // hr = NWApiClosePrinter( hPrinter ); error: RRETURN(hr); } //+--------------------------------------------------------------------------- // Function: BuildParent // // Synopsis: // // Arguments: [POBJECTINFO pObjectInfo] // [LPWSTR szBuffer] // // Returns: HRESULT // // Modifies: // // History: 11-3-95 krishnag Created. // //---------------------------------------------------------------------------- HRESULT BuildParent( POBJECTINFO pObjectInfo, LPWSTR szBuffer ) { DWORD i = 0; if (!pObjectInfo->ProviderName) { RRETURN(E_ADS_BAD_PATHNAME); } wsprintf(szBuffer,L"%s:", pObjectInfo->ProviderName); if (pObjectInfo->NumComponents - 1) { wcscat(szBuffer, L"//"); wcscat(szBuffer, pObjectInfo->DisplayComponentArray[0]); for (i = 1; i < (pObjectInfo->NumComponents - 1); i++) { wcscat(szBuffer, L"/"); wcscat(szBuffer, pObjectInfo->DisplayComponentArray[i]); } } RRETURN(S_OK); } //+--------------------------------------------------------------------------- // Function: BuildGrandParent // // Synopsis: // // Arguments: [POBJECTINFO pObjectInfo] // [LPWSTR szBuffer] // // Returns: HRESULT // // Modifies: // // History: 11-3-95 krishnag Created. // //---------------------------------------------------------------------------- HRESULT BuildGrandParent(POBJECTINFO pObjectInfo, LPWSTR szBuffer) { DWORD i = 0; if (!pObjectInfo->ProviderName) { RRETURN(E_ADS_BAD_PATHNAME); } wsprintf(szBuffer,L"%s:", pObjectInfo->ProviderName); if (pObjectInfo->NumComponents - 2) { wcscat(szBuffer, L"//"); wcscat(szBuffer, pObjectInfo->DisplayComponentArray[0]); for (i = 1; i < (pObjectInfo->NumComponents - 2); i++) { wcscat(szBuffer, L"/"); wcscat(szBuffer, pObjectInfo->DisplayComponentArray[i]); } } RRETURN(S_OK); } //+--------------------------------------------------------------------------- // Function: BuildADsPath // // Synopsis: // // Arguments: [POBJECTINFO pObjectInfo] // [LPWSTR szBuffer] // // Returns: HRESULT // // Modifies: // // History: 11-3-95 krishnag Created. // //---------------------------------------------------------------------------- HRESULT BuildADsPath( POBJECTINFO pObjectInfo, LPWSTR szBuffer ) { DWORD i = 0; if (!pObjectInfo->ProviderName) { RRETURN(E_ADS_BAD_PATHNAME); } wsprintf(szBuffer,L"%s:", pObjectInfo->ProviderName); if (pObjectInfo->NumComponents) { wcscat(szBuffer, L"//"); wcscat(szBuffer, pObjectInfo->DisplayComponentArray[0]); for (i = 1; i < (pObjectInfo->NumComponents); i++) { wcscat(szBuffer, L"/"); wcscat(szBuffer, pObjectInfo->DisplayComponentArray[i]); } } RRETURN(S_OK); }
22.781675
81
0.472821
npocmaka
8f64237be4d822ab784aca49bd0ad286d2fc30af
15,434
cpp
C++
export/windows/obj/src/flixel/math/FlxAngle.cpp
seanbashaw/frozenlight
47c540d30d63e946ea2dc787b4bb602cc9347d21
[ "MIT" ]
null
null
null
export/windows/obj/src/flixel/math/FlxAngle.cpp
seanbashaw/frozenlight
47c540d30d63e946ea2dc787b4bb602cc9347d21
[ "MIT" ]
null
null
null
export/windows/obj/src/flixel/math/FlxAngle.cpp
seanbashaw/frozenlight
47c540d30d63e946ea2dc787b4bb602cc9347d21
[ "MIT" ]
null
null
null
// Generated by Haxe 3.4.7 #include <hxcpp.h> #ifndef INCLUDED_95f339a1d026d52c #define INCLUDED_95f339a1d026d52c #include "hxMath.h" #endif #ifndef INCLUDED_flixel_FlxBasic #include <flixel/FlxBasic.h> #endif #ifndef INCLUDED_flixel_FlxCamera #include <flixel/FlxCamera.h> #endif #ifndef INCLUDED_flixel_FlxG #include <flixel/FlxG.h> #endif #ifndef INCLUDED_flixel_FlxObject #include <flixel/FlxObject.h> #endif #ifndef INCLUDED_flixel_FlxSprite #include <flixel/FlxSprite.h> #endif #ifndef INCLUDED_flixel_input_FlxPointer #include <flixel/input/FlxPointer.h> #endif #ifndef INCLUDED_flixel_input_IFlxInputManager #include <flixel/input/IFlxInputManager.h> #endif #ifndef INCLUDED_flixel_input_mouse_FlxMouse #include <flixel/input/mouse/FlxMouse.h> #endif #ifndef INCLUDED_flixel_math_FlxAngle #include <flixel/math/FlxAngle.h> #endif #ifndef INCLUDED_flixel_math_FlxPoint #include <flixel/math/FlxPoint.h> #endif #ifndef INCLUDED_flixel_util_FlxPool_flixel_math_FlxPoint #include <flixel/util/FlxPool_flixel_math_FlxPoint.h> #endif #ifndef INCLUDED_flixel_util_IFlxDestroyable #include <flixel/util/IFlxDestroyable.h> #endif #ifndef INCLUDED_flixel_util_IFlxPool #include <flixel/util/IFlxPool.h> #endif #ifndef INCLUDED_flixel_util_IFlxPooled #include <flixel/util/IFlxPooled.h> #endif HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_65_wrapAngle,"flixel.math.FlxAngle","wrapAngle",0xae3043f0,"flixel.math.FlxAngle.wrapAngle","flixel/math/FlxAngle.hx",65,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_87_asDegrees,"flixel.math.FlxAngle","asDegrees",0x8ea59f1c,"flixel.math.FlxAngle.asDegrees","flixel/math/FlxAngle.hx",87,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_99_asRadians,"flixel.math.FlxAngle","asRadians",0x7b3b01e7,"flixel.math.FlxAngle.asRadians","flixel/math/FlxAngle.hx",99,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_112_angleBetween,"flixel.math.FlxAngle","angleBetween",0x83e3464e,"flixel.math.FlxAngle.angleBetween","flixel/math/FlxAngle.hx",112,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_132_angleBetweenPoint,"flixel.math.FlxAngle","angleBetweenPoint",0x0a124322,"flixel.math.FlxAngle.angleBetweenPoint","flixel/math/FlxAngle.hx",132,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_154_angleBetweenMouse,"flixel.math.FlxAngle","angleBetweenMouse",0x4fe7a4f7,"flixel.math.FlxAngle.angleBetweenMouse","flixel/math/FlxAngle.hx",154,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_208_angleFromFacing,"flixel.math.FlxAngle","angleFromFacing",0x8474a75e,"flixel.math.FlxAngle.angleFromFacing","flixel/math/FlxAngle.hx",208,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_233_getCartesianCoords,"flixel.math.FlxAngle","getCartesianCoords",0x688d1f29,"flixel.math.FlxAngle.getCartesianCoords","flixel/math/FlxAngle.hx",233,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_252_getPolarCoords,"flixel.math.FlxAngle","getPolarCoords",0xf74e15df,"flixel.math.FlxAngle.getPolarCoords","flixel/math/FlxAngle.hx",252,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_264_get_TO_DEG,"flixel.math.FlxAngle","get_TO_DEG",0x36e6a544,"flixel.math.FlxAngle.get_TO_DEG","flixel/math/FlxAngle.hx",264,0x32e99189) HX_LOCAL_STACK_FRAME(_hx_pos_5b56d9e1983dc02b_269_get_TO_RAD,"flixel.math.FlxAngle","get_TO_RAD",0x36f14153,"flixel.math.FlxAngle.get_TO_RAD","flixel/math/FlxAngle.hx",269,0x32e99189) namespace flixel{ namespace math{ void FlxAngle_obj::__construct() { } Dynamic FlxAngle_obj::__CreateEmpty() { return new FlxAngle_obj; } void *FlxAngle_obj::_hx_vtable = 0; Dynamic FlxAngle_obj::__Create(hx::DynamicArray inArgs) { hx::ObjectPtr< FlxAngle_obj > _hx_result = new FlxAngle_obj(); _hx_result->__construct(); return _hx_result; } bool FlxAngle_obj::_hx_isInstanceOf(int inClassId) { return inClassId==(int)0x00000001 || inClassId==(int)0x0071e2b9; } Float FlxAngle_obj::wrapAngle(Float angle){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_65_wrapAngle) HXLINE( 66) if ((angle > (int)180)) { HXLINE( 68) angle = ::flixel::math::FlxAngle_obj::wrapAngle((angle - (int)360)); } else { HXLINE( 70) if ((angle < (int)-180)) { HXLINE( 72) angle = ::flixel::math::FlxAngle_obj::wrapAngle((angle + (int)360)); } } HXLINE( 75) return angle; } STATIC_HX_DEFINE_DYNAMIC_FUNC1(FlxAngle_obj,wrapAngle,return ) Float FlxAngle_obj::asDegrees(Float radians){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_87_asDegrees) HXDLIN( 87) return (radians * ((Float)(int)180 / (Float)::Math_obj::PI)); } STATIC_HX_DEFINE_DYNAMIC_FUNC1(FlxAngle_obj,asDegrees,return ) Float FlxAngle_obj::asRadians(Float degrees){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_99_asRadians) HXDLIN( 99) return (degrees * ((Float)::Math_obj::PI / (Float)(int)180)); } STATIC_HX_DEFINE_DYNAMIC_FUNC1(FlxAngle_obj,asRadians,return ) Float FlxAngle_obj::angleBetween( ::flixel::FlxSprite SpriteA, ::flixel::FlxSprite SpriteB,hx::Null< bool > __o_AsDegrees){ bool AsDegrees = __o_AsDegrees.Default(false); HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_112_angleBetween) HXLINE( 113) Float dx = (SpriteB->x + SpriteB->origin->x); HXDLIN( 113) Float dx1 = (dx - (SpriteA->x + SpriteA->origin->x)); HXLINE( 114) Float dy = (SpriteB->y + SpriteB->origin->y); HXDLIN( 114) Float dy1 = (dy - (SpriteA->y + SpriteA->origin->y)); HXLINE( 116) if (AsDegrees) { HXLINE( 117) return (::Math_obj::atan2(dy1,dx1) * ((Float)(int)180 / (Float)::Math_obj::PI)); } else { HXLINE( 119) return ::Math_obj::atan2(dy1,dx1); } HXLINE( 116) return ((Float)0.); } STATIC_HX_DEFINE_DYNAMIC_FUNC3(FlxAngle_obj,angleBetween,return ) Float FlxAngle_obj::angleBetweenPoint( ::flixel::FlxSprite Sprite, ::flixel::math::FlxPoint Target,hx::Null< bool > __o_AsDegrees){ bool AsDegrees = __o_AsDegrees.Default(false); HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_132_angleBetweenPoint) HXLINE( 133) Float Target1 = Target->x; HXDLIN( 133) Float dx = (Target1 - (Sprite->x + Sprite->origin->x)); HXLINE( 134) Float Target2 = Target->y; HXDLIN( 134) Float dy = (Target2 - (Sprite->y + Sprite->origin->y)); HXLINE( 136) if (Target->_weak) { HXLINE( 136) Target->put(); } HXLINE( 138) if (AsDegrees) { HXLINE( 139) return (::Math_obj::atan2(dy,dx) * ((Float)(int)180 / (Float)::Math_obj::PI)); } else { HXLINE( 141) return ::Math_obj::atan2(dy,dx); } HXLINE( 138) return ((Float)0.); } STATIC_HX_DEFINE_DYNAMIC_FUNC3(FlxAngle_obj,angleBetweenPoint,return ) Float FlxAngle_obj::angleBetweenMouse( ::flixel::FlxObject Object,hx::Null< bool > __o_AsDegrees){ bool AsDegrees = __o_AsDegrees.Default(false); HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_154_angleBetweenMouse) HXLINE( 156) if (hx::IsNull( Object )) { HXLINE( 157) return (int)0; } HXLINE( 159) ::flixel::math::FlxPoint p = Object->getScreenPosition(null(),null()); HXLINE( 161) Float dx = (::flixel::FlxG_obj::mouse->screenX - p->x); HXLINE( 162) Float dy = (::flixel::FlxG_obj::mouse->screenY - p->y); HXLINE( 164) p->put(); HXLINE( 166) if (AsDegrees) { HXLINE( 167) return (::Math_obj::atan2(dy,dx) * ((Float)(int)180 / (Float)::Math_obj::PI)); } else { HXLINE( 169) return ::Math_obj::atan2(dy,dx); } HXLINE( 166) return ((Float)0.); } STATIC_HX_DEFINE_DYNAMIC_FUNC2(FlxAngle_obj,angleBetweenMouse,return ) Float FlxAngle_obj::angleFromFacing(int FacingBitmask,hx::Null< bool > __o_AsDegrees){ bool AsDegrees = __o_AsDegrees.Default(false); HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_208_angleFromFacing) HXLINE( 209) int degrees; HXDLIN( 209) switch((int)(FacingBitmask)){ case (int)1: { HXLINE( 209) degrees = (int)180; } break; case (int)16: { HXLINE( 209) degrees = (int)0; } break; case (int)256: { HXLINE( 209) degrees = (int)-90; } break; case (int)4096: { HXLINE( 209) degrees = (int)90; } break; default:{ HXLINE( 215) int f = FacingBitmask; HXDLIN( 215) if ((f == (int)257)) { HXLINE( 209) degrees = (int)-135; } else { HXLINE( 216) int f1 = FacingBitmask; HXDLIN( 216) if ((f1 == (int)272)) { HXLINE( 209) degrees = (int)-45; } else { HXLINE( 217) int f2 = FacingBitmask; HXDLIN( 217) if ((f2 == (int)4097)) { HXLINE( 209) degrees = (int)135; } else { HXLINE( 218) int f3 = FacingBitmask; HXDLIN( 218) if ((f3 == (int)4112)) { HXLINE( 209) degrees = (int)45; } else { HXLINE( 209) degrees = (int)0; } } } } } } HXLINE( 221) if (AsDegrees) { HXLINE( 221) return degrees; } else { HXLINE( 221) return (degrees * ((Float)::Math_obj::PI / (Float)(int)180)); } HXDLIN( 221) return ((Float)0.); } STATIC_HX_DEFINE_DYNAMIC_FUNC2(FlxAngle_obj,angleFromFacing,return ) ::flixel::math::FlxPoint FlxAngle_obj::getCartesianCoords(Float Radius,Float Angle, ::flixel::math::FlxPoint point){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_233_getCartesianCoords) HXLINE( 234) ::flixel::math::FlxPoint p = point; HXLINE( 235) if (hx::IsNull( p )) { HXLINE( 236) ::flixel::math::FlxPoint point1 = ::flixel::math::FlxPoint_obj::_pool->get()->set((int)0,(int)0); HXDLIN( 236) point1->_inPool = false; HXDLIN( 236) p = point1; } HXLINE( 238) p->set_x((Radius * ::Math_obj::cos((Angle * ((Float)::Math_obj::PI / (Float)(int)180))))); HXLINE( 239) p->set_y((Radius * ::Math_obj::sin((Angle * ((Float)::Math_obj::PI / (Float)(int)180))))); HXLINE( 240) return p; } STATIC_HX_DEFINE_DYNAMIC_FUNC3(FlxAngle_obj,getCartesianCoords,return ) ::flixel::math::FlxPoint FlxAngle_obj::getPolarCoords(Float X,Float Y, ::flixel::math::FlxPoint point){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_252_getPolarCoords) HXLINE( 253) ::flixel::math::FlxPoint p = point; HXLINE( 254) if (hx::IsNull( p )) { HXLINE( 255) ::flixel::math::FlxPoint point1 = ::flixel::math::FlxPoint_obj::_pool->get()->set((int)0,(int)0); HXDLIN( 255) point1->_inPool = false; HXDLIN( 255) p = point1; } HXLINE( 257) p->set_x(::Math_obj::sqrt(((X * X) + (Y * Y)))); HXLINE( 258) Float _hx_tmp = ::Math_obj::atan2(Y,X); HXDLIN( 258) p->set_y((_hx_tmp * ((Float)(int)180 / (Float)::Math_obj::PI))); HXLINE( 259) return p; } STATIC_HX_DEFINE_DYNAMIC_FUNC3(FlxAngle_obj,getPolarCoords,return ) Float FlxAngle_obj::get_TO_DEG(){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_264_get_TO_DEG) HXDLIN( 264) return ((Float)(int)180 / (Float)::Math_obj::PI); } STATIC_HX_DEFINE_DYNAMIC_FUNC0(FlxAngle_obj,get_TO_DEG,return ) Float FlxAngle_obj::get_TO_RAD(){ HX_STACKFRAME(&_hx_pos_5b56d9e1983dc02b_269_get_TO_RAD) HXDLIN( 269) return ((Float)::Math_obj::PI / (Float)(int)180); } STATIC_HX_DEFINE_DYNAMIC_FUNC0(FlxAngle_obj,get_TO_RAD,return ) FlxAngle_obj::FlxAngle_obj() { } bool FlxAngle_obj::__GetStatic(const ::String &inName, Dynamic &outValue, hx::PropertyAccess inCallProp) { switch(inName.length) { case 6: if (HX_FIELD_EQ(inName,"TO_DEG") ) { if (inCallProp == hx::paccAlways) { outValue = ( get_TO_DEG() ); return true; } } if (HX_FIELD_EQ(inName,"TO_RAD") ) { if (inCallProp == hx::paccAlways) { outValue = ( get_TO_RAD() ); return true; } } break; case 9: if (HX_FIELD_EQ(inName,"wrapAngle") ) { outValue = wrapAngle_dyn(); return true; } if (HX_FIELD_EQ(inName,"asDegrees") ) { outValue = asDegrees_dyn(); return true; } if (HX_FIELD_EQ(inName,"asRadians") ) { outValue = asRadians_dyn(); return true; } break; case 10: if (HX_FIELD_EQ(inName,"get_TO_DEG") ) { outValue = get_TO_DEG_dyn(); return true; } if (HX_FIELD_EQ(inName,"get_TO_RAD") ) { outValue = get_TO_RAD_dyn(); return true; } break; case 12: if (HX_FIELD_EQ(inName,"angleBetween") ) { outValue = angleBetween_dyn(); return true; } break; case 14: if (HX_FIELD_EQ(inName,"getPolarCoords") ) { outValue = getPolarCoords_dyn(); return true; } break; case 15: if (HX_FIELD_EQ(inName,"angleFromFacing") ) { outValue = angleFromFacing_dyn(); return true; } break; case 17: if (HX_FIELD_EQ(inName,"angleBetweenPoint") ) { outValue = angleBetweenPoint_dyn(); return true; } if (HX_FIELD_EQ(inName,"angleBetweenMouse") ) { outValue = angleBetweenMouse_dyn(); return true; } break; case 18: if (HX_FIELD_EQ(inName,"getCartesianCoords") ) { outValue = getCartesianCoords_dyn(); return true; } } return false; } #if HXCPP_SCRIPTABLE static hx::StorageInfo *FlxAngle_obj_sMemberStorageInfo = 0; static hx::StaticInfo *FlxAngle_obj_sStaticStorageInfo = 0; #endif static void FlxAngle_obj_sMarkStatics(HX_MARK_PARAMS) { HX_MARK_MEMBER_NAME(FlxAngle_obj::__mClass,"__mClass"); }; #ifdef HXCPP_VISIT_ALLOCS static void FlxAngle_obj_sVisitStatics(HX_VISIT_PARAMS) { HX_VISIT_MEMBER_NAME(FlxAngle_obj::__mClass,"__mClass"); }; #endif hx::Class FlxAngle_obj::__mClass; static ::String FlxAngle_obj_sStaticFields[] = { HX_HCSTRING("wrapAngle","\xa9","\xbd","\x58","\xc6"), HX_HCSTRING("asDegrees","\xd5","\x18","\xce","\xa6"), HX_HCSTRING("asRadians","\xa0","\x7b","\x63","\x93"), HX_HCSTRING("angleBetween","\x35","\xe6","\xd4","\x69"), HX_HCSTRING("angleBetweenPoint","\xdb","\x9d","\x50","\x15"), HX_HCSTRING("angleBetweenMouse","\xb0","\xff","\x25","\x5b"), HX_HCSTRING("angleFromFacing","\xd7","\xb1","\xc0","\xdc"), HX_HCSTRING("getCartesianCoords","\x50","\x26","\xde","\x33"), HX_HCSTRING("getPolarCoords","\x86","\xbd","\xd4","\x74"), HX_HCSTRING("get_TO_DEG","\x6b","\xad","\x28","\x42"), HX_HCSTRING("get_TO_RAD","\x7a","\x49","\x33","\x42"), ::String(null()) }; void FlxAngle_obj::__register() { hx::Object *dummy = new FlxAngle_obj; FlxAngle_obj::_hx_vtable = *(void **)dummy; hx::Static(__mClass) = new hx::Class_obj(); __mClass->mName = HX_HCSTRING("flixel.math.FlxAngle","\xf5","\x97","\xd6","\x2c"); __mClass->mSuper = &super::__SGetClass(); __mClass->mConstructEmpty = &__CreateEmpty; __mClass->mConstructArgs = &__Create; __mClass->mGetStaticField = &FlxAngle_obj::__GetStatic; __mClass->mSetStaticField = &hx::Class_obj::SetNoStaticField; __mClass->mMarkFunc = FlxAngle_obj_sMarkStatics; __mClass->mStatics = hx::Class_obj::dupFunctions(FlxAngle_obj_sStaticFields); __mClass->mMembers = hx::Class_obj::dupFunctions(0 /* sMemberFields */); __mClass->mCanCast = hx::TCanCast< FlxAngle_obj >; #ifdef HXCPP_VISIT_ALLOCS __mClass->mVisitFunc = FlxAngle_obj_sVisitStatics; #endif #ifdef HXCPP_SCRIPTABLE __mClass->mMemberStorageInfo = FlxAngle_obj_sMemberStorageInfo; #endif #ifdef HXCPP_SCRIPTABLE __mClass->mStaticStorageInfo = FlxAngle_obj_sStaticStorageInfo; #endif hx::_hx_RegisterClass(__mClass->mName, __mClass); } } // end namespace flixel } // end namespace math
39.676093
207
0.69308
seanbashaw
8f64e6acaed3a75bc7a334766c5da38bca1de0e5
13,476
hpp
C++
ThirdParty-mod/java2cpp/android/widget/MultiAutoCompleteTextView.hpp
kakashidinho/HQEngine
8125b290afa7c62db6cc6eac14e964d8138c7fd0
[ "MIT" ]
1
2019-04-03T01:53:28.000Z
2019-04-03T01:53:28.000Z
ThirdParty-mod/java2cpp/android/widget/MultiAutoCompleteTextView.hpp
kakashidinho/HQEngine
8125b290afa7c62db6cc6eac14e964d8138c7fd0
[ "MIT" ]
null
null
null
ThirdParty-mod/java2cpp/android/widget/MultiAutoCompleteTextView.hpp
kakashidinho/HQEngine
8125b290afa7c62db6cc6eac14e964d8138c7fd0
[ "MIT" ]
null
null
null
/*================================================================================ code generated by: java2cpp author: Zoran Angelov, mailto://baldzar@gmail.com class: android.widget.MultiAutoCompleteTextView ================================================================================*/ #ifndef J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_ANDROID_WIDGET_MULTIAUTOCOMPLETETEXTVIEW_HPP_DECL #define J2CPP_ANDROID_WIDGET_MULTIAUTOCOMPLETETEXTVIEW_HPP_DECL namespace j2cpp { namespace java { namespace lang { class Object; } } } namespace j2cpp { namespace java { namespace lang { class CharSequence; } } } namespace j2cpp { namespace android { namespace content { class Context; } } } namespace j2cpp { namespace android { namespace widget { class AutoCompleteTextView; } } } namespace j2cpp { namespace android { namespace widget { namespace MultiAutoCompleteTextView_ { class Tokenizer; } } } } namespace j2cpp { namespace android { namespace util { class AttributeSet; } } } #include <android/content/Context.hpp> #include <android/util/AttributeSet.hpp> #include <android/widget/AutoCompleteTextView.hpp> #include <android/widget/MultiAutoCompleteTextView.hpp> #include <java/lang/CharSequence.hpp> #include <java/lang/Object.hpp> namespace j2cpp { namespace android { namespace widget { class MultiAutoCompleteTextView; namespace MultiAutoCompleteTextView_ { class Tokenizer; class Tokenizer : public object<Tokenizer> { public: J2CPP_DECLARE_CLASS J2CPP_DECLARE_METHOD(0) J2CPP_DECLARE_METHOD(1) J2CPP_DECLARE_METHOD(2) explicit Tokenizer(jobject jobj) : object<Tokenizer>(jobj) { } operator local_ref<java::lang::Object>() const; jint findTokenStart(local_ref< java::lang::CharSequence > const&, jint); jint findTokenEnd(local_ref< java::lang::CharSequence > const&, jint); local_ref< java::lang::CharSequence > terminateToken(local_ref< java::lang::CharSequence > const&); }; //class Tokenizer class CommaTokenizer; class CommaTokenizer : public object<CommaTokenizer> { public: J2CPP_DECLARE_CLASS J2CPP_DECLARE_METHOD(0) J2CPP_DECLARE_METHOD(1) J2CPP_DECLARE_METHOD(2) J2CPP_DECLARE_METHOD(3) explicit CommaTokenizer(jobject jobj) : object<CommaTokenizer>(jobj) { } operator local_ref<java::lang::Object>() const; operator local_ref<android::widget::MultiAutoCompleteTextView_::Tokenizer>() const; CommaTokenizer(); jint findTokenStart(local_ref< java::lang::CharSequence > const&, jint); jint findTokenEnd(local_ref< java::lang::CharSequence > const&, jint); local_ref< java::lang::CharSequence > terminateToken(local_ref< java::lang::CharSequence > const&); }; //class CommaTokenizer } //namespace MultiAutoCompleteTextView_ class MultiAutoCompleteTextView : public object<MultiAutoCompleteTextView> { public: J2CPP_DECLARE_CLASS J2CPP_DECLARE_METHOD(0) J2CPP_DECLARE_METHOD(1) J2CPP_DECLARE_METHOD(2) J2CPP_DECLARE_METHOD(3) J2CPP_DECLARE_METHOD(4) J2CPP_DECLARE_METHOD(5) J2CPP_DECLARE_METHOD(6) J2CPP_DECLARE_METHOD(7) J2CPP_DECLARE_METHOD(8) typedef MultiAutoCompleteTextView_::Tokenizer Tokenizer; typedef MultiAutoCompleteTextView_::CommaTokenizer CommaTokenizer; explicit MultiAutoCompleteTextView(jobject jobj) : object<MultiAutoCompleteTextView>(jobj) { } operator local_ref<android::widget::AutoCompleteTextView>() const; MultiAutoCompleteTextView(local_ref< android::content::Context > const&); MultiAutoCompleteTextView(local_ref< android::content::Context > const&, local_ref< android::util::AttributeSet > const&); MultiAutoCompleteTextView(local_ref< android::content::Context > const&, local_ref< android::util::AttributeSet > const&, jint); void setTokenizer(local_ref< android::widget::MultiAutoCompleteTextView_::Tokenizer > const&); jboolean enoughToFilter(); void performValidation(); }; //class MultiAutoCompleteTextView } //namespace widget } //namespace android } //namespace j2cpp #endif //J2CPP_ANDROID_WIDGET_MULTIAUTOCOMPLETETEXTVIEW_HPP_DECL #else //J2CPP_INCLUDE_IMPLEMENTATION #ifndef J2CPP_ANDROID_WIDGET_MULTIAUTOCOMPLETETEXTVIEW_HPP_IMPL #define J2CPP_ANDROID_WIDGET_MULTIAUTOCOMPLETETEXTVIEW_HPP_IMPL namespace j2cpp { android::widget::MultiAutoCompleteTextView_::Tokenizer::operator local_ref<java::lang::Object>() const { return local_ref<java::lang::Object>(get_jobject()); } jint android::widget::MultiAutoCompleteTextView_::Tokenizer::findTokenStart(local_ref< java::lang::CharSequence > const &a0, jint a1) { return call_method< android::widget::MultiAutoCompleteTextView_::Tokenizer::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView_::Tokenizer::J2CPP_METHOD_NAME(0), android::widget::MultiAutoCompleteTextView_::Tokenizer::J2CPP_METHOD_SIGNATURE(0), jint >(get_jobject(), a0, a1); } jint android::widget::MultiAutoCompleteTextView_::Tokenizer::findTokenEnd(local_ref< java::lang::CharSequence > const &a0, jint a1) { return call_method< android::widget::MultiAutoCompleteTextView_::Tokenizer::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView_::Tokenizer::J2CPP_METHOD_NAME(1), android::widget::MultiAutoCompleteTextView_::Tokenizer::J2CPP_METHOD_SIGNATURE(1), jint >(get_jobject(), a0, a1); } local_ref< java::lang::CharSequence > android::widget::MultiAutoCompleteTextView_::Tokenizer::terminateToken(local_ref< java::lang::CharSequence > const &a0) { return call_method< android::widget::MultiAutoCompleteTextView_::Tokenizer::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView_::Tokenizer::J2CPP_METHOD_NAME(2), android::widget::MultiAutoCompleteTextView_::Tokenizer::J2CPP_METHOD_SIGNATURE(2), local_ref< java::lang::CharSequence > >(get_jobject(), a0); } J2CPP_DEFINE_CLASS(android::widget::MultiAutoCompleteTextView_::Tokenizer,"android/widget/MultiAutoCompleteTextView$Tokenizer") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView_::Tokenizer,0,"findTokenStart","(Ljava/lang/CharSequence;I)I") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView_::Tokenizer,1,"findTokenEnd","(Ljava/lang/CharSequence;I)I") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView_::Tokenizer,2,"terminateToken","(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;") android::widget::MultiAutoCompleteTextView_::CommaTokenizer::operator local_ref<java::lang::Object>() const { return local_ref<java::lang::Object>(get_jobject()); } android::widget::MultiAutoCompleteTextView_::CommaTokenizer::operator local_ref<android::widget::MultiAutoCompleteTextView_::Tokenizer>() const { return local_ref<android::widget::MultiAutoCompleteTextView_::Tokenizer>(get_jobject()); } android::widget::MultiAutoCompleteTextView_::CommaTokenizer::CommaTokenizer() : object<android::widget::MultiAutoCompleteTextView_::CommaTokenizer>( call_new_object< android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_METHOD_NAME(0), android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_METHOD_SIGNATURE(0) >() ) { } jint android::widget::MultiAutoCompleteTextView_::CommaTokenizer::findTokenStart(local_ref< java::lang::CharSequence > const &a0, jint a1) { return call_method< android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_METHOD_NAME(1), android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_METHOD_SIGNATURE(1), jint >(get_jobject(), a0, a1); } jint android::widget::MultiAutoCompleteTextView_::CommaTokenizer::findTokenEnd(local_ref< java::lang::CharSequence > const &a0, jint a1) { return call_method< android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_METHOD_NAME(2), android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_METHOD_SIGNATURE(2), jint >(get_jobject(), a0, a1); } local_ref< java::lang::CharSequence > android::widget::MultiAutoCompleteTextView_::CommaTokenizer::terminateToken(local_ref< java::lang::CharSequence > const &a0) { return call_method< android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_METHOD_NAME(3), android::widget::MultiAutoCompleteTextView_::CommaTokenizer::J2CPP_METHOD_SIGNATURE(3), local_ref< java::lang::CharSequence > >(get_jobject(), a0); } J2CPP_DEFINE_CLASS(android::widget::MultiAutoCompleteTextView_::CommaTokenizer,"android/widget/MultiAutoCompleteTextView$CommaTokenizer") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView_::CommaTokenizer,0,"<init>","()V") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView_::CommaTokenizer,1,"findTokenStart","(Ljava/lang/CharSequence;I)I") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView_::CommaTokenizer,2,"findTokenEnd","(Ljava/lang/CharSequence;I)I") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView_::CommaTokenizer,3,"terminateToken","(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;") android::widget::MultiAutoCompleteTextView::operator local_ref<android::widget::AutoCompleteTextView>() const { return local_ref<android::widget::AutoCompleteTextView>(get_jobject()); } android::widget::MultiAutoCompleteTextView::MultiAutoCompleteTextView(local_ref< android::content::Context > const &a0) : object<android::widget::MultiAutoCompleteTextView>( call_new_object< android::widget::MultiAutoCompleteTextView::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_NAME(0), android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_SIGNATURE(0) >(a0) ) { } android::widget::MultiAutoCompleteTextView::MultiAutoCompleteTextView(local_ref< android::content::Context > const &a0, local_ref< android::util::AttributeSet > const &a1) : object<android::widget::MultiAutoCompleteTextView>( call_new_object< android::widget::MultiAutoCompleteTextView::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_NAME(1), android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_SIGNATURE(1) >(a0, a1) ) { } android::widget::MultiAutoCompleteTextView::MultiAutoCompleteTextView(local_ref< android::content::Context > const &a0, local_ref< android::util::AttributeSet > const &a1, jint a2) : object<android::widget::MultiAutoCompleteTextView>( call_new_object< android::widget::MultiAutoCompleteTextView::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_NAME(2), android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_SIGNATURE(2) >(a0, a1, a2) ) { } void android::widget::MultiAutoCompleteTextView::setTokenizer(local_ref< android::widget::MultiAutoCompleteTextView_::Tokenizer > const &a0) { return call_method< android::widget::MultiAutoCompleteTextView::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_NAME(3), android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_SIGNATURE(3), void >(get_jobject(), a0); } jboolean android::widget::MultiAutoCompleteTextView::enoughToFilter() { return call_method< android::widget::MultiAutoCompleteTextView::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_NAME(5), android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_SIGNATURE(5), jboolean >(get_jobject()); } void android::widget::MultiAutoCompleteTextView::performValidation() { return call_method< android::widget::MultiAutoCompleteTextView::J2CPP_CLASS_NAME, android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_NAME(6), android::widget::MultiAutoCompleteTextView::J2CPP_METHOD_SIGNATURE(6), void >(get_jobject()); } J2CPP_DEFINE_CLASS(android::widget::MultiAutoCompleteTextView,"android/widget/MultiAutoCompleteTextView") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView,0,"<init>","(Landroid/content/Context;)V") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView,1,"<init>","(Landroid/content/Context;Landroid/util/AttributeSet;)V") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView,2,"<init>","(Landroid/content/Context;Landroid/util/AttributeSet;I)V") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView,3,"setTokenizer","(Landroid/widget/MultiAutoCompleteTextView$Tokenizer;)V") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView,4,"performFiltering","(Ljava/lang/CharSequence;I)V") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView,5,"enoughToFilter","()Z") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView,6,"performValidation","()V") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView,7,"performFiltering","(Ljava/lang/CharSequence;III)V") J2CPP_DEFINE_METHOD(android::widget::MultiAutoCompleteTextView,8,"replaceText","(Ljava/lang/CharSequence;)V") } //namespace j2cpp #endif //J2CPP_ANDROID_WIDGET_MULTIAUTOCOMPLETETEXTVIEW_HPP_IMPL #endif //J2CPP_INCLUDE_IMPLEMENTATION
39.28863
181
0.768106
kakashidinho
8f6506492f65a0d960c9332ff1e24fc1798bb6f0
14,524
cpp
C++
src/Kernel/Champs/Champ_Gen_de_Champs_Gen.cpp
cea-trust-platform/trust-code
c4f42d8f8602a8cc5e0ead0e29dbf0be8ac52f72
[ "BSD-3-Clause" ]
12
2021-06-30T18:50:38.000Z
2022-03-23T09:03:16.000Z
src/Kernel/Champs/Champ_Gen_de_Champs_Gen.cpp
pledac/trust-code
46ab5c5da3f674185f53423090f526a38ecdbad1
[ "BSD-3-Clause" ]
null
null
null
src/Kernel/Champs/Champ_Gen_de_Champs_Gen.cpp
pledac/trust-code
46ab5c5da3f674185f53423090f526a38ecdbad1
[ "BSD-3-Clause" ]
2
2021-10-04T09:19:39.000Z
2021-12-15T14:21:04.000Z
/**************************************************************************** * Copyright (c) 2015 - 2016, CEA * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ ////////////////////////////////////////////////////////////////////////////// // // File: Champ_Gen_de_Champs_Gen.cpp // Directory: $TRUST_ROOT/src/Kernel/Champs // Version: /main/23 // ////////////////////////////////////////////////////////////////////////////// #include <Champ_Gen_de_Champs_Gen.h> #include <Champ_Generique_refChamp.h> #include <Champs_compris.h> #include <Discretisation_base.h> #include <Param.h> Implemente_base(Champ_Gen_de_Champs_Gen,"Champ_Gen_de_Champs_Gen",Champ_Generique_base); //cf Champ_Generique_base::readOn Entree& Champ_Gen_de_Champs_Gen::readOn(Entree& is) { Champ_Generique_base::readOn(is); return is; } Sortie& Champ_Gen_de_Champs_Gen::printOn(Sortie& os) const { exit(); return os; } // source : declenche la lecture du champ genrerique source // sources_reference : declenche la lecture du nom d un ou plusieurs champs generiques qui doivent etre // deja definis afin de pouvoir initialiser une reference vers ce champ // nom_source : option pour nommer le champ en tant que source (sinon nommer par defaut) void Champ_Gen_de_Champs_Gen::set_param(Param& param) { param.ajouter_non_std("source",(this)); param.ajouter_non_std("sources",(this)); param.ajouter_non_std("nom_source",(this)); param.ajouter_non_std("source_reference",(this)); param.ajouter("sources_reference",&noms_sources_ref_); } int Champ_Gen_de_Champs_Gen::lire_motcle_non_standard(const Motcle& mot, Entree& is) { if (mot=="source") { Champ_Generique& new_src = sources_.add(Champ_Generique()); Nom typ; is >> typ; Journal() << "Reading a source type " << typ << finl; new_src.typer(typ); is >> new_src.valeur(); return 1; } else if (mot=="source_reference") { Nom& new_s = noms_sources_ref_.add(Nom()); is >> new_s; Cerr<<"WARNING : obsolete option. Use now sources_reference { " << new_s<< " } instead of source_reference "<<new_s<<finl; return 1; } else if (mot=="sources") { Nom accouverte="{"; Nom accfermee="}"; Nom virgule=","; Nom typ; is >> typ; assert (typ==accouverte); is >> typ; if(typ==accfermee) { Cerr<<"We should not use the keyword \"sources\" to specify a generic field"<<finl; Cerr<<"of type Champ_Gen_de_Champs_Gen without specifying sources"<<finl; exit(); } while(1) { Champ_Generique& new_src = sources_.add(Champ_Generique()); Journal() << "Reading a source type " << typ << finl; new_src.typer(typ); is >> new_src.valeur(); is >> typ; if(typ==accfermee) break; if(typ!=virgule) { Cerr << typ << " : We expected a ',' or '}'" << finl; exit(); } is >> typ; } return 1; } else if (mot=="nom_source") { Nom id_source; is >> id_source; nommer(id_source); return 1; } else return Champ_Generique_base::lire_motcle_non_standard(mot,is); return 1; } LIST(Champ_Generique)& Champ_Gen_de_Champs_Gen::get_set_sources() { return sources_; } Champ_Generique& Champ_Gen_de_Champs_Gen::get_set_source() { if (sources_.size() < 1) sources_.add(Champ_Generique()); return sources_[0]; } void Champ_Gen_de_Champs_Gen::reset() { sources_.vide(); } void Champ_Gen_de_Champs_Gen::mettre_a_jour(double temps) { const int n = sources_.size(); for (int i = 0; i < n; i++) sources_[i].valeur().mettre_a_jour(temps); } Champ_Fonc& Champ_Gen_de_Champs_Gen::creer_espace_stockage(const Nature_du_champ& nature, const int& nb_comp, Champ_Fonc& es_tmp) const { Noms noms; Noms unites; for (int c=0; c<nb_comp; c++) { // noms.add("bidon"); unites.add("bidon"); } noms.add("bidon"); double temps; temps = get_time(); const Discretisation_base& discr = get_discretisation(); Motcle directive = get_directive_pour_discr(); const Zone_dis_base& zone_dis = get_ref_zone_dis_base(); discr.discretiser_champ(directive,zone_dis,nature,noms,unites,nb_comp,temps,es_tmp); if (directive=="pression") { const Zone_Cl_dis_base& zcl = get_ref_zcl_dis_base(); es_tmp->completer(zcl); } return es_tmp; } const Champ_Generique_base& Champ_Gen_de_Champs_Gen::get_source(int i) const { // Si sources_ et source_ref sont vide, on n'a pas a etre ici if ((sources_reference_.size()==0) && (sources_.size()==0)) { Cerr << finl; Cerr << "Error : The field \"" << noms_sources_ref_ << "\" is not recognized in the sources_reference option of the " << que_suis_je() << " keyword." << finl; Cerr << "\"" << noms_sources_ref_ << "\" should be defined before." << finl; exit(); } int n_sources_ref=sources_reference_.size(); if (i<n_sources_ref) { if ( ! sources_reference_[i].non_nul()) { Cerr << finl; Cerr << "Error : The field \"" << noms_sources_ref_[0] << "\" is not recognized in the sources_reference option of the " << que_suis_je() << " keyword." << finl; Cerr << "\"" << noms_sources_ref_[0] << "\" should be defined before." << finl; exit(); } return sources_reference_[i].valeur(); } else return sources_[i-n_sources_ref].valeur(); } Champ_Generique_base& Champ_Gen_de_Champs_Gen::set_source(int i) { // POur eviter de recoder la meme chose que get_source return ref_cast_non_const(Champ_Generique_base,get_source(i)); } int Champ_Gen_de_Champs_Gen::get_nb_sources() const { return sources_reference_.size()+sources_.size(); } // Description: sauvegarde des differentes sources int Champ_Gen_de_Champs_Gen::sauvegarder(Sortie& os) const { const int n = sources_.size(); int bytes = 0; for (int i = 0; i < n; i++) bytes += sources_[i].valeur().sauvegarder(os); return bytes; } // Description: reprise des differentes sources int Champ_Gen_de_Champs_Gen::reprendre(Entree& is) { const int n = sources_.size(); for (int i = 0; i < n; i++) sources_[i].valeur().reprendre(is); return 1; } void Champ_Gen_de_Champs_Gen::completer(const Postraitement_base& post) { int n_sources_ref=noms_sources_ref_.size(); if ( n_sources_ref!=sources_reference_.size()) { sources_reference_.vide(); for (int i=0; i<n_sources_ref; i++) { REF(Champ_Generique_base)& source_ref=sources_reference_.add(REF(Champ_Generique_base)()); const Postraitement& postraitement =ref_cast(Postraitement,post); //const Probleme_base& pb = ref_cast(Postraitement,post).probleme(); source_ref = postraitement.get_champ_post(noms_sources_ref_[i]); } } const int n = get_nb_sources(); for (int i = n_sources_ref ; i < n; i++) { Champ_Generique_base& source_a_completer = ref_cast(Champ_Generique_base,set_source(i)); source_a_completer.completer(post); } const Probleme_base& pb = get_ref_pb_base(); const Nom& nom_pb = pb.le_nom(); nom_pb_ = nom_pb; nommer_source(); } //Methodes complementaires int Champ_Gen_de_Champs_Gen::get_dimension() const { return get_source(0).get_dimension(); } void Champ_Gen_de_Champs_Gen::get_property_names(Motcles& list) const { get_source(0).get_property_names(list); } const Noms Champ_Gen_de_Champs_Gen::get_property(const Motcle& query) const { Motcles motcles(1); motcles[0] = "nom"; int rang = motcles.search(query); switch(rang) { case 0: { Noms mots(1); mots[0] = nom_post_; return mots; break; } } return get_source(0).get_property(query); } Entity Champ_Gen_de_Champs_Gen::get_localisation(const int index) const { return get_source(0).get_localisation(index); } const DoubleTab& Champ_Gen_de_Champs_Gen::get_ref_values() const { return get_source(0).get_ref_values(); } void Champ_Gen_de_Champs_Gen::get_copy_values(DoubleTab& values) const { const DoubleTab& val = get_ref_values(); // Cree une copie du tableau values = val; } void Champ_Gen_de_Champs_Gen::get_xyz_values(const DoubleTab& coords, DoubleTab& values, ArrOfBit& validity_flag) const { throw Champ_Generique_erreur("NOT_IMPLEMENTED"); } const Domaine& Champ_Gen_de_Champs_Gen::get_ref_domain() const { return get_source(0).get_ref_domain(); } void Champ_Gen_de_Champs_Gen::get_copy_domain(Domaine& domain) const { return get_source(0).get_copy_domain(domain); } const Zone_dis_base& Champ_Gen_de_Champs_Gen::get_ref_zone_dis_base() const { return get_source(0).get_ref_zone_dis_base(); } const Zone_Cl_dis_base& Champ_Gen_de_Champs_Gen::get_ref_zcl_dis_base() const { return get_source(0).get_ref_zcl_dis_base(); } const DoubleTab& Champ_Gen_de_Champs_Gen::get_ref_coordinates() const { return get_source(0).get_ref_coordinates(); } void Champ_Gen_de_Champs_Gen::get_copy_coordinates(DoubleTab& coordinates) const { get_source(0).get_copy_coordinates(coordinates); } const IntTab& Champ_Gen_de_Champs_Gen::get_ref_connectivity(Entity index1, Entity index2) const { return get_source(0).get_ref_connectivity(index1,index2); } void Champ_Gen_de_Champs_Gen::get_copy_connectivity(Entity index1, Entity index2, IntTab& tab) const { get_source(0).get_copy_connectivity(index1,index2,tab); } double Champ_Gen_de_Champs_Gen::get_time() const { return get_source(0).get_time(); } const Probleme_base& Champ_Gen_de_Champs_Gen::get_ref_pb_base() const { return get_source(0).get_ref_pb_base(); } const Discretisation_base& Champ_Gen_de_Champs_Gen::get_discretisation() const { return get_source(0).get_discretisation(); } const Motcle Champ_Gen_de_Champs_Gen::get_directive_pour_discr() const { return get_source(0).get_directive_pour_discr(); } void Champ_Gen_de_Champs_Gen::nommer_sources() { int nb_sources = get_nb_sources(); for (int i=0; i<nb_sources; i++) { if (sub_type(Champ_Gen_de_Champs_Gen,sources_[i].valeur())) { Champ_Gen_de_Champs_Gen& champ = ref_cast(Champ_Gen_de_Champs_Gen,sources_[i].valeur()); champ.nommer_sources(); champ.nommer_source(); } else if (sub_type(Champ_Generique_refChamp,sources_[i].valeur())) { Champ_Generique_refChamp& champ = ref_cast(Champ_Generique_refChamp,sources_[i].valeur()); champ.nommer_source(); } else { Cerr<<"There is no method nommer_source() for this type of field "<<finl; Cerr<<"sources_[i].valeur().que_suis_je()"<<finl; exit(); } } } //Cette methode doit etre surchargee pour chacun des Champ_Gen_de_Champs_Gen void Champ_Gen_de_Champs_Gen::nommer_source() { } int Champ_Gen_de_Champs_Gen::get_info_type_post() const { return get_source(0).get_info_type_post(); } //Methodes pour changer t_deb et t_fin pour des reprises de statistiques void Champ_Gen_de_Champs_Gen::fixer_serie(const double& t1, const double& t2) { const int n = get_nb_sources();; for (int i = 0; i < n; i++) { if (sub_type(Champ_Gen_de_Champs_Gen,get_source(i))) { Champ_Gen_de_Champs_Gen& source = ref_cast(Champ_Gen_de_Champs_Gen,set_source(i)); source.fixer_serie(t1,t2); } } } void Champ_Gen_de_Champs_Gen::fixer_tstat_deb(const double& t1, const double& t2) { const int n = get_nb_sources();; for (int i = 0; i < n; i++) { if (sub_type(Champ_Gen_de_Champs_Gen,get_source(i))) { Champ_Gen_de_Champs_Gen& source = ref_cast(Champ_Gen_de_Champs_Gen,set_source(i)); source.fixer_tstat_deb(t1,t2); } } } void Champ_Gen_de_Champs_Gen::lire_bidon(Entree& is) const { const int n = get_nb_sources();; for (int i = 0; i < n; i++) { if (sub_type(Champ_Gen_de_Champs_Gen,get_source(i))) { const Champ_Gen_de_Champs_Gen& source = ref_cast(Champ_Gen_de_Champs_Gen,get_source(i)); source.lire_bidon(is); } } } const Champ_Generique_base& Champ_Gen_de_Champs_Gen::get_champ_post(const Motcle& nom) const { REF(Champ_Generique_base) ref_champ; try { return Champ_Generique_base::get_champ_post(nom); } catch (Champs_compris_erreur) { } try { return get_source(0).get_champ_post(nom); } catch (Champs_compris_erreur) { } throw Champs_compris_erreur(); return ref_champ; } int Champ_Gen_de_Champs_Gen::comprend_champ_post(const Motcle& identifiant) const { if (Champ_Generique_base::comprend_champ_post(identifiant)) return 1; else if (get_source(0).comprend_champ_post(identifiant)) return 1; return 0; }
30.070393
260
0.672542
cea-trust-platform
8f69113c165724b1a4315ce911c755ebb5908fb5
1,963
hxx
C++
live555/test/h264_subsession.hxx
triminalt/snippets
ced19012a55b0cc8e5fcd33fe3fc4947cb399366
[ "MIT" ]
1
2017-01-29T16:14:23.000Z
2017-01-29T16:14:23.000Z
live555/test/h264_subsession.hxx
triminalt/snippets
ced19012a55b0cc8e5fcd33fe3fc4947cb399366
[ "MIT" ]
null
null
null
live555/test/h264_subsession.hxx
triminalt/snippets
ced19012a55b0cc8e5fcd33fe3fc4947cb399366
[ "MIT" ]
null
null
null
// // @author trimnalt AT gmail DOT com // @version initial // @date 2018-07-03 // #ifndef H264_SUBSESSION_HXX #define H264_SUBSESSION_HXX #include <string> #include <memory> #include <OnDemandServerMediaSubsession.hh> #include <H264VideoStreamFramer.hh> #include <H264VideoRTPSink.hh> #include "./h264_pump.hxx" #include "./h264_source.hxx" #include "./h264_sink.hxx" class h264_subsession final: public OnDemandServerMediaSubsession { public: h264_subsession( UsageEnvironment& env , Boolean reused , std::shared_ptr<h264_pump> const& pump , unsigned fps , std::string sps , std::string pps) : OnDemandServerMediaSubsession(env, reused) , pump_(pump) , fps_(fps) , sps_(sps) , pps_(pps) { // EMPTY } virtual ~h264_subsession() = default; protected: virtual FramedSource* createNewStreamSource( unsigned , unsigned& bitrate) override { bitrate = 1024; return H264VideoStreamFramer::createNew( envir() , new h264_source( envir() , pump_ , fps_) , true); } virtual RTPSink* createNewRTPSink( Groupsock* rtp , unsigned char rtp_payload_type_if_dynamic , FramedSource*) override { return new h264_sink( envir() , rtp , rtp_payload_type_if_dynamic , sps_ , pps_); } private: std::shared_ptr<h264_pump> pump_; unsigned fps_; std::string sps_; std::string pps_; }; #endif // H264_SUBSESSION_HXX
29.742424
80
0.501274
triminalt
8f6bfca0bd584b9aaa57a47a29558d3c88f3fc98
2,411
hh
C++
RAVL2/Core/Base/FuncStream.hh
isuhao/ravl2
317e0ae1cb51e320b877c3bad6a362447b5e52ec
[ "BSD-Source-Code" ]
null
null
null
RAVL2/Core/Base/FuncStream.hh
isuhao/ravl2
317e0ae1cb51e320b877c3bad6a362447b5e52ec
[ "BSD-Source-Code" ]
null
null
null
RAVL2/Core/Base/FuncStream.hh
isuhao/ravl2
317e0ae1cb51e320b877c3bad6a362447b5e52ec
[ "BSD-Source-Code" ]
null
null
null
// This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2008, OmniPerception Ltd. // This code may be redistributed under the terms of the GNU Lesser // General Public License (LGPL). See the lgpl.licence file for details or // see http://www.gnu.org/copyleft/lesser.html // file-header-ends-here #ifndef RAVL_FUNCSTREAM_HEADER #define RAVL_FUNCSTREAM_HEADER 1 //! file="Ravl/Core/Base/FuncStream.hh" //! lib=RavlCore //! date="29/05/2008" //! author="Charles Galambos" //! docentry="Ravl.API.Core.IO.Streams" //! userlevel=Normal #include "Ravl/Stream.hh" #include "Ravl/Calls.hh" namespace RavlN { //: Write stream to a method. class FuncOStreamBufC : public std::streambuf { public: typedef traits_type::int_type int_type; //: Constructor FuncOStreamBufC(const CallFunc2C<const char *,SizeT> &writeCall, SizeT bufferSize = 8192); //: Destructor. virtual ~FuncOStreamBufC(); //: Buffer overflow virtual int_type overflow(int_type c); //: Sync stream. virtual int sync(); protected: void Flush(); char *m_buffer; SizeT m_bufferSize; CallFunc2C<const char *,SizeT> m_write; // Method to call to write data. }; //: Read stream from a method. class FuncIStreamBufC : public std::streambuf { public: typedef traits_type::int_type int_type; //: Constructor. FuncIStreamBufC(const CallFunc2C<char *,SizeT,SizeT> &readCall, SizeT bufferSize = 8192); //: Destructor. virtual ~FuncIStreamBufC(); //: Underflow. virtual int_type underflow(); protected: char *m_buffer; SizeT m_bufferSize; CallFunc2C<char *,SizeT,SizeT> m_read; }; //: function based ostream class funcostream : public std::ostream { public: funcostream(const CallFunc2C<const char *,SizeT> &writeCall, SizeT bufferSize = 8192) : std::ostream(0), m_streamBuf(writeCall, bufferSize) { rdbuf(&m_streamBuf); } protected: FuncOStreamBufC m_streamBuf; }; //: function based ostream class funcistream : public std::istream { public: funcistream(const CallFunc2C<char *,SizeT,SizeT> &readCall, SizeT bufferSize = 8192) : std::istream(0), m_streamBuf(readCall, bufferSize) { rdbuf(&m_streamBuf); } protected: FuncIStreamBufC m_streamBuf; }; } #endif
23.182692
94
0.663625
isuhao
8f6e259e1c954e447098a4f6fdcc4f7c36370c45
54,502
hpp
C++
Source/Tools/alive_api/AOTlvs.hpp
THEONLYDarkShadow/alive_reversing
680d87088023f2d5f2a40c42d6543809281374fb
[ "MIT" ]
1
2021-04-11T23:44:43.000Z
2021-04-11T23:44:43.000Z
Source/Tools/alive_api/AOTlvs.hpp
THEONLYDarkShadow/alive_reversing
680d87088023f2d5f2a40c42d6543809281374fb
[ "MIT" ]
null
null
null
Source/Tools/alive_api/AOTlvs.hpp
THEONLYDarkShadow/alive_reversing
680d87088023f2d5f2a40c42d6543809281374fb
[ "MIT" ]
null
null
null
#pragma once #include "TlvObjectBase.hpp" #include "../AliveLibAO/HoistRocksEffect.hpp" #include "../AliveLibAO/Abe.hpp" #include "../AliveLibAO/Door.hpp" #include "../AliveLibAO/Switch.hpp" #include "../AliveLibAO/DoorLight.hpp" #include "../AliveLibAO/ElectricWall.hpp" #include "../AliveLibAO/Well.hpp" #include "../AliveLibAO/Slig.hpp" #include "../AliveLibAO/SecurityOrb.hpp" #include "../AliveLibAO/FallingItem.hpp" #include "../AliveLibAO/Mine.hpp" #include "../AliveLibAO/Dove.hpp" #include "../AliveLibAO/UXB.hpp" #include "../AliveLibAO/HintFly.hpp" #include "../AliveLibAO/Bat.hpp" #include "../AliveLibAO/ShadowZone.hpp" #include "../AliveLibAO/BellHammer.hpp" #include "../AliveLibAO/IdSplitter.hpp" #include "../AliveLibAO/PullRingRope.hpp" #include "../AliveLibAO/MusicTrigger.hpp" #include "../AliveLibAO/Elum.hpp" #include "../AliveLibAO/LiftPoint.hpp" #include "../AliveLibAO/MovingBomb.hpp" #include "../AliveLibAO/Mudokon.hpp" #include "../AliveLibAO/MeatSaw.hpp" #include "../AliveLibAO/LCDScreen.hpp" #include "../AliveLibAO/InvisibleSwitch.hpp" #include "../AliveLibAO/TrapDoor.hpp" #include "../AliveLibAO/BirdPortal.hpp" #include "../AliveLibAO/BoomMachine.hpp" #include "../AliveLibAO/Slog.hpp" #include "../AliveLibAO/ChimeLock.hpp" #include "../AliveLibAO/FlintLockFire.hpp" #include "../AliveLibAO/LiftMover.hpp" #include "../AliveLibAO/Scrab.hpp" #include "../AliveLibAO/SlogSpawner.hpp" #include "../AliveLibAO/Rock.hpp" #include "../AliveLibAO/SlogHut.hpp" #include "../AliveLibAO/SecurityClaw.hpp" #include "../AliveLibAO/SecurityDoor.hpp" #include "../AliveLibAO/TimedMine.hpp" #include "../AliveLibAO/MotionDetector.hpp" #include "../AliveLibAO/BackgroundAnimation.hpp" #include "../AliveLibAO/LCDStatusBoard.hpp" #include "../AliveLibAO/HoneySack.hpp" #include "../AliveLibAO/SlingMudokon.hpp" #include "../AliveLibAO/BeeSwarmHole.hpp" #include "../AliveLibAO/Meat.hpp" #include "../AliveLibAO/RollingBall.hpp" #include "../AliveLibAO/RollingBallStopper.hpp" #include "../AliveLibAO/ZBall.hpp" #include "../AliveLibAO/FootSwitch.hpp" #include "../AliveLibAO/Paramite.hpp" #define CTOR_AO(className, objectTypeName, tlvType) className() : TlvObjectBaseAO(tlvType, objectTypeName) {} className(TypesCollection& globalTypes, AO::Path_TLV* pTlv = nullptr) : TlvObjectBaseAO(tlvType, objectTypeName, pTlv) namespace AO { struct Path_HoneyDripTarget : public Path_TLV { // No fields }; struct Path_Honey : public Path_TLV { __int16 id; __int16 state; int scale; }; struct Path_Bees : public Path_TLV { __int16 id; __int16 swarm_size; __int16 chase_time; __int16 speed; __int16 disable_resources; __int16 num_bees; }; struct Path_ScrabNoFall : public Path_TLV { // No fields }; struct Path_ScrabLeftBound : public Path_TLV { // No fields }; struct Path_ScrabRightBound : public Path_TLV { // No fields }; struct Path_ZSligCover : public Path_TLV { // No fields }; struct Path_AbeStart : public Path_TLV { int scale; }; struct Path_MudokonPathTrans : public Path_TLV { LevelIds level; __int16 path; int camera; }; struct Path_Pulley : public Path_TLV { int scale; }; struct Path_Preloader : public Path_TLV { int unload_cams_ASAP; }; struct Path_SligSpawner : public Path_TLV { enum class StartState : __int16 { Listening_0 = 0, Paused_1 = 1, Sleeping_2 = 2, Chase_3 = 3, GameEnder_4 = 4, Paused_5 = 5, }; __int16 field_18_scale; StartState field_1A_start_state; __int16 field_1C_pause_time; __int16 field_1E_pause_left_min; __int16 field_20_pause_left_max; __int16 field_22_pause_right_min; __int16 field_24_pause_right_max; __int16 field_26_chal_type; __int16 field_28_chal_time; __int16 field_2A_number_of_times_to_shoot; __int16 field_2C_unknown; // TODO: Part of above field, check me? __int16 field_2E_code1; __int16 field_30_code2; __int16 field_32_chase_abe; __int16 field_34_start_direction; __int16 field_36_panic_timeout; __int16 field_38_num_panic_sounds; __int16 field_3A_panic_sound_timeout; __int16 field_3C_stop_chase_delay; __int16 field_3E_time_to_wait_before_chase; __int16 field_40_slig_id; __int16 field_42_listen_time; __int16 field_44_percent_say_what; __int16 field_46_percent_beat_mud; __int16 field_48_talk_to_abe; __int16 field_4A_dont_shoot; __int16 field_4C_z_shoot_delay; __int16 field_4E_stay_awake; __int16 field_50_disable_resources; __int16 field_52_noise_wake_up_distance; int field_54_id; }; struct Path_ContinueZone : public Path_TLV { int field_10_zone_number; }; struct Path_StartController : public Path_TLV { // No fields }; struct Path_InvisibleZone : public Path_TLV { // No fields }; struct Path_DeathDrop : public Path_TLV { __int16 animation; __int16 sound; __int16 id; __int16 action; int set_value; }; struct Path_ElumStart : public Path_TLV { // No fields }; struct Path_ElumWall : public Path_TLV { // No fields }; struct Path_HandStone : public Path_TLV { Path_Handstone_data mData; }; struct Path_BellsongStone : public Path_TLV { Path_BellsongStone_data mData; }; struct Path_MovieStone : public Path_TLV { Path_Moviestone_data mData; }; } namespace AOTlvs { struct Path_MovieStone : public TlvObjectBaseAO<AO::Path_MovieStone> { CTOR_AO(Path_MovieStone, "MovieStone", AO::TlvTypes::MovieStone_51) { ADD("fmv_id", mTlv.mData.fmvId); ADD("scale", mTlv.mData.scale); } }; struct Path_BellsongStone : public TlvObjectBaseAO<AO::Path_BellsongStone> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::BellsongTypes>("Enum_BellsongTypes", { {AO::BellsongTypes::eWhistle, "whistle"}, {AO::BellsongTypes::eChimes, "chimes"}, }); } CTOR_AO(Path_BellsongStone, "BellSongStone", AO::TlvTypes::BellSongStone_54) { ADD("scale", mTlv.mData.scale); ADD("type", mTlv.mData.type); ADD("code1", mTlv.mData.code1); ADD("code2", mTlv.mData.code2); ADD("id", mTlv.mData.id); } }; struct Path_HandStone : public TlvObjectBaseAO<AO::Path_HandStone> { CTOR_AO(Path_HandStone, "HandStone", AO::TlvTypes::HandStone_100) { ADD("scale", mTlv.mData.scale); ADD("camera1_level", mTlv.mData.camera1.level); ADD("camera1_path", mTlv.mData.camera1.path); ADD("camera1_camera", mTlv.mData.camera1.camera); ADD("camera2_level", mTlv.mData.camera2.level); ADD("camera2_path", mTlv.mData.camera2.path); ADD("camera2_camera", mTlv.mData.camera2.camera); ADD("camera3_level", mTlv.mData.camera3.level); ADD("camera3_path", mTlv.mData.camera3.path); ADD("camera3_camera", mTlv.mData.camera3.camera); } }; struct Path_Door : public TlvObjectBaseAO<AO::Path_Door> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::DoorStates>("Enum_DoorStates", { {AO::DoorStates::eOpen_0, "Open"}, {AO::DoorStates::eClosed_1, "Closed"}, {AO::DoorStates::eOpening_2, "Opening"}, {AO::DoorStates::eClosing_3, "Closing"}, }); } CTOR_AO(Path_Door, "Door", AO::TlvTypes::Door_6) { ADD("Level", mTlv.field_18_level); ADD("Path", mTlv.field_1A_path); ADD("Camera", mTlv.field_1C_camera); ADD("Scale", mTlv.field_1E_scale); ADD("DoorNumber", mTlv.field_20_door_number); ADD("Id", mTlv.field_22_id); ADD("TargetDoorNumber", mTlv.field_24_target_door_number); ADD("StartState", mTlv.field_26_start_state); ADD("DoorClosed", mTlv.field_28_door_closed); ADD("Hub1", mTlv.field_2A_hub1); ADD("Hub2", mTlv.field_2A_hub2); ADD("Hub3", mTlv.field_2A_hub3); ADD("Hub4", mTlv.field_2A_hub4); ADD("Hub5", mTlv.field_2A_hub5); ADD("Hub6", mTlv.field_2A_hub6); ADD("Hub7", mTlv.field_2A_hub7); ADD("Hub8", mTlv.field_2A_hub8); ADD("WipeEffect", mTlv.field_3A_wipe_effect); ADD("MovieNumber", mTlv.field_3C_movie_number); ADD("XOffset", mTlv.field_3E_x_offset); ADD("YOffset", mTlv.field_40_y_offset); ADD("WipeXOrg", mTlv.field_42_wipe_x_org); ADD("WipeYOrg", mTlv.field_44_wipe_y_org); ADD("AbeDirection", mTlv.field_46_abe_direction); } }; struct Path_ContinuePoint : public TlvObjectBaseAO<AO::Path_ContinuePoint> { CTOR_AO(Path_ContinuePoint, "ContinuePoint", AO::TlvTypes::ContinuePoint_0) { ADD("ZoneNumber", mTlv.field_18_zone_number); ADD("ClearFromId", mTlv.field_1A_clear_from_id); ADD("ClearToId", mTlv.field_1C_clear_to_id); ADD("ElumRestarts", mTlv.field_1E_elum_restarts); ADD("AbeSpawnDirection", mTlv.field_20_abe_direction); } }; struct Path_Hoist : public TlvObjectBaseAO<AO::Path_Hoist> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_Hoist::Type>("Enum_HoistType", { {AO::Path_Hoist::Type::eNextEdge, "next_edge"}, {AO::Path_Hoist::Type::eNextFloor, "next_floor"}, {AO::Path_Hoist::Type::eOffScreen, "off_screen"}, }); types.AddEnum<AO::Path_Hoist::EdgeType>("Enum_HoistEdgeType", { {AO::Path_Hoist::EdgeType::eBoth, "both"}, {AO::Path_Hoist::EdgeType::eLeft, "left"}, {AO::Path_Hoist::EdgeType::eRight, "right"}, }); } CTOR_AO(Path_Hoist, "Hoist", AO::TlvTypes::Hoist_3) { ADD("HoistType", mTlv.field_18_hoist_type); ADD("HoistEdgeType", mTlv.field_1A_edge_type); ADD("Id", mTlv.field_1C_id); } }; struct Path_Change : public TlvObjectBaseAO<AO::Path_ChangeTLV> { CTOR_AO(Path_Change, "PathTransition", AO::TlvTypes::PathTransition_1) { ADD("Level", mTlv.field_18_level); ADD("HoistEdgeType", mTlv.field_1A_path); ADD("Camera", mTlv.field_1C_camera); ADD("Movie", mTlv.field_1E_movie); // TODO: Enum ADD("Wipe", mTlv.field_20_wipe); // TODO: Enum ADD("Scale", mTlv.field_22_scale); // TODO: Enum } }; struct Path_Switch : public TlvObjectBaseAO<AO::Path_Switch> { CTOR_AO(Path_Switch, "Switch", AO::TlvTypes::Switch_26) { ADD("TriggerObject", mTlv.field_18_trigger_object); ADD("TriggerAction", mTlv.field_1A_trigger_object_action); ADD("Scale", mTlv.field_1C_scale); ADD("OnSound", mTlv.field_1E_on_sound); // TODO: Enum ADD("OffSound", mTlv.field_20_off_sound); // TODO: Enum ADD("SoundDirection", mTlv.field_22_sound_direction); // TODO: Enum } }; struct Path_LightEffect : public TlvObjectBaseAO<AO::Path_LightEffect> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_LightEffect::Type>("Enum_LightType", { {AO::Path_LightEffect::Type::Star_0, "Star"}, {AO::Path_LightEffect::Type::RedGlow_1, "RedGlow"}, {AO::Path_LightEffect::Type::GreenGlow_2, "GreenGlow"}, {AO::Path_LightEffect::Type::FlintGlow_3, "FlintGlow"}, {AO::Path_LightEffect::Type::Switchable_RedGreenDoorLights_4, "RedGreenDoorLight"}, {AO::Path_LightEffect::Type::Switchable_RedGreenHubLight_5, "RedGreenHubLight"}, }); } CTOR_AO(Path_LightEffect, "LightEffect", AO::TlvTypes::LightEffect_106) { ADD("Type", mTlv.field_18_type); ADD("Size", mTlv.field_1A_size); ADD("Id", mTlv.field_1C_id); ADD("FlipX", mTlv.field_1E_flip_x); } }; struct Path_ElectricWall : public TlvObjectBaseAO<AO::Path_ElectricWall> { CTOR_AO(Path_ElectricWall, "ElectricWall", AO::TlvTypes::ElectricWall_67) { ADD("Scale", mTlv.field_18_scale); ADD("Id", mTlv.field_1A_id); ADD("State", mTlv.field_1C_start_state); // TODO: Enum } }; struct Path_ContinueZone : public TlvObjectBaseAO<AO::Path_ContinueZone> { CTOR_AO(Path_ContinueZone, "ContinueZone", AO::TlvTypes::ContinueZone_2) { ADD("ZoneNumber", mTlv.field_10_zone_number); } }; struct Path_StartController : public TlvObjectBaseAO<AO::Path_StartController> { CTOR_AO(Path_StartController, "StartController", AO::TlvTypes::StartController_28) { // No fields } }; struct Path_Edge : public TlvObjectBaseAO<AO::Path_Edge> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_Edge::Type>("Enum_EdgeType", { {AO::Path_Edge::Type::eLeft, "left"}, {AO::Path_Edge::Type::eRight, "right"}, {AO::Path_Edge::Type::eBoth, "both"}, }); } CTOR_AO(Path_Edge, "Edge", AO::TlvTypes::Edge_4) { ADD("type", mTlv.field_18_type); ADD("can_grab", mTlv.field_1A_can_grab); } }; struct Path_WellLocal : public TlvObjectBaseAO<AO::Path_WellLocal> { CTOR_AO(Path_WellLocal, "WellLocal", AO::TlvTypes::WellLocal_11) { // Well base ADD("scale", mTlv.field_18_scale); ADD("trigger_id", mTlv.field_1A_trigger_id); ADD("well_id", mTlv.field_1C_well_id); ADD("resource_id", mTlv.field_1E_res_id); ADD("exit_x", mTlv.field_20_exit_x); ADD("exit_y", mTlv.field_22_exit_y); ADD("dx", mTlv.field_24_off_level_or_dx.dx); ADD("dy", mTlv.field_26_off_path_or_dy); // Well local ADD("on_dx", mTlv.field_28_on_dx); ADD("on_dy", mTlv.field_2A_on_dy); ADD("emit_leaves", mTlv.field_2C_bEmit_leaves); ADD("leaf_x", mTlv.field_2E_leaf_x); ADD("leaf_y", mTlv.field_30_leaf_y); } }; struct Path_WellExpress : public TlvObjectBaseAO<AO::Path_WellExpress> { CTOR_AO(Path_WellExpress, "WellExpress", AO::TlvTypes::WellExpress_45) { // Well base ADD("scale", mTlv.field_18_scale); ADD("trigger_id", mTlv.field_1A_trigger_id); ADD("well_id", mTlv.field_1C_well_id); ADD("resource_id", mTlv.field_1E_res_id); ADD("exit_x", mTlv.field_20_exit_x); ADD("exit_y", mTlv.field_22_exit_y); ADD("off_level", mTlv.field_24_off_level_or_dx.level); ADD("off_path", mTlv.field_26_off_path_or_dy); // Well express ADD("off_camera", mTlv.field_28_off_camera); ADD("off_well_id", mTlv.field_2A_off_well_id); ADD("on_level", mTlv.field_2C_on_level); ADD("on_path", mTlv.field_2E_on_path); ADD("on_camera", mTlv.field_30_on_camera); ADD("on_well_id", mTlv.field_32_on_well_id); ADD("emit_leaves", mTlv.field_34_emit_leaves); ADD("leaf_x", mTlv.field_36_leaf_x); ADD("leaf_y", mTlv.field_38_leaf_y); ADD("movie_id", mTlv.field_3A_movie_id); } }; struct Path_InvisibleZone : public TlvObjectBaseAO<AO::Path_InvisibleZone> { CTOR_AO(Path_InvisibleZone, "InvisibleZone", AO::TlvTypes::InvisibleZone_58) { // No fields } }; struct Path_EnemyStopper : public TlvObjectBaseAO<AO::Path_EnemyStopper> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_EnemyStopper::StopDirection>("Enum_StopDirection", { {AO::Path_EnemyStopper::StopDirection::Left_0, "left"}, {AO::Path_EnemyStopper::StopDirection::Right_1, "right"}, {AO::Path_EnemyStopper::StopDirection::Both_2, "both"}, }); } CTOR_AO(Path_EnemyStopper, "EnemyStopper", AO::TlvTypes::EnemyStopper_79) { ADD("direction", mTlv.field_18_direction); ADD("id", mTlv.field_1A_id); } }; struct Path_Slig : public TlvObjectBaseAO<AO::Path_Slig> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_Slig::StartState>("Enum_SligStartState", { {AO::Path_Slig::StartState::Listening_0, "listening"}, {AO::Path_Slig::StartState::Paused_1, "paused"}, {AO::Path_Slig::StartState::Sleeping_2, "sleeping"}, {AO::Path_Slig::StartState::Chase_3, "chase"}, {AO::Path_Slig::StartState::GameEnder_4, "game_ender"}, {AO::Path_Slig::StartState::Paused_5, "paused"}, }); } CTOR_AO(Path_Slig, "Slig", AO::TlvTypes::Slig_24) { ADD("scale", mTlv.field_18_scale); ADD("start_state", mTlv.field_1A_start_state); ADD("pause_time", mTlv.field_1C_pause_time); ADD("pause_left_min", mTlv.field_1E_pause_left_min); ADD("pause_left_max", mTlv.field_20_pause_left_max); ADD("pause_right_min", mTlv.field_22_pause_right_min); ADD("pause_right_max", mTlv.field_24_pause_right_max); ADD("chal_type", mTlv.field_26_chal_type); ADD("chal_time", mTlv.field_28_chal_time); ADD("number_of_times_to_shoot", mTlv.field_2A_number_of_times_to_shoot); ADD("unknown", mTlv.field_2C_unknown); ADD("code1", mTlv.field_2E_code1); ADD("code2", mTlv.field_30_code2); ADD("chase_abe", mTlv.field_32_chase_abe); ADD("start_direction", mTlv.field_34_start_direction); ADD("panic_timeout", mTlv.field_36_panic_timeout); ADD("num_panic_sounds", mTlv.field_38_num_panic_sounds); ADD("panic_sound_timeout", mTlv.field_3A_panic_sound_timeout); ADD("stop_chase_delay", mTlv.field_3C_stop_chase_delay); ADD("time_to_wait_before_chase", mTlv.field_3E_time_to_wait_before_chase); ADD("slig_id", mTlv.field_40_slig_id); ADD("listen_time", mTlv.field_42_listen_time); ADD("percent_say_what", mTlv.field_44_percent_say_what); ADD("percent_beat_mud", mTlv.field_46_percent_beat_mud); ADD("talk_to_abe", mTlv.field_48_talk_to_abe); ADD("dont_shoot", mTlv.field_4A_dont_shoot); ADD("z_shoot_delay", mTlv.field_4C_z_shoot_delay); ADD("stay_awake", mTlv.field_4E_stay_awake); ADD("disable_resources", mTlv.field_50_disable_resources.Raw().all); ADD("noise_wake_up_distance", mTlv.field_52_noise_wake_up_distance); ADD("id", mTlv.field_54_id); } }; struct Path_DeathDrop : public TlvObjectBaseAO<AO::Path_DeathDrop> { CTOR_AO(Path_DeathDrop, "DeathDrop", AO::TlvTypes::DeathDrop_5) { ADD_HIDDEN("animation", mTlv.animation); ADD_HIDDEN("sound", mTlv.sound); ADD_HIDDEN("id", mTlv.id); ADD_HIDDEN("action", mTlv.action); ADD_HIDDEN("set_value", mTlv.set_value); } }; struct Path_SligLeftBound : public TlvObjectBaseAO<AO::Path_SligLeftBound> { CTOR_AO(Path_SligLeftBound, "SligLeftBound", AO::TlvTypes::eSligBoundLeft_57) { ADD("id", mTlv.field_18_slig_id); ADD("disabled_resources", mTlv.field_1A_disabled_resources.Raw().all); } }; struct Path_SligRightBound : public TlvObjectBaseAO<AO::Path_SligRightBound> { CTOR_AO(Path_SligRightBound, "SligRightBound", AO::TlvTypes::eSligBoundRight_76) { ADD("id", mTlv.field_18_slig_id); ADD("disabled_resources", mTlv.field_1A_disabled_resources.Raw().all); } }; struct Path_SligPersist : public TlvObjectBaseAO<AO::Path_SligPersist> { CTOR_AO(Path_SligPersist, "SligPersist", AO::TlvTypes::eSligPersist_77) { ADD("id", mTlv.field_18_slig_id); ADD("disabled_resources", mTlv.field_1A_disabled_resources.Raw().all); } }; struct Path_SecurityOrb : public TlvObjectBaseAO<AO::Path_SecurityOrb> { CTOR_AO(Path_SecurityOrb, "SecurityOrb", AO::TlvTypes::SecurityOrb_29) { ADD("scale", mTlv.field_18_scale); ADD("disabled_resources", mTlv.field_1A_disable_resources); } }; struct Path_FallingItem : public TlvObjectBaseAO<AO::Path_FallingItem> { CTOR_AO(Path_FallingItem, "FallingItem", AO::TlvTypes::FallingItem_15) { ADD("id", mTlv.field_18_id); ADD("scale", mTlv.field_1A_scale); ADD("delay_time", mTlv.field_1C_delay_time); ADD("number_of_items", mTlv.field_1E_number_of_items); ADD("reset_id", mTlv.field_20_reset_id); } }; struct Path_Mine : public TlvObjectBaseAO<AO::Path_Mine> { CTOR_AO(Path_Mine, "Mine", AO::TlvTypes::Mine_46) { ADD("num_patterns", mTlv.field_18_num_patterns); ADD("pattern", mTlv.field_1A_pattern); ADD("scale", mTlv.field_1C_scale); ADD("disabled_resources", mTlv.field_1E_disabled_resources); ADD("persists_offscreen", mTlv.field_20_persists_offscreen); } }; struct Path_Dove : public TlvObjectBaseAO<AO::Path_Dove> { CTOR_AO(Path_Dove, "Dove", AO::TlvTypes::Dove_12) { ADD("dove_count", mTlv.field_18_dove_count); ADD("pixel_perfect", mTlv.field_1A_pixel_perfect); ADD("scale", mTlv.field_1C_scale); } }; struct Path_UXB : public TlvObjectBaseAO<AO::Path_UXB> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::UXB_State>("UXB_State", { {AO::UXB_State::eArmed_0, "Armed"}, {AO::UXB_State::eDisarmed_1, "Disarmed"}, }); } CTOR_AO(Path_UXB, "UXB", AO::TlvTypes::UXB_47) { ADD("num_patterns", mTlv.field_18_num_patterns); ADD("pattern", mTlv.field_1A_pattern); ADD("scale", mTlv.field_1C_scale); ADD("state", mTlv.field_1E_state); ADD("disabled_resources", mTlv.field_20_disabled_resources); } }; struct Path_HintFly : public TlvObjectBaseAO<AO::Path_HintFly> { CTOR_AO(Path_HintFly, "HintFly", AO::TlvTypes::HintFly_92) { ADD("message_id", mTlv.field_18_message_id); } }; struct Path_Bat : public TlvObjectBaseAO<AO::Path_Bat> { CTOR_AO(Path_Bat, "Bat", AO::TlvTypes::Bat_49) { ADD("ticks_before_moving", mTlv.field_18_ticks_before_moving); ADD("speed", mTlv.field_1A_speed); ADD("scale", mTlv.field_1C_scale); ADD("attack_duration", mTlv.field_1E_attack_duration); } }; struct Path_ShadowZone : public TlvObjectBaseAO<AO::Path_ShadowZone> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::ShadowZoneScale>("Enum_ShadowZoneScale", { {AO::ShadowZoneScale::eBoth_0, "both"}, {AO::ShadowZoneScale::eHalf_1, "half"}, {AO::ShadowZoneScale::eFull_2, "full"}, }); } CTOR_AO(Path_ShadowZone, "ShadowZone", AO::TlvTypes::ShadowZone_7) { ADD("centre_w", mTlv.field_18_centre_w); ADD("centre_h", mTlv.field_1A_centre_h); ADD("r", mTlv.field_1C_r); ADD("g", mTlv.field_1E_g); ADD("b", mTlv.field_20_b); ADD("id", mTlv.field_22_id); ADD("scale", mTlv.field_24_scale); } }; struct Path_BellHammer : public TlvObjectBaseAO<AO::Path_BellHammer> { CTOR_AO(Path_BellHammer, "BellHammer", AO::TlvTypes::BellHammer_27) { ADD("id", mTlv.field_18_id); ADD("action", mTlv.field_1A_action); ADD("scale", mTlv.field_1C_scale); ADD("direction", mTlv.field_1E_direction); } }; struct Path_IdSplitter : public TlvObjectBaseAO<AO::Path_IdSplitter> { CTOR_AO(Path_IdSplitter, "IdSplitter", AO::TlvTypes::IdSplitter_94) { ADD("source_id", mTlv.field_18_source_id); ADD("delay", mTlv.field_1A_delay); ADD("id_1", mTlv.field_1C_id1); ADD("id_2", mTlv.field_1C_id2); ADD("id_3", mTlv.field_1C_id3); ADD("id_4", mTlv.field_1C_id4); } }; struct Path_PullRingRope : public TlvObjectBaseAO<AO::Path_PullRingRope> { CTOR_AO(Path_PullRingRope, "PullRingRope", AO::TlvTypes::PullRingRope_18) { ADD("id", mTlv.field_18_id); ADD("action", mTlv.field_1A_action); ADD("rope_length", mTlv.field_1C_rope_length); ADD("scale", mTlv.field_1E_scale); ADD("on_sound", mTlv.field_20_on_sound); ADD("off_sound", mTlv.field_22_off_sound); ADD("sound_direction", mTlv.field_24_sound_direction); } }; struct Path_MusicTrigger : public TlvObjectBaseAO<AO::Path_MusicTrigger> { CTOR_AO(Path_MusicTrigger, "MusicTrigger", AO::TlvTypes::MusicTrigger_105) { ADD("type", mTlv.field_18_type); ADD("enabled_by", mTlv.field_1A_enabled_by); ADD("id", mTlv.field_1C_id); ADD("timer", mTlv.field_1E_timer); } }; struct Path_ElumPathTrans : public TlvObjectBaseAO<AO::Path_ElumPathTrans> { CTOR_AO(Path_ElumPathTrans, "ElumPathTrans", AO::TlvTypes::ElumPathTrans_99) { ADD("level", mTlv.field_18_level); ADD("path", mTlv.field_1A_path); ADD("camera", mTlv.field_1C_camera); } }; struct Path_ElumStart : public TlvObjectBaseAO<AO::Path_ElumStart> { CTOR_AO(Path_ElumStart, "ElumStart", AO::TlvTypes::ElumStart_38) { // No fields } }; struct Path_ElumWall : public TlvObjectBaseAO<AO::Path_ElumWall> { CTOR_AO(Path_ElumWall, "ElumWall", AO::TlvTypes::ElumWall_40) { // No fields } }; struct Path_LiftPoint : public TlvObjectBaseAO<AO::Path_LiftPoint> { CTOR_AO(Path_LiftPoint, "LiftPoint", AO::TlvTypes::LiftPoint_8) { ADD("id", mTlv.field_18_id); ADD("is_start_point", mTlv.field_1A_bstart_point); ADD("lift_type", mTlv.field_1C_lift_type); ADD("lift_point_stop_type", mTlv.field_1E_lift_point_stop_type); ADD("scale", mTlv.field_20_scale); ADD("ignore_lift_mover", mTlv.field_22_bIgnore_lift_mover); } }; struct Path_MovingBomb : public TlvObjectBaseAO<AO::Path_MovingBomb> { CTOR_AO(Path_MovingBomb, "MovingBomb", AO::TlvTypes::MovingBomb_86) { ADD("speed", mTlv.field_18_speed); ADD("id", mTlv.field_1A_id); ADD("start_type_triggered_by_alarm", mTlv.field_1C_bStart_type_triggered_by_alarm); ADD("scale", mTlv.field_1E_scale); ADD("max_rise", mTlv.field_20_max_rise); ADD("disabled_resources", mTlv.field_22_disabled_resources); ADD("start_speed", mTlv.field_24_start_speed); ADD("persist_offscreen", mTlv.field_26_persist_offscreen); } }; struct Path_MovingBombStopper : public TlvObjectBaseAO<AO::Path_MovingBombStopper> { CTOR_AO(Path_MovingBombStopper, "MovingBombStopper", AO::TlvTypes::MovingBombStopper_87) { ADD("min_delay", mTlv.field_18_min_delay); ADD("max_delay", mTlv.field_1A_max_delay); } }; struct Path_RingMudokon : public TlvObjectBaseAO<AO::Path_RingMudokon> { CTOR_AO(Path_RingMudokon, "RingMudokon", AO::TlvTypes::RingMudokon_50) { ADD("facing", mTlv.field_18_facing); ADD("abe_must_be_same_direction", mTlv.field_1A_abe_must_be_same_direction); ADD("scale", mTlv.field_1C_scale); ADD("silent", mTlv.field_1E_silent); ADD("code1", mTlv.field_20_code1); ADD("code2", mTlv.field_22_code2); ADD("action", mTlv.field_24_action); ADD("ring_timeout", mTlv.field_26_ring_timeout); ADD("instant_powerup", mTlv.field_28_instant_powerup); } }; struct Path_RingCancel : public TlvObjectBaseAO<AO::Path_RingCancel> // TODO: correct size is 24 not 28 { CTOR_AO(Path_RingCancel, "RingCancel", AO::TlvTypes::RingCancel_109) { // No properties } }; struct Path_MeatSaw : public TlvObjectBaseAO<AO::Path_MeatSaw> { CTOR_AO(Path_MeatSaw, "MeatSaw", AO::TlvTypes::MeatSaw_88) { ADD("scale", mTlv.field_18_scale_background); ADD("min_time_off1", mTlv.field_1A_min_time_off1); ADD("max_time_off1", mTlv.field_1C_max_time_off1); ADD("max_rise_time", mTlv.field_1E_max_rise_time); ADD("id", mTlv.field_20_id); ADD("type", mTlv.field_22_type); ADD("speed", mTlv.field_24_speed); ADD("start_state", mTlv.field_26_start_state); ADD("off_speed", mTlv.field_28_off_speed); ADD("min_time_off2", mTlv.field_2A_min_time_off2); ADD("max_time_off2", mTlv.field_2C_max_time_off2); ADD("initial_position", mTlv.field_2E_inital_position); } }; struct Path_LCDScreen : public TlvObjectBaseAO<AO::Path_LCDScreen> { CTOR_AO(Path_LCDScreen, "LCDScreen", AO::TlvTypes::LCDScreen_98) { ADD("message_1_id", mTlv.field_18_message_1_id); ADD("message_rand_min", mTlv.field_1A_message_rand_min); ADD("message_rand_max", mTlv.field_1C_message_rand_max); } }; struct Path_InvisibleSwitch : public TlvObjectBaseAO<AO::Path_InvisibleSwitch> { CTOR_AO(Path_InvisibleSwitch, "InvisibleSwitch", AO::TlvTypes::InvisibleSwitch_81) { ADD("id", mTlv.field_18_id); ADD("action", mTlv.field_1A_action); ADD("delay", mTlv.field_1C_delay); ADD("set_off_alarm", mTlv.field_1E_set_off_alarm); ADD("scale", mTlv.field_20_scale); } }; struct Path_TrapDoor : public TlvObjectBaseAO<AO::Path_TrapDoor> { CTOR_AO(Path_TrapDoor, "TrapDoor", AO::TlvTypes::TrapDoor_55) { ADD("id", mTlv.field_18_id); ADD("start_state", mTlv.field_1A_start_state); ADD("self_closing", mTlv.field_1C_self_closing); ADD("scale", mTlv.field_1E_scale); ADD("dest_level", mTlv.field_20_dest_level); ADD("direction", mTlv.field_22_direction); ADD("anim_offset", mTlv.field_24_anim_offset); } }; struct Path_BirdPortal : public TlvObjectBaseAO<AO::Path_BirdPortal> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::PortalSide>("Enum_PortalSide", { {AO::PortalSide::eRight_0, "right"}, {AO::PortalSide::eLeft_1, "left"}, }); types.AddEnum<AO::PortalType>("Enum_PortalType", { {AO::PortalType::eAbe_0, "abe"}, {AO::PortalType::eWorker_1, "worker"}, {AO::PortalType::eShrykull_2, "shrykull"}, {AO::PortalType::eMudTeleport_3, "mud_teleport"}, }); } CTOR_AO(Path_BirdPortal, "BirdPortal", AO::TlvTypes::BirdPortal_52) { ADD("side", mTlv.field_18_side); ADD("dest_level", mTlv.field_1A_dest_level); ADD("dest_path", mTlv.field_1C_dest_path); ADD("dest_camera", mTlv.field_1E_dest_camera); ADD("scale", mTlv.field_20_scale); ADD("movie_id", mTlv.field_22_movie_id); ADD("portal_type", mTlv.field_24_portal_type); ADD("num_muds_for_shrykull", mTlv.field_26_num_muds_for_shrykul); } }; struct Path_BoomMachine : public TlvObjectBaseAO<AO::Path_BoomMachine> { CTOR_AO(Path_BoomMachine, "BoomMachine", AO::TlvTypes::BoomMachine_97) { ADD("scale", mTlv.field_18_scale); ADD("nozzle_side", mTlv.field_1A_nozzle_side); ADD("disabled_resources", mTlv.field_1C_disabled_resources); ADD("number_of_grenades", mTlv.field_1E_number_of_grenades); } }; struct Path_Mudokon : public TlvObjectBaseAO<AO::Path_Mudokon> { CTOR_AO(Path_Mudokon, "Mudokon", AO::TlvTypes::Mudokon_82) { ADD("scale", mTlv.field_18_scale); ADD("job", mTlv.field_1A_job); ADD("direction", mTlv.field_1C_direction); ADD("voice_adjust", mTlv.field_1E_voice_adjust); ADD("rescue_id", mTlv.field_20_rescue_id); ADD("deaf", mTlv.field_22_deaf); ADD("disabled_resources", mTlv.field_24_disabled_resources); ADD("persist", mTlv.field_26_persist); } }; struct Path_BirdPortalExit : public TlvObjectBaseAO<AO::Path_BirdPortalExit> { CTOR_AO(Path_BirdPortalExit, "BirdPortalExit", AO::TlvTypes::BirdPortalExit_53) { ADD("side", mTlv.field_18_side); ADD("scale", mTlv.field_1A_scale); } }; struct Path_Slog : public TlvObjectBaseAO<AO::Path_Slog> { CTOR_AO(Path_Slog, "Slog", AO::TlvTypes::Slog_25) { ADD("scale", mTlv.field_18_scale); ADD("direction", mTlv.field_1A_direction); ADD("wakeup_anger", mTlv.field_1C_wakeup_anger); ADD("bark_anger", mTlv.field_1E_bark_anger); ADD("sleeps", mTlv.field_20_sleeps); ADD("chase_anger", mTlv.field_22_chase_anger); ADD("jump_attack_delay", mTlv.field_24_jump_attack_delay); ADD("disabled_resources", mTlv.field_26_disabled_resources); ADD("anger_trigger_id", mTlv.field_28_anger_trigger_id); } }; struct Path_ChimeLock : public TlvObjectBaseAO<AO::Path_ChimeLock> { CTOR_AO(Path_ChimeLock, "ChimeLock", AO::TlvTypes::ChimeLock_69) { ADD("scale", mTlv.field_18_scale); ADD("solve_id", mTlv.field_1A_solve_id); ADD("code1", mTlv.field_1C_code1); ADD("code2", mTlv.field_1E_code2); ADD("id", mTlv.field_20_id); } }; struct Path_FlintLockFire : public TlvObjectBaseAO<AO::Path_FlintLockFire> { CTOR_AO(Path_FlintLockFire, "FlintLockFire", AO::TlvTypes::FlintLockFire_73) { ADD("scale", mTlv.field_18_scale); ADD("id", mTlv.field_1A_id); } }; struct Path_LiftMover : public TlvObjectBaseAO<AO::Path_LiftMover> { CTOR_AO(Path_LiftMover, "LiftMover", AO::TlvTypes::LiftMover_68) { ADD("switch_id", mTlv.field_18_switch_id); ADD("lift_id", mTlv.field_1A_lift_id); ADD("direction", mTlv.field_1C_direction); } }; struct Path_Scrab : public TlvObjectBaseAO<AO::Path_Scrab> { CTOR_AO(Path_Scrab, "Scrab", AO::TlvTypes::Scrab_72) { ADD("scale", mTlv.field_18_scale); ADD("attack_delay", mTlv.field_1A_attack_delay); ADD("patrol_type", mTlv.field_1C_patrol_type); ADD("left_min_delay", mTlv.field_1E_left_min_delay); ADD("left_max_delay", mTlv.field_20_left_max_delay); ADD("right_min_delay", mTlv.field_22_right_min_delay); ADD("right_max_delay", mTlv.field_24_right_max_delay); ADD("attack_duration", mTlv.field_26_attack_duration); ADD("disable_resources", mTlv.field_28_disable_resources); ADD("roar_randomly", mTlv.field_2A_roar_randomly); } }; struct Path_SlogSpawner : public TlvObjectBaseAO<AO::Path_SlogSpawner> { CTOR_AO(Path_SlogSpawner, "SlogSpawner", AO::TlvTypes::SlogSpawner_107) { ADD("scale", mTlv.field_18_scale); ADD("num_slogs", mTlv.field_1A_num_slogs); ADD("num_at_a_time", mTlv.field_1C_num_at_a_time); ADD("direction", mTlv.field_1E_direction); ADD("ticks_between_slogs", mTlv.field_20_ticks_between_slogs); ADD("start_id", mTlv.field_22_start_id); } }; struct Path_RockSack : public TlvObjectBaseAO<AO::Path_RockSack> { CTOR_AO(Path_RockSack, "RockSack", AO::TlvTypes::RockSack_13) { ADD("side", mTlv.field_18_side); ADD("x_vel", mTlv.field_1A_x_vel); ADD("y_vel", mTlv.field_1C_y_vel); ADD("scale", mTlv.field_1E_scale); ADD("num_rocks", mTlv.field_20_num_rocks); } }; struct Path_SlogHut : public TlvObjectBaseAO<AO::Path_SlogHut> { CTOR_AO(Path_SlogHut, "SlogHut", AO::TlvTypes::SlogHut_111) { ADD("scale", mTlv.field_18_scale); ADD("switch_id", mTlv.field_1A_switch_id); ADD("z_delay", mTlv.field_1C_z_delay); } }; struct Path_SecurityClaw : public TlvObjectBaseAO<AO::Path_SecurityClaw> { CTOR_AO(Path_SecurityClaw, "SecurityClaw", AO::TlvTypes::SecurityClaw_61) { ADD("scale", mTlv.field_18_scale); ADD("alarm_id", mTlv.field_1A_alarm_id); ADD("alarm_time", mTlv.field_1C_alarm_time); ADD("disabled_resources", mTlv.field_1E_disabled_resources); } }; struct Path_SecurityDoor : public TlvObjectBaseAO<AO::Path_SecurityDoor> { CTOR_AO(Path_SecurityDoor, "SecurityDoor", AO::TlvTypes::SecurityDoor_95) { ADD("scale", mTlv.field_18_scale); ADD("id", mTlv.field_1A_id); ADD("code_1", mTlv.field_1C_code_1); ADD("code_2", mTlv.field_1E_code2); ADD("xpos", mTlv.field_20_xpos); ADD("ypos", mTlv.field_22_ypos); } }; struct Path_TimedMine : public TlvObjectBaseAO<AO::Path_TimedMine> { CTOR_AO(Path_TimedMine, "TimedMine", AO::TlvTypes::TimedMine_22) { ADD("id", mTlv.field_18_id); ADD("state", mTlv.field_1A_state); ADD("scale", mTlv.field_1C_scale); ADD("ticks_before_explode", mTlv.field_1E_ticks_before_explode); ADD("disable_resources", mTlv.field_20_disable_resources); } }; struct Path_SligSpawner : public TlvObjectBaseAO<AO::Path_SligSpawner> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_SligSpawner::StartState>("Enum_SligSpawnerStartState", { {AO::Path_SligSpawner::StartState::Listening_0, "listening"}, {AO::Path_SligSpawner::StartState::Paused_1, "paused"}, {AO::Path_SligSpawner::StartState::Sleeping_2, "sleeping"}, {AO::Path_SligSpawner::StartState::Chase_3, "chase"}, {AO::Path_SligSpawner::StartState::GameEnder_4, "game_ender"}, {AO::Path_SligSpawner::StartState::Paused_5, "paused"}, }); } CTOR_AO(Path_SligSpawner, "SligSpawner", AO::TlvTypes::SligSpawner_66) { ADD("scale", mTlv.field_18_scale); ADD("start_state", mTlv.field_1A_start_state); ADD("pause_time", mTlv.field_1C_pause_time); ADD("pause_left_min", mTlv.field_1E_pause_left_min); ADD("pause_left_max", mTlv.field_20_pause_left_max); ADD("pause_right_min", mTlv.field_22_pause_right_min); ADD("pause_right_max", mTlv.field_24_pause_right_max); ADD("chal_type", mTlv.field_26_chal_type); ADD("chal_time", mTlv.field_28_chal_time); ADD("number_of_times_to_shoot", mTlv.field_2A_number_of_times_to_shoot); ADD("unknown", mTlv.field_2C_unknown); ADD("code1", mTlv.field_2E_code1); ADD("code2", mTlv.field_30_code2); ADD("chase_abe", mTlv.field_32_chase_abe); ADD("start_direction", mTlv.field_34_start_direction); ADD("panic_timeout", mTlv.field_36_panic_timeout); ADD("num_panic_sounds", mTlv.field_38_num_panic_sounds); ADD("panic_sound_timeout", mTlv.field_3A_panic_sound_timeout); ADD("stop_chase_delay", mTlv.field_3C_stop_chase_delay); ADD("time_to_wait_before_chase", mTlv.field_3E_time_to_wait_before_chase); ADD("slig_id", mTlv.field_40_slig_id); ADD("listen_time", mTlv.field_42_listen_time); ADD("percent_say_what", mTlv.field_44_percent_say_what); ADD("percent_beat_mud", mTlv.field_46_percent_beat_mud); ADD("talk_to_abe", mTlv.field_48_talk_to_abe); ADD("dont_shoot", mTlv.field_4A_dont_shoot); ADD("z_shoot_delay", mTlv.field_4C_z_shoot_delay); ADD("stay_awake", mTlv.field_4E_stay_awake); ADD("disable_resources", mTlv.field_50_disable_resources); ADD("noise_wake_up_distance", mTlv.field_52_noise_wake_up_distance); ADD("id", mTlv.field_54_id); } }; struct Path_MotionDetector : public TlvObjectBaseAO<AO::Path_MotionDetector> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_MotionDetector::StartMoveDirection>("Enum_MotionDetectorStartMoveDirection", { {AO::Path_MotionDetector::StartMoveDirection::eRight_0, "right"}, {AO::Path_MotionDetector::StartMoveDirection::eLeft_1, "left"}, }); } CTOR_AO(Path_MotionDetector, "MotionDetector", AO::TlvTypes::MotionDetector_62) { ADD("scale", mTlv.field_18_scale); ADD("device_x", mTlv.field_1A_device_x); ADD("device_y", mTlv.field_1C_device_y); ADD("speed_x256", mTlv.field_1E_speed_x256); ADD("start_move_direction", mTlv.field_20_start_move_direction); ADD("draw_flare", mTlv.field_22_draw_flare); ADD("disable_id", mTlv.field_24_disable_id); ADD("alarm_id", mTlv.field_26_alarm_id); ADD("alarm_ticks", mTlv.field_28_alarm_ticks); } }; struct Path_BackgroundAnimation : public TlvObjectBaseAO<AO::Path_BackgroundAnimation> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::TPageAbr>("Enum_TPageAbr", { {AO::TPageAbr::eBlend_1, "blend_1"}, {AO::TPageAbr::eBlend_2, "blend_2"}, {AO::TPageAbr::eBlend_3, "blend_3"}, {AO::TPageAbr::eBlend_0, "blend_0"}, }); } CTOR_AO(Path_BackgroundAnimation, "BackgroundAnimation", AO::TlvTypes::BackgroundAnimation_19) { ADD("animation_id", mTlv.field_18_animation_id); ADD("is_semi_trans", mTlv.field_1A_is_semi_trans); ADD("semi_trans_mode", mTlv.field_1C_semi_trans_mode); ADD("sound_effect", mTlv.field_1E_sound_effect); } }; struct Path_LCDStatusBoard : public TlvObjectBaseAO<AO::Path_LCDStatusBoard> { CTOR_AO(Path_LCDStatusBoard, "LCDStatusBoard", AO::TlvTypes::LCDStatusBoard_103) { // No fields } }; struct Path_Preloader : public TlvObjectBaseAO<AO::Path_Preloader> { CTOR_AO(Path_Preloader, "Preloader", AO::TlvTypes::Preloader_102) { ADD("unload_cams_asap", mTlv.unload_cams_ASAP); } }; struct Path_Pulley : public TlvObjectBaseAO<AO::Path_Pulley> { CTOR_AO(Path_Pulley, "Pulley", AO::TlvTypes::Pulley_35) { ADD("scale", mTlv.scale); } }; struct Path_SoftLanding : public TlvObjectBaseAO<AO::Path_SoftLanding> { CTOR_AO(Path_SoftLanding, "SoftLanding", AO::TlvTypes::SoftLanding_114) { // No fields } }; struct Path_MudokonPathTrans : public TlvObjectBaseAO<AO::Path_MudokonPathTrans> { CTOR_AO(Path_MudokonPathTrans, "MudokonPathTrans", AO::TlvTypes::MudokonPathTrans_89) { ADD("level", mTlv.level); ADD("path", mTlv.path); ADD("camera", mTlv.camera); } }; struct Path_AbeStart : public TlvObjectBaseAO<AO::Path_AbeStart> { CTOR_AO(Path_AbeStart, "AbeStart", AO::TlvTypes::AbeStart_37) { ADD("scale", mTlv.scale); } }; struct Path_ZSligCover : public TlvObjectBaseAO<AO::Path_ZSligCover> { CTOR_AO(Path_ZSligCover, "ZSligCover", AO::TlvTypes::ZSligCover_83) { // No fields } }; struct Path_ScrabLeftBound : public TlvObjectBaseAO<AO::Path_ScrabLeftBound> { CTOR_AO(Path_ScrabLeftBound, "ScrabLeftBound", AO::TlvTypes::ScrabLeftBound_74) { // No fields } }; struct Path_ScrabRightBound : public TlvObjectBaseAO<AO::Path_ScrabRightBound> { CTOR_AO(Path_ScrabRightBound, "ScrabRightBound", AO::TlvTypes::ScrabRightBound_75) { // No fields } }; struct Path_ScrabNoFall : public TlvObjectBaseAO<AO::Path_ScrabNoFall> { CTOR_AO(Path_ScrabNoFall, "ScrabNoFall", AO::TlvTypes::ScrabNoFall_93) { // No fields } }; struct Path_LiftMudokon : public TlvObjectBaseAO<AO::Path_LiftMudokon> { CTOR_AO(Path_LiftMudokon, "LiftMudokon", AO::TlvTypes::LiftMudokon_32) { ADD("how_far_to_walk", mTlv.field_18_how_far_to_walk); ADD("lift_id", mTlv.field_1A_lift_id); ADD("direction", mTlv.field_1C_direction); ADD("silent", mTlv.field_1E_silent); ADD("scale", mTlv.field_20_scale); ADD("code1", mTlv.field_22_code1); ADD("code2", mTlv.field_24_code2); } }; struct Path_HoneySack : public TlvObjectBaseAO<AO::Path_HoneySack> { CTOR_AO(Path_HoneySack, "HoneySack", AO::TlvTypes::HoneySack_36) { ADD("chase_ticks", mTlv.field_18_chase_ticks); ADD("scale", mTlv.field_1A_scale); } }; struct Path_SlingMudokon : public TlvObjectBaseAO<AO::Path_SlingMudokon> { CTOR_AO(Path_SlingMudokon, "SlingMudokon", AO::TlvTypes::SlingMudokon_41) { ADD("scale", mTlv.field_18_scale); ADD("silent", mTlv.field_1A_silent); ADD("code1", mTlv.field_1C_code_1); ADD("code2", mTlv.field_1E_code_2); } }; struct Path_BeeSwarmHole : public TlvObjectBaseAO<AO::Path_BeeSwarmHole> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_BeeSwarmHole::MovementType>("Enum_BeeSwarmHoleMovementType", { {AO::Path_BeeSwarmHole::MovementType::eHover_0, "hover"}, {AO::Path_BeeSwarmHole::MovementType::eAttack_1, "attack"}, {AO::Path_BeeSwarmHole::MovementType::eFollowPath_2, "follow_path"}, }); } CTOR_AO(Path_BeeSwarmHole, "BeeSwarmHole", AO::TlvTypes::BeeSwarmHole_34) { ADD("what_to_spawn", mTlv.field_18_what_to_spawn); ADD("interval", mTlv.field_1A_interval); ADD("id", mTlv.field_1C_id); ADD("movement_type", mTlv.field_1E_movement_type); ADD("size", mTlv.field_20_size); ADD("chase_time", mTlv.field_22_chase_time); ADD("speed", mTlv.field_24_speed); ADD("scale", mTlv.field_26_scale); } }; struct Path_MeatSack : public TlvObjectBaseAO<AO::Path_MeatSack> { CTOR_AO(Path_MeatSack, "MeatSack", AO::TlvTypes::MeatSack_71) { ADD("side", mTlv.field_18_side); ADD("x_vel", mTlv.field_1A_x_vel); ADD("y_vel", mTlv.field_1C_y_vel); ADD("scale", mTlv.field_1E_scale); ADD("amount_of_meat", mTlv.field_20_amount_of_meat); } }; struct Path_RollingBall : public TlvObjectBaseAO<AO::Path_RollingBall> { CTOR_AO(Path_RollingBall, "RollingBall", AO::TlvTypes::RollingBall_56) { ADD("scale", mTlv.field_18_scale); ADD("roll_direction", mTlv.field_1A_roll_direction); ADD("release", mTlv.field_1C_release); ADD("speed", mTlv.field_1E_speed); ADD("acceleration", mTlv.field_20_acceleration); } }; struct Path_RollingBallStopper : public TlvObjectBaseAO<AO::Path_RollingBallStopper> { CTOR_AO(Path_RollingBallStopper, "RollingBallStopper", AO::TlvTypes::RollingBallStopper_59) { ADD("id_on", mTlv.field_18_id_on); ADD("scale", mTlv.field_1A_scale); ADD("id_off", mTlv.field_1C_id_off); ADD("direction", mTlv.field_1E_direction); } }; struct Path_Bees : public TlvObjectBaseAO<AO::Path_Bees> { CTOR_AO(Path_Bees, "Bees", AO::TlvTypes::Bees_43) { ADD("id", mTlv.id); ADD("swarm_size", mTlv.swarm_size); ADD("chase_time", mTlv.chase_time); ADD("speed", mTlv.speed); ADD("disable_resources", mTlv.disable_resources); ADD("num_bees", mTlv.num_bees); } }; struct Path_ZBall : public TlvObjectBaseAO<AO::Path_ZBall> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::Path_ZBall::StartPos>("Enum_ZBallStartPos", { {AO::Path_ZBall::StartPos::eCenter_0, "center"}, {AO::Path_ZBall::StartPos::eOut_1, "out"}, {AO::Path_ZBall::StartPos::eIn_2, "in"}, }); types.AddEnum<AO::Path_ZBall::Speed>("Enum_ZBallSpeed", { {AO::Path_ZBall::Speed::eNormal_0, "normal"}, {AO::Path_ZBall::Speed::eFast_1, "fast"}, {AO::Path_ZBall::Speed::eSlow_2, "slow"}, }); } CTOR_AO(Path_ZBall, "ZBall", AO::TlvTypes::ZBall_14) { ADD("start_pos", mTlv.field_18_start_pos); ADD("scale", mTlv.field_1A_scale); ADD("speed", mTlv.field_1C_speed); } }; struct Path_FootSwitch : public TlvObjectBaseAO<AO::Path_FootSwitch> { void AddTypes(TypesCollection& types) override { types.AddEnum<AO::FootSwitchTriggerBy>("Enum_FootSwitchTriggeredBy", { {AO::FootSwitchTriggerBy::eOnlyAbe_0, "only_abe"}, {AO::FootSwitchTriggerBy::eAnyone_1, "anyone"}, }); } CTOR_AO(Path_FootSwitch, "FootSwitch", AO::TlvTypes::FootSwitch_60) { ADD("id", mTlv.field_18_id); ADD("scale", mTlv.field_1A_scale); ADD("action", mTlv.field_1C_action); ADD("triggered_by", mTlv.field_1E_trigger_by); } }; struct Path_Paramite : public TlvObjectBaseAO<AO::Path_Paramite> { CTOR_AO(Path_Paramite, "Paramite", AO::TlvTypes::Paramite_48) { ADD("scale", mTlv.field_18_scale); ADD("enter_from_web", mTlv.field_1A_bEnter_from_web); ADD("attack_delay", mTlv.field_1C_attack_delay); ADD("drop_in_timer", mTlv.field_1E_drop_in_timer); ADD("meat_eating_time", mTlv.field_20_meat_eating_time); ADD("attack_duration", mTlv.field_22_attack_duration); ADD("disabled_resources", mTlv.field_24_disabled_resources); ADD("id", mTlv.field_26_id); ADD("hiss_before_attack", mTlv.field_28_hiss_before_attack); ADD("delete_when_far_away", mTlv.field_2A_delete_when_far_away); } }; struct Path_Honey : public TlvObjectBaseAO<AO::Path_Honey> { CTOR_AO(Path_Honey, "Honey", AO::TlvTypes::Honey_20) { ADD("id", mTlv.id); ADD("state", mTlv.state); ADD("scale", mTlv.scale); } }; struct Path_HoneyDripTarget : public TlvObjectBaseAO<AO::Path_HoneyDripTarget> { CTOR_AO(Path_HoneyDripTarget, "HoneyDripTarget", AO::TlvTypes::HoneyDripTarget_42) { // No fields } }; }
36.701684
229
0.604253
THEONLYDarkShadow
8f6fb4b6e359b997373d444156b358a826b4c91e
2,458
cpp
C++
code/library/Graphics/Sprite.cpp
jpike/noah_ark
491ab775f69457e20a930c0dd8049609dee9c677
[ "Unlicense" ]
null
null
null
code/library/Graphics/Sprite.cpp
jpike/noah_ark
491ab775f69457e20a930c0dd8049609dee9c677
[ "Unlicense" ]
61
2015-04-11T21:26:12.000Z
2021-10-02T13:34:43.000Z
code/library/Graphics/Sprite.cpp
jpike/noah_ark
491ab775f69457e20a930c0dd8049609dee9c677
[ "Unlicense" ]
null
null
null
#include "Graphics/Sprite.h" namespace GRAPHICS { /// Creates an invisible sprite based on the provided texture information. /// @param[in] texture_id - The ID of the texture containing graphics for the sprite. /// @param[in] texture_sub_rectangle - The sub-rectangle of the texture /// defining which portion should be used for the sprite. Sprite::Sprite( const RESOURCES::AssetId texture_id, const MATH::FloatRectangle& texture_sub_rectangle) : IsVisible(false), WorldPosition(), TextureId(texture_id), TextureSubRectangle(texture_sub_rectangle) { // Sprites should be centered within their texture rectangle by default. Origin.X = texture_sub_rectangle.Width() / 2.0f; Origin.Y = texture_sub_rectangle.Height() / 2.0f; } /// Gets the bounding box of the sprite, in world pixel coordinates. /// @return The bounding box of the sprite. MATH::FloatRectangle Sprite::GetWorldBoundingBox() const { /// @todo Completely eliminate SFML usage here! sf::Sprite sfml_sprite; sfml_sprite.setColor(sf::Color(Color.Red, Color.Green, Color.Blue, Color.Alpha)); sfml_sprite.setOrigin(Origin.X, Origin.Y); sfml_sprite.setPosition(WorldPosition.X, WorldPosition.Y); sfml_sprite.setRotation(RotationAngleInDegrees); sfml_sprite.setScale(Scale.X, Scale.Y); sf::IntRect texture_rectangle; texture_rectangle.left = (int)TextureSubRectangle.LeftTop.X; texture_rectangle.top = (int)TextureSubRectangle.LeftTop.Y; texture_rectangle.width = (int)TextureSubRectangle.Width(); texture_rectangle.height = (int)TextureSubRectangle.Height(); sfml_sprite.setTextureRect(texture_rectangle); MATH::FloatRectangle world_bounding_box(sfml_sprite.getGlobalBounds()); return world_bounding_box; } /// Gets the width of the sprite, in pixels. /// @return The width of the sprite. float Sprite::GetWidthInPixels() const { MATH::FloatRectangle bounding_box = GetWorldBoundingBox(); float width = bounding_box.Width(); return width; } /// Gets the height of the sprite, in pixels. /// @return The height of the sprite. float Sprite::GetHeightInPixels() const { MATH::FloatRectangle bounding_box = GetWorldBoundingBox(); float height = bounding_box.Height(); return height; } }
39.645161
90
0.685924
jpike
8f76125695a45a68e86f37957b4ab31a9db03fa4
979
cpp
C++
modules/complex-number/test/test_Andrich_Maria_complex_number.cpp
BalovaElena/devtools-course-practice
f8d5774dbb78ec50200c45fd17665ed40fc8c4c5
[ "CC-BY-4.0" ]
null
null
null
modules/complex-number/test/test_Andrich_Maria_complex_number.cpp
BalovaElena/devtools-course-practice
f8d5774dbb78ec50200c45fd17665ed40fc8c4c5
[ "CC-BY-4.0" ]
null
null
null
modules/complex-number/test/test_Andrich_Maria_complex_number.cpp
BalovaElena/devtools-course-practice
f8d5774dbb78ec50200c45fd17665ed40fc8c4c5
[ "CC-BY-4.0" ]
null
null
null
// Copyright 2022 Andrich Maria #include <gtest/gtest.h> #include "include/complex_number.h" TEST(Andrich_Maria_ComplexNumberTest, addition) { double re = 0.0; double im = 0.0; ComplexNumber num(re, im); EXPECT_EQ(re, num.getRe()); EXPECT_EQ(im, num.getIm()); } TEST(Andrich_Maria_ComplexNumberTest, Sum) { double re = 3.0; double im = 2.5; double re1 = 2.0; double im1 = 1.5; ComplexNumber a(re, im); ComplexNumber b(re1, im1); ComplexNumber c = a + b; EXPECT_EQ(5.0, c.getRe()); EXPECT_EQ(4.0, c.getIm()); } TEST(Andrich_Maria_ComplexNumberTest, Divide_by_zero) { double re = 1.7; double im = 0.8; double re1 = 0.0; double im1 = 0.0; ComplexNumber a(re, im); ComplexNumber b(re1, im1); ASSERT_ANY_THROW(a / b); } TEST(Andrich_Maria_ComplexNumberTest, Comparison) { double re = 2.0; double im = 3.0; double re1 = 2.0; double im1 = 3.0; ComplexNumber a(re, im); ComplexNumber b(re1, im1); EXPECT_EQ(a, b); }
17.8
55
0.657814
BalovaElena
8f783a02f48c7425995d2792d93dedc443a46bc7
3,860
cxx
C++
main/svtools/source/contnr/tooltiplbox.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
679
2015-01-06T06:34:58.000Z
2022-03-30T01:06:03.000Z
main/svtools/source/contnr/tooltiplbox.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
102
2017-11-07T08:51:31.000Z
2022-03-17T12:13:49.000Z
main/svtools/source/contnr/tooltiplbox.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
331
2015-01-06T11:40:55.000Z
2022-03-14T04:07:51.000Z
/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. * *************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include <svtools/tooltiplbox.hxx> #include <vcl/help.hxx> // ============================================================================ namespace svtools { // ---------------------------------------------------------------------------- void lcl_ToolTipLBox_ShowToolTip( ListBox& rListBox, const HelpEvent& rHEvt ) { // only show tooltip if helpmode is BALLOON or QUICK if ( !( rHEvt.GetMode() & HELPMODE_BALLOON ) && !( rHEvt.GetMode() & HELPMODE_QUICK ) ) { // else call base class method rListBox.ListBox::RequestHelp( rHEvt ); return ; } // find the list box entry the mouse points to Point aMousePos( rListBox.ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ); sal_uInt16 nTop = rListBox.GetTopEntry(); sal_uInt16 nBottom = nTop + rListBox.GetDisplayLineCount(); sal_uInt16 nPos; for( nPos = nTop; nPos < nBottom; ++nPos ) { Rectangle aItemRect( rListBox.GetBoundingRectangle( nPos ) ); if( (aItemRect.Top() <= aMousePos.Y()) && (aMousePos.Y() <= aItemRect.Bottom()) ) break; } // show text content of the entry, if it does not fit if( nPos < nBottom ) { String aHelpText( rListBox.GetEntry( nPos ) ); if( rListBox.GetTextWidth( aHelpText ) > rListBox.GetOutputSizePixel().Width() ) { Point aLBoxPos( rListBox.OutputToScreenPixel( Point( 0, 0 ) ) ); Size aLBoxSize( rListBox.GetSizePixel() ); Rectangle aLBoxRect( aLBoxPos, aLBoxSize ); if( rHEvt.GetMode() == HELPMODE_BALLOON ) Help::ShowBalloon( &rListBox, aLBoxRect.Center(), aLBoxRect, aHelpText ); else Help::ShowQuickHelp( &rListBox, aLBoxRect, aHelpText ); } } } // ---------------------------------------------------------------------------- ToolTipListBox::ToolTipListBox( Window* pParent, WinBits nStyle ) : ListBox( pParent, nStyle ) { } ToolTipListBox::ToolTipListBox( Window* pParent, const ResId& rResId ) : ListBox( pParent, rResId ) { } void ToolTipListBox::RequestHelp( const HelpEvent& rHEvt ) { lcl_ToolTipLBox_ShowToolTip( *this, rHEvt ); } // ---------------------------------------------------------------------------- ToolTipMultiListBox::ToolTipMultiListBox( Window* pParent, WinBits nStyle ) : MultiListBox( pParent, nStyle ) { } ToolTipMultiListBox::ToolTipMultiListBox( Window* pParent, const ResId& rResId ) : MultiListBox( pParent, rResId ) { } void ToolTipMultiListBox::RequestHelp( const HelpEvent& rHEvt ) { lcl_ToolTipLBox_ShowToolTip( *this, rHEvt ); } // ---------------------------------------------------------------------------- } // namespace svtools // ============================================================================
32.991453
91
0.573834
Grosskopf
8f788e2be14f32174830c4b227eab817df0b9861
4,577
cpp
C++
disc-fe/src/Panzer_GlobalEvaluationDataContainer.cpp
hillyuan/Panzer
13ece3ea4c145c4d7b6339e3ad6332a501932ea8
[ "BSD-3-Clause" ]
1
2022-03-22T03:49:50.000Z
2022-03-22T03:49:50.000Z
disc-fe/src/Panzer_GlobalEvaluationDataContainer.cpp
hillyuan/Panzer
13ece3ea4c145c4d7b6339e3ad6332a501932ea8
[ "BSD-3-Clause" ]
null
null
null
disc-fe/src/Panzer_GlobalEvaluationDataContainer.cpp
hillyuan/Panzer
13ece3ea4c145c4d7b6339e3ad6332a501932ea8
[ "BSD-3-Clause" ]
null
null
null
// @HEADER // *********************************************************************** // // Panzer: A partial differential equation assembly // engine for strongly coupled complex multiphysics systems // Copyright (2011) Sandia Corporation // // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the Corporation nor the names of the // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "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 SANDIA CORPORATION OR THE // 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. // // Questions? Contact Roger P. Pawlowski (rppawlo@sandia.gov) and // Eric C. Cyr (eccyr@sandia.gov) // *********************************************************************** // @HEADER #include "Panzer_GlobalEvaluationDataContainer.hpp" namespace panzer { GlobalEvaluationData::~GlobalEvaluationData() {} /** Add a data object to be used in evaluation loop. */ void GlobalEvaluationDataContainer::addDataObject(const std::string & key, const Teuchos::RCP<GlobalEvaluationData> & ged) { lookupTable_[key] = ged; } /** Does this containe have a match to a certain key. */ bool GlobalEvaluationDataContainer::containsDataObject(const std::string & key) const { return lookupTable_.find(key)!=lookupTable_.end(); } /** Get the data object associated with the key. */ Teuchos::RCP<GlobalEvaluationData> GlobalEvaluationDataContainer::getDataObject(const std::string & key) const { std::unordered_map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr; for(itr=begin();itr!=end();++itr) { if(itr->first==key) return itr->second; } { std::stringstream ss; ss << "Valid keys = "; for(const_iterator litr=begin();litr!=end();++litr) ss << "\"" << litr->first << "\" "; TEUCHOS_TEST_FOR_EXCEPTION(true,std::logic_error, "In GlobalEvaluationDataContainer::getDataObject(key) failed to find the data object specified by \""+key+"\"\n " + ss.str()); } return Teuchos::null; /* std::unordered_map<std::string,Teuchos::RCP<GlobalEvaluationData> >::const_iterator itr = lookupTable_.find(key); if(itr==lookupTable_.end()) { std::stringstream ss; ss << "Valid keys = "; for(const_iterator litr=begin();litr!=end();++litr) ss << "\"" << litr->first << "\" "; TEUCHOS_TEST_FOR_EXCEPTION(itr==lookupTable_.end(),std::logic_error, "In GlobalEvaluationDataContainer::getDataObject(key) failed to find the data object specified by \""+key+"\"\n " + ss.str()); } return itr->second; */ } //! Call ghost to global on all the containers void GlobalEvaluationDataContainer::ghostToGlobal(int p) { for(iterator itr=begin();itr!=end();++itr) itr->second->ghostToGlobal(p); } //! Call global to ghost on all the containers void GlobalEvaluationDataContainer::globalToGhost(int p) { for(iterator itr=begin();itr!=end();++itr) itr->second->globalToGhost(p); } //! Call global to ghost on all the containers void GlobalEvaluationDataContainer::initialize() { for(iterator itr=begin();itr!=end();++itr) itr->second->initializeData(); } }
36.91129
152
0.678829
hillyuan
8f7b44104365e4e421935f84bf8c342c827d1a1f
702
cpp
C++
.Codeforces/Codeforces Round #571 (Div. 2)/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings.cpp
sxweetlollipop2912/MaCode
661d77a2096e4d772fda2b6a7f80c84113b2cde9
[ "MIT" ]
null
null
null
.Codeforces/Codeforces Round #571 (Div. 2)/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings.cpp
sxweetlollipop2912/MaCode
661d77a2096e4d772fda2b6a7f80c84113b2cde9
[ "MIT" ]
null
null
null
.Codeforces/Codeforces Round #571 (Div. 2)/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings/C. Vus the Cossack and Strings.cpp
sxweetlollipop2912/MaCode
661d77a2096e4d772fda2b6a7f80c84113b2cde9
[ "MIT" ]
null
null
null
#include "pch.h" #include <iostream> #include <algorithm> #include <string> #define maxN 1000001 typedef long maxn; typedef std::string str; maxn na, nb, da[maxN], res; str a, b; bool even; void Prepare() { std::cin >> a >> b; na = a.size(); nb = b.size(); for (maxn i = 1; i < na; i++) { da[i] = da[i - 1] + (bool)(a[i] != a[i - 1]); } } void Process() { even = 1; for (maxn i = 0; i < nb; i++) if (a[i] != b[i]) even = !even; res = even; for (maxn l = 1; l <= na - nb; l++) { maxn r = l + nb - 1; if ((da[r] - da[l - 1]) & 1) even = !even; res += even; } std::cout << res; } int main() { std::ios_base::sync_with_stdio(0); std::cin.tie(0); Prepare(); Process(); }
14.625
47
0.519943
sxweetlollipop2912