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
e22e9ae17eea1dfda75559fcaa2056af277d2c84
4,867
cpp
C++
XLib-v1.2.0/src/Base/Host/fUtil.cpp
mangrove-univr/Mangrove
3d95096c7adfad5eb27625b020c222487e91ab4e
[ "MIT" ]
1
2019-12-28T09:30:24.000Z
2019-12-28T09:30:24.000Z
XLib-v1.2.0/src/Base/Host/fUtil.cpp
mangrove-univr/Mangrove
3d95096c7adfad5eb27625b020c222487e91ab4e
[ "MIT" ]
1
2020-08-25T10:57:11.000Z
2020-08-25T10:57:11.000Z
XLib-v1.2.0/src/Base/Host/fUtil.cpp
mangrove-univr/Mangrove
3d95096c7adfad5eb27625b020c222487e91ab4e
[ "MIT" ]
null
null
null
/*------------------------------------------------------------------------------ Copyright © 2016 by Nicola Bombieri XLib is provided under the terms of The MIT License (MIT): Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------------*/ /** * @author Federico Busato * Univerity of Verona, Dept. of Computer Science * federico.busato@univr.it */ #include <iostream> #include <fstream> #include <locale> #include <iomanip> #include <stdexcept> #include "Base/Host/fUtil.hpp" #include "Base/Host/numeric.hpp" #if __linux__ #include <unistd.h> #endif namespace xlib { /// @cond std::ostream& operator<<(std::ostream& os, const Color& mod) { return os << "\033[" << (int) mod << "m"; } std::ostream& operator<<(std::ostream& os, const Emph& mod) { return os << "\033[" << (int) mod << "m"; } ThousandSep::ThousandSep() : sep(NULL) { sep = new myseps; std::cout.imbue(std::locale(std::locale(), sep)); } ThousandSep::~ThousandSep() { std::cout.imbue(std::locale()); } void fixedFloat() { std::cout.setf(std::ios::fixed, std::ios::floatfield); } void scientificFloat() { std::cout.setf(std::ios::scientific, std::ios::floatfield); } /// @endcond //} //@StreamModifier #if __linux__ void memInfoHost(std::size_t Req) { unsigned pages = static_cast<unsigned>(::sysconf(_SC_PHYS_PAGES)); unsigned page_size = static_cast<unsigned>(::sysconf(_SC_PAGE_SIZE)); memInfoPrint(pages * page_size, pages * page_size - 100u * (1u << 20u), Req); } #endif void memInfoPrint(std::size_t total, std::size_t free, std::size_t Req) { std::cout << " Total Memory:\t" << (total >> 20) << " MB" << std::endl << " Free Memory:\t" << (free >> 20) << " MB" << std::endl << "Request memory:\t" << (Req >> 20) << " MB" << std::endl << " Request (%):\t" << ((Req >> 20) * 100) / (total >> 20) << " %" << std::endl << std::endl; if (Req > free) throw std::runtime_error(" ! Memory too low"); } bool isDigit(std::string str) { return str.find_first_not_of("0123456789") == std::string::npos; } #if (__linux__) #include <sys/resource.h> #include <errno.h> stackManagement::stackManagement() { if (getrlimit(RLIMIT_STACK, &ActualLimit)) __ERROR("stackManagement::stackManagement() -> getrlimit()"); } stackManagement::~stackManagement() { this->restore(); } void stackManagement::setLimit(std::size_t size) { struct rlimit RL; RL.rlim_cur = size; RL.rlim_max = size; if (setrlimit(RLIMIT_STACK, &RL)) { if (errno == EFAULT) std::cout << "EFAULT" << std::endl; else if (errno == EINVAL) std::cout << "EINVAL" << std::endl; else if (errno == EPERM) std::cout << "EPERM" << std::endl; else if (errno == ESRCH) std::cout << "ESRCH" << std::endl; else std::cout << "?" << std::endl; __ERROR("stackManagement::setLimit() -> setrlimit()"); } } void stackManagement::restore() { if (setrlimit(RLIMIT_STACK, &ActualLimit)) __ERROR("stackManagement::restore() -> setrlimit()"); } void stackManagement::checkUnlimited() { if (ActualLimit.rlim_cur != RLIM_INFINITY) __ERROR("stack size != unlimited (" << ActualLimit.rlim_cur << ")"); } #include <signal.h> // our new library namespace { void ctrlC_HandleFun(int) { #if defined(__NVCC__) cudaDeviceReset(); #endif std::exit(EXIT_FAILURE); } } void ctrlC_Handle() { signal(SIGINT, ctrlC_HandleFun); } #else stackManagement::~stackManagement() {} stackManagement::stackManagement() {} void stackManagement::setLimit(std::size_t size) {} void stackManagement::restore() {} void ctrlC_Handle() {} #endif } //@xlib
29.676829
81
0.623998
mangrove-univr
e2352f737da0f27359996f5b28a286a5afdbe233
1,935
cpp
C++
test/crypto/test_block_crypto.cpp
mbassale/ownpass
a84e0cd3933ec8c3febf0e09647990baf3c2d506
[ "MIT" ]
null
null
null
test/crypto/test_block_crypto.cpp
mbassale/ownpass
a84e0cd3933ec8c3febf0e09647990baf3c2d506
[ "MIT" ]
null
null
null
test/crypto/test_block_crypto.cpp
mbassale/ownpass
a84e0cd3933ec8c3febf0e09647990baf3c2d506
[ "MIT" ]
null
null
null
// // Created by Marco Bassaletti on 11-03-21. // #include <string> #include <vector> #include "../catch.hpp" #include "../../src/crypto/BlockCrypto.h" #include "../../src/crypto/InitializationVector.h" using namespace std; using namespace NSPass::Crypto; class BlockCryptoFixture { public: BlockCryptoFixture() { } protected: vector<uint8_t> create_block_from_string(BlockCrypto& block_crypto, const std::string& str) { auto block_length = block_crypto.pad_length(str.size()); vector<uint8_t> block; block.resize(block_length, 0); memcpy(block.data(), str.data(), str.size()); return block; } void assert_encrypt(BlockCrypto& block_crypto, const std::string& expected, const std::string& plain_text) { auto plain_block = create_block_from_string(block_crypto, expected); auto cipher_block = block_crypto.encrypt(plain_block); auto result_block = block_crypto.decrypt(cipher_block); REQUIRE(plain_block == result_block); } }; TEST_CASE_METHOD(BlockCryptoFixture, "constructor") { vector<uint8_t> init_vector = InitializationVectorFactory::make(BlockCrypto::get_block_length()); REQUIRE_THROWS_AS((BlockCrypto{ "", init_vector }), KeyLengthError); REQUIRE_THROWS_AS((BlockCrypto{ "test1234", init_vector }), KeyLengthError); REQUIRE_NOTHROW((BlockCrypto{ "one test AES key", init_vector })); REQUIRE_NOTHROW((BlockCrypto{ "one test AES keyone test AES key", init_vector })); } TEST_CASE_METHOD(BlockCryptoFixture, "encrypt and decrypt") { vector<uint8_t> init_vector = InitializationVectorFactory::make(BlockCrypto::get_block_length()); BlockCrypto string_crypto{ "two test AES key", init_vector }; assert_encrypt(string_crypto, "", ""); assert_encrypt(string_crypto, " ", " "); assert_encrypt(string_crypto, "a", "a"); assert_encrypt(string_crypto, "123456789 abcdefghijklmnopqrstuvwzyz ABCDEFGHIJKLMNOPQRSTUVWZYZ", "123456789 abcdefghijklmnopqrstuvwzyz ABCDEFGHIJKLMNOPQRSTUVWZYZ"); }
32.79661
107
0.763307
mbassale
e237fdd7e578881d884861f464e9cf27de724716
1,843
cpp
C++
cap8/pp8_3.cpp
Titan201/Jumping-to-cpp
467ba4d197ac2f5225b43732c42aa3fb5262d557
[ "MIT" ]
null
null
null
cap8/pp8_3.cpp
Titan201/Jumping-to-cpp
467ba4d197ac2f5225b43732c42aa3fb5262d557
[ "MIT" ]
null
null
null
cap8/pp8_3.cpp
Titan201/Jumping-to-cpp
467ba4d197ac2f5225b43732c42aa3fb5262d557
[ "MIT" ]
null
null
null
#include <cstdlib> #include <ctime> #include <iostream> using namespace std; int randRange (int low, int high) { return rand() % (high - low + 1) + low; } int GuessResponse(int response, int numberToGuess) { int signal; cout << "You need to guess a number who is between 1 and 100, what will be your guess?: "<< response<<"\n"; if (response > numberToGuess) { cout << "Too High!\n"; signal = 1; return signal; } else if (response == numberToGuess) { cout << "Just Right!\n"; signal = 0; return signal; } else if (response < numberToGuess) { cout << "Too low!\n"; signal = -1; return signal; } cout << "\n"; } int main() { srand( time (NULL)); int numberToGuess = randRange(1,100); int yourGuess, pastGuess, highGuess, lowGuess, signal, pastSignal, steps=1; yourGuess = randRange(1,100); pastGuess = yourGuess; signal = GuessResponse(yourGuess,numberToGuess) ; while(1) { if(signal == 1) { highGuess = pastGuess; yourGuess = randRange(1,highGuess-1); signal = GuessResponse(yourGuess, numberToGuess); } else if (signal == 0) { yourGuess = yourGuess; cout<< "JUST RIGHT!"; break; } else if (signal == -1) { lowGuess = pastGuess; yourGuess = randRange(lowGuess+1,100); signal = GuessResponse(yourGuess,numberToGuess); } pastGuess = yourGuess; pastSignal = signal ; steps++; } cout << "\nThe number to guess is: "<< numberToGuess << endl; cout << "The number of steps to guess the number was: "<< steps<< endl; }
23.0375
111
0.528486
Titan201
e239d9d37a2e275ded954003e6f858e7d771ec9b
2,426
cpp
C++
Ad-hoc/UVA11309 Counting Chaps/Code.cpp
adelnobel/Training-for-ACM-ICPC-problems
8030d24ab3ce1f50821b22647bf9195b41f932b1
[ "MIT" ]
1
2020-03-05T09:09:36.000Z
2020-03-05T09:09:36.000Z
Ad-hoc/UVA11309 Counting Chaps/Code.cpp
adelnobel/Training-for-ACM-ICPC-problems
8030d24ab3ce1f50821b22647bf9195b41f932b1
[ "MIT" ]
null
null
null
Ad-hoc/UVA11309 Counting Chaps/Code.cpp
adelnobel/Training-for-ACM-ICPC-problems
8030d24ab3ce1f50821b22647bf9195b41f932b1
[ "MIT" ]
null
null
null
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <string> using namespace std; #define EPS 1e-7 #define N 10 char s[N]; char s1[N]; int main() { //freopen("in2.in", "r", stdin); int n; scanf("%d", &n, s); while(n--) { scanf("%s", s); bool valid = true, flag = true; int a1 = s[0] - '0', b1 = s[1] - '0', c1 = s[3] - '0', d1 = s[4] + 1 - '0'; while(flag) { for(int a = a1 + '0'; a <= '2' && flag; a++) { char to = '9'; if(a == '2') to = '3'; for(int b = b1 + '0'; b <= to && flag; b++) { for(int c = c1 + '0'; c <= '5' && flag; c++) { for(int d = d1 + '0'; d <= '9' && flag; d++) { valid = true; if( a != d ) valid = false; if( b != c ) valid = false; if(a == '0') { valid = false; if(b == '0') { if(c == '0') { valid = true; } else { if(c == d) valid = true; } } else { if(b == d) valid = true; } } if(valid) { printf("%c%c:%c%c\n", a, b, c, d); flag = false; } } d1 = 0; } c1 = 0; } b1 = 0; } a1 = 0; } } return 0; }
26.955556
83
0.240313
adelnobel
e23baf05a6b2a8a88c00c8ad9d770cea25667394
590
cpp
C++
TAO/performance-tests/Latency/AMH_Single_Threaded/Roundtrip.cpp
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
36
2015-01-10T07:27:33.000Z
2022-03-07T03:32:08.000Z
TAO/performance-tests/Latency/AMH_Single_Threaded/Roundtrip.cpp
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
2
2018-08-13T07:30:51.000Z
2019-02-25T03:04:31.000Z
TAO/performance-tests/Latency/AMH_Single_Threaded/Roundtrip.cpp
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
38
2015-01-08T14:12:06.000Z
2022-01-19T08:33:00.000Z
// // $Id: Roundtrip.cpp 91648 2010-09-08 13:25:56Z johnnyw $ // #include "Roundtrip.h" Roundtrip::Roundtrip (CORBA::ORB_ptr orb) : orb_ (CORBA::ORB::_duplicate (orb)) { } void Roundtrip::test_method ( Test::AMH_RoundtripResponseHandler_ptr _tao_rh, Test::Timestamp send_time) { //ACE_DEBUG ((LM_DEBUG, "Test_Method called\n")); _tao_rh->test_method (send_time); //ACE_DEBUG ((LM_DEBUG, "RH completed\n")); } void Roundtrip::shutdown ( Test::AMH_RoundtripResponseHandler_ptr _tao_rh) { _tao_rh->shutdown (); this->orb_->shutdown (0); }
21.071429
63
0.664407
cflowe
e23c9813eb21af8c65552a4713155c062acd5591
919
hpp
C++
NCGB/Compile/src/OBSOLETE2009/ReduceFix.hpp
mcdeoliveira/NC
54b2a81ebda9e5260328f88f83f56fe8cf472ac3
[ "BSD-3-Clause" ]
103
2016-09-21T06:01:23.000Z
2022-03-27T06:52:10.000Z
NCGB/Compile/src/OBSOLETE2009/ReduceFix.hpp
albinjames/NC
157a55458931a18dd1f42478872c9df0de5cc450
[ "BSD-3-Clause" ]
11
2017-03-27T13:11:42.000Z
2022-03-08T13:46:14.000Z
NCGB/Compile/src/OBSOLETE2009/ReduceFix.hpp
albinjames/NC
157a55458931a18dd1f42478872c9df0de5cc450
[ "BSD-3-Clause" ]
21
2017-06-23T09:01:21.000Z
2022-02-18T06:24:00.000Z
// (c) Mark Stankus 1999 // ReduceFix.h #ifndef INCLUDED_REDUCEFIX_H #define INCLUDED_REDUCEFIX_H // Reduce a fixed set of polynomials #include "Reduce.hpp" #pragma warning(disable:4786) #include "Choice.hpp" #ifdef HAS_INCLUDE_NO_DOTS #include <list> #else #include <list.h> #endif #include "Polynomial.hpp" #include "vcpp.hpp" class ReduceFix : public Reduce { ReduceFix(const ReduceFix&); // not implemented void operator=(const ReduceFix &); // not implemented Reduce & d_x; int d_num_zero; list<Polynomial> d_original; list<Polynomial> d_current; public: ReduceFix(Reduce & x,const list<Polynomial> & L); virtual ~ReduceFix(); virtual bool reduce(Polynomial &) const; void reducefix(); int numberZero() const { return d_num_zero;} const list<Polynomial> & original() const { return d_original; }; const list<Polynomial> & current() const { return d_current; }; }; #endif
23.564103
67
0.718172
mcdeoliveira
e245c060fa77fc08bcf7b89dfcdc7d8fae923079
22,698
cpp
C++
qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/designercore/model/abstractview.cpp
kevinlq/Qt-Creator-Opensource-Study
b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f
[ "MIT" ]
5
2018-12-22T14:49:13.000Z
2022-01-13T07:21:46.000Z
qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/designercore/model/abstractview.cpp
kevinlq/Qt-Creator-Opensource-Study
b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f
[ "MIT" ]
null
null
null
qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/designercore/model/abstractview.cpp
kevinlq/Qt-Creator-Opensource-Study
b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f
[ "MIT" ]
8
2018-07-17T03:55:48.000Z
2021-12-22T06:37:53.000Z
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #include "abstractview.h" #include "model.h" #include "model_p.h" #include "internalnode_p.h" #include "nodeinstanceview.h" #include <qmlstate.h> #include <qmltimelinemutator.h> #ifndef QMLDESIGNER_TEST #include <qmldesignerplugin.h> #include <viewmanager.h> #endif #include <coreplugin/helpmanager.h> #include <utils/qtcassert.h> #include <QRegExp> namespace QmlDesigner { /*! \class QmlDesigner::AbstractView \ingroup CoreModel \brief The AbstractView class provides an abstract interface that views and editors can implement to be notified about model changes. \sa QmlDesigner::WidgetQueryView(), QmlDesigner::NodeInstanceView() */ AbstractView::~AbstractView() { if (m_model) m_model.data()->detachView(this, Model::DoNotNotifyView); } /*! Sets the view of a new \a model. This is handled automatically by AbstractView::modelAttached(). \sa AbstractView::modelAttached() */ void AbstractView::setModel(Model *model) { Q_ASSERT(model != 0); if (model == m_model.data()) return; if (m_model) m_model.data()->detachView(this); m_model = model; } RewriterTransaction AbstractView::beginRewriterTransaction(const QByteArray &identifier) { return RewriterTransaction(this, identifier); } ModelNode AbstractView::createModelNode(const TypeName &typeName, int majorVersion, int minorVersion, const QList<QPair<PropertyName, QVariant> > &propertyList, const QList<QPair<PropertyName, QVariant> > &auxPropertyList, const QString &nodeSource, ModelNode::NodeSourceType nodeSourceType) { return ModelNode(model()->d->createNode(typeName, majorVersion, minorVersion, propertyList, auxPropertyList, nodeSource, nodeSourceType), model(), this); } /*! Returns the constant root model node. */ const ModelNode AbstractView::rootModelNode() const { Q_ASSERT(model()); return ModelNode(model()->d->rootNode(), model(), const_cast<AbstractView*>(this)); } /*! Returns the root model node. */ ModelNode AbstractView::rootModelNode() { Q_ASSERT(model()); return ModelNode(model()->d->rootNode(), model(), this); } /*! Sets the reference to a model to a null pointer. */ void AbstractView::removeModel() { m_model.clear(); } WidgetInfo AbstractView::createWidgetInfo(QWidget *widget, WidgetInfo::ToolBarWidgetFactoryInterface *toolBarWidgetFactory, const QString &uniqueId, WidgetInfo::PlacementHint placementHint, int placementPriority, const QString &tabName, DesignerWidgetFlags widgetFlags) { WidgetInfo widgetInfo; widgetInfo.widget = widget; widgetInfo.toolBarWidgetFactory = toolBarWidgetFactory; widgetInfo.uniqueId = uniqueId; widgetInfo.placementHint = placementHint; widgetInfo.placementPriority = placementPriority; widgetInfo.tabName = tabName; widgetInfo.widgetFlags = widgetFlags; return widgetInfo; } /*! Returns the model of the view. */ Model* AbstractView::model() const { return m_model.data(); } bool AbstractView::isAttached() const { return model(); } /*! Called if a view is being attached to \a model. The default implementation is setting the reference of the model to the view. \sa Model::attachView() */ void AbstractView::modelAttached(Model *model) { setModel(model); } /*! Called before a view is detached from \a model. This function is not called if Model::detachViewWithOutNotification is used. The default implementation is removing the reference to the model from the view. \sa Model::detachView() */ void AbstractView::modelAboutToBeDetached(Model *) { removeModel(); } /*! \enum QmlDesigner::AbstractView::PropertyChangeFlag Notifies about changes in the abstract properties of a node: \value NoAdditionalChanges No changes were made. \value PropertiesAdded Some properties were added. \value EmptyPropertiesRemoved Empty properties were removed. */ void AbstractView::instancePropertyChanged(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/) { } void AbstractView::instanceInformationsChanged(const QMultiHash<ModelNode, InformationName> &/*informationChangeHash*/) { } void AbstractView::instancesRenderImageChanged(const QVector<ModelNode> &/*nodeList*/) { } void AbstractView::instancesPreviewImageChanged(const QVector<ModelNode> &/*nodeList*/) { } void AbstractView::instancesChildrenChanged(const QVector<ModelNode> &/*nodeList*/) { } void AbstractView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/) { } void AbstractView::nodeSourceChanged(const ModelNode &/*modelNode*/, const QString &/*newNodeSource*/) { } void AbstractView::rewriterBeginTransaction() { } void AbstractView::rewriterEndTransaction() { } void AbstractView::instanceErrorChanged(const QVector<ModelNode> &/*errorNodeList*/) { } void AbstractView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/) { } // Node related functions /*! \fn void AbstractView::nodeCreated(const ModelNode &createdNode) Called when the new node \a createdNode is created. */ void AbstractView::nodeCreated(const ModelNode &/*createdNode*/) { } void AbstractView::currentStateChanged(const ModelNode &/*node*/) { } /*! Called when the file URL (that is needed to resolve relative paths against, for example) is changed form \a oldUrl to \a newUrl. */ void AbstractView::fileUrlChanged(const QUrl &/*oldUrl*/, const QUrl &/*newUrl*/) { } void AbstractView::nodeOrderChanged(const NodeListProperty &/*listProperty*/, const ModelNode &/*movedNode*/, int /*oldIndex*/) { } /*! \fn void AbstractView::nodeAboutToBeRemoved(const ModelNode &removedNode) Called when the node specified by \a removedNode will be removed. */ void AbstractView::nodeAboutToBeRemoved(const ModelNode &/*removedNode*/) { } void AbstractView::nodeRemoved(const ModelNode &/*removedNode*/, const NodeAbstractProperty &/*parentProperty*/, PropertyChangeFlags /*propertyChange*/) { } void AbstractView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& /*propertyList*/) { } /*! Called when the properties specified by \a propertyList are removed. */ void AbstractView::propertiesRemoved(const QList<AbstractProperty>& /*propertyList*/) { } /*! \fn void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange) Called when the parent of \a node will be changed from \a oldPropertyParent to \a newPropertyParent. */ /*! \fn void QmlDesigner::AbstractView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList) Called when the selection is changed from \a lastSelectedNodeList to \a selectedNodeList. */ void AbstractView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/, const QList<ModelNode> &/*lastSelectedNodeList*/) { } void AbstractView::nodeAboutToBeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/) { } void AbstractView::nodeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/) { } void AbstractView::nodeIdChanged(const ModelNode& /*node*/, const QString& /*newId*/, const QString& /*oldId*/) { } void AbstractView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) { } void AbstractView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) { } void AbstractView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) { } void AbstractView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) { } void AbstractView::nodeTypeChanged(const ModelNode & /*node*/, const TypeName & /*type*/, int /*majorVersion*/, int /*minorVersion*/) { } void AbstractView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/) { } void AbstractView::auxiliaryDataChanged(const ModelNode &/*node*/, const PropertyName &/*name*/, const QVariant &/*data*/) { } void AbstractView::customNotification(const AbstractView * /*view*/, const QString & /*identifier*/, const QList<ModelNode> & /*nodeList*/, const QList<QVariant> & /*data*/) { } void AbstractView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) { } void AbstractView::documentMessagesChanged(const QList<DocumentMessage> &/*errors*/, const QList<DocumentMessage> &/*warnings*/) { } void AbstractView::currentTimelineChanged(const ModelNode & /*node*/) { } QList<ModelNode> AbstractView::toModelNodeList(const QList<Internal::InternalNode::Pointer> &nodeList) const { return QmlDesigner::toModelNodeList(nodeList, const_cast<AbstractView*>(this)); } QList<ModelNode> toModelNodeList(const QList<Internal::InternalNode::Pointer> &nodeList, AbstractView *view) { QList<ModelNode> newNodeList; foreach (const Internal::InternalNode::Pointer &node, nodeList) newNodeList.append(ModelNode(node, view->model(), view)); return newNodeList; } QList<Internal::InternalNode::Pointer> toInternalNodeList(const QList<ModelNode> &nodeList) { QList<Internal::InternalNode::Pointer> newNodeList; foreach (const ModelNode &node, nodeList) newNodeList.append(node.internalNode()); return newNodeList; } /*! Sets the list of nodes to the actual selected nodes specified by \a selectedNodeList. */ void AbstractView::setSelectedModelNodes(const QList<ModelNode> &selectedNodeList) { model()->d->setSelectedNodes(toInternalNodeList(selectedNodeList)); } void AbstractView::setSelectedModelNode(const ModelNode &modelNode) { setSelectedModelNodes({modelNode}); } /*! Clears the selection. */ void AbstractView::clearSelectedModelNodes() { model()->d->clearSelectedNodes(); } bool AbstractView::hasSelectedModelNodes() const { return !model()->d->selectedNodes().isEmpty(); } bool AbstractView::hasSingleSelectedModelNode() const { return model()->d->selectedNodes().count() == 1; } bool AbstractView::isSelectedModelNode(const ModelNode &modelNode) const { return model()->d->selectedNodes().contains(modelNode.internalNode()); } /*! Sets the list of nodes to the actual selected nodes. Returns a list of the selected nodes. */ QList<ModelNode> AbstractView::selectedModelNodes() const { return toModelNodeList(model()->d->selectedNodes()); } ModelNode AbstractView::firstSelectedModelNode() const { if (hasSelectedModelNodes()) return ModelNode(model()->d->selectedNodes().constFirst(), model(), this); return ModelNode(); } ModelNode AbstractView::singleSelectedModelNode() const { if (hasSingleSelectedModelNode()) return ModelNode(model()->d->selectedNodes().constFirst(), model(), this); return ModelNode(); } /*! Adds \a node to the selection list. */ void AbstractView::selectModelNode(const ModelNode &modelNode) { QTC_ASSERT(modelNode.isInHierarchy(), return); model()->d->selectNode(modelNode.internalNode()); } /*! Removes \a node from the selection list. */ void AbstractView::deselectModelNode(const ModelNode &node) { model()->d->deselectNode(node.internalNode()); } ModelNode AbstractView::modelNodeForId(const QString &id) { return ModelNode(model()->d->nodeForId(id), model(), this); } bool AbstractView::hasId(const QString &id) const { return model()->d->hasId(id); } QString firstCharToLower(const QString &string) { QString resultString = string; if (!resultString.isEmpty()) resultString[0] = resultString.at(0).toLower(); return resultString; } QString AbstractView::generateNewId(const QString &prefixName) const { int counter = 1; /* First try just the prefixName without number as postfix, then continue with 2 and further as postfix * until id does not already exist. * Properties of the root node are not allowed for ids, because they are available in the complete context * without qualification. * The id "item" is explicitly not allowed, because it is too likely to clash. */ QString newId = QString(QStringLiteral("%1")).arg(firstCharToLower(prefixName)); newId.remove(QRegExp(QStringLiteral("[^a-zA-Z0-9_]"))); while (!ModelNode::isValidId(newId) || hasId(newId) || rootModelNode().hasProperty(newId.toUtf8()) || newId == "item") { counter += 1; newId = QString(QStringLiteral("%1%2")).arg(firstCharToLower(prefixName)).arg(counter - 1); newId.remove(QRegExp(QStringLiteral("[^a-zA-Z0-9_]"))); } return newId; } ModelNode AbstractView::modelNodeForInternalId(qint32 internalId) const { return ModelNode(model()->d->nodeForInternalId(internalId), model(), this); } bool AbstractView::hasModelNodeForInternalId(qint32 internalId) const { return model()->d->hasNodeForInternalId(internalId); } NodeInstanceView *AbstractView::nodeInstanceView() const { if (model()) return model()->d->nodeInstanceView(); else return 0; } RewriterView *AbstractView::rewriterView() const { if (model()) return model()->d->rewriterView(); else return 0; } void AbstractView::resetView() { if (!model()) return; Model *currentModel = model(); currentModel->detachView(this); currentModel->attachView(this); } void AbstractView::resetPuppet() { emitCustomNotification(QStringLiteral("reset QmlPuppet")); } bool AbstractView::hasWidget() const { return false; } WidgetInfo AbstractView::widgetInfo() { return createWidgetInfo(); } void AbstractView::contextHelpId(const Core::IContext::HelpIdCallback &callback) const { #ifndef QMLDESIGNER_TEST QmlDesignerPlugin::instance()->viewManager().qmlJSEditorHelpId(callback); #else callback(QString()); #endif } void AbstractView::activateTimelineRecording(const ModelNode &mutator) { Internal::WriteLocker locker(m_model.data()); if (model()) model()->d->notifyCurrentTimelineChanged(mutator); } void AbstractView::deactivateTimelineRecording() { Internal::WriteLocker locker(m_model.data()); if (model()) model()->d->notifyCurrentTimelineChanged(ModelNode()); } QList<ModelNode> AbstractView::allModelNodes() const { return toModelNodeList(model()->d->allNodes()); } void AbstractView::emitDocumentMessage(const QString &error) { emitDocumentMessage({DocumentMessage(error)}); } void AbstractView::emitDocumentMessage(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) { if (model()) model()->d->setDocumentMessages(errors, warnings); } void AbstractView::emitCustomNotification(const QString &identifier) { emitCustomNotification(identifier, QList<ModelNode>()); } void AbstractView::emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList) { emitCustomNotification(identifier, nodeList, QList<QVariant>()); } void AbstractView::emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) { model()->d->notifyCustomNotification(this, identifier, nodeList, data); } void AbstractView::emitInstancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList) { if (model() && nodeInstanceView() == this) model()->d->notifyInstancePropertyChange(propertyList); } void AbstractView::emitInstanceErrorChange(const QVector<qint32> &instanceIds) { if (model() && nodeInstanceView() == this) model()->d->notifyInstanceErrorChange(instanceIds); } void AbstractView::emitInstancesCompleted(const QVector<ModelNode> &nodeVector) { if (model() && nodeInstanceView() == this) model()->d->notifyInstancesCompleted(nodeVector); } void AbstractView::emitInstanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash) { if (model() && nodeInstanceView() == this) model()->d->notifyInstancesInformationsChange(informationChangeHash); } void AbstractView::emitInstancesRenderImageChanged(const QVector<ModelNode> &nodeVector) { if (model() && nodeInstanceView() == this) model()->d->notifyInstancesRenderImageChanged(nodeVector); } void AbstractView::emitInstancesPreviewImageChanged(const QVector<ModelNode> &nodeVector) { if (model() && nodeInstanceView() == this) model()->d->notifyInstancesPreviewImageChanged(nodeVector); } void AbstractView::emitInstancesChildrenChanged(const QVector<ModelNode> &nodeVector) { if (model() && nodeInstanceView() == this) model()->d->notifyInstancesChildrenChanged(nodeVector); } void AbstractView::emitRewriterBeginTransaction() { if (model()) model()->d->notifyRewriterBeginTransaction(); } void AbstractView::sendTokenToInstances(const QString &token, int number, const QVector<ModelNode> &nodeVector) { if (nodeInstanceView()) nodeInstanceView()->sendToken(token, number, nodeVector); } void AbstractView::emitInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector) { if (nodeInstanceView()) model()->d->notifyInstanceToken(token, number, nodeVector); } void AbstractView::emitRewriterEndTransaction() { if (model()) model()->d->notifyRewriterEndTransaction(); } void AbstractView::setCurrentStateNode(const ModelNode &node) { Internal::WriteLocker locker(m_model.data()); if (model()) model()->d->notifyCurrentStateChanged(node); } void AbstractView::changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion) { Internal::WriteLocker locker(m_model.data()); m_model.data()->d->changeRootNodeType(type, majorVersion, minorVersion); } ModelNode AbstractView::currentStateNode() const { if (model()) return ModelNode(m_model.data()->d->currentStateNode(), m_model.data(), const_cast<AbstractView*>(this)); return ModelNode(); } QmlModelState AbstractView::currentState() const { return QmlModelState(currentStateNode()); } QmlTimelineMutator AbstractView::currentTimeline() const { if (model()) return QmlTimelineMutator(ModelNode(m_model.data()->d->currentTimelineNode(), m_model.data(), const_cast<AbstractView*>(this))); return QmlTimelineMutator(); } static int getMinorVersionFromImport(const Model *model) { foreach (const Import &import, model->imports()) { if (import.isLibraryImport() && import.url() == "QtQuick") { const QString versionString = import.version(); if (versionString.contains(".")) { const QString minorVersionString = versionString.split(".").constLast(); return minorVersionString.toInt(); } } } return -1; } static int getMajorVersionFromImport(const Model *model) { foreach (const Import &import, model->imports()) { if (import.isLibraryImport() && import.url() == QStringLiteral("QtQuick")) { const QString versionString = import.version(); if (versionString.contains(QStringLiteral("."))) { const QString majorVersionString = versionString.split(QStringLiteral(".")).constFirst(); return majorVersionString.toInt(); } } } return -1; } static int getMajorVersionFromNode(const ModelNode &modelNode) { if (modelNode.metaInfo().isValid()) { foreach (const NodeMetaInfo &info, modelNode.metaInfo().classHierarchy()) { if (info.typeName() == "QtQuick.QtObject" || info.typeName() == "QtQuick.Item") return info.majorVersion(); } } return 1; //default } static int getMinorVersionFromNode(const ModelNode &modelNode) { if (modelNode.metaInfo().isValid()) { foreach (const NodeMetaInfo &info, modelNode.metaInfo().classHierarchy()) { if (info.typeName() == "QtQuick.QtObject" || info.typeName() == "QtQuick.Item") return info.minorVersion(); } } return 1; //default } int AbstractView::majorQtQuickVersion() const { int majorVersionFromImport = getMajorVersionFromImport(model()); if (majorVersionFromImport >= 0) return majorVersionFromImport; return getMajorVersionFromNode(rootModelNode()); } int AbstractView::minorQtQuickVersion() const { int minorVersionFromImport = getMinorVersionFromImport(model()); if (minorVersionFromImport >= 0) return minorVersionFromImport; return getMinorVersionFromNode(rootModelNode()); } } // namespace QmlDesigner
28.515075
225
0.705348
kevinlq
e247b6d7e88e51b12b1c8b917bb0007eb3b90c16
1,277
cpp
C++
examples/loop_interchange_kernel/loop_interchange.cpp
DavidPfander-UniStuttgart/AutoTuneTMP
f5fb836778b04c2ab0fbcc4d36c466e577e96e65
[ "BSD-3-Clause" ]
5
2019-11-06T15:02:41.000Z
2022-01-14T20:25:50.000Z
examples/loop_interchange_kernel/loop_interchange.cpp
DavidPfander-UniStuttgart/AutoTuneTMP
f5fb836778b04c2ab0fbcc4d36c466e577e96e65
[ "BSD-3-Clause" ]
3
2018-01-25T21:25:22.000Z
2022-03-14T17:35:27.000Z
examples/loop_interchange_kernel/loop_interchange.cpp
DavidPfander-UniStuttgart/AutoTuneTMP
f5fb836778b04c2ab0fbcc4d36c466e577e96e65
[ "BSD-3-Clause" ]
1
2020-07-15T11:05:43.000Z
2020-07-15T11:05:43.000Z
#include "parameters.hpp" #include <array> #include <iostream> #include <tuple> #include "opttmp/loop/loop_exchange.hpp" namespace detail { template <size_t depth, size_t index, size_t cur_depth> constexpr size_t extract_index_rec(const size_t perm_rem) { if constexpr (cur_depth == index) { return perm_rem % depth; } else { return extract_index_rec<depth, index, cur_depth + 1>(perm_rem / depth); } } } // namespace detail template <size_t depth, size_t index> constexpr size_t extract_index(const size_t perm_index) { return detail::extract_index_rec<depth, index, 0>(perm_index); } constexpr size_t N = 3; AUTOTUNE_EXPORT void loop_interchange() { std::array<std::tuple<size_t, size_t, size_t>, N> loop_bounds{ {{0, 2, 1}, {0, 2, 1}, {0, 2, 1}}}; // 0, 1, 2 // 0, 2, 1 // 1, ... // std::array<size_t, N> order{2, 0, 1}; std::array<size_t, N> order; order[0] = extract_index<N, 0>(LOOP_ORDER); order[1] = extract_index<N, 1>(LOOP_ORDER); order[2] = extract_index<N, 2>(LOOP_ORDER); opttmp::loop::loop_interchange( [](std::array<size_t, N> &i) { // int x, int y, int z std::cout << "i[0]: " << i[0] << " i[1]: " << i[1] << " i[2]: " << i[2] << std::endl; }, loop_bounds, order); }
27.170213
79
0.624119
DavidPfander-UniStuttgart
e247f91790f70a065e474772c701d8d80ff9ee09
287
cpp
C++
src/DescentEngine/src/EntityEngine/MultiVisualEntity.cpp
poseidn/KungFoo-legacy
9b79d65b596acc9dff4725ef5bfab8ecc4164afb
[ "MIT" ]
1
2017-11-24T03:01:31.000Z
2017-11-24T03:01:31.000Z
src/DescentEngine/src/EntityEngine/MultiVisualEntity.cpp
poseidn/KungFoo-legacy
9b79d65b596acc9dff4725ef5bfab8ecc4164afb
[ "MIT" ]
null
null
null
src/DescentEngine/src/EntityEngine/MultiVisualEntity.cpp
poseidn/KungFoo-legacy
9b79d65b596acc9dff4725ef5bfab8ecc4164afb
[ "MIT" ]
null
null
null
#include "MultiVisualEntity.h" #include "../Log.h" #include <algorithm> // DO NOT PUT THE METHOD DEFINITIONS in the .cpp file ! // otherwise the android compile produces link error, not sure why // one idea is that overrwiting virtual methods across library borders is // problematic
26.090909
73
0.752613
poseidn
e249369dc70ebf9a284c7c5a4690cf045aef5050
557
cpp
C++
cpp/container_multiset_empty.cpp
rpuntaie/c-examples
385b3c792e5b39f81a187870100ed6401520a404
[ "MIT" ]
null
null
null
cpp/container_multiset_empty.cpp
rpuntaie/c-examples
385b3c792e5b39f81a187870100ed6401520a404
[ "MIT" ]
null
null
null
cpp/container_multiset_empty.cpp
rpuntaie/c-examples
385b3c792e5b39f81a187870100ed6401520a404
[ "MIT" ]
null
null
null
/* g++ --std=c++20 -pthread -o ../_build/cpp/container_multiset_empty.exe ./cpp/container_multiset_empty.cpp && (cd ../_build/cpp/;./container_multiset_empty.exe) https://en.cppreference.com/w/cpp/container/multiset/empty */ #include <set> #include <iostream> int main() { std::multiset<int> numbers; std::cout << std::boolalpha; std::cout << "Initially, numbers.empty(): " << numbers.empty() << '\n'; numbers.insert(42); numbers.insert(13317); std::cout << "After adding elements, numbers.empty(): " << numbers.empty() << '\n'; }
32.764706
159
0.653501
rpuntaie
e249487ce9171d4e2fc2ff6fee68c7655a01c72f
11,722
cc
C++
extensions/h5/dataset.cc
PyreFramework/pyre
345c7449a3416eea1c1affa74fb32faff30a6aaa
[ "BSD-3-Clause" ]
null
null
null
extensions/h5/dataset.cc
PyreFramework/pyre
345c7449a3416eea1c1affa74fb32faff30a6aaa
[ "BSD-3-Clause" ]
null
null
null
extensions/h5/dataset.cc
PyreFramework/pyre
345c7449a3416eea1c1affa74fb32faff30a6aaa
[ "BSD-3-Clause" ]
null
null
null
// -*- c++ -*- // // michael a.g. aïvázis <michael.aivazis@para-sim.com> // (c) 1998-2022 all rights reserved // externals #include "external.h" // namespace setup #include "forward.h" // datasets void h5::py::dataset(py::module & m) { // add bindings for hdf5 datasets auto cls = py::class_<DataSet>( // in scope m, // class name "DataSet", // docstring "an HDF5 dataset"); // the dataset type cls.def_property_readonly( // the name "cell", // the implementation [](const DataSet & self) { // get my type class return self.getTypeClass(); }, // the docstring "get the dataset cell type"); // the dataset shape cls.def_property_readonly( // the name "shape", // the implementation [](const DataSet & self) -> dims_t { // get my dataspace auto space = self.getSpace(); // ask it for its rank auto rank = space.getSimpleExtentNdims(); // make a correctly sized vector to hold the result dims_t shape(rank); // populate it space.getSimpleExtentDims(&shape[0], nullptr); // and return it return shape; }, // the docstring "get the shape of the dataset"); // attempt to get the dataset contents as an int cls.def( // the name "int", // the implementation [](const DataSet & self) -> long { // get my type auto type = self.getTypeClass(); // check whether i can be converted to an integer if (type != H5T_INTEGER) { // if not, make a channel auto channel = pyre::journal::error_t("pyre.hdf5"); // complain channel // what << "the dataset does not contain an integer" // where << pyre::journal::endl(__HERE__); // and bail return 0; } // make some room long result; // read the data self.read(&result, self.getIntType()); // all done return result; }, // the docstring "extract my contents as an integer"); // attempt to get the dataset contents as a double cls.def( // the name "double", // the implementation [](const DataSet & self) -> double { // get my type auto type = self.getTypeClass(); // check whether i can be converted to a floating point number if (type != H5T_FLOAT) { // if not, make a channel auto channel = pyre::journal::error_t("pyre.hdf5"); // complain channel // what << "the dataset does not contain a floating point number" // where << pyre::journal::endl(__HERE__); // and bail return 0; } // make some room double result; // read the data self.read(&result, self.getFloatType()); // all done return result; }, // the docstring "extract my contents as a double"); // attempt to get the dataset contents as a string cls.def( // the name "str", // the implementation [](const DataSet & self) -> string_t { // get my type auto type = self.getTypeClass(); // check whether i can be converted to a string if (type != H5T_STRING) { // if not, make a channel auto channel = pyre::journal::error_t("pyre.hdf5"); // complain channel // what << "the dataset does not contain a string" // where << pyre::journal::endl(__HERE__); // and bail return ""; } // make some room string_t result; // read the data self.read(result, self.getStrType()); // all done return result; }, // the docstring "extract my contents as a string"); // attempt to get the dataset contents as a list of ints cls.def( // the name "ints", // the implementation [](const DataSet & self) -> ints_t { // get my type auto type = self.getTypeClass(); // check whether i contain integers if (type != H5T_INTEGER) { // if not, make a channel auto channel = pyre::journal::error_t("pyre.hdf5"); // complain channel // what << "not a dataset with integers" // where << pyre::journal::endl(__HERE__); // build an empty list of integers ints_t ints; // and bail return ints; } // we have ints; let's find out how many // get my data space auto space = self.getSpace(); // ask it for its rank auto rank = space.getSimpleExtentNdims(); // make a correctly sized vector to hold the result dims_t shape(rank); // populate it space.getSimpleExtentDims(&shape[0], nullptr); // make sure i'm just a list if (rank != 1) { // if not, make a channel auto channel = pyre::journal::error_t("pyre.hdf5"); // complain channel // what << "not a list " // where << pyre::journal::endl(__HERE__); // build an empty list of ints ints_t ints; // and bail return ints; } // shape now knows how many integers there are auto len = shape[0]; // use it to make a correctly sized vector auto ints = ints_t(len); // unconditional/unrestricted read self.read(&ints[0], self.getIntType()); // all done return ints; }, // the docstring "get my contents as a list of ints"); // attempt to get the dataset contents as a list of doubles cls.def( // the name "doubles", // the implementation [](const DataSet & self) -> doubles_t { // get my type auto type = self.getTypeClass(); // check whether i contain doubles if (type != H5T_FLOAT) { // if not, make a channel auto channel = pyre::journal::error_t("pyre.hdf5"); // complain channel // what << "not a dataset with doubles" // where << pyre::journal::endl(__HERE__); // build an empty list of doubles doubles_t doubles; // and bail return doubles; } // we have doubles; let's find out how many // get my data space auto space = self.getSpace(); // ask it for its rank auto rank = space.getSimpleExtentNdims(); // make a correctly sized vector to hold the result dims_t shape(rank); // populate it space.getSimpleExtentDims(&shape[0], nullptr); // make sure i'm just a list if (rank != 1) { // if not, make a channel auto channel = pyre::journal::error_t("pyre.hdf5"); // complain channel // what << "not a list " // where << pyre::journal::endl(__HERE__); // build an empty list of doubles doubles_t doubles; // and bail return doubles; } // shape now knows how many doubles there are auto len = shape[0]; // use it to make a correctly sized vector auto doubles = doubles_t(len); // unconditional/unrestricted read self.read(&doubles[0], self.getFloatType()); // all done return doubles; }, // the docstring "get my contents as a list of ints"); // attempt to get the dataset contents as a list of strings cls.def( // the name "strings", // the implementation [](const DataSet & self) -> strings_t { // get my type auto type = self.getTypeClass(); // check whether i can be converted to a list of strings if (type != H5T_STRING) { // if not, make a channel auto channel = pyre::journal::error_t("pyre.hdf5"); // complain channel // what << "not a dataset with null terminated strings" // where << pyre::journal::endl(__HERE__); // build an empty list of strings strings_t strings; // and bail return strings; } // we have strings; let's find out how many // get my data space auto space = self.getSpace(); // ask it for its rank auto rank = space.getSimpleExtentNdims(); // make a correctly sized vector to hold the result dims_t shape(rank); // populate it space.getSimpleExtentDims(&shape[0], nullptr); // make sure i'm just a list if (rank != 1) { // if not, make a channel auto channel = pyre::journal::error_t("pyre.hdf5"); // complain channel // what << "not a list " // where << pyre::journal::endl(__HERE__); // build an empty list of strings strings_t strings; // and bail return strings; } // shape now knows how many strings there are auto len = shape[0]; // use it to make a correctly sized vector auto strings = strings_t(len); // make a slot const hsize_t one = 1; // we always write one string at offset zero auto write = DataSpace(1, &one); // and read from the dataset space auto read = self.getSpace(); // read as many times as there are strings to pull for (hsize_t idx = 0; idx < len; ++idx) { // restrict the read dataspace to one string at offset {idx} read.selectHyperslab(H5S_SELECT_SET, &one, &idx); // unconditional/unrestricted read self.read(strings[idx], self.getStrType(), write, read); } // all done return strings; }, // the docstring "get my contents as a list of strings"); // all done return; } // end of file
31.175532
77
0.460587
PyreFramework
e24c230644b0e2ace59dc88fac67afbf182ab07b
1,801
cpp
C++
cpp/src/opendnp3/DNPCrc.cpp
cverges/adnp3
2a07f364bec8f1ad46e33cc8b6b8ef37b9005f3a
[ "MS-PL", "Naumen", "Condor-1.1", "Apache-1.1" ]
2
2016-08-31T23:03:06.000Z
2017-07-26T01:57:01.000Z
cpp/src/opendnp3/DNPCrc.cpp
dupes/dnp3-automatak
08348d21738ae93e9a7f02ec46933934b6b463af
[ "Naumen", "Condor-1.1", "Apache-1.1", "MS-PL" ]
null
null
null
cpp/src/opendnp3/DNPCrc.cpp
dupes/dnp3-automatak
08348d21738ae93e9a7f02ec46933934b6b463af
[ "Naumen", "Condor-1.1", "Apache-1.1", "MS-PL" ]
1
2020-01-20T08:23:27.000Z
2020-01-20T08:23:27.000Z
// // Licensed to Green Energy Corp (www.greenenergycorp.com) under one or // more contributor license agreements. See the NOTICE file distributed // with this work for additional information regarding copyright ownership. // Green Energy Corp 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. // // This file was forked on 01/01/2013 by Automatak, LLC and modifications // have been made to this file. Automatak, LLC licenses these modifications to // you under the terms of the License. // #include "DNPCrc.h" #include "CRC.h" #include "PackingUnpacking.h" namespace opendnp3 { unsigned int DNPCrc::mpCrcTable[256]; //initialize the table bool DNPCrc::mIsInitialized = DNPCrc::InitCrcTable(); unsigned int DNPCrc::CalcCrc(const uint8_t* aInput, size_t aLength) { return CRC::CalcCRC(aInput, aLength, mpCrcTable, 0x0000, true); } void DNPCrc::AddCrc(uint8_t* aInput, size_t aLength) { unsigned int crc = DNPCrc::CalcCrc(aInput, aLength); aInput[aLength] = crc & 0xFF; //set the LSB aInput[aLength + 1] = (crc >> 8) & 0xFF; //set the MSB } bool DNPCrc::IsCorrectCRC(const uint8_t* aInput, size_t aLength) { return CalcCrc(aInput, aLength) == UInt16LE::Read(aInput + aLength); } bool DNPCrc::InitCrcTable() { CRC::PrecomputeCRC(mpCrcTable, 0xA6BC); return true; } }
29.048387
78
0.743476
cverges
e24c77279df0a7bd4e2a3e91d6c76f1a70540966
12,086
cc
C++
RAVL2/3D/Mesh/TriMesh.cc
isuhao/ravl2
317e0ae1cb51e320b877c3bad6a362447b5e52ec
[ "BSD-Source-Code" ]
null
null
null
RAVL2/3D/Mesh/TriMesh.cc
isuhao/ravl2
317e0ae1cb51e320b877c3bad6a362447b5e52ec
[ "BSD-Source-Code" ]
null
null
null
RAVL2/3D/Mesh/TriMesh.cc
isuhao/ravl2
317e0ae1cb51e320b877c3bad6a362447b5e52ec
[ "BSD-Source-Code" ]
null
null
null
// This file is part of RAVL, Recognition And Vision Library // Copyright (C) 2002, University of Surrey // 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 ///////////////////////////////////////////////////////////////////// //! rcsid="$Id: TriMesh.cc 6261 2007-07-09 15:42:21Z craftit $" //! lib=Ravl3D //! author="Charles Galambos" //! file="Ravl/3D/Mesh/TriMesh.cc" #include "Ravl/3D/TriMesh.hh" #include "Ravl/SArray1dIter.hh" #include "Ravl/SArray1dIter2.hh" #include "Ravl/Index3d.hh" namespace Ravl3DN { #if RAVL_VISUALCPP_NAMESPACE_BUG using namespace RavlN; #endif //: Construct from an array of vertexes and an array of indices. // The length of faceInd should be a power of 3, success triples are taken // from it to form the faces in the mesh. TriMeshBodyC::TriMeshBodyC(const SArray1dC<Vector3dC> &v,const SArray1dC<UIntT> &faceInd) : vertices(v.Size()), faces(faceInd.Size()/3), haveTexture(false) { Vector3dC zero(0,0,0); for(SArray1dIter2C<VertexC,Vector3dC> it(vertices,v);it;it++) { it.Data1().Position() = it.Data2(); it.Data1().Normal() = zero; } RavlAssert(faceInd.Size() == (faces.Size() * 3)); SArray1dIterC<UIntT> iit(faceInd); /* Create vertex pointers, and some inital vertex normals. */ for(SArray1dIterC<TriC> fit(faces);fit;fit++) { int i; for(i = 0;i < 3;i++,iit++) { fit.Data1().VertexPtr(i) = &(vertices[*iit]); } fit->UpdateFaceNormal(); Vector3dC norm = fit->FaceNormal(); for( i = 0;i < 3;i++) fit->Normal(i) += norm; } /* Make unit normals. */ for(SArray1dIterC<VertexC> itv(vertices);itv;itv++) itv->Normal().MakeUnit(); } //: Construct from a list of vertexes and a list of indices. // The length of faceInd should be a power of 3, success triples are taken // from it to form the faces in the mesh. TriMeshBodyC::TriMeshBodyC(const DListC<Vector3dC> &v,const DListC<UIntT> &faceInd) : vertices(v.Size()), faces(faceInd.Size()/3), haveTexture(false) { // Create the vertices from the vertex positions v Vector3dC zero(0,0,0); DLIterC<Vector3dC> itPos(v); SArray1dIterC<VertexC> itVerts(vertices); for (; itPos; itPos++, itVerts++) { itVerts.Data().Position() = itPos.Data(); itVerts.Data().Normal() = zero; } // Create the tri faces from the face vertex indices RavlAssert(faceInd.Size() == (faces.Size() * 3)); DLIterC<UIntT> iit(faceInd); SArray1dIterC<TriC> fit(faces); /* Create vertex pointers, and some inital vertex normals. */ for(;fit;fit++) { int i; for(i = 0;i < 3;i++,iit++) { fit.Data().VertexPtr(i) = &(vertices[*iit]); } fit->UpdateFaceNormal(); Vector3dC norm = fit->FaceNormal(); for( i = 0;i < 3;i++) fit->Normal(i) += norm; } /* Make unit normals. */ SArray1dIterC<VertexC> itv(vertices); for(; itv; itv++) itv->Normal().MakeUnit(); } //: Construct from a list of vertices and a list of indices. TriMeshBodyC::TriMeshBodyC(const DListC<Vector3dC> &v,const DListC<Index3dC> &faceInd) : vertices(v.Size()), faces(faceInd.Size()), haveTexture(false) { // Create the vertices from the vertex positions v Vector3dC zero(0,0,0); DLIterC<Vector3dC> itPos(v); SArray1dIterC<VertexC> itVerts(vertices); for (; itPos; itPos++, itVerts++) { itVerts.Data().Position() = itPos.Data(); itVerts.Data().Normal() = zero; } // Create the tri faces from the face vertex indices RavlAssert(faceInd.Size() == (faces.Size())); DLIterC<Index3dC> iit(faceInd); SArray1dIterC<TriC> fit(faces); /* Create vertex pointers, and some inital vertex normals. */ for(;fit;fit++,iit++) { UIntT i; for(i = 0;i < 3;i++) fit.Data().VertexPtr(i) = &(vertices[(*iit)[i]]); fit->UpdateFaceNormal(); Vector3dC norm = fit->FaceNormal(); for( i = 0;i < 3;i++) fit->Normal(i) += norm; } /* Make unit normals. */ SArray1dIterC<VertexC> itv(vertices); for(; itv; itv++) itv->Normal().MakeUnit(); } //: Copy constructor TriMeshBodyC::TriMeshBodyC(const TriMeshBodyC& oth) { haveTexture = oth.haveTexture; vertices = oth.vertices.Copy(); faces = SArray1dC<TriC>(oth.faces.Size()); SArray1dIter2C<TriC,TriC> it(faces,oth.faces); for(; it; it++) { int i; for(i=0 ; i<3; i++) it.Data1().VertexPtr(i) = &(vertices[oth.Index(it.Data2(),i)]); it.Data1().TextureID() = it.Data2().TextureID(); it.Data1().TextureCoords() = it.Data2().TextureCoords(); it.Data1().Colour() = it.Data2().Colour(); it.Data1().FaceNormal() = it.Data2().FaceNormal(); } } //: Flips the mesh surface void TriMeshBodyC::FlipTriangles(void) { for(SArray1dIterC<TriC> it(faces);it;it++) it->Flip(); } //: Centre of triset. // - average vertex position Vector3dC TriMeshBodyC::Centroid() const { Vector3dC ret(0,0,0); if(vertices.Size() == 0) return ret; // Can't take a centroid of an empty mesh. for(SArray1dIterC<VertexC> it(vertices);it;it++) ret += it->Position(); return ret / vertices.Size(); } //: Transform mesh with RT void TriMeshBodyC::Transform(const RigidTransform3dC & rt){ for(SArray1dIterC<VertexC> it(vertices);it;it++){ Vector3dC v(it->Position()); it->Position() = rt.Transform(v); it->Normal()=rt.ExportRotationMatrix()*(it->Normal()); } for(SArray1dIterC<TriC> iv(faces);iv;iv++) iv->FaceNormal()=rt.ExportRotationMatrix()*(iv->FaceNormal()); } //: Create an array of faces indices. // each successive triple of indices represents a face in the mesh. SArray1dC<UIntT> TriMeshBodyC::FaceIndices() const { SArray1dC<UIntT> ret(3 * faces.Size()); if(faces.Size() == 0) return ret; SArray1dIterC<UIntT> rit(ret); const VertexC *x = &(vertices[0]); for(SArray1dIterC<TriC> it(faces);it;it++) { *rit = it->VertexPtr(0) - x; rit++; *rit = it->VertexPtr(1) - x; rit++; *rit = it->VertexPtr(2) - x; rit++; } return ret; } //: Find largest and smallest for each compoent of all vertices. void TriMeshBodyC::Limits(Vector3dC &min,Vector3dC &max) const{ SArray1dIterC<VertexC> it(vertices); if(!it) return ; // Empty mesh! min = it->Position(); max = it->Position(); for(it++;it;it++) { for(int i = 0;i < 3;i++) { if(min[i] > it->Position()[i]) min[i] = it->Position()[i]; if(max[i] < it->Position()[i]) max[i] = it->Position()[i]; } } } //: Offset and Scale mesh by given values. void TriMeshBodyC::OffsetScale(const Vector3dC &off,RealT scale) { for(SArray1dIterC<VertexC> it(vertices);it;it++) it->Position() = (it->Position() + off) * scale; } //: Recalculate vertex normals. void TriMeshBodyC::UpdateVertexNormals() { Vector3dC zero(0,0,0); for(SArray1dIterC<VertexC> it(vertices);it;it++) it->Normal() = zero; for(SArray1dIterC<TriC> itf(faces);itf;itf++) { itf->UpdateFaceNormal(); Vector3dC norm = itf->FaceNormal(); for(int i = 0;i < 3;i++) itf->Normal(i) += norm; } for(SArray1dIterC<VertexC> itv(vertices);itv;itv++) itv->Normal() = itv->Normal().Unit(); } TriMeshC TriMeshBodyC::operator+ (const TriMeshC &t2) const { SArray1dC<VertexC> verts(Vertices().Size()+t2.Vertices().Size()); // put this in first SArray1dIterC<VertexC> vit(verts); for(UIntT ivL=0;ivL<Vertices().Size();ivL++){ vit->Position()=Vertices()[ivL].Position(); vit->Normal() = Vertices()[ivL].Normal(); vit++; } for(UIntT ivM=0;ivM<t2.Vertices().Size();ivM++){ vit->Position()=t2.Vertices()[ivM].Position(); vit->Normal() = t2.Vertices()[ivM].Normal(); vit++; } SArray1dC<TriC> faces(Faces().Size()+t2.Faces().Size()); SArray1dIterC<TriC> it(faces); UIntT ii = 0; const VertexC *Lv0 = &(Vertices()[0]); for(;ii < Faces().Size();ii++) { UIntT i0=Faces()[ii].VertexPtr(0)-Lv0; UIntT i1=Faces()[ii].VertexPtr(1)-Lv0; UIntT i2=Faces()[ii].VertexPtr(2)-Lv0; it->VertexPtr(0) = &(verts[i0]); it->VertexPtr(1) = &(verts[i1]); it->VertexPtr(2) = &(verts[i2]); it->FaceNormal()=Faces()[ii].FaceNormal(); it++; } const VertexC *Mv0 = &(t2.Vertices()[0]); for(ii=0;ii < t2.Faces().Size();ii++) { UIntT i0=t2.Faces()[ii].VertexPtr(0)-Mv0+Vertices().Size(); UIntT i1=t2.Faces()[ii].VertexPtr(1)-Mv0+Vertices().Size(); UIntT i2=t2.Faces()[ii].VertexPtr(2)-Mv0+Vertices().Size(); it->VertexPtr(0) = &(verts[i0]); it->VertexPtr(1) = &(verts[i1]); it->VertexPtr(2) = &(verts[i2]); it->FaceNormal()=t2.Faces()[ii].FaceNormal(); it++; } return TriMeshC(verts,faces); } //: Automatically generate texture coordinates. bool TriMeshBodyC::GenerateTextureCoords(void) { // Check that we have a valid mesh IntT iNumFaces = faces.Size(); if (iNumFaces==0) return false; // Work out how many squares we need to take all our triangles IntT iNumSquares = iNumFaces / 2; if ( (iNumFaces%2) ) iNumSquares++; // Work out how many squares to a side of the texture (rounded up square root) IntT iDim = IntT(ceil(Sqrt(iNumSquares))); RealT dSize = 1.0/(RealT)iDim; // Generate texture coordinates for each triangle. SArray1dIterC<TriC> itFaces(faces); IntT x,y; for (x=0; (x<iDim && itFaces); x++) { RealT dXBase = x*dSize; for (y=0; (y<iDim && itFaces); y++) { RealT dYBase = y*dSize; // Generate texture coordinates for the triangle in the top left corner of the square TriC& faceTL = itFaces.Data(); faceTL.TextureID() = 0; faceTL.TextureCoord(0) = Vector2dC(dXBase + dSize*0.05, dYBase + dSize*0.90); faceTL.TextureCoord(1) = Vector2dC(dXBase + dSize*0.05, dYBase + dSize*0.05); faceTL.TextureCoord(2) = Vector2dC(dXBase + dSize*0.90, dYBase + dSize*0.05); itFaces++; if (itFaces) { // Generate texture coordinates for the triangle in the bottom right corner of the square TriC& faceBR = itFaces.Data(); faceBR.TextureID() = 0; faceBR.TextureCoord(0) = Vector2dC(dXBase + dSize*0.95, dYBase + dSize*0.10); faceBR.TextureCoord(1) = Vector2dC(dXBase + dSize*0.95, dYBase + dSize*0.95); faceBR.TextureCoord(2) = Vector2dC(dXBase + dSize*0.10, dYBase + dSize*0.95); itFaces++; } } } haveTexture = true; return true; } ostream &operator<<(ostream &s,const TriMeshC &ts) { RavlAssert(ts.IsValid()); s << ts.Vertices(); s << (IntT)ts.HaveTextureCoord() << '\n'; s << ts.Faces().Size() << '\n'; const VertexC *x = &(ts.Vertices()[0]); SArray1dIterC<TriC> it(ts.Faces()); for(; it; it++) { s << (it->VertexPtr(0) - x) << ' ' << (it->VertexPtr(1) - x) << ' ' << (it->VertexPtr(2) - x) << ' '; s << it->TextureID() << ' '; s << it->TextureCoords() << ' '; s << it->Colour() << '\n'; } return s; } istream &operator>>(istream &s,TriMeshC &ts) { SArray1dC<VertexC> verts; s >> verts; IntT iHaveTexture; s >> iHaveTexture; bool bHaveTexture = (iHaveTexture) ? true : false; UIntT nfaces,i1,i2,i3; s >> nfaces; SArray1dC<TriC> faces(nfaces); for(SArray1dIterC<TriC> it(faces);it;it++) { s >> i1 >> i2 >> i3; s >> it->TextureID(); s >> it->TextureCoords(); s >> it->Colour(); it->VertexPtr(0) = &(verts[i1]); it->VertexPtr(1) = &(verts[i2]); it->VertexPtr(2) = &(verts[i3]); it->UpdateFaceNormal(); } ts = TriMeshC(verts,faces,bHaveTexture); return s; } }
31.721785
92
0.595896
isuhao
f46c31106931df1fa55f2f90afa01dec9b8befa5
2,656
cpp
C++
source/common/generic_config/model/ChoiceParam.cpp
varunamachi/quartz
29b0cf7fb981ec95db894259e32af233f64fa616
[ "MIT" ]
6
2018-01-07T18:11:27.000Z
2022-03-25T03:32:45.000Z
source/common/generic_config/model/ChoiceParam.cpp
varunamachi/quartz
29b0cf7fb981ec95db894259e32af233f64fa616
[ "MIT" ]
8
2019-02-28T02:25:53.000Z
2019-02-28T15:47:18.000Z
source/common/generic_config/model/ChoiceParam.cpp
varunamachi/quartz
29b0cf7fb981ec95db894259e32af233f64fa616
[ "MIT" ]
4
2016-05-28T16:31:06.000Z
2019-09-25T07:13:45.000Z
#include <QVariant> #include <QString> #include <QHash> #include <QVector> #include "ChoiceParam.h" namespace Quartz { struct ChoiceParam::Data { Data() : m_defaultIndex(0) , m_index(m_defaultIndex) { } QVector<QString> m_names; QVector<QVariant> m_values; int m_defaultIndex; int m_index; }; ChoiceParam::ChoiceParam(const QString& id, const QString& name, const QString& description, TreeNode* parent) : Param(id, name, description, parent) , m_data{new Data{}} { } ChoiceParam::~ChoiceParam() { } void ChoiceParam::addOption(const QString& name, const QVariant& value) { if (!m_data->m_names.contains(name)) { m_data->m_names.append(name); m_data->m_values.append(value); } if (m_data->m_defaultIndex == -1) { m_data->m_defaultIndex = 0; m_data->m_index = 0; } } QPair<QString, QVariant> ChoiceParam::option(int index) const { QPair<QString, QVariant> result; if (m_data->m_names.size() > index && index >= 0) { result = QPair<QString, QVariant>{m_data->m_names[index], m_data->m_values[index]}; } return result; } ParamType ChoiceParam::type() const { return ParamType::Choice; } QVariant ChoiceParam::value() const { return this->option(m_data->m_index).second; } int ChoiceParam::index() const { return m_data->m_index; } void ChoiceParam::setValue(const QVariant& value) { m_data->m_index = m_data->m_values.indexOf(value.toString()); } int ChoiceParam::defaultIndex() const { return m_data->m_defaultIndex; } void ChoiceParam::setDefaultIndex(int defaultIndex) { m_data->m_defaultIndex = defaultIndex; } void ChoiceParam::setDefaultValue(const QVariant& value) { auto index = m_data->m_values.indexOf(value); if (index != -1) { m_data->m_defaultIndex = index; } } int ChoiceParam::numOption() const { return m_data->m_names.size(); } std::unique_ptr<Param> ChoiceParam::clone() const { auto param = std::make_unique<ChoiceParam>( id(), name(), description(), parent()); param->setDefaultIndex(this->defaultIndex()); for (auto i = 0; i < m_data->m_names.size(); ++i) { param->addOption(m_data->m_names[i], m_data->m_values[i]); } return std::move(param); } QVariant ChoiceParam::fieldValue(int field) const { if (field == 1) { auto index = m_data->m_index >= 0 ? m_data->m_index : 0; return m_data->m_names[index]; } return Param::fieldValue(field); } } // namespace Quartz
23.095652
73
0.626506
varunamachi
f46f1c6527f8e9eda363a9e2357a4e8d85e78624
4,411
cpp
C++
source/internal/curl.cpp
HeliosInteractive/libkeen
f31246c2f0a705b9f1c25e4400d96a62408c37e6
[ "MIT" ]
1
2016-04-26T04:16:55.000Z
2016-04-26T04:16:55.000Z
source/internal/curl.cpp
HeliosInteractive/libkeen
f31246c2f0a705b9f1c25e4400d96a62408c37e6
[ "MIT" ]
null
null
null
source/internal/curl.cpp
HeliosInteractive/libkeen
f31246c2f0a705b9f1c25e4400d96a62408c37e6
[ "MIT" ]
2
2016-04-14T16:57:03.000Z
2020-02-21T00:17:48.000Z
#include "internal/curl.hpp" #include "scoped.hpp" #include "logger.hpp" #include "curl/curl.h" namespace libkeen { namespace internal { class LibCurlHandle { public: static std::shared_ptr< LibCurlHandle > ref() { static std::shared_ptr< LibCurlHandle > instance{ new LibCurlHandle }; return instance; } LibCurlHandle(); ~LibCurlHandle(); bool isReady() const; private: bool mReady = false; std::vector<LoggerRef> mLoggerRefs; }; LibCurlHandle::LibCurlHandle() { LOG_INFO("Starting up cURL"); internal::Logger::pull(mLoggerRefs); mReady = (curl_global_init(CURL_GLOBAL_DEFAULT) == CURLE_OK); } LibCurlHandle::~LibCurlHandle() { LOG_INFO("Shutting down cURL"); if (isReady()) { curl_global_cleanup(); } } bool LibCurlHandle::isReady() const { return mReady; } bool Curl::sendEvent(const std::string& url, const std::string& json) { if (!mLibCurlHandle || !mLibCurlHandle->isReady()) { LOG_WARN("cURL is not ready. Invalid operation."); return false; } bool success = false; LOG_INFO("cURL is about to send an event to: " << url << " with json: " << json); if (auto curl = curl_easy_init()) { curl_slist *headers = nullptr; Scoped<CURL> scope_bound_curl(curl); Scoped<curl_slist> scope_bound_slist(headers); headers = curl_slist_append(headers, "Accept: application/json"); headers = curl_slist_append(headers, "Content-Type: application/json"); headers = curl_slist_append(headers, "charsets: utf-8"); curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); auto res = curl_easy_perform(curl); if (res == CURLE_OK) { long http_code = 0; curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); if (http_code == 200 || http_code == 201) success = true; // FROM https://keen.io/docs/api/#errors // Check the response body for individual event statuses. Some or all may have failed. // TODO ^^^ } } if (success) { LOG_INFO("cURL succesfully sent an event."); } else { LOG_ERROR("cURL failed to send an event."); } return success; } namespace { static size_t write_cb(void *contents, size_t size, size_t nmemb, void *userp) { ((std::string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; }} bool Curl::sendEvent(const std::string& url, const std::string& json, std::string& reply) { if (!mLibCurlHandle || !mLibCurlHandle->isReady()) { LOG_WARN("cURL is not ready. Invalid operation."); return false; } bool success = false; if (!reply.empty()) reply.clear(); LOG_INFO("cURL is about to send an event to: " << url << " with json: " << json); if (auto curl = curl_easy_init()) { curl_slist *headers = nullptr; Scoped<CURL> scope_bound_curl(curl); Scoped<curl_slist> scope_bound_slist(headers); headers = curl_slist_append(headers, "Accept: application/json"); headers = curl_slist_append(headers, "Content-Type: application/json"); headers = curl_slist_append(headers, "charsets: utf-8"); curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, json.c_str()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &reply); auto res = curl_easy_perform(curl); if (res == CURLE_OK) { long http_code = 0; curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); if (http_code == 200 || http_code == 201) success = true; } } if (success) { LOG_INFO("cURL succesfully sent an event."); } else { LOG_ERROR("cURL failed to send an event."); } return success; } Curl::Curl() : mLibCurlHandle(LibCurlHandle::ref()) { internal::Logger::pull(mLoggerRefs); if (mLibCurlHandle && mLibCurlHandle->isReady()) LOG_INFO("cURL is initialized successfully."); } }}
26.572289
98
0.622308
HeliosInteractive
f46fd5e806eed37746556c8169397994332e255b
8,336
cpp
C++
src/widgets/qwellarray.cpp
sandsmark/qt1
e62eef42291be80065a7f824530aa42b79917a8d
[ "Xnet", "X11" ]
18
2018-02-16T16:57:26.000Z
2022-02-10T21:23:47.000Z
src/widgets/qwellarray.cpp
sandsmark/qt1
e62eef42291be80065a7f824530aa42b79917a8d
[ "Xnet", "X11" ]
2
2018-08-12T12:46:38.000Z
2020-06-19T16:30:06.000Z
src/widgets/qwellarray.cpp
sandsmark/qt1
e62eef42291be80065a7f824530aa42b79917a8d
[ "Xnet", "X11" ]
7
2018-06-22T01:17:58.000Z
2021-09-02T21:05:28.000Z
/********************************************************************** ** $Id: qwellarray.cpp,v 1.6 1998/07/03 00:09:54 hanord Exp $ ** ** Implementation of QWellArray widget class ** ** Created : 980114 ** ** Copyright (C) 1992-1999 Troll Tech AS. All rights reserved. ** ** This file is part of Qt Free Edition, version 1.45. ** ** See the file LICENSE included in the distribution for the usage ** and distribution terms, or http://www.troll.no/free-license.html. ** ** IMPORTANT NOTE: You may NOT copy this file or any part of it into ** your own programs or libraries. ** ** Please see http://www.troll.no/pricing.html for information about ** Qt Professional Edition, which is this same library but with a ** license which allows creation of commercial/proprietary software. ** *****************************************************************************/ //#include <qlayout.h> #include "qdrawutil.h" //#include <qevent.h> //#include "qobjectlist.h" #include "qobjectdict.h" #include "qkeycode.h" #include "qwellarray.h" struct QWellArrayData { QBrush *brush; }; /*notready \class QWellArray qwellarray.h \brief .... .... \ingroup realwidgets */ QWellArray::QWellArray( QWidget *parent, const char * name, bool popup ) : QTableView(parent,name,popup?WStyle_Customize|WStyle_Tool|WStyle_NoBorder:0) { d = 0; setFocusPolicy( StrongFocus ); // setBackgroundMode( PaletteBase ); nCols = 7; nRows = 7; int w = 24; // cell width int h = 21; // cell height smallStyle = popup; if ( popup ) { w = h = 18; if ( style() == WindowsStyle ) setFrameStyle( QFrame::WinPanel | QFrame::Raised ); else setFrameStyle( QFrame::Panel | QFrame::Raised ); setMargin( 1 ); setLineWidth( 2 ); } setNumCols( nCols ); setNumRows( nRows ); setCellWidth( w ); setCellHeight( h ); /* setTableFlags( Tbl_vScrollBar | Tbl_hScrollBar | Tbl_clipCellPainting | Tbl_smoothScrolling); */ curCol = 0; curRow = 0; selCol = -1; selRow = -1; if ( smallStyle ) setMouseTracking( TRUE ); setOffset( 5 , 10 ); resize( sizeHint() ); } QSize QWellArray::sizeHint() const { int f = frameWidth() * 2; int w = nCols * cellWidth() + f; int h = nRows * cellHeight() + f; return QSize( w, h ); } void QWellArray::paintCell( QPainter* p, int row, int col ) { // debug( "::repaint%d", xOffset() ); int w = cellWidth( col ); // width of cell in pixels int h = cellHeight( row ); // height of cell in pixels // int x = 0; // int y = 0; // int x2 = w - 1; // int y2 = h - 1; int b = 1; if ( !smallStyle ) b = 3; //##### QColorGroup g = colorGroup(); p->setPen( QPen( black, 0, SolidLine ) ); if ( !smallStyle && row ==selRow && col == selCol && style() != MotifStyle ) { int n = 2; p->drawRect( n, n, w-2*n, h-2*n ); } if ( style() == WindowsStyle ) { qDrawWinPanel( p, b, b , w - 2*b, h - 2*b, g, TRUE ); b += 2; } else { if ( smallStyle ) { qDrawShadePanel( p, b, b , w - 2*b, h - 2*b, g, TRUE, 2 ); b += 2; } else { int t = ( row == selRow && col == selCol ) ? 3 : 0; b -= t; qDrawShadePanel( p, b, b , w - 2*b, h - 2*b, g, TRUE, 2 ); b += 2 + t; } } if ( (row == curRow) && (col == curCol) ) { if ( smallStyle ) { p->setPen ( white ); p->drawRect( 1, 1, w-2, h-2 ); p->setPen ( black ); p->drawRect( 0, 0, w, h ); p->drawRect( 2, 2, w-4, h-4 ); b = 3; } else if ( hasFocus() ) { if ( style() == MotifStyle ) { int t = 1; if ( row == selRow && col == selCol ) t = 3; p->drawRect(t,t,w-2*t,h-2*t ); } else { p->drawWinFocusRect(0,0,w,h,g.background() ); } } } drawContents( p, row, col, QRect(b, b, w - 2*b, h - 2*b) ); } /*! Pass-through to QTableView::drawContents() to avoid hiding. */ void QWellArray::drawContents( QPainter *p ) { QTableView::drawContents(p); } /*! Override this function to change the contents of the well array. */ void QWellArray::drawContents( QPainter *p, int row, int col, const QRect &r ) { if ( d ) { p->fillRect( r, d->brush[row*nCols+col] ); } else { p->fillRect( r, white ); p->setPen( black ); p->drawLine( r.topLeft(), r.bottomRight() ); p->drawLine( r.topRight(), r.bottomLeft() ); } } /* Handles mouse press events for the well array. The current cell marker is set to the cell the mouse is clicked in. */ void QWellArray::mousePressEvent( QMouseEvent* e ) { QPoint clickedPos = e->pos(); setCurrent( findRow( clickedPos.y() ), findCol( clickedPos.x() ) ); setSelected( curRow, curCol ); //emit selected(); } /* Handles mouse move events for the well array. The current cell marker is set to the cell the mouse is clicked in. */ void QWellArray::mouseMoveEvent( QMouseEvent* e ) { if ( smallStyle ) { QPoint pos = e->pos(); setCurrent( findRow( pos.y() ), findCol( pos.x() ) ); } } void QWellArray::setCurrent( int row, int col ) { if ( (curRow == row) && (curCol == col) ) return; int oldRow = curRow; int oldCol = curCol; curRow = row; curCol = col; updateCell( oldRow, oldCol ); updateCell( curRow, curCol ); } void QWellArray::setSelected( int row, int col ) { if ( (selRow == row) && (selCol == col) ) return; int oldRow = selRow; int oldCol = selCol; selCol = col; selRow = row; updateCell( oldRow, oldCol ); updateCell( selRow, selCol ); } /*! Handles focus reception events for the well array. Repaint only the current cell; to avoid flickering */ void QWellArray::focusInEvent( QFocusEvent* ) { updateCell( curRow, curCol ); } /*! Sets the size of the well array to be \c rows cells by \c cols. Resets any brush info set by setCellBrush(). Must be called by reimplementors. */ void QWellArray::setDimension( int rows, int cols ) { nRows = rows; nCols = cols; if ( d ) { if ( d->brush ) delete[] d->brush; delete d; d = 0; } setNumCols( nCols ); setNumRows( nRows ); } void QWellArray::setCellBrush( int row, int col, const QBrush &b ) { if ( !d ) { d = new QWellArrayData; d->brush = new QBrush[nRows*nCols]; } d->brush[row*nCols+col] = b; } /*! Handles focus loss events for the well array. Repaint only the current cell; to avoid flickering */ void QWellArray::focusOutEvent( QFocusEvent* ) { updateCell( curRow, curCol ); } /* Handles key press events for the well array. Allows moving the current cell marker around with the arrow keys */ void QWellArray::keyPressEvent( QKeyEvent* e ) { int oldRow = curRow; // store previous current cell int oldCol = curCol; int edge = 0; switch( e->key() ) { // Look at the key code case Key_Left: // If 'left arrow'-key, if( curCol > 0 ) { // and cr't not in leftmost col curCol--; // set cr't to next left column edge = leftCell(); // find left edge if ( curCol < edge ) // if we have moved off edge, setLeftCell( edge - 1 ); // scroll view to rectify } break; case Key_Right: // Correspondingly... if( curCol < numCols()-1 ) { curCol++; edge = lastColVisible(); if ( curCol >= edge ) setLeftCell( leftCell() + 1 ); } break; case Key_Up: if( curRow > 0 ) { curRow--; edge = topCell(); if ( curRow < edge ) setTopCell( edge - 1 ); } break; case Key_Down: if( curRow < numRows()-1 ) { curRow++; edge = lastRowVisible(); if ( curRow >= edge ) setTopCell( topCell() + 1 ); } break; case Key_Space: case Key_Return: case Key_Enter: if( !smallStyle ) { setSelected( curRow, curCol ); } //emit selected(); break; default: // If not an interesting key, e->ignore(); // we don't accept the event return; } if ( (curRow != oldRow) // if current cell has moved, || (curCol != oldCol) ) { updateCell( oldRow, oldCol ); // erase previous marking updateCell( curRow, curCol ); // show new current cell } // if ( e->key() == Key_Enter || e->key() == Key_Return ) // emit return_pressed; // or ignore the event or something... }
22.713896
82
0.576895
sandsmark
f47229d31ccbbb3533a99020633dfcecb890c051
2,012
cpp
C++
TOJ/toj 266.cpp
Xi-Plus/OJ-Code
7ff6d691f34c9553d53dc9cddf90ad7dc7092349
[ "MIT" ]
null
null
null
TOJ/toj 266.cpp
Xi-Plus/OJ-Code
7ff6d691f34c9553d53dc9cddf90ad7dc7092349
[ "MIT" ]
null
null
null
TOJ/toj 266.cpp
Xi-Plus/OJ-Code
7ff6d691f34c9553d53dc9cddf90ad7dc7092349
[ "MIT" ]
null
null
null
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; struct T{ int maxbid; long long maxval; }tree[40010]; priority_queue<long long> bucket[10001]; void init(int tid,int l,int r){ tree[tid].maxbid=0; tree[tid].maxval=-1e18; if(l==r) return; int m=(l+r)/2; init(tid*2,l,m); init(tid*2+1,m+1,r); } int bid2tid(int tid,int l,int r,int bid){ if(l==r) return tid; int m=(l+r)/2; if(bid<=m){ return bid2tid(tid*2,l,m,bid); }else { return bid2tid(tid*2+1,m+1,r,bid); } } void up(int tid){ if(tree[tid*2+1].maxval>=tree[tid*2].maxval){ tree[tid].maxval=tree[tid*2+1].maxval; tree[tid].maxbid=tree[tid*2+1].maxbid; }else { tree[tid].maxval=tree[tid*2].maxval; tree[tid].maxbid=tree[tid*2].maxbid; } } void add(int bid,long long val,int l,int r){ bucket[bid].push(val); int tid=bid2tid(1,l,r,bid); tree[tid].maxbid=bid; tree[tid].maxval=bucket[bid].top(); tid/=2; while(tid){ up(tid); tid/=2; } } int ansbid; long long ansval; void get_max(int ql,int qr,int tl,int tr,int tid){ if(ql==tl&&qr==tr){ if(tree[tid].maxval<-1e10) return ; if(tree[tid].maxval>ansval){ ansval=tree[tid].maxval; ansbid=tree[tid].maxbid; }else if(tree[tid].maxval==ansval){ ansbid=max(ansbid,tree[tid].maxbid); } return ; } int tm=(tl+tr)/2; if(ql<=tm){ get_max(ql,min(qr,tm),tl,tm,tid*2); } if(qr>tm){ get_max(max(ql,tm+1),qr,tm+1,tr,tid*2+1); } } void del(int l,int r){ bucket[ansbid].pop(); int tid=bid2tid(1,l,r,ansbid); tree[tid].maxval=bucket[ansbid].top(); tree[tid].maxbid=ansbid; tid/=2; while(tid){ up(tid); tid/=2; } } int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int n,q; cin>>n>>q; init(1,1,n); for(int q=1;q<=n;q++){ bucket[q].push(-1e18); } int a,b,c; while(q--){ cin>>a>>b>>c; if(a==0){ b++; add(b,c,1,n); }else { b++; c++; ansbid=0; ansval=-1e18; get_max(b,c,1,n,1); if(ansbid==0){ cout<<-1<<endl; }else { cout<<ansval<<endl; del(1,n); } } } }
18.62963
50
0.599901
Xi-Plus
f4733dc07d5529f32f8f85a3889457648db545a0
7,562
cc
C++
NS3-master/src/lte/helper/emu-epc-helper.cc
legendPerceptor/blockchain
615ba331ae5ec53c683dfe6a16992a5181be0fea
[ "Apache-2.0" ]
1
2021-09-20T07:05:25.000Z
2021-09-20T07:05:25.000Z
NS3-master/src/lte/helper/emu-epc-helper.cc
legendPerceptor/blockchain
615ba331ae5ec53c683dfe6a16992a5181be0fea
[ "Apache-2.0" ]
null
null
null
NS3-master/src/lte/helper/emu-epc-helper.cc
legendPerceptor/blockchain
615ba331ae5ec53c683dfe6a16992a5181be0fea
[ "Apache-2.0" ]
2
2021-09-02T08:25:16.000Z
2022-01-03T08:48:38.000Z
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2011-2019 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Jaume Nin <jnin@cttc.es> * Nicola Baldo <nbaldo@cttc.es> * Manuel Requena <manuel.requena@cttc.es> */ #include <iomanip> #include "ns3/log.h" #include "ns3/string.h" #include "ns3/lte-enb-net-device.h" #include "ns3/lte-enb-rrc.h" #include "ns3/epc-x2.h" #include "ns3/emu-fd-net-device-helper.h" #include "ns3/emu-epc-helper.h" namespace ns3 { NS_LOG_COMPONENT_DEFINE ("EmuEpcHelper"); NS_OBJECT_ENSURE_REGISTERED (EmuEpcHelper); EmuEpcHelper::EmuEpcHelper () : NoBackhaulEpcHelper () { NS_LOG_FUNCTION (this); // To access the attribute value within the constructor ObjectBase::ConstructSelf (AttributeConstructionList ()); // Create EmuFdNetDevice for SGW EmuFdNetDeviceHelper emu; NS_LOG_LOGIC ("SGW device: " << m_sgwDeviceName); emu.SetDeviceName (m_sgwDeviceName); Ptr<Node> sgw = GetSgwNode (); NetDeviceContainer sgwDevices = emu.Install (sgw); Ptr<NetDevice> sgwDevice = sgwDevices.Get (0); NS_LOG_LOGIC ("SGW MAC address: " << m_sgwMacAddress); sgwDevice->SetAttribute ("Address", Mac48AddressValue (m_sgwMacAddress.c_str ())); // Address of the SGW: 10.0.0.1 m_epcIpv4AddressHelper.SetBase ("10.0.0.0", "255.255.255.0", "0.0.0.1"); m_sgwIpIfaces = m_epcIpv4AddressHelper.Assign (sgwDevices); // Address of the first eNB: 10.0.0.101 m_epcIpv4AddressHelper.SetBase ("10.0.0.0", "255.255.255.0", "0.0.0.101"); } EmuEpcHelper::~EmuEpcHelper () { NS_LOG_FUNCTION (this); } TypeId EmuEpcHelper::GetTypeId (void) { static TypeId tid = TypeId ("ns3::EmuEpcHelper") .SetParent<EpcHelper> () .SetGroupName("Lte") .AddConstructor<EmuEpcHelper> () .AddAttribute ("SgwDeviceName", "The name of the device used for the S1-U interface of the SGW", StringValue ("veth0"), MakeStringAccessor (&EmuEpcHelper::m_sgwDeviceName), MakeStringChecker ()) .AddAttribute ("EnbDeviceName", "The name of the device used for the S1-U interface of the eNB", StringValue ("veth1"), MakeStringAccessor (&EmuEpcHelper::m_enbDeviceName), MakeStringChecker ()) .AddAttribute ("SgwMacAddress", "MAC address used for the SGW", StringValue ("00:00:00:59:00:aa"), MakeStringAccessor (&EmuEpcHelper::m_sgwMacAddress), MakeStringChecker ()) .AddAttribute ("EnbMacAddressBase", "First 5 bytes of the eNB MAC address base", StringValue ("00:00:00:eb:00"), MakeStringAccessor (&EmuEpcHelper::m_enbMacAddressBase), MakeStringChecker ()) ; return tid; } TypeId EmuEpcHelper::GetInstanceTypeId () const { return GetTypeId (); } void EmuEpcHelper::DoDispose () { NS_LOG_FUNCTION (this); NoBackhaulEpcHelper::DoDispose (); } void EmuEpcHelper::AddEnb (Ptr<Node> enb, Ptr<NetDevice> lteEnbNetDevice, uint16_t cellId) { NS_LOG_FUNCTION (this << enb << lteEnbNetDevice << cellId); NoBackhaulEpcHelper::AddEnb (enb, lteEnbNetDevice, cellId); // Create an EmuFdNetDevice for the eNB to connect with the SGW and other eNBs EmuFdNetDeviceHelper emu; NS_LOG_LOGIC ("eNB cellId: " << cellId); NS_LOG_LOGIC ("eNB device: " << m_enbDeviceName); emu.SetDeviceName (m_enbDeviceName); NetDeviceContainer enbDevices = emu.Install (enb); NS_ABORT_IF ((cellId == 0) || (cellId > 255)); std::ostringstream enbMacAddress; enbMacAddress << m_enbMacAddressBase << ":" << std::hex << std::setfill ('0') << std::setw (2) << cellId; NS_LOG_LOGIC ("eNB MAC address: " << enbMacAddress.str ()); Ptr<NetDevice> enbDev = enbDevices.Get (0); enbDev->SetAttribute ("Address", Mac48AddressValue (enbMacAddress.str ().c_str ())); //emu.EnablePcap ("enbDevice", enbDev); NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB after installing emu dev: " << enb->GetObject<Ipv4> ()->GetNInterfaces ()); Ipv4InterfaceContainer enbIpIfaces = m_epcIpv4AddressHelper.Assign (enbDevices); NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB after assigning Ipv4 addr to S1 dev: " << enb->GetObject<Ipv4> ()->GetNInterfaces ()); Ipv4Address enbAddress = enbIpIfaces.GetAddress (0); Ipv4Address sgwAddress = m_sgwIpIfaces.GetAddress (0); NoBackhaulEpcHelper::AddS1Interface (enb, enbAddress, sgwAddress, cellId); } void EmuEpcHelper::AddX2Interface (Ptr<Node> enb1, Ptr<Node> enb2) { NS_LOG_FUNCTION (this << enb1 << enb2); NS_LOG_WARN ("X2 support still untested"); // for X2, we reuse the same device and IP address of the S1-U interface Ptr<Ipv4> enb1Ipv4 = enb1->GetObject<Ipv4> (); Ptr<Ipv4> enb2Ipv4 = enb2->GetObject<Ipv4> (); NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB #1: " << enb1Ipv4->GetNInterfaces ()); NS_LOG_LOGIC ("number of Ipv4 ifaces of the eNB #2: " << enb2Ipv4->GetNInterfaces ()); NS_LOG_LOGIC ("number of NetDevices of the eNB #1: " << enb1->GetNDevices ()); NS_LOG_LOGIC ("number of NetDevices of the eNB #2: " << enb2->GetNDevices ()); // 0 is the LTE device, 1 is localhost, 2 is the EPC NetDevice Ptr<NetDevice> enb1EpcDev = enb1->GetDevice (2); Ptr<NetDevice> enb2EpcDev = enb2->GetDevice (2); int32_t enb1Interface = enb1Ipv4->GetInterfaceForDevice (enb1EpcDev); int32_t enb2Interface = enb2Ipv4->GetInterfaceForDevice (enb2EpcDev); NS_ASSERT (enb1Interface >= 0); NS_ASSERT (enb2Interface >= 0); NS_ASSERT (enb1Ipv4->GetNAddresses (enb1Interface) == 1); NS_ASSERT (enb2Ipv4->GetNAddresses (enb2Interface) == 1); Ipv4Address enb1Addr = enb1Ipv4->GetAddress (enb1Interface, 0).GetLocal (); Ipv4Address enb2Addr = enb2Ipv4->GetAddress (enb2Interface, 0).GetLocal (); NS_LOG_LOGIC (" eNB 1 IP address: " << enb1Addr); NS_LOG_LOGIC (" eNB 2 IP address: " << enb2Addr); // Add X2 interface to both eNBs' X2 entities Ptr<EpcX2> enb1X2 = enb1->GetObject<EpcX2> (); Ptr<LteEnbNetDevice> enb1LteDev = enb1->GetDevice (0)->GetObject<LteEnbNetDevice> (); uint16_t enb1CellId = enb1LteDev->GetCellId (); NS_LOG_LOGIC ("LteEnbNetDevice #1 = " << enb1LteDev << " - CellId = " << enb1CellId); Ptr<EpcX2> enb2X2 = enb2->GetObject<EpcX2> (); Ptr<LteEnbNetDevice> enb2LteDev = enb2->GetDevice (0)->GetObject<LteEnbNetDevice> (); uint16_t enb2CellId = enb2LteDev->GetCellId (); NS_LOG_LOGIC ("LteEnbNetDevice #2 = " << enb2LteDev << " - CellId = " << enb2CellId); enb1X2->AddX2Interface (enb1CellId, enb1Addr, enb2CellId, enb2Addr); enb2X2->AddX2Interface (enb2CellId, enb2Addr, enb1CellId, enb1Addr); enb1LteDev->GetRrc ()->AddX2Neighbour (enb2LteDev->GetCellId ()); enb2LteDev->GetRrc ()->AddX2Neighbour (enb1LteDev->GetCellId ()); } } // namespace ns3
37.81
136
0.687517
legendPerceptor
f4756766856cdc7cf12e4a4226c7c2672a68509e
186
cpp
C++
src/component/component.cpp
MeTheFlea/flare
cf94019ef1a907fa33f29c5834616e05d891fb0d
[ "MIT" ]
3
2015-04-05T18:16:16.000Z
2016-05-02T19:00:48.000Z
src/component/component.cpp
MeTheFlea/flare
cf94019ef1a907fa33f29c5834616e05d891fb0d
[ "MIT" ]
null
null
null
src/component/component.cpp
MeTheFlea/flare
cf94019ef1a907fa33f29c5834616e05d891fb0d
[ "MIT" ]
null
null
null
#include "component/component.h" std::vector<std::function<void()>> flare::Components::s_updateFunctions; std::vector<std::function<void()>> flare::Components::s_renderFunctions;
31
73
0.741935
MeTheFlea
f476c8652e3523983370c829674a7362b6876dea
13,348
hpp
C++
common/include/pcl/common/impl/eigen.hpp
yxlao/StanfordPCL
98a8663f896c1ba880d14efa2338b7cfbd01b6ef
[ "MIT" ]
null
null
null
common/include/pcl/common/impl/eigen.hpp
yxlao/StanfordPCL
98a8663f896c1ba880d14efa2338b7cfbd01b6ef
[ "MIT" ]
null
null
null
common/include/pcl/common/impl/eigen.hpp
yxlao/StanfordPCL
98a8663f896c1ba880d14efa2338b7cfbd01b6ef
[ "MIT" ]
null
null
null
/* * Software License Agreement (BSD License) * * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2010, Willow Garage, Inc. * Copyright (c) 2012-, Open Perception, 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 the copyright holder(s) nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR a PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #ifndef PCL_COMMON_EIGEN_IMPL_HPP_ #define PCL_COMMON_EIGEN_IMPL_HPP_ #include <pcl/pcl_macros.h> ////////////////////////////////////////////////////////////////////////////////////////// void pcl::getTransFromUnitVectorsZY(const Eigen::Vector3f &z_axis, const Eigen::Vector3f &y_direction, Eigen::Affine3f &transformation) { Eigen::Vector3f tmp0 = (y_direction.cross(z_axis)).normalized(); Eigen::Vector3f tmp1 = (z_axis.cross(tmp0)).normalized(); Eigen::Vector3f tmp2 = z_axis.normalized(); transformation(0, 0) = tmp0[0]; transformation(0, 1) = tmp0[1]; transformation(0, 2) = tmp0[2]; transformation(0, 3) = 0.0f; transformation(1, 0) = tmp1[0]; transformation(1, 1) = tmp1[1]; transformation(1, 2) = tmp1[2]; transformation(1, 3) = 0.0f; transformation(2, 0) = tmp2[0]; transformation(2, 1) = tmp2[1]; transformation(2, 2) = tmp2[2]; transformation(2, 3) = 0.0f; transformation(3, 0) = 0.0f; transformation(3, 1) = 0.0f; transformation(3, 2) = 0.0f; transformation(3, 3) = 1.0f; } ////////////////////////////////////////////////////////////////////////////////////////// Eigen::Affine3f pcl::getTransFromUnitVectorsZY(const Eigen::Vector3f &z_axis, const Eigen::Vector3f &y_direction) { Eigen::Affine3f transformation; getTransFromUnitVectorsZY(z_axis, y_direction, transformation); return (transformation); } ////////////////////////////////////////////////////////////////////////////////////////// void pcl::getTransFromUnitVectorsXY(const Eigen::Vector3f &x_axis, const Eigen::Vector3f &y_direction, Eigen::Affine3f &transformation) { Eigen::Vector3f tmp2 = (x_axis.cross(y_direction)).normalized(); Eigen::Vector3f tmp1 = (tmp2.cross(x_axis)).normalized(); Eigen::Vector3f tmp0 = x_axis.normalized(); transformation(0, 0) = tmp0[0]; transformation(0, 1) = tmp0[1]; transformation(0, 2) = tmp0[2]; transformation(0, 3) = 0.0f; transformation(1, 0) = tmp1[0]; transformation(1, 1) = tmp1[1]; transformation(1, 2) = tmp1[2]; transformation(1, 3) = 0.0f; transformation(2, 0) = tmp2[0]; transformation(2, 1) = tmp2[1]; transformation(2, 2) = tmp2[2]; transformation(2, 3) = 0.0f; transformation(3, 0) = 0.0f; transformation(3, 1) = 0.0f; transformation(3, 2) = 0.0f; transformation(3, 3) = 1.0f; } ////////////////////////////////////////////////////////////////////////////////////////// Eigen::Affine3f pcl::getTransFromUnitVectorsXY(const Eigen::Vector3f &x_axis, const Eigen::Vector3f &y_direction) { Eigen::Affine3f transformation; getTransFromUnitVectorsXY(x_axis, y_direction, transformation); return (transformation); } ////////////////////////////////////////////////////////////////////////////////////////// void pcl::getTransformationFromTwoUnitVectors( const Eigen::Vector3f &y_direction, const Eigen::Vector3f &z_axis, Eigen::Affine3f &transformation) { getTransFromUnitVectorsZY(z_axis, y_direction, transformation); } ////////////////////////////////////////////////////////////////////////////////////////// Eigen::Affine3f pcl::getTransformationFromTwoUnitVectors(const Eigen::Vector3f &y_direction, const Eigen::Vector3f &z_axis) { Eigen::Affine3f transformation; getTransformationFromTwoUnitVectors(y_direction, z_axis, transformation); return (transformation); } void pcl::getTransformationFromTwoUnitVectorsAndOrigin( const Eigen::Vector3f &y_direction, const Eigen::Vector3f &z_axis, const Eigen::Vector3f &origin, Eigen::Affine3f &transformation) { getTransformationFromTwoUnitVectors(y_direction, z_axis, transformation); Eigen::Vector3f translation = transformation * origin; transformation(0, 3) = -translation[0]; transformation(1, 3) = -translation[1]; transformation(2, 3) = -translation[2]; } ////////////////////////////////////////////////////////////////////////////////////////// void pcl::getEulerAngles(const Eigen::Affine3f &t, float &roll, float &pitch, float &yaw) { roll = atan2f(t(2, 1), t(2, 2)); pitch = asinf(-t(2, 0)); yaw = atan2f(t(1, 0), t(0, 0)); } ////////////////////////////////////////////////////////////////////////////////////////// void pcl::getTranslationAndEulerAngles(const Eigen::Affine3f &t, float &x, float &y, float &z, float &roll, float &pitch, float &yaw) { x = t(0, 3); y = t(1, 3); z = t(2, 3); roll = atan2f(t(2, 1), t(2, 2)); pitch = asinf(-t(2, 0)); yaw = atan2f(t(1, 0), t(0, 0)); } ////////////////////////////////////////////////////////////////////////////////////////// template <typename Scalar> void pcl::getTransformation(Scalar x, Scalar y, Scalar z, Scalar roll, Scalar pitch, Scalar yaw, Eigen::Transform<Scalar, 3, Eigen::Affine> &t) { Scalar A = cos(yaw), B = sin(yaw), C = cos(pitch), D = sin(pitch), E = cos(roll), F = sin(roll), DE = D * E, DF = D * F; t(0, 0) = A * C; t(0, 1) = A * DF - B * E; t(0, 2) = B * F + A * DE; t(0, 3) = x; t(1, 0) = B * C; t(1, 1) = A * E + B * DF; t(1, 2) = B * DE - A * F; t(1, 3) = y; t(2, 0) = -D; t(2, 1) = C * F; t(2, 2) = C * E; t(2, 3) = z; t(3, 0) = 0; t(3, 1) = 0; t(3, 2) = 0; t(3, 3) = 1; } ////////////////////////////////////////////////////////////////////////////////////////// Eigen::Affine3f pcl::getTransformation(float x, float y, float z, float roll, float pitch, float yaw) { Eigen::Affine3f t; getTransformation(x, y, z, roll, pitch, yaw, t); return (t); } ////////////////////////////////////////////////////////////////////////////////////////// template <typename Derived> void pcl::saveBinary(const Eigen::MatrixBase<Derived> &matrix, std::ostream &file) { uint32_t rows = static_cast<uint32_t>(matrix.rows()), cols = static_cast<uint32_t>(matrix.cols()); file.write(reinterpret_cast<char *>(&rows), sizeof(rows)); file.write(reinterpret_cast<char *>(&cols), sizeof(cols)); for (uint32_t i = 0; i < rows; ++i) for (uint32_t j = 0; j < cols; ++j) { typename Derived::Scalar tmp = matrix(i, j); file.write(reinterpret_cast<const char *>(&tmp), sizeof(tmp)); } } ////////////////////////////////////////////////////////////////////////////////////////// template <typename Derived> void pcl::loadBinary(Eigen::MatrixBase<Derived> const &matrix_, std::istream &file) { Eigen::MatrixBase<Derived> &matrix = const_cast<Eigen::MatrixBase<Derived> &>(matrix_); uint32_t rows, cols; file.read(reinterpret_cast<char *>(&rows), sizeof(rows)); file.read(reinterpret_cast<char *>(&cols), sizeof(cols)); if (matrix.rows() != static_cast<int>(rows) || matrix.cols() != static_cast<int>(cols)) matrix.derived().resize(rows, cols); for (uint32_t i = 0; i < rows; ++i) for (uint32_t j = 0; j < cols; ++j) { typename Derived::Scalar tmp; file.read(reinterpret_cast<char *>(&tmp), sizeof(tmp)); matrix(i, j) = tmp; } } ////////////////////////////////////////////////////////////////////////////////////////// template <typename Derived, typename OtherDerived> typename Eigen::internal::umeyama_transform_matrix_type<Derived, OtherDerived>::type pcl::umeyama(const Eigen::MatrixBase<Derived> &src, const Eigen::MatrixBase<OtherDerived> &dst, bool with_scaling) { typedef typename Eigen::internal::umeyama_transform_matrix_type< Derived, OtherDerived>::type TransformationMatrixType; typedef typename Eigen::internal::traits<TransformationMatrixType>::Scalar Scalar; typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; typedef typename Derived::Index Index; EIGEN_STATIC_ASSERT(!Eigen::NumTraits<Scalar>::IsComplex, NUMERIC_TYPE_MUST_BE_REAL) EIGEN_STATIC_ASSERT( (Eigen::internal::is_same<Scalar, typename Eigen::internal::traits< OtherDerived>::Scalar>::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) enum { Dimension = PCL_EIGEN_SIZE_MIN_PREFER_DYNAMIC( Derived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime) }; typedef Eigen::Matrix<Scalar, Dimension, 1> VectorType; typedef Eigen::Matrix<Scalar, Dimension, Dimension> MatrixType; typedef typename Eigen::internal::plain_matrix_type_row_major<Derived>::type RowMajorMatrixType; const Index m = src.rows(); // dimension const Index n = src.cols(); // number of measurements // required for demeaning ... const RealScalar one_over_n = 1 / static_cast<RealScalar>(n); // computation of mean const VectorType src_mean = src.rowwise().sum() * one_over_n; const VectorType dst_mean = dst.rowwise().sum() * one_over_n; // demeaning of src and dst points const RowMajorMatrixType src_demean = src.colwise() - src_mean; const RowMajorMatrixType dst_demean = dst.colwise() - dst_mean; // Eq. (36)-(37) const Scalar src_var = src_demean.rowwise().squaredNorm().sum() * one_over_n; // Eq. (38) const MatrixType sigma(one_over_n * dst_demean * src_demean.transpose()); Eigen::JacobiSVD<MatrixType> svd(sigma, Eigen::ComputeFullU | Eigen::ComputeFullV); // Initialize the resulting transformation with an identity matrix... TransformationMatrixType Rt = TransformationMatrixType::Identity(m + 1, m + 1); // Eq. (39) VectorType S = VectorType::Ones(m); if (sigma.determinant() < 0) S(m - 1) = -1; // Eq. (40) and (43) const VectorType &d = svd.singularValues(); Index rank = 0; for (Index i = 0; i < m; ++i) if (!Eigen::internal::isMuchSmallerThan(d.coeff(i), d.coeff(0))) ++rank; if (rank == m - 1) { if (svd.matrixU().determinant() * svd.matrixV().determinant() > 0) Rt.block(0, 0, m, m).noalias() = svd.matrixU() * svd.matrixV().transpose(); else { const Scalar s = S(m - 1); S(m - 1) = -1; Rt.block(0, 0, m, m).noalias() = svd.matrixU() * S.asDiagonal() * svd.matrixV().transpose(); S(m - 1) = s; } } else { Rt.block(0, 0, m, m).noalias() = svd.matrixU() * S.asDiagonal() * svd.matrixV().transpose(); } // Eq. (42) if (with_scaling) { // Eq. (42) const Scalar c = 1 / src_var * svd.singularValues().dot(S); // Eq. (41) Rt.col(m).head(m) = dst_mean; Rt.col(m).head(m).noalias() -= c * Rt.topLeftCorner(m, m) * src_mean; Rt.block(0, 0, m, m) *= c; } else { Rt.col(m).head(m) = dst_mean; Rt.col(m).head(m).noalias() -= Rt.topLeftCorner(m, m) * src_mean; } return (Rt); } #endif // PCL_COMMON_EIGEN_IMPL_HPP_
39.964072
122
0.562631
yxlao
f477acb834ef5d09a1b8d6bb5b20a4411eabd74f
2,992
cpp
C++
Algorithms/Validator/valGeneral3Deg.cpp
lucaskeiler/AlgoritmosTCC
eccf14c2c872acb9e0728eb8948eee121b274f2e
[ "MIT" ]
null
null
null
Algorithms/Validator/valGeneral3Deg.cpp
lucaskeiler/AlgoritmosTCC
eccf14c2c872acb9e0728eb8948eee121b274f2e
[ "MIT" ]
null
null
null
Algorithms/Validator/valGeneral3Deg.cpp
lucaskeiler/AlgoritmosTCC
eccf14c2c872acb9e0728eb8948eee121b274f2e
[ "MIT" ]
null
null
null
#include <iostream> #include <cstdio> #include <cmath> #include "infection3deg.h" #include <ctime> using namespace std; int main (){ printf("["); for(int t = 20;t <= 10000;t+=20){ int n = t; Graph graph(n); graph.degree[0] = 1; graph.degree[n-1] = 1; //int y = 1,m = 1; int k = int(n/4 + 1); // while(y < n){ // for(int i=0;i<k-2 && y<n;i++){ // if(y == n-1){ // graph.degree[y++] = 3; // m+=3; // }else{ // if(y == n-2){ // graph.degree[y++] = 2; // m+=2; // }else{ // graph.degree[y++] = 3; // m+=3; // } // } // if(y<n){ // graph.degree[y++] = 1; // m++; // } // } // if(y < n){ // if(y == n-1){ // graph.degree[y++] = 1; // m+=1; // }else{ // graph.degree[y++] = 2; // m+=2; // } // } // } for(int i=1;i<n-1;i++){ if(i%2) graph.degree[i] = 3; else graph.degree[i] = 1; } //m/=2; graph.adjList[0].push_back(1); graph.adjList[1].push_back(0); for(int i=1;i<n-2;i+=2){ graph.adjList[i].push_back(i+1); graph.adjList[i+1].push_back(i); graph.adjList[i].push_back(i+2); graph.adjList[i+2].push_back(i); } // y = 1; // while(y < n){ // if(graph.degree[y] == 3){ // if(y+1 < n){ // graph.adjList[y].push_back(y+1); // graph.adjList[y+1].push_back(y); // } // if(y+2 < n){ // graph.adjList[y].push_back(y+2); // graph.adjList[y+2].push_back(y); // } // y += 2; // }else{ // if(y+1 < n){ // graph.adjList[y].push_back(y+1); // graph.adjList[y+1].push_back(y); // } // y++; // } // } //DEBUG // for(int i=0;i<n;i++){ // printf("(%d) -> %d: ",i,graph.degree[i]); // for(auto viz : graph.adjList[i]) // printf("%d, ",viz); // printf("\n"); // } clock_t begin = clock(); decide(graph,k); //getchar(); clock_t end = clock(); //printf("%d\n",resp); printf("[%d, %f], ",n,(double)(end - begin)/CLOCKS_PER_SEC); } printf("]\n"); return 0; }
23.559055
68
0.304144
lucaskeiler
f4786386813bbbc1426d8a1112e967e203d37c60
68,589
cxx
C++
main/dbaccess/source/ui/uno/copytablewizard.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
679
2015-01-06T06:34:58.000Z
2022-03-30T01:06:03.000Z
main/dbaccess/source/ui/uno/copytablewizard.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
102
2017-11-07T08:51:31.000Z
2022-03-17T12:13:49.000Z
main/dbaccess/source/ui/uno/copytablewizard.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_dbui.hxx" #include "dbu_reghelper.hxx" #include "dbu_resource.hrc" #include "dbu_uno.hrc" #include "dbustrings.hrc" #include "moduledbu.hxx" #include "sqlmessage.hxx" #include "WCopyTable.hxx" /** === begin UNO includes === **/ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sdb/application/XCopyTableWizard.hpp> #include <com/sun/star/sdb/application/CopyTableContinuation.hpp> #include <com/sun/star/sdb/application/CopyTableOperation.hpp> #include <com/sun/star/ucb/AlreadyInitializedException.hpp> #include <com/sun/star/lang/NotInitializedException.hpp> #include <com/sun/star/sdbc/XDataSource.hpp> #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/sdb/XDocumentDataSource.hpp> #include <com/sun/star/sdb/XCompletedConnection.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdb/XQueriesSupplier.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> #include <com/sun/star/sdbc/XParameters.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XBlob.hpp> #include <com/sun/star/sdbc/XClob.hpp> #include <com/sun/star/sdbcx/XRowLocate.hpp> #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdbc/XDriverManager.hpp> /** === end UNO includes === **/ #include <comphelper/componentcontext.hxx> #include <comphelper/interaction.hxx> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/proparrhlp.hxx> #include <comphelper/string.hxx> #include <connectivity/dbexception.hxx> #include <connectivity/dbtools.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/implbase1.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/logfile.hxx> #include <svtools/genericunodialog.hxx> #include <tools/diagnose_ex.h> #include <unotools/sharedunocomponent.hxx> #include <vcl/msgbox.hxx> #include <vcl/waitobj.hxx> //........................................................................ namespace dbaui { //........................................................................ /** === begin UNO using === **/ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::beans::Property; using ::com::sun::star::sdb::application::XCopyTableWizard; using ::com::sun::star::sdb::application::XCopyTableListener; using ::com::sun::star::sdb::application::CopyTableRowEvent; using ::com::sun::star::beans::Optional; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::ucb::AlreadyInitializedException; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::lang::NotInitializedException; using ::com::sun::star::lang::XServiceInfo; using ::com::sun::star::sdbc::XConnection; using ::com::sun::star::sdbc::XDataSource; using ::com::sun::star::container::XNameAccess; using ::com::sun::star::container::XChild; using ::com::sun::star::task::XInteractionHandler; using ::com::sun::star::frame::XModel; using ::com::sun::star::sdb::XDocumentDataSource; using ::com::sun::star::sdb::XCompletedConnection; using ::com::sun::star::lang::WrappedTargetException; using ::com::sun::star::sdbcx::XTablesSupplier; using ::com::sun::star::sdb::XQueriesSupplier; using ::com::sun::star::lang::DisposedException; using ::com::sun::star::sdbc::XPreparedStatement; using ::com::sun::star::sdb::XSingleSelectQueryComposer; using ::com::sun::star::sdbc::XDatabaseMetaData; using ::com::sun::star::sdbcx::XColumnsSupplier; using ::com::sun::star::sdbc::XParameters; using ::com::sun::star::sdbc::XResultSet; using ::com::sun::star::sdbc::XRow; using ::com::sun::star::sdbc::XBlob; using ::com::sun::star::sdbc::XClob; using ::com::sun::star::sdbcx::XRowLocate; using ::com::sun::star::sdbc::XResultSetMetaDataSupplier; using ::com::sun::star::sdbc::XResultSetMetaData; using ::com::sun::star::sdbc::SQLException; using ::com::sun::star::sdb::SQLContext; using ::com::sun::star::sdbc::XDriverManager; using ::com::sun::star::beans::PropertyValue; /** === end UNO using === **/ namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOperation; namespace CopyTableContinuation = ::com::sun::star::sdb::application::CopyTableContinuation; namespace CommandType = ::com::sun::star::sdb::CommandType; namespace DataType = ::com::sun::star::sdbc::DataType; typedef ::utl::SharedUNOComponent< XConnection > SharedConnection; typedef Reference< XInteractionHandler > InteractionHandler; //========================================================================= //= CopyTableWizard //========================================================================= typedef ::svt::OGenericUnoDialog CopyTableWizard_DialogBase; typedef ::cppu::ImplInheritanceHelper1 < CopyTableWizard_DialogBase , XCopyTableWizard > CopyTableWizard_Base; class CopyTableWizard :public CopyTableWizard_Base ,public ::comphelper::OPropertyArrayUsageHelper< CopyTableWizard > { public: // XServiceInfo virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException); virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(RuntimeException); // XServiceInfo - static methods static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( RuntimeException ); static ::rtl::OUString getImplementationName_Static(void) throw( RuntimeException ); static Reference< XInterface > Create( const Reference< XMultiServiceFactory >& ); // XCopyTableWizard virtual ::sal_Int16 SAL_CALL getOperation() throw (RuntimeException); virtual void SAL_CALL setOperation( ::sal_Int16 _operation ) throw (IllegalArgumentException, RuntimeException); virtual ::rtl::OUString SAL_CALL getDestinationTableName() throw (RuntimeException); virtual void SAL_CALL setDestinationTableName( const ::rtl::OUString& _destinationTableName ) throw (RuntimeException); virtual Optional< ::rtl::OUString > SAL_CALL getCreatePrimaryKey() throw (RuntimeException); virtual void SAL_CALL setCreatePrimaryKey( const Optional< ::rtl::OUString >& _newPrimaryKey ) throw (IllegalArgumentException, RuntimeException); virtual sal_Bool SAL_CALL getUseHeaderLineAsColumnNames() throw (RuntimeException); virtual void SAL_CALL setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames ) throw (RuntimeException); virtual void SAL_CALL addCopyTableListener( const Reference< XCopyTableListener >& Listener ) throw (RuntimeException); virtual void SAL_CALL removeCopyTableListener( const Reference< XCopyTableListener >& Listener ) throw (RuntimeException); // XCopyTableWizard::XExecutableDialog virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) throw (RuntimeException); virtual ::sal_Int16 SAL_CALL execute( ) throw (RuntimeException); // XInitialization virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException); // XPropertySet virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(RuntimeException); virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; public: ::osl::Mutex& getMutex() { return m_aMutex; } bool isInitialized() const { return m_xSourceConnection.is() && m_pSourceObject.get() && m_xDestConnection.is(); } protected: CopyTableWizard( const Reference< XMultiServiceFactory >& _rxORB ); ~CopyTableWizard(); // OGenericUnoDialog overridables virtual Dialog* createDialog( Window* _pParent ); virtual void executedDialog( sal_Int16 _nExecutionResult ); private: /// ensures our current attribute values are reflected in the dialog void impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialog ) const; /// ensures the current dialog settings are reflected in our attributes void impl_dialogToAttributes_nothrow( const OCopyTableWizard& _rDialog ); /** returns our typed dialog @throws ::com::sun::star::uno::RuntimeException if we don't have a dialog at the moment the method is called */ OCopyTableWizard& impl_getDialog_throw(); /** returns our typed dialog @throws ::com::sun::star::uno::RuntimeException if we don't have a dialog at the moment the method is called */ const OCopyTableWizard& impl_getDialog_throw() const; /** ensures the given argument sequence contains a valid data access descriptor at the given position @param _rAllArgs the arguments as passed to ->initialize @param _nArgPos the position within ->_rAllArgs which contains the data access descriptor @param _out_rxConnection will, upon successful return, contain the connection for the data source @param _out_rxDocInteractionHandler will, upon successful return, contain the interaction handler which could be deduced from database document described by the descriptor, if any. (It is possible that the descriptor does not allow to deduce a database document, in which case <code>_out_rxDocInteractionHandler</code> will be <NULL/>.) @return the data access descriptor */ Reference< XPropertySet > impl_ensureDataAccessDescriptor_throw( const Sequence< Any >& _rAllArgs, const sal_Int16 _nArgPos, SharedConnection& _out_rxConnection, InteractionHandler& _out_rxDocInteractionHandler ) const; /** extracts the source object (table or query) described by the given descriptor, relative to m_xSourceConnection */ ::std::auto_ptr< ICopyTableSourceObject > impl_extractSourceObject_throw( const Reference< XPropertySet >& _rxDescriptor, sal_Int32& _out_rCommandType ) const; /** extracts the result set to copy records from, and the selection-related aspects, if any. Effectively, this method extracts m_xSourceResultSet, m_aSourceSelection, and m_bSourceSelectionBookmarks. If an inconsistent/insufficent sub set of those properties is present in the descriptor, and exception is thrown. */ void impl_extractSourceResultSet_throw( const Reference< XPropertySet >& i_rDescriptor ); /** checks whether the given copy source descriptor contains settings which are not supported (yet) Throws an IllegalArgumentException if the descriptor contains a valid setting, which is not yet supported. */ void impl_checkForUnsupportedSettings_throw( const Reference< XPropertySet >& _rxSourceDescriptor ) const; /** obtaines the connection described by the given data access descriptor If needed and possible, the method will ask the user, using the interaction handler associated with the database described by the descriptor. All errors are handled with the InteractionHandler associated with the data source, if there is one. Else, they will be silenced (but asserted in non-product builds). @param _rxDataSourceDescriptor the data access descriptor describing the data source whose connection should be obtained. Must not be <NULL/>. @param _out_rxDocInteractionHandler the interaction handler which could be deduced from the descriptor @throws RuntimeException if anything goes seriously wrong. */ SharedConnection impl_extractConnection_throw( const Reference< XPropertySet >& _rxDataSourceDescriptor, InteractionHandler& _out_rxDocInteractionHandler ) const; /** actually copies the table This method is called after the dialog has been successfully executed. */ void impl_doCopy_nothrow(); /** creates the INSERT INTO statement @param _xTable The destination table. */ ::rtl::OUString impl_getServerSideCopyStatement_throw( const Reference< XPropertySet >& _xTable ); /** creates the statement which, when executed, will produce the source data to copy If the source object refers to a query which contains parameters, those parameters are filled in, using an interaction handler. */ ::utl::SharedUNOComponent< XPreparedStatement > impl_createSourceStatement_throw() const; /** copies the data rows from the given source result set to the given destination table */ void impl_copyRows_throw( const Reference< XResultSet >& _rxSourceResultSet, const Reference< XPropertySet >& _rxDestTable ); /** processes an error which occurred during copying First, all listeners are ask. If a listener tells to cancel or continue copying, this is reported to the method's caller. If a listener tells to ask the user, this is done, and the user's decision is reported to the method's caller. @return <TRUE/> if and only if copying should be continued. */ bool impl_processCopyError_nothrow( const CopyTableRowEvent& _rEvent ); private: ::comphelper::ComponentContext m_aContext; // attributes sal_Int16 m_nOperation; ::rtl::OUString m_sDestinationTable; Optional< ::rtl::OUString > m_aPrimaryKeyName; sal_Bool m_bUseHeaderLineAsColumnNames; // source SharedConnection m_xSourceConnection; sal_Int32 m_nCommandType; ::std::auto_ptr< ICopyTableSourceObject > m_pSourceObject; Reference< XResultSet > m_xSourceResultSet; Sequence< Any > m_aSourceSelection; sal_Bool m_bSourceSelectionBookmarks; // destination SharedConnection m_xDestConnection; // other InteractionHandler m_xInteractionHandler; ::cppu::OInterfaceContainerHelper m_aCopyTableListeners; sal_Int16 m_nOverrideExecutionResult; }; //========================================================================= //= MethodGuard //========================================================================= class CopyTableAccessGuard { public: CopyTableAccessGuard( CopyTableWizard& _rWizard ) :m_rWizard( _rWizard ) { m_rWizard.getMutex().acquire(); if ( !m_rWizard.isInitialized() ) throw NotInitializedException(); } ~CopyTableAccessGuard() { m_rWizard.getMutex().release(); } private: CopyTableWizard& m_rWizard; }; //========================================================================= //------------------------------------------------------------------------- CopyTableWizard::CopyTableWizard( const Reference< XMultiServiceFactory >& _rxORB ) :CopyTableWizard_Base( _rxORB ) ,m_aContext( _rxORB ) ,m_nOperation( CopyTableOperation::CopyDefinitionAndData ) ,m_sDestinationTable() ,m_aPrimaryKeyName( sal_False, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ID" ) )) ,m_bUseHeaderLineAsColumnNames( sal_True ) ,m_xSourceConnection() ,m_nCommandType( CommandType::COMMAND ) ,m_pSourceObject() ,m_xSourceResultSet() ,m_aSourceSelection() ,m_bSourceSelectionBookmarks( sal_True ) ,m_xDestConnection() ,m_aCopyTableListeners( m_aMutex ) ,m_nOverrideExecutionResult( -1 ) { } //------------------------------------------------------------------------- CopyTableWizard::~CopyTableWizard() { acquire(); // protect some members whose dtor might potentially throw try { m_xSourceConnection.clear(); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } try { m_xDestConnection.clear(); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } // TODO: shouldn't we have explicit disposal support? If a listener is registered // at our instance, and perhaps holds this our instance by a hard ref, then we'll never // be destroyed. // However, adding XComponent support to the GenericUNODialog probably requires // some thinking - would it break existing clients which do not call a dispose, then? } //------------------------------------------------------------------------- Reference< XInterface > CopyTableWizard::Create( const Reference< XMultiServiceFactory >& _rxFactory ) { return *( new CopyTableWizard( _rxFactory ) ); } //------------------------------------------------------------------------- ::rtl::OUString SAL_CALL CopyTableWizard::getImplementationName() throw(RuntimeException) { return getImplementationName_Static(); } //------------------------------------------------------------------------- ::rtl::OUString CopyTableWizard::getImplementationName_Static() throw(RuntimeException) { return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.dbu.CopyTableWizard" ) ); } //------------------------------------------------------------------------- ::comphelper::StringSequence SAL_CALL CopyTableWizard::getSupportedServiceNames() throw(RuntimeException) { return getSupportedServiceNames_Static(); } //------------------------------------------------------------------------- ::comphelper::StringSequence CopyTableWizard::getSupportedServiceNames_Static() throw(RuntimeException) { ::comphelper::StringSequence aSupported(1); aSupported.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.application.CopyTableWizard" ) ); return aSupported; } //------------------------------------------------------------------------- Reference< XPropertySetInfo > SAL_CALL CopyTableWizard::getPropertySetInfo() throw(RuntimeException) { Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); return xInfo; } //-------------------------------------------------------------------- ::sal_Int16 SAL_CALL CopyTableWizard::getOperation() throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); return m_nOperation; } //-------------------------------------------------------------------- void SAL_CALL CopyTableWizard::setOperation( ::sal_Int16 _operation ) throw (IllegalArgumentException, RuntimeException) { CopyTableAccessGuard aGuard( *this ); if ( ( _operation != CopyTableOperation::CopyDefinitionAndData ) && ( _operation != CopyTableOperation::CopyDefinitionOnly ) && ( _operation != CopyTableOperation::CreateAsView ) && ( _operation != CopyTableOperation::AppendData ) ) throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); if ( ( _operation == CopyTableOperation::CreateAsView ) && !OCopyTableWizard::supportsViews( m_xDestConnection ) ) throw IllegalArgumentException( String( ModuleRes( STR_CTW_NO_VIEWS_SUPPORT ) ), *this, 1 ); m_nOperation = _operation; } //-------------------------------------------------------------------- ::rtl::OUString SAL_CALL CopyTableWizard::getDestinationTableName() throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); return m_sDestinationTable; } //-------------------------------------------------------------------- void SAL_CALL CopyTableWizard::setDestinationTableName( const ::rtl::OUString& _destinationTableName ) throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); m_sDestinationTable = _destinationTableName; } //-------------------------------------------------------------------- Optional< ::rtl::OUString > SAL_CALL CopyTableWizard::getCreatePrimaryKey() throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); return m_aPrimaryKeyName; } //-------------------------------------------------------------------- void SAL_CALL CopyTableWizard::setCreatePrimaryKey( const Optional< ::rtl::OUString >& _newPrimaryKey ) throw (IllegalArgumentException, RuntimeException) { CopyTableAccessGuard aGuard( *this ); if ( _newPrimaryKey.IsPresent && !OCopyTableWizard::supportsPrimaryKey( m_xDestConnection ) ) throw IllegalArgumentException( String( ModuleRes( STR_CTW_NO_PRIMARY_KEY_SUPPORT ) ), *this, 1 ); m_aPrimaryKeyName = _newPrimaryKey; } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL CopyTableWizard::getUseHeaderLineAsColumnNames() throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); return m_bUseHeaderLineAsColumnNames; } // ----------------------------------------------------------------------------- void SAL_CALL CopyTableWizard::setUseHeaderLineAsColumnNames( sal_Bool _bUseHeaderLineAsColumnNames ) throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); m_bUseHeaderLineAsColumnNames = _bUseHeaderLineAsColumnNames; } //-------------------------------------------------------------------- void SAL_CALL CopyTableWizard::addCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); if ( _rxListener.is() ) m_aCopyTableListeners.addInterface( _rxListener ); } //-------------------------------------------------------------------- void SAL_CALL CopyTableWizard::removeCopyTableListener( const Reference< XCopyTableListener >& _rxListener ) throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); if ( _rxListener.is() ) m_aCopyTableListeners.removeInterface( _rxListener ); } //-------------------------------------------------------------------- void SAL_CALL CopyTableWizard::setTitle( const ::rtl::OUString& _rTitle ) throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); CopyTableWizard_DialogBase::setTitle( _rTitle ); } //-------------------------------------------------------------------- ::sal_Int16 SAL_CALL CopyTableWizard::execute( ) throw (RuntimeException) { CopyTableAccessGuard aGuard( *this ); m_nOverrideExecutionResult = -1; sal_Int16 nExecutionResult = CopyTableWizard_DialogBase::execute(); if ( m_nOverrideExecutionResult ) nExecutionResult = m_nOverrideExecutionResult; return nExecutionResult; } //------------------------------------------------------------------------- OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() { OCopyTableWizard* pWizard = dynamic_cast< OCopyTableWizard* >( m_pDialog ); if ( !pWizard ) throw DisposedException( ::rtl::OUString(), *this ); return *pWizard; } //------------------------------------------------------------------------- const OCopyTableWizard& CopyTableWizard::impl_getDialog_throw() const { const OCopyTableWizard* pWizard = dynamic_cast< const OCopyTableWizard* >( m_pDialog ); if ( !pWizard ) throw DisposedException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) ); return *pWizard; } //------------------------------------------------------------------------- void CopyTableWizard::impl_attributesToDialog_nothrow( OCopyTableWizard& _rDialog ) const { // primary key column _rDialog.setCreatePrimaryKey( m_aPrimaryKeyName.IsPresent, m_aPrimaryKeyName.Value ); _rDialog.setUseHeaderLine(m_bUseHeaderLineAsColumnNames); // everything else was passed at construction time already } //------------------------------------------------------------------------- void CopyTableWizard::impl_dialogToAttributes_nothrow( const OCopyTableWizard& _rDialog ) { m_aPrimaryKeyName.IsPresent = _rDialog.shouldCreatePrimaryKey(); if ( m_aPrimaryKeyName.IsPresent ) m_aPrimaryKeyName.Value = _rDialog.getPrimaryKeyName(); else m_aPrimaryKeyName.Value = ::rtl::OUString(); m_sDestinationTable = _rDialog.getName(); m_nOperation = _rDialog.getOperation(); m_bUseHeaderLineAsColumnNames = _rDialog.UseHeaderLine(); } //------------------------------------------------------------------------- namespace { //..................................................................... /** tries to obtain the InteractionHandler associated with a given data source If the data source is a sdb-level data source, it will have a DatabaseDocument associated with it. This doocument may have an InteractionHandler used while loading it. @throws RuntimeException if it occurs during invoking any of the data source's methods, or if any of the involved components violates its contract by not providing the required interfaces */ InteractionHandler lcl_getInteractionHandler_throw( const Reference< XDataSource >& _rxDataSource, const InteractionHandler& _rFallback ) { InteractionHandler xHandler( _rFallback ); // try to obtain the document model Reference< XModel > xDocumentModel; Reference< XDocumentDataSource > xDocDataSource( _rxDataSource, UNO_QUERY ); if ( xDocDataSource.is() ) xDocumentModel.set( xDocDataSource->getDatabaseDocument(), UNO_QUERY_THROW ); // see whether the document model can provide a handler if ( xDocumentModel.is() ) { ::comphelper::NamedValueCollection aModelArgs( xDocumentModel->getArgs() ); xHandler = aModelArgs.getOrDefault( "InteractionHandler", xHandler ); } return xHandler; } //..................................................................... /** tries to obtain the InteractionHandler associated with a given connection If the connection belongs to a sdb-level data source, then this data source is examined for an interaction handler. Else, <NULL/> is returned. @throws RuntimeException if it occurs during invoking any of the data source's methods, or if any of the involved components violates its contract by not providing the required interfaces */ InteractionHandler lcl_getInteractionHandler_throw( const Reference< XConnection >& _rxConnection, const InteractionHandler& _rFallback ) { // try whether there is a data source which the connection belongs to Reference< XDataSource > xDataSource; Reference< XChild > xAsChild( _rxConnection, UNO_QUERY ); if ( xAsChild.is() ) xDataSource = xDataSource.query( xAsChild->getParent() ); if ( xDataSource.is() ) return lcl_getInteractionHandler_throw( xDataSource, _rFallback ); return _rFallback; } } //------------------------------------------------------------------------- Reference< XPropertySet > CopyTableWizard::impl_ensureDataAccessDescriptor_throw( const Sequence< Any >& _rAllArgs, const sal_Int16 _nArgPos, SharedConnection& _out_rxConnection, InteractionHandler& _out_rxDocInteractionHandler ) const { Reference< XPropertySet > xDescriptor; _rAllArgs[ _nArgPos ] >>= xDescriptor; // the descriptor must be non-NULL, of course bool bIsValid = xDescriptor.is(); // it must support the proper service if ( bIsValid ) { Reference< XServiceInfo > xSI( xDescriptor, UNO_QUERY ); bIsValid = ( xSI.is() && xSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DataAccessDescriptor" ) ) ) ); } // it must be able to provide a connection if ( bIsValid ) { _out_rxConnection = impl_extractConnection_throw( xDescriptor, _out_rxDocInteractionHandler ); bIsValid = _out_rxConnection.is(); } if ( !bIsValid ) { throw IllegalArgumentException( String( ModuleRes( STR_CTW_INVALID_DATA_ACCESS_DESCRIPTOR ) ), *const_cast< CopyTableWizard* >( this ), _nArgPos + 1 ); } return xDescriptor; } //------------------------------------------------------------------------- namespace { bool lcl_hasNonEmptyStringValue_throw( const Reference< XPropertySet >& _rxDescriptor, const Reference< XPropertySetInfo > _rxPSI, const ::rtl::OUString& _rPropertyName ) { ::rtl::OUString sValue; if ( _rxPSI->hasPropertyByName( _rPropertyName ) ) { OSL_VERIFY( _rxDescriptor->getPropertyValue( _rPropertyName ) >>= sValue ); } return sValue.getLength() > 0; } } //------------------------------------------------------------------------- void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< XPropertySet >& _rxSourceDescriptor ) const { OSL_PRECOND( _rxSourceDescriptor.is(), "CopyTableWizard::impl_checkForUnsupportedSettings_throw: illegal argument!" ); Reference< XPropertySetInfo > xPSI( _rxSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); ::rtl::OUString sUnsupportedSetting; const ::rtl::OUString aSettings[] = { PROPERTY_FILTER, PROPERTY_ORDER, PROPERTY_HAVING_CLAUSE, PROPERTY_GROUP_BY }; for ( size_t i=0; i < sizeof( aSettings ) / sizeof( aSettings[0] ); ++i ) { if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSettings[i] ) ) { sUnsupportedSetting = aSettings[i]; break; } } if ( sUnsupportedSetting.getLength() != 0 ) { ::rtl::OUString sMessage( String(ModuleRes( STR_CTW_ERROR_UNSUPPORTED_SETTING )) ); ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$name$", sUnsupportedSetting ); throw IllegalArgumentException( sMessage, *const_cast< CopyTableWizard* >( this ), 1 ); } } //------------------------------------------------------------------------- ::std::auto_ptr< ICopyTableSourceObject > CopyTableWizard::impl_extractSourceObject_throw( const Reference< XPropertySet >& _rxDescriptor, sal_Int32& _out_rCommandType ) const { OSL_PRECOND( _rxDescriptor.is() && m_xSourceConnection.is(), "CopyTableWizard::impl_extractSourceObject_throw: illegal arguments!" ); Reference< XPropertySetInfo > xPSI( _rxDescriptor->getPropertySetInfo(), UNO_SET_THROW ); if ( !xPSI->hasPropertyByName( PROPERTY_COMMAND ) || !xPSI->hasPropertyByName( PROPERTY_COMMAND_TYPE ) ) throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Expecting a table or query specification." ) ), // TODO: resource *const_cast< CopyTableWizard* >( this ), 1 ); ::rtl::OUString sCommand; _out_rCommandType = CommandType::COMMAND; OSL_VERIFY( _rxDescriptor->getPropertyValue( PROPERTY_COMMAND ) >>= sCommand ); OSL_VERIFY( _rxDescriptor->getPropertyValue( PROPERTY_COMMAND_TYPE ) >>= _out_rCommandType ); ::std::auto_ptr< ICopyTableSourceObject > pSourceObject; Reference< XNameAccess > xContainer; switch ( _out_rCommandType ) { case CommandType::TABLE: { Reference< XTablesSupplier > xSuppTables( m_xSourceConnection.getTyped(), UNO_QUERY ); if ( xSuppTables.is() ) xContainer.set( xSuppTables->getTables(), UNO_SET_THROW ); } break; case CommandType::QUERY: { Reference< XQueriesSupplier > xSuppQueries( m_xSourceConnection.getTyped(), UNO_QUERY ); if ( xSuppQueries.is() ) xContainer.set( xSuppQueries->getQueries(), UNO_SET_THROW ); } break; default: throw IllegalArgumentException( String( ModuleRes( STR_CTW_ONLY_TABLES_AND_QUERIES_SUPPORT ) ), *const_cast< CopyTableWizard* >( this ), 1 ); } if ( xContainer.is() ) { pSourceObject.reset( new ObjectCopySource( m_xSourceConnection, Reference< XPropertySet >( xContainer->getByName( sCommand ), UNO_QUERY_THROW ) ) ); } else { // our source connection is an SDBC level connection only, not a SDBCX level one // Which means it cannot provide the to-be-copied object as component. if ( _out_rCommandType == CommandType::QUERY ) // we cannot copy a query if the connection cannot provide it ... throw IllegalArgumentException( String(ModuleRes( STR_CTW_ERROR_NO_QUERY )), *const_cast< CopyTableWizard* >( this ), 1 ); pSourceObject.reset( new NamedTableCopySource( m_xSourceConnection, sCommand ) ); } return pSourceObject; } //------------------------------------------------------------------------- void CopyTableWizard::impl_extractSourceResultSet_throw( const Reference< XPropertySet >& i_rDescriptor ) { Reference< XPropertySetInfo > xPSI( i_rDescriptor->getPropertySetInfo(), UNO_SET_THROW ); // extract relevant settings if ( xPSI->hasPropertyByName( PROPERTY_RESULT_SET ) ) m_xSourceResultSet.set( i_rDescriptor->getPropertyValue( PROPERTY_RESULT_SET ), UNO_QUERY ); if ( xPSI->hasPropertyByName( PROPERTY_SELECTION ) ) OSL_VERIFY( i_rDescriptor->getPropertyValue( PROPERTY_SELECTION ) >>= m_aSourceSelection ); if ( xPSI->hasPropertyByName( PROPERTY_BOOKMARK_SELECTION ) ) OSL_VERIFY( i_rDescriptor->getPropertyValue( PROPERTY_BOOKMARK_SELECTION ) >>= m_bSourceSelectionBookmarks ); // sanity checks const bool bHasResultSet = m_xSourceResultSet.is(); const bool bHasSelection = ( m_aSourceSelection.getLength() != 0 ); if ( bHasSelection && !bHasResultSet ) throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "A result set is needed when specifying a selection to copy." ) ), // TODO: resource *this, 1 ); if ( bHasSelection && m_bSourceSelectionBookmarks ) { Reference< XRowLocate > xRowLocate( m_xSourceResultSet, UNO_QUERY ); if ( !xRowLocate.is() ) { ::dbtools::throwGenericSQLException( String( ModuleRes( STR_CTW_COPY_SOURCE_NEEDS_BOOKMARKS ) ), *this ); } } } //------------------------------------------------------------------------- SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< XPropertySet >& _rxDataSourceDescriptor, InteractionHandler& _out_rxDocInteractionHandler ) const { SharedConnection xConnection; OSL_PRECOND( _rxDataSourceDescriptor.is(), "CopyTableWizard::impl_extractConnection_throw: no descriptor!" ); if ( !_rxDataSourceDescriptor.is() ) return xConnection; InteractionHandler xInteractionHandler; do { Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); // if there's an ActiveConnection, use it if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) ) { Reference< XConnection > xPure; OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure ); xConnection.reset( xPure, SharedConnection::NoTakeOwnership ); } if ( xConnection.is() ) { xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler ); OSL_POSTCOND( xInteractionHandler.is(), "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); break; } // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource ::rtl::OUString sDataSource, sDatabaseLocation; if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) ) OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource ); if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) ) OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation ); // need a DatabaseContext for loading the data source Reference< XNameAccess > xDatabaseContext( m_aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW ); Reference< XDataSource > xDataSource; if ( sDataSource.getLength() ) xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW ); if ( !xDataSource.is() && sDatabaseLocation.getLength() ) xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW ); if ( xDataSource.is() ) { // first, try connecting with completion xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler ); OSL_POSTCOND( xInteractionHandler.is(), "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); if ( xInteractionHandler.is() ) { Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY ); if ( xInteractiveConnection.is() ) xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership ); } // interactively connecting was not successful or possible -> connect without interaction if ( !xConnection.is() ) { xConnection.reset( xDataSource->getConnection( ::rtl::OUString(), ::rtl::OUString() ), SharedConnection::TakeOwnership ); } } if ( xConnection.is() ) break; // finally, there could be a ConnectionResource/ConnectionInfo ::rtl::OUString sConnectionResource; Sequence< PropertyValue > aConnectionInfo; if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) ) OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource ); if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) ) OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo ); Reference< XDriverManager > xDriverManager; xDriverManager.set( m_aContext.createComponent( "com.sun.star.sdbc.ConnectionPool" ), UNO_QUERY ); if ( !xDriverManager.is() ) // no connection pool installed xDriverManager.set( m_aContext.createComponent( "com.sun.star.sdbc.DriverManager" ), UNO_QUERY_THROW ); if ( aConnectionInfo.getLength() ) xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW ); else xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW ); } while ( false ); if ( xInteractionHandler != m_xInteractionHandler ) _out_rxDocInteractionHandler = xInteractionHandler; return xConnection; } //------------------------------------------------------------------------- ::utl::SharedUNOComponent< XPreparedStatement > CopyTableWizard::impl_createSourceStatement_throw() const { OSL_PRECOND( m_xSourceConnection.is(), "CopyTableWizard::impl_createSourceStatement_throw: illegal call!" ); if ( !m_xSourceConnection.is() ) throw RuntimeException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) ); ::utl::SharedUNOComponent< XPreparedStatement > xStatement; switch ( m_nCommandType ) { case CommandType::TABLE: xStatement.set( m_pSourceObject->getPreparedSelectStatement(), UNO_SET_THROW ); break; case CommandType::QUERY: { ::rtl::OUString sQueryCommand( m_pSourceObject->getSelectStatement() ); xStatement.set( m_pSourceObject->getPreparedSelectStatement(), UNO_SET_THROW ); // check whether we have to fill in parameter values // create and fill a composer Reference< XMultiServiceFactory > xFactory( m_xSourceConnection, UNO_QUERY ); ::utl::SharedUNOComponent< XSingleSelectQueryComposer > xComposer; if ( xFactory.is() ) // note: connections below the sdb-level are allowed to not support the XMultiServiceFactory interface xComposer.set( xFactory->createInstance( SERVICE_NAME_SINGLESELECTQUERYCOMPOSER ), UNO_QUERY ); if ( xComposer.is() ) { xComposer->setQuery( sQueryCommand ); Reference< XParameters > xStatementParams( xStatement, UNO_QUERY ); OSL_ENSURE( xStatementParams.is(), "CopyTableWizard::impl_createSourceStatement_throw: no access to the statement's parameters!" ); // the statement should be a css.sdbc.PreparedStatement (this is what // we created), and a prepared statement is required to support XParameters if ( xStatementParams.is() ) { OSL_ENSURE( m_xInteractionHandler.is(), "CopyTableWizard::impl_createSourceStatement_throw: no interaction handler for the parameters request!" ); // we should always have an interaction handler - as last fallback, we create an own one in ::initialize if ( m_xInteractionHandler.is() ) ::dbtools::askForParameters( xComposer, xStatementParams, m_xSourceConnection, m_xInteractionHandler ); } } } break; default: // this should not have survived initialization phase throw RuntimeException( ::rtl::OUString(), *const_cast< CopyTableWizard* >( this ) ); } return xStatement; } //------------------------------------------------------------------------- namespace { class ValueTransfer { public: ValueTransfer( const sal_Int32& _rSourcePos, const sal_Int32& _rDestPos, const ::std::vector< sal_Int32 >& _rColTypes, const Reference< XRow >& _rxSource, const Reference< XParameters >& _rxDest ) :m_rSourcePos( _rSourcePos ) ,m_rDestPos( _rDestPos ) ,m_rColTypes( _rColTypes ) ,m_xSource( _rxSource ) ,m_xDest( _rxDest ) { } template< typename VALUE_TYPE > void transferValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ), void (SAL_CALL XParameters::*_pSetter)( sal_Int32, VALUE_TYPE ) ) { VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) ); if ( m_xSource->wasNull() ) m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] ); else (m_xDest.get()->*_pSetter)( m_rDestPos, value ); } template< typename VALUE_TYPE > void transferComplexValue( VALUE_TYPE ( SAL_CALL XRow::*_pGetter )( sal_Int32 ), void (SAL_CALL XParameters::*_pSetter)( sal_Int32, const VALUE_TYPE& ) ) { const VALUE_TYPE value( (m_xSource.get()->*_pGetter)( m_rSourcePos ) ); { if ( m_xSource->wasNull() ) m_xDest->setNull( m_rDestPos, m_rColTypes[ m_rSourcePos ] ); else (m_xDest.get()->*_pSetter)( m_rDestPos, value ); } } private: const sal_Int32& m_rSourcePos; const sal_Int32& m_rDestPos; const ::std::vector< sal_Int32 > m_rColTypes; const Reference< XRow > m_xSource; const Reference< XParameters > m_xDest; }; } //------------------------------------------------------------------------- bool CopyTableWizard::impl_processCopyError_nothrow( const CopyTableRowEvent& _rEvent ) { Reference< XCopyTableListener > xListener; try { ::cppu::OInterfaceIteratorHelper aIter( m_aCopyTableListeners ); while ( aIter.hasMoreElements() ) { xListener.set( aIter.next(), UNO_QUERY_THROW ); sal_Int16 nListenerChoice = xListener->copyRowError( _rEvent ); switch ( nListenerChoice ) { case CopyTableContinuation::Proceed: return true; // continue copying case CopyTableContinuation::CallNextHandler: continue; // continue the loop, ask next listener case CopyTableContinuation::Cancel: return false; // cancel copying case CopyTableContinuation::AskUser: break; // stop asking the listeners, ask the user default: OSL_ENSURE( false, "CopyTableWizard::impl_processCopyError_nothrow: invalid listener response!" ); // ask next listener continue; } } } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } // no listener felt responsible for the error, or a listener told to ask the user try { SQLContext aError; aError.Context = *this; aError.Message = String( ModuleRes( STR_ERROR_OCCURED_WHILE_COPYING ) ); ::dbtools::SQLExceptionInfo aInfo( _rEvent.Error ); if ( aInfo.isValid() ) aError.NextException = _rEvent.Error; else { // a non-SQL exception happened Exception aException; OSL_VERIFY( _rEvent.Error >>= aException ); SQLContext aContext; aContext.Context = aException.Context; aContext.Message = aException.Message; aContext.Details = _rEvent.Error.getValueTypeName(); aError.NextException <<= aContext; } ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) ); ::rtl::Reference< ::comphelper::OInteractionApprove > xYes = new ::comphelper::OInteractionApprove; xRequest->addContinuation( xYes.get() ); xRequest->addContinuation( new ::comphelper::OInteractionDisapprove ); OSL_ENSURE( m_xInteractionHandler.is(), "CopyTableWizard::impl_processCopyError_nothrow: we always should have an interaction handler!" ); if ( m_xInteractionHandler.is() ) m_xInteractionHandler->handle( xRequest.get() ); if ( xYes->wasSelected() ) // continue copying return true; } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } // cancel copying return false; } //------------------------------------------------------------------------- void CopyTableWizard::impl_copyRows_throw( const Reference< XResultSet >& _rxSourceResultSet, const Reference< XPropertySet >& _rxDestTable ) { OSL_PRECOND( m_xDestConnection.is(), "CopyTableWizard::impl_copyRows_throw: illegal call!" ); if ( !m_xDestConnection.is() ) throw RuntimeException( ::rtl::OUString(), *this ); Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_QUERY_THROW ); const OCopyTableWizard& rWizard = impl_getDialog_throw(); ODatabaseExport::TPositions aColumnMapping = rWizard.GetColumnPositions(); bool bAutoIncrement = rWizard.shouldCreatePrimaryKey(); Reference< XRow > xRow ( _rxSourceResultSet, UNO_QUERY_THROW ); Reference< XRowLocate > xRowLocate ( _rxSourceResultSet, UNO_QUERY_THROW ); Reference< XResultSetMetaDataSupplier > xSuppResMeta( _rxSourceResultSet, UNO_QUERY_THROW ); Reference< XResultSetMetaData> xMeta( xSuppResMeta->getMetaData() ); // we need a vector which all types sal_Int32 nCount = xMeta->getColumnCount(); ::std::vector< sal_Int32 > aSourceColTypes; aSourceColTypes.reserve( nCount + 1 ); aSourceColTypes.push_back( -1 ); // just to avoid a every time i-1 call ::std::vector< sal_Int32 > aSourcePrec; aSourcePrec.reserve( nCount + 1 ); aSourcePrec.push_back( -1 ); // just to avoid a every time i-1 call for ( sal_Int32 k=1; k <= nCount; ++k ) { aSourceColTypes.push_back( xMeta->getColumnType( k ) ); aSourcePrec.push_back( xMeta->getPrecision( k ) ); } // now create, fill and execute the prepared statement Reference< XPreparedStatement > xStatement( ODatabaseExport::createPreparedStatment( xDestMetaData, _rxDestTable, aColumnMapping ), UNO_SET_THROW ); Reference< XParameters > xStatementParams( xStatement, UNO_QUERY_THROW ); const bool bSelectedRecordsOnly = m_aSourceSelection.getLength() != 0; const Any* pSelectedRow = m_aSourceSelection.getConstArray(); const Any* pSelEnd = pSelectedRow + m_aSourceSelection.getLength(); sal_Int32 nRowCount = 0; bool bContinue = false; CopyTableRowEvent aCopyEvent; aCopyEvent.Source = *this; aCopyEvent.SourceData = _rxSourceResultSet; do // loop as long as there are more rows or the selection ends { bContinue = false; if ( bSelectedRecordsOnly ) { if ( pSelectedRow != pSelEnd ) { if ( m_bSourceSelectionBookmarks ) { bContinue = xRowLocate->moveToBookmark( *pSelectedRow ); } else { sal_Int32 nPos = 0; OSL_VERIFY( *pSelectedRow >>= nPos ); bContinue = _rxSourceResultSet->absolute( nPos ); } ++pSelectedRow; } } else bContinue = _rxSourceResultSet->next(); if ( !bContinue ) { break; } ++nRowCount; sal_Bool bInsertAutoIncrement = sal_True; ODatabaseExport::TPositions::const_iterator aPosIter = aColumnMapping.begin(); ODatabaseExport::TPositions::const_iterator aPosEnd = aColumnMapping.end(); aCopyEvent.Error.clear(); try { // notify listeners m_aCopyTableListeners.notifyEach( &XCopyTableListener::copyingRow, aCopyEvent ); sal_Int32 nDestColumn( 0 ); sal_Int32 nSourceColumn( 1 ); ValueTransfer aTransfer( nSourceColumn, nDestColumn, aSourceColTypes, xRow, xStatementParams ); for ( ; aPosIter != aPosEnd; ++aPosIter ) { nDestColumn = aPosIter->first; if ( nDestColumn == COLUMN_POSITION_NOT_FOUND ) { ++nSourceColumn; // otherwise we don't get the correct value when only the 2nd source column was selected continue; } if ( bAutoIncrement && bInsertAutoIncrement ) { xStatementParams->setInt( 1, nRowCount ); bInsertAutoIncrement = sal_False; continue; } if ( ( nSourceColumn < 1 ) || ( nSourceColumn >= (sal_Int32)aSourceColTypes.size() ) ) { // ( we have to check here against 1 because the parameters are 1 based) ::dbtools::throwSQLException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Internal error: invalid column type index." ) ), ::dbtools::SQL_INVALID_DESCRIPTOR_INDEX, *this ); } switch ( aSourceColTypes[ nSourceColumn ] ) { case DataType::DOUBLE: case DataType::REAL: aTransfer.transferValue( &XRow::getDouble, &XParameters::setDouble ); break; case DataType::CHAR: case DataType::VARCHAR: case DataType::LONGVARCHAR: case DataType::DECIMAL: case DataType::NUMERIC: aTransfer.transferComplexValue( &XRow::getString, &XParameters::setString ); break; case DataType::BIGINT: aTransfer.transferValue( &XRow::getLong, &XParameters::setLong ); break; case DataType::FLOAT: aTransfer.transferValue( &XRow::getFloat, &XParameters::setFloat ); break; case DataType::LONGVARBINARY: case DataType::BINARY: case DataType::VARBINARY: aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes ); break; case DataType::DATE: aTransfer.transferComplexValue( &XRow::getDate, &XParameters::setDate ); break; case DataType::TIME: aTransfer.transferComplexValue( &XRow::getTime, &XParameters::setTime ); break; case DataType::TIMESTAMP: aTransfer.transferComplexValue( &XRow::getTimestamp, &XParameters::setTimestamp ); break; case DataType::BIT: if ( aSourcePrec[nSourceColumn] > 1 ) { aTransfer.transferComplexValue( &XRow::getBytes, &XParameters::setBytes ); break; } // run through case DataType::BOOLEAN: aTransfer.transferValue( &XRow::getBoolean, &XParameters::setBoolean ); break; case DataType::TINYINT: aTransfer.transferValue( &XRow::getByte, &XParameters::setByte ); break; case DataType::SMALLINT: aTransfer.transferValue( &XRow::getShort, &XParameters::setShort ); break; case DataType::INTEGER: aTransfer.transferValue( &XRow::getInt, &XParameters::setInt ); break; case DataType::BLOB: aTransfer.transferComplexValue( &XRow::getBlob, &XParameters::setBlob ); break; case DataType::CLOB: aTransfer.transferComplexValue( &XRow::getClob, &XParameters::setClob ); break; default: { ::rtl::OUString aMessage( String( ModuleRes( STR_CTW_UNSUPPORTED_COLUMN_TYPE ) ) ); aMessage.replaceAt( aMessage.indexOfAsciiL( "$type$", 6 ), 6, ::rtl::OUString::valueOf( aSourceColTypes[ nSourceColumn ] ) ); aMessage.replaceAt( aMessage.indexOfAsciiL( "$pos$", 5 ), 5, ::rtl::OUString::valueOf( nSourceColumn ) ); ::dbtools::throwSQLException( aMessage, ::dbtools::SQL_INVALID_SQL_DATA_TYPE, *this ); } } ++nSourceColumn; } xStatement->executeUpdate(); // notify listeners m_aCopyTableListeners.notifyEach( &XCopyTableListener::copiedRow, aCopyEvent ); } catch( const Exception& ) { aCopyEvent.Error = ::cppu::getCaughtException(); } if ( aCopyEvent.Error.hasValue() ) bContinue = impl_processCopyError_nothrow( aCopyEvent ); } while( bContinue ); } //------------------------------------------------------------------------- void CopyTableWizard::impl_doCopy_nothrow() { Any aError; try { OCopyTableWizard& rWizard( impl_getDialog_throw() ); WaitObject aWO( rWizard.GetParent() ); Reference< XPropertySet > xTable; switch ( rWizard.getOperation() ) { case CopyTableOperation::CopyDefinitionOnly: case CopyTableOperation::CopyDefinitionAndData: { xTable = rWizard.createTable(); if( !xTable.is() ) { OSL_ENSURE( false, "CopyTableWizard::impl_doCopy_nothrow: createTable should throw here, shouldn't it?" ); break; } if( CopyTableOperation::CopyDefinitionOnly == rWizard.getOperation() ) break; } // run through case CopyTableOperation::AppendData: { if ( !xTable.is() ) { xTable = rWizard.createTable(); if ( !xTable.is() ) { OSL_ENSURE( false, "CopyTableWizard::impl_doCopy_nothrow: createTable should throw here, shouldn't it?" ); break; } } ::utl::SharedUNOComponent< XPreparedStatement > xSourceStatement; ::utl::SharedUNOComponent< XResultSet > xSourceResultSet; if ( m_xSourceResultSet.is() ) { xSourceResultSet.reset( m_xSourceResultSet, ::utl::SharedUNOComponent< XResultSet >::NoTakeOwnership ); } else { const bool bIsSameConnection = ( m_xSourceConnection.getTyped() == m_xDestConnection.getTyped() ); const bool bIsTable = ( CommandType::TABLE == m_nCommandType ); bool bDone = false; if ( bIsSameConnection && bIsTable ) { // try whether the server supports copying via SQL try { m_xDestConnection->createStatement()->executeUpdate( impl_getServerSideCopyStatement_throw(xTable) ); bDone = true; } catch( const Exception& ) { // this is allowed. } } if ( !bDone ) { xSourceStatement.set( impl_createSourceStatement_throw(), UNO_SET_THROW ); xSourceResultSet.set( xSourceStatement->executeQuery(), UNO_SET_THROW ); } } if ( xSourceResultSet.is() ) impl_copyRows_throw( xSourceResultSet, xTable ); } break; case CopyTableOperation::CreateAsView: rWizard.createView(); break; default: OSL_ENSURE( false, "CopyTableWizard::impl_doCopy_nothrow: What operation, please?" ); break; } } catch( const Exception& ) { aError = ::cppu::getCaughtException(); // silence the error of the user cancelling the parameter's dialog SQLException aSQLError; if ( ( aError >>= aSQLError ) && ( aSQLError.ErrorCode == ::dbtools::ParameterInteractionCancelled ) ) { aError.clear(); m_nOverrideExecutionResult = RET_CANCEL; } } if ( aError.hasValue() && m_xInteractionHandler.is() ) { try { ::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( aError ) ); m_xInteractionHandler->handle( xRequest.get() ); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); } } } // ----------------------------------------------------------------------------- ::rtl::OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference< XPropertySet >& _xTable) { const Reference<XColumnsSupplier> xDestColsSup(_xTable,UNO_QUERY_THROW); const Sequence< ::rtl::OUString> aDestColumnNames = xDestColsSup->getColumns()->getElementNames(); const Sequence< ::rtl::OUString > aColumnNames = m_pSourceObject->getColumnNames(); const Reference< XDatabaseMetaData > xDestMetaData( m_xDestConnection->getMetaData(), UNO_QUERY_THROW ); const ::rtl::OUString sQuote = xDestMetaData->getIdentifierQuoteString(); ::rtl::OUStringBuffer sColumns; // 1st check if the columns matching const OCopyTableWizard& rWizard = impl_getDialog_throw(); ODatabaseExport::TPositions aColumnMapping = rWizard.GetColumnPositions(); ODatabaseExport::TPositions::const_iterator aPosIter = aColumnMapping.begin(); for ( sal_Int32 i = 0; aPosIter != aColumnMapping.end() ; ++aPosIter,++i ) { if ( COLUMN_POSITION_NOT_FOUND != aPosIter->second ) { if ( sColumns.getLength() ) sColumns.appendAscii(","); sColumns.append(sQuote); sColumns.append(aDestColumnNames[aPosIter->second - 1]); sColumns.append(sQuote); } } // for ( ; aPosIter != aColumnMapping.end() ; ++aPosIter ) ::rtl::OUStringBuffer sSql; sSql.appendAscii("INSERT INTO "); const ::rtl::OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, _xTable, ::dbtools::eInDataManipulation, false, false, true ); sSql.append( sComposedTableName ); sSql.appendAscii(" ( "); sSql.append( sColumns ); sSql.appendAscii(" ) ( "); sSql.append( m_pSourceObject->getSelectStatement()); sSql.appendAscii(" )"); return sSql.makeStringAndClear(); } //------------------------------------------------------------------------- void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) throw (Exception, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); if ( isInitialized() ) throw AlreadyInitializedException( ::rtl::OUString(), *this ); sal_Int32 nArgCount( _rArguments.getLength() ); if ( ( nArgCount != 2 ) && ( nArgCount != 3 ) ) throw IllegalArgumentException( String( ModuleRes( STR_CTW_ILLEGAL_PARAMETER_COUNT ) ), *this, 1 ); try { if ( nArgCount == 3 ) { // ->createWithInteractionHandler if ( !( _rArguments[2] >>= m_xInteractionHandler ) ) throw IllegalArgumentException( String(ModuleRes( STR_CTW_ERROR_INVALID_INTERACTIONHANDLER )), *this, 3 ); } if ( !m_xInteractionHandler.is() ) m_xInteractionHandler.set( m_aContext.createComponent( "com.sun.star.task.InteractionHandler" ), UNO_QUERY_THROW ); InteractionHandler xSourceDocHandler; Reference< XPropertySet > xSourceDescriptor( impl_ensureDataAccessDescriptor_throw( _rArguments, 0, m_xSourceConnection, xSourceDocHandler ) ); impl_checkForUnsupportedSettings_throw( xSourceDescriptor ); m_pSourceObject = impl_extractSourceObject_throw( xSourceDescriptor, m_nCommandType ); impl_extractSourceResultSet_throw( xSourceDescriptor ); InteractionHandler xDestDocHandler; impl_ensureDataAccessDescriptor_throw( _rArguments, 1, m_xDestConnection, xDestDocHandler ); if ( xDestDocHandler.is() && !m_xInteractionHandler.is() ) m_xInteractionHandler = xDestDocHandler; } catch( const RuntimeException& ) { throw; } catch( const IllegalArgumentException& ) { throw; } catch( const SQLException& ) { throw; } catch( const Exception& ) { throw WrappedTargetException( String( ModuleRes( STR_CTW_ERROR_DURING_INITIALIZATION ) ), *this, ::cppu::getCaughtException() ); } } //------------------------------------------------------------------------- ::cppu::IPropertyArrayHelper& CopyTableWizard::getInfoHelper() { return *getArrayHelper(); } //------------------------------------------------------------------------------ ::cppu::IPropertyArrayHelper* CopyTableWizard::createArrayHelper( ) const { Sequence< Property > aProps; describeProperties( aProps ); return new ::cppu::OPropertyArrayHelper( aProps ); } //------------------------------------------------------------------------------ Dialog* CopyTableWizard::createDialog( Window* _pParent ) { OSL_PRECOND( isInitialized(), "CopyTableWizard::createDialog: not initialized!" ); // this should have been prevented in ::execute already OCopyTableWizard* pWizard = new OCopyTableWizard( _pParent, m_sDestinationTable, m_nOperation, *m_pSourceObject, m_xSourceConnection.getTyped(), m_xDestConnection.getTyped(), m_aContext.getLegacyServiceFactory(), m_xInteractionHandler ); impl_attributesToDialog_nothrow( *pWizard ); return pWizard; } //------------------------------------------------------------------------------ void CopyTableWizard::executedDialog( sal_Int16 _nExecutionResult ) { CopyTableWizard_DialogBase::executedDialog( _nExecutionResult ); if ( _nExecutionResult == RET_OK ) impl_doCopy_nothrow(); // do this after impl_doCopy_nothrow: The attributes may change during copying, for instance // if the user entered an unqualified table name impl_dialogToAttributes_nothrow( impl_getDialog_throw() ); } //........................................................................ } // namespace dbaui //........................................................................ extern "C" void SAL_CALL createRegistryInfo_CopyTableWizard() { static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::CopyTableWizard > aAutoRegistration; }
41.848078
175
0.607648
Grosskopf
f47c0b1bb0cb79c8460fd506cbcb6304ef6782d7
8,871
cpp
C++
hotspot/src/cpu/x86/vm/interp_masm_x86.cpp
dbac/jdk8
abfce42ff6d4b8b77d622157519ecd211ba0aa8f
[ "MIT" ]
1
2020-12-26T04:52:15.000Z
2020-12-26T04:52:15.000Z
hotspot/src/cpu/x86/vm/interp_masm_x86.cpp
dbac/jdk8
abfce42ff6d4b8b77d622157519ecd211ba0aa8f
[ "MIT" ]
1
2020-12-26T04:57:19.000Z
2020-12-26T04:57:19.000Z
hotspot/src/cpu/x86/vm/interp_masm_x86.cpp
dbac/jdk8
abfce42ff6d4b8b77d622157519ecd211ba0aa8f
[ "MIT" ]
1
2021-12-06T01:13:18.000Z
2021-12-06T01:13:18.000Z
/* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #include "precompiled.hpp" #include "interp_masm_x86.hpp" #include "interpreter/interpreter.hpp" #include "oops/methodData.hpp" #ifndef CC_INTERP void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) { Label update, next, none; verify_oop(obj); testptr(obj, obj); jccb(Assembler::notZero, update); orptr(mdo_addr, TypeEntries::null_seen); jmpb(next); bind(update); load_klass(obj, obj); xorptr(obj, mdo_addr); testptr(obj, TypeEntries::type_klass_mask); jccb(Assembler::zero, next); // klass seen before, nothing to // do. The unknown bit may have been // set already but no need to check. testptr(obj, TypeEntries::type_unknown); jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore. cmpptr(mdo_addr, 0); jccb(Assembler::equal, none); cmpptr(mdo_addr, TypeEntries::null_seen); jccb(Assembler::equal, none); // There is a chance that the checks above (re-reading profiling // data from memory) fail if another thread has just set the // profiling to this obj's klass xorptr(obj, mdo_addr); testptr(obj, TypeEntries::type_klass_mask); jccb(Assembler::zero, next); // different than before. Cannot keep accurate profile. orptr(mdo_addr, TypeEntries::type_unknown); jmpb(next); bind(none); // first time here. Set profile type. movptr(mdo_addr, obj); bind(next); } void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual) { if (!ProfileInterpreter) { return; } if (MethodData::profile_arguments() || MethodData::profile_return()) { Label profile_continue; test_method_data_pointer(mdp, profile_continue); int off_to_start = is_virtual ? in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size()); cmpb(Address(mdp, in_bytes(DataLayout::tag_offset()) - off_to_start), is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag); jcc(Assembler::notEqual, profile_continue); if (MethodData::profile_arguments()) { Label done; int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset()); addptr(mdp, off_to_args); for (int i = 0; i < TypeProfileArgsLimit; i++) { if (i > 0 || MethodData::profile_return()) { // If return value type is profiled we may have no argument to profile movptr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args)); subl(tmp, i*TypeStackSlotEntries::per_arg_count()); cmpl(tmp, TypeStackSlotEntries::per_arg_count()); jcc(Assembler::less, done); } movptr(tmp, Address(callee, Method::const_offset())); load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset())); // stack offset o (zero based) from the start of the argument // list, for n arguments translates into offset n - o - 1 from // the end of the argument list subptr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::stack_slot_offset(i))-off_to_args)); subl(tmp, 1); Address arg_addr = argument_address(tmp); movptr(tmp, arg_addr); Address mdo_arg_addr(mdp, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args); profile_obj_type(tmp, mdo_arg_addr); int to_add = in_bytes(TypeStackSlotEntries::per_arg_size()); addptr(mdp, to_add); off_to_args += to_add; } if (MethodData::profile_return()) { movptr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args)); subl(tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count()); } bind(done); if (MethodData::profile_return()) { // We're right after the type profile for the last // argument. tmp is the number of cell left in the // CallTypeData/VirtualCallTypeData to reach its end. Non null // if there's a return to profile. assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), "can't move past ret type"); shll(tmp, exact_log2(DataLayout::cell_size)); addptr(mdp, tmp); } movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp); } else { assert(MethodData::profile_return(), "either profile call args or call ret"); update_mdp_by_constant(mdp, in_bytes(ReturnTypeEntry::size())); } // mdp points right after the end of the // CallTypeData/VirtualCallTypeData, right after the cells for the // return value type if there's one bind(profile_continue); } } void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) { assert_different_registers(mdp, ret, tmp, _bcp_register); if (ProfileInterpreter && MethodData::profile_return()) { Label profile_continue, done; test_method_data_pointer(mdp, profile_continue); if (MethodData::profile_return_jsr292_only()) { // If we don't profile all invoke bytecodes we must make sure // it's a bytecode we indeed profile. We can't go back to the // begining of the ProfileData we intend to update to check its // type because we're right after it and we don't known its // length Label do_profile; cmpb(Address(_bcp_register, 0), Bytecodes::_invokedynamic); jcc(Assembler::equal, do_profile); cmpb(Address(_bcp_register, 0), Bytecodes::_invokehandle); jcc(Assembler::equal, do_profile); get_method(tmp); cmpb(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm); jcc(Assembler::notEqual, profile_continue); bind(do_profile); } Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size())); mov(tmp, ret); profile_obj_type(tmp, mdo_ret_addr); bind(profile_continue); } } void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) { if (ProfileInterpreter && MethodData::profile_parameters()) { Label profile_continue, done; test_method_data_pointer(mdp, profile_continue); // Load the offset of the area within the MDO used for // parameters. If it's negative we're not profiling any parameters movl(tmp1, Address(mdp, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()))); testl(tmp1, tmp1); jcc(Assembler::negative, profile_continue); // Compute a pointer to the area for parameters from the offset // and move the pointer to the slot for the last // parameters. Collect profiling from last parameter down. // mdo start + parameters offset + array length - 1 addptr(mdp, tmp1); movptr(tmp1, Address(mdp, in_bytes(ArrayData::array_len_offset()))); decrement(tmp1, TypeStackSlotEntries::per_arg_count()); Label loop; bind(loop); int off_base = in_bytes(ParametersTypeData::stack_slot_offset(0)); int type_base = in_bytes(ParametersTypeData::type_offset(0)); Address::ScaleFactor per_arg_scale = Address::times(DataLayout::cell_size); Address arg_off(mdp, tmp1, per_arg_scale, off_base); Address arg_type(mdp, tmp1, per_arg_scale, type_base); // load offset on the stack from the slot for this parameter movptr(tmp2, arg_off); negptr(tmp2); // read the parameter from the local area movptr(tmp2, Address(_locals_register, tmp2, Interpreter::stackElementScale())); // profile the parameter profile_obj_type(tmp2, arg_type); // go to next parameter decrement(tmp1, TypeStackSlotEntries::per_arg_count()); jcc(Assembler::positive, loop); bind(profile_continue); } } #endif
38.569565
160
0.704092
dbac
f47c3987fa2311f982ef31193d7757bacaf250b7
8,285
cpp
C++
Examples_5_4/Sticktrace/SticktraceWindow.cpp
hukushirom/luastick
29e43ee9d7e26b6ab45a510e664825b8c64845ac
[ "MIT" ]
12
2020-04-26T11:38:00.000Z
2021-11-02T21:13:27.000Z
Examples_5_4/Sticktrace/SticktraceWindow.cpp
hukushirom/luastick
29e43ee9d7e26b6ab45a510e664825b8c64845ac
[ "MIT" ]
null
null
null
Examples_5_4/Sticktrace/SticktraceWindow.cpp
hukushirom/luastick
29e43ee9d7e26b6ab45a510e664825b8c64845ac
[ "MIT" ]
null
null
null
// SticktraceWindow.cpp : DLL の初期化ルーチンです。 // #include "stdafx.h" #include <thread> #include "Resource.h" // For IDD_STICK_TRACE. #include "RegBase.h" #include "DlgSticktrace.h" #include "Sticktrace.h" #ifdef _DEBUG #define new DEBUG_NEW #endif class __declspec(dllexport) SticktraceWindow { private: static SticktraceWindow* New( const wchar_t* companyName, const wchar_t* packageName, const wchar_t* applicationName, unsigned int dialogId, SticktraceDef::DebuggerCallbackFunc DGT_debuggerCallbackFunc, void* debuggerCallbackData ); static void Delete(SticktraceWindow* mtw); SticktraceWindow( unsigned int dialogId, SticktraceDef::DebuggerCallbackFunc DGT_debuggerCallbackFunc, void* debuggerCallbackData ); ~SticktraceWindow(); bool Show(bool show); bool IsVisible(bool & isVisible); bool IsScriptModified(bool & isModified); bool SetSource(const char * sandbox, const char * name, const char * source); bool IsDebugMode(); bool IsBreakpoint(const char* name, int lineIndex); bool OnSuspended(); bool OnResumed(); bool Jump(const char * name, int lineIndex); bool NewSession(); bool OnStart(SticktraceDef::ExecType execType); bool OnStop(SticktraceDef::ExecType execType); //----- 21.05.18 Fukushiro M. 削除始 ()----- //// 21.05.18 Fukushiro M. 1行追加 () // bool OnErrorStop(const char* message); //----- 21.05.18 Fukushiro M. 削除終 ()----- bool OutputError(const char* message); bool OutputDebug(const char* message); bool SetWatch(const char * data); bool SetVariableNotify(bool succeeded); SticktraceDef::SuspendCommand WaitCommandIsSet(StickString & paramA, uint32_t waitMilliseconds); // 20.06.10 1行削除 () // void Create(unsigned int dialogId); void Destroy(); static void StaticThreadFunc( SticktraceWindow* stickTrace, unsigned int dialogId, SticktraceDef::DebuggerCallbackFunc DGT_debuggerCallbackFunc, void* debuggerCallbackData ); void ThreadFunc( unsigned int dialogId, SticktraceDef::DebuggerCallbackFunc DGT_debuggerCallbackFunc, void* debuggerCallbackData ); private: CDlgSticktrace* m_stickTraceDlg; LONG m_threadId; LONG m_threadTerminateFlag; }; SticktraceWindow* SticktraceWindow::New( const wchar_t* companyName, const wchar_t* packageName, const wchar_t* applicationName, unsigned int dialogId, SticktraceDef::DebuggerCallbackFunc DGT_debuggerCallbackFunc, void* debuggerCallbackData ) { FCRegBase::SetApplicationInfo(companyName, packageName, applicationName); return new SticktraceWindow(dialogId, DGT_debuggerCallbackFunc, debuggerCallbackData); } void SticktraceWindow::Delete(SticktraceWindow* mtw) { delete mtw; } SticktraceWindow::SticktraceWindow( unsigned int dialogId, SticktraceDef::DebuggerCallbackFunc DGT_debuggerCallbackFunc, void* debuggerCallbackData ) : m_stickTraceDlg(nullptr) , m_threadId(0) , m_threadTerminateFlag(0) { if (::InterlockedCompareExchange(&m_threadId, 0, 0) != 0) return; std::thread{ SticktraceWindow::StaticThreadFunc, this, dialogId, DGT_debuggerCallbackFunc, debuggerCallbackData }.detach(); for (int i = 0; i != 100 && ::InterlockedCompareExchange(&m_threadId, 0, 0) == 0; i++) ::Sleep(10); } SticktraceWindow::~SticktraceWindow() { Destroy(); } void SticktraceWindow::StaticThreadFunc( SticktraceWindow* stickTrace, unsigned int dialogId, SticktraceDef::DebuggerCallbackFunc DGT_debuggerCallbackFunc, void* debuggerCallbackData ) { stickTrace->ThreadFunc(dialogId, DGT_debuggerCallbackFunc, debuggerCallbackData); } void SticktraceWindow::ThreadFunc( unsigned int dialogId, SticktraceDef::DebuggerCallbackFunc DGT_debuggerCallbackFunc, void* debuggerCallbackData ) { m_stickTraceDlg = new CDlgSticktrace(); m_stickTraceDlg->SetDialogId(dialogId); m_stickTraceDlg->SetDebuggerCallback(DGT_debuggerCallbackFunc, debuggerCallbackData); m_stickTraceDlg->Create(IDD_STICK_TRACE); m_stickTraceDlg->EnableWindow(FALSE); // スレッドIDを設定。後で強制終了できるよう。CSロック前なのでInterlockedで設定。 ::InterlockedExchange(&m_threadId, (LONG)::GetCurrentThreadId()); while (::InterlockedCompareExchange(&m_threadTerminateFlag, 0, 0) == 0) AfxGetApp()->PumpMessage(); //----- 20.07.30 Fukushiro M. 削除始 ()----- // MSG msg; // for (;;) // { // if (::InterlockedCompareExchange(&m_threadTerminateFlag, 0, 0) != 0) // break; //// AfxGetApp()->PumpMessage(); // if (::GetMessage(&msg, NULL, 0, 0)) // { // if (!m_stickTraceDlg->PreTranslateMessage(&msg)) // { // // ::TranslateMessage(&msg); // ::DispatchMessage(&msg); // } // } // } // // // while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) // { // if (::InterlockedCompareExchange(&m_threadTerminateFlag, 0, 0) != 0) // break; // if (!AfxGetApp()->PumpMessage()) // { // break; // } // } //----- 20.07.30 Fukushiro M. 削除終 ()----- //----- 20.07.30 Fukushiro M. 変更終 ()----- m_stickTraceDlg->DestroyWindow(); delete m_stickTraceDlg; m_stickTraceDlg = nullptr; // スレッドIDを解除。 ::InterlockedExchange(&m_threadId, 0); ::InterlockedExchange(&m_threadTerminateFlag, 0); } void SticktraceWindow::Destroy() { auto threadId = (DWORD)::InterlockedCompareExchange(&m_threadId, 0, 0); if (threadId == 0) return; auto threadHandle = ::OpenThread(THREAD_ALL_ACCESS, false, threadId); ::InterlockedExchange(&m_threadTerminateFlag, 1); #if defined(_DEBUG) static constexpr int WAIT_COUNT = 5000; #else static constexpr int WAIT_COUNT = 50; #endif DWORD result = WAIT_TIMEOUT; for (int i = 0; i != WAIT_COUNT && result == WAIT_TIMEOUT; i++) { // Post the WM_USER as a dummy message to work the GetMessage function. if (::IsWindow(m_stickTraceDlg->GetSafeHwnd())) m_stickTraceDlg->PostMessage(WM_USER); result = ::WaitForSingleObject(threadHandle, 100); } if (result == WAIT_TIMEOUT) { ::TerminateThread(threadHandle, 0); ::CloseHandle(threadHandle); // delete m_stickTraceDlg はできない。スレッドを強制停止したため。 } m_stickTraceDlg = nullptr; ::InterlockedExchange(&m_threadId, 0); ::InterlockedExchange(&m_threadTerminateFlag, 0); } bool SticktraceWindow::Show(bool show) { return m_stickTraceDlg->APT_Show(show); } bool SticktraceWindow::IsVisible(bool & isVisible) { if (m_stickTraceDlg == nullptr) return false; return m_stickTraceDlg->APT_IsVisible(isVisible); } bool SticktraceWindow::IsScriptModified(bool & isModified) { if (m_stickTraceDlg == nullptr) return false; return m_stickTraceDlg->APT_IsScriptModified(isModified); } bool SticktraceWindow::SetSource(const char * sandbox, const char * name, const char * source) { return m_stickTraceDlg->APT_SetSource(sandbox, name, source); } bool SticktraceWindow::IsDebugMode() { return m_stickTraceDlg->APT_IsDebugMode(); } bool SticktraceWindow::IsBreakpoint(const char* name, int lineIndex) { return m_stickTraceDlg->APT_IsBreakpoint(name, lineIndex); } bool SticktraceWindow::OnSuspended() { return m_stickTraceDlg->APT_OnSuspended(); } bool SticktraceWindow::OnResumed() { return m_stickTraceDlg->APT_OnResumed(); } bool SticktraceWindow::Jump(const char * name, int lineIndex) { return m_stickTraceDlg->APT_Jump(name, lineIndex); } bool SticktraceWindow::NewSession() { return m_stickTraceDlg->APT_NewSession(); } bool SticktraceWindow::OnStart(SticktraceDef::ExecType execType) { return m_stickTraceDlg->APT_OnStart(execType); } bool SticktraceWindow::OnStop(SticktraceDef::ExecType execType) { return m_stickTraceDlg->APT_OnStop(execType); } //----- 21.05.18 Fukushiro M. 削除始 ()----- ////----- 21.05.18 Fukushiro M. 追加始 ()----- //bool SticktraceWindow::OnErrorStop(const char * message) //{ // return m_stickTraceDlg->APT_OnErrorStop(message); //} ////----- 21.05.18 Fukushiro M. 追加終 ()----- //----- 21.05.18 Fukushiro M. 削除終 ()----- bool SticktraceWindow::OutputError(const char * message) { return m_stickTraceDlg->APT_OutputError(message); } bool SticktraceWindow::OutputDebug(const char * message) { return m_stickTraceDlg->APT_OutputDebug(message); } bool SticktraceWindow::SetWatch(const char * data) { return m_stickTraceDlg->APT_SetWatch(data); } bool SticktraceWindow::SetVariableNotify(bool succeeded) { return m_stickTraceDlg->APT_SetVariableNotify(succeeded); } SticktraceDef::SuspendCommand SticktraceWindow::WaitCommandIsSet(StickString & paramA, uint32_t waitMilliseconds) { return m_stickTraceDlg->APT_WaitCommandIsSet(paramA, waitMilliseconds); }
26.812298
124
0.749427
hukushirom
f47cd19863c6c6e596258ff85f536118228615b6
10,226
cpp
C++
3rdparty/openmm/plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
merkys/MMB
0531385b8367405e1188e31c3eef7aa4cc50170b
[ "MIT" ]
5
2020-07-31T17:33:03.000Z
2022-01-01T19:24:37.000Z
3rdparty/openmm/plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
merkys/MMB
0531385b8367405e1188e31c3eef7aa4cc50170b
[ "MIT" ]
11
2020-06-16T05:05:42.000Z
2022-03-30T09:59:14.000Z
3rdparty/openmm/plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
merkys/MMB
0531385b8367405e1188e31c3eef7aa4cc50170b
[ "MIT" ]
9
2020-01-24T12:02:37.000Z
2020-10-16T06:23:56.000Z
/* -------------------------------------------------------------------------- * * OpenMM * * -------------------------------------------------------------------------- * * This is part of the OpenMM molecular simulation toolkit originating from * * Simbios, the NIH National Center for Physics-Based Simulation of * * Biological Structures at Stanford, funded under the NIH Roadmap for * * Medical Research, grant U54 GM072970. See https://simtk.org. * * * * Portions copyright (c) 2008-2014 Stanford University and the Authors. * * Authors: Peter Eastman * * 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, CONTRIBUTORS 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 "openmm/RPMDIntegrator.h" #include "openmm/Context.h" #include "openmm/OpenMMException.h" #include "openmm/internal/ContextImpl.h" #include "openmm/RpmdKernels.h" #include "openmm/RPMDUpdater.h" #include "SimTKOpenMMRealType.h" #include <cmath> #include <string> using namespace OpenMM; using namespace std; RPMDIntegrator::RPMDIntegrator(int numCopies, double temperature, double frictionCoeff, double stepSize, const map<int, int>& contractions) : numCopies(numCopies), applyThermostat(true), contractions(contractions), forcesAreValid(false), hasSetPosition(false), hasSetVelocity(false), isFirstStep(true) { setTemperature(temperature); setFriction(frictionCoeff); setStepSize(stepSize); setConstraintTolerance(1e-5); setRandomNumberSeed(0); } RPMDIntegrator::RPMDIntegrator(int numCopies, double temperature, double frictionCoeff, double stepSize) : numCopies(numCopies), applyThermostat(true), forcesAreValid(false), hasSetPosition(false), hasSetVelocity(false), isFirstStep(true) { setTemperature(temperature); setFriction(frictionCoeff); setStepSize(stepSize); setConstraintTolerance(1e-5); setRandomNumberSeed(0); } void RPMDIntegrator::initialize(ContextImpl& contextRef) { if (owner != NULL && &contextRef.getOwner() != owner) throw OpenMMException("This Integrator is already bound to a context"); if (contextRef.getSystem().getNumConstraints() > 0) throw OpenMMException("RPMDIntegrator cannot be used with Systems that include constraints"); context = &contextRef; owner = &contextRef.getOwner(); kernel = context->getPlatform().createKernel(IntegrateRPMDStepKernel::Name(), contextRef); kernel.getAs<IntegrateRPMDStepKernel>().initialize(contextRef.getSystem(), *this); } void RPMDIntegrator::cleanup() { kernel = Kernel(); } void RPMDIntegrator::stateChanged(State::DataType changed) { forcesAreValid = false; } vector<string> RPMDIntegrator::getKernelNames() { std::vector<std::string> names; names.push_back(IntegrateRPMDStepKernel::Name()); return names; } void RPMDIntegrator::setPositions(int copy, const vector<Vec3>& positions) { kernel.getAs<IntegrateRPMDStepKernel>().setPositions(copy, positions); forcesAreValid = false; hasSetPosition = true; } void RPMDIntegrator::setVelocities(int copy, const vector<Vec3>& velocities) { kernel.getAs<IntegrateRPMDStepKernel>().setVelocities(copy, velocities); hasSetVelocity = true; } State RPMDIntegrator::getState(int copy, int types, bool enforcePeriodicBox, int groups) { if (isFirstStep) { // Call setPositions() on the Context so it doesn't think the user is trying to // run a simulation without setting positions first. These positions will // immediately get overwritten by the ones stored in this integrator. vector<Vec3> p(context->getSystem().getNumParticles(), Vec3()); context->getOwner().setPositions(p); isFirstStep = false; } kernel.getAs<IntegrateRPMDStepKernel>().copyToContext(copy, *context); State state = context->getOwner().getState(types, enforcePeriodicBox && copy == 0, groups); if (enforcePeriodicBox && copy > 0 && (types&State::Positions) != 0) { // Apply periodic boundary conditions based on copy 0. Otherwise, molecules might end // up in different places for different copies. kernel.getAs<IntegrateRPMDStepKernel>().copyToContext(0, *context); State state2 = context->getOwner().getState(State::Positions, false, groups); vector<Vec3> positions = state.getPositions(); const vector<Vec3>& refPos = state2.getPositions(); const vector<vector<int> >& molecules = context->getMolecules(); Vec3 periodicBoxSize[3]; state2.getPeriodicBoxVectors(periodicBoxSize[0], periodicBoxSize[1], periodicBoxSize[2]); for (auto& mol : molecules) { // Find the molecule center. Vec3 center; for (int j : mol) center += refPos[j]; center *= 1.0/mol.size(); // Find the displacement to move it into the first periodic box. Vec3 diff; diff += periodicBoxSize[2]*floor(center[2]/periodicBoxSize[2][2]); diff += periodicBoxSize[1]*floor((center[1]-diff[1])/periodicBoxSize[1][1]); diff += periodicBoxSize[0]*floor((center[0]-diff[0])/periodicBoxSize[0][0]); // Translate all the particles in the molecule. for (int j : mol) { Vec3& pos = positions[j]; pos -= diff; } } // Construct the new State. State::StateBuilder builder(state.getTime()); builder.setPositions(positions); builder.setPeriodicBoxVectors(periodicBoxSize[0], periodicBoxSize[1], periodicBoxSize[2]); if (types&State::Velocities) builder.setVelocities(state.getVelocities()); if (types&State::Forces) builder.setForces(state.getForces()); if (types&State::Parameters) builder.setParameters(state.getParameters()); if (types&State::Energy) builder.setEnergy(state.getKineticEnergy(), state.getPotentialEnergy()); state = builder.getState(); } return state; } double RPMDIntegrator::computeKineticEnergy() { return kernel.getAs<IntegrateRPMDStepKernel>().computeKineticEnergy(*context, *this); } void RPMDIntegrator::step(int steps) { if (context == NULL) throw OpenMMException("This Integrator is not bound to a context!"); if (!hasSetPosition) { // Initialize the positions from the context. State s = context->getOwner().getState(State::Positions); for (int i = 0; i < numCopies; i++) setPositions(i, s.getPositions()); } if (!hasSetVelocity) { // Initialize the velocities from the context. State s = context->getOwner().getState(State::Velocities); for (int i = 0; i < numCopies; i++) setVelocities(i, s.getVelocities()); } if (isFirstStep) { // Call setPositions() on the Context so it doesn't think the user is trying to // run a simulation without setting positions first. These positions will // immediately get overwritten by the ones stored in this integrator. vector<Vec3> p(context->getSystem().getNumParticles(), Vec3()); context->getOwner().setPositions(p); isFirstStep = false; } for (auto impl : context->getForceImpls()) { RPMDUpdater* updater = dynamic_cast<RPMDUpdater*>(impl); if (updater != NULL) updater->updateRPMDState(*context); } for (int i = 0; i < steps; ++i) { kernel.getAs<IntegrateRPMDStepKernel>().execute(*context, *this, forcesAreValid); forcesAreValid = true; } } double RPMDIntegrator::getTotalEnergy() { const System& system = owner->getSystem(); int numParticles = system.getNumParticles(); double energy = 0.0; const double hbar = 1.054571628e-34*AVOGADRO/(1000*1e-12); const double wn = numCopies*BOLTZ*temperature/hbar; State prevState = getState(numCopies-1, State::Positions); for (int i = 0; i < numCopies; i++) { // Add the energy of this copy. State state = getState(i, State::Positions | State::Energy); energy += state.getKineticEnergy()+state.getPotentialEnergy(); // Add the energy from the springs connecting it to the previous copy. for (int j = 0; j < numParticles; j++) { Vec3 delta = state.getPositions()[j]-prevState.getPositions()[j]; energy += 0.5*wn*wn*system.getParticleMass(j)*delta.dot(delta); } prevState = state; } return energy; }
45.448889
169
0.623411
merkys
f47e429b41b9e543425fde38c44e240f9a80fd1f
18,267
cpp
C++
src/caffe/test/test_roi_pooling_layer.cpp
imoisture/caffe
4d6892afeff234c57ce470056939101e0ae71369
[ "BSD-2-Clause" ]
null
null
null
src/caffe/test/test_roi_pooling_layer.cpp
imoisture/caffe
4d6892afeff234c57ce470056939101e0ae71369
[ "BSD-2-Clause" ]
null
null
null
src/caffe/test/test_roi_pooling_layer.cpp
imoisture/caffe
4d6892afeff234c57ce470056939101e0ae71369
[ "BSD-2-Clause" ]
null
null
null
/* All modification made by Cambricon Corporation: © 2018-2019 Cambricon Corporation All rights reserved. All other contributions: Copyright (c) 2014--2019, the respective contributors All rights reserved. For the list of contributors go to https://github.com/BVLC/caffe/blob/master/CONTRIBUTORS.md 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 Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 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 <assert.h> #include <algorithm> #include <cfloat> #include <cmath> #include <memory> #include <random> #include <string> #include <vector> #include "caffe/blob.hpp" #include "caffe/common.hpp" #include "caffe/filler.hpp" #include "caffe/layers/mlu_roi_pooling_layer.hpp" #include "caffe/layers/roi_pooling_layer.hpp" #include "caffe/test/test_caffe_main.hpp" #include "caffe/util/math_functions.hpp" #include "gtest/gtest.h" using std::max; using std::min; using std::floor; using std::ceil; namespace caffe { template <typename Dtype> void caffe_roipool(const Blob<Dtype>* in, const Blob<Dtype>* in2, ROIPoolingParameter* roi_pool_param, Blob<Dtype>* out, int mode_option) { int channels_ = in->channels(); int height_ = in->height(); int width_ = in->width(); CHECK_GT(roi_pool_param->pooled_h(), 0) << "pooled_h must be > 0"; CHECK_GT(roi_pool_param->pooled_w(), 0) << "pooled_w must be > 0"; int pooled_height_ = roi_pool_param->pooled_h(); int pooled_width_ = roi_pool_param->pooled_w(); float spatial_scale_ = roi_pool_param->spatial_scale(); const Dtype* bottom_data = in->cpu_data(); const Dtype* bottom_rois = in2->cpu_data(); // Number of ROIs int num_rois = in2->num(); int batch_size = in->num(); int top_count = out->count(); Dtype* top_data = out->mutable_cpu_data(); caffe_set(top_count, Dtype(0), top_data); // For each ROI R = [batch_index x1 y1 x2 y2]: max pool over R int roi_batch_ind; int roi_start_w; int roi_start_h; int roi_end_w; int roi_end_h; for (int n = 0; n < num_rois; ++n) { if (mode_option == 0) { roi_batch_ind = bottom_rois[0]; roi_start_w = round(bottom_rois[1] * spatial_scale_); roi_start_h = round(bottom_rois[2] * spatial_scale_); roi_end_w = round(bottom_rois[3] * spatial_scale_); roi_end_h = round(bottom_rois[4] * spatial_scale_); } else { roi_batch_ind = bottom_rois[4]; roi_start_w = round(bottom_rois[0] * spatial_scale_); roi_start_h = round(bottom_rois[1] * spatial_scale_); roi_end_w = round(bottom_rois[2] * spatial_scale_); roi_end_h = round(bottom_rois[3] * spatial_scale_); } CHECK_GE(roi_batch_ind, 0); CHECK_LT(roi_batch_ind, batch_size); int roi_height = max(roi_end_h - roi_start_h + 1, 1); int roi_width = max(roi_end_w - roi_start_w + 1, 1); const Dtype bin_size_h = static_cast<Dtype>(roi_height) / static_cast<Dtype>(pooled_height_); const Dtype bin_size_w = static_cast<Dtype>(roi_width) / static_cast<Dtype>(pooled_width_); const Dtype* batch_data = bottom_data + in->offset(roi_batch_ind); for (int c = 0; c < channels_; ++c) { for (int ph = 0; ph < pooled_height_; ++ph) { for (int pw = 0; pw < pooled_width_; ++pw) { // Compute pooling region for this output unit: // start (included) = floor(ph * roi_height / pooled_height_) // end (excluded) = ceil((ph + 1) * roi_height / pooled_height_) int hstart = static_cast<int>(floor(static_cast<Dtype>(ph) * bin_size_h)); int wstart = static_cast<int>(floor(static_cast<Dtype>(pw) * bin_size_w)); int hend = static_cast<int>(ceil(static_cast<Dtype>(ph + 1) * bin_size_h)); int wend = static_cast<int>(ceil(static_cast<Dtype>(pw + 1) * bin_size_w)); hstart = min(max(hstart + roi_start_h, 0), height_); hend = min(max(hend + roi_start_h, 0), height_); wstart = min(max(wstart + roi_start_w, 0), width_); wend = min(max(wend + roi_start_w, 0), width_); bool is_empty = (hend <= hstart) || (wend <= wstart); const int pool_index = ph * pooled_width_ + pw; if (is_empty) { top_data[pool_index] = 0; } for (int h = hstart; h < hend; ++h) { for (int w = wstart; w < wend; ++w) { const int index = h * width_ + w; if (batch_data[index] > top_data[pool_index]) { top_data[pool_index] = batch_data[index]; } } } } } // Increment all data pointers by one channel batch_data += in->offset(0, 1); top_data += out->offset(0, 1); } // Increment ROI data pointer bottom_rois += 5; } } void pad_uniform_distribution_data_roi_pooling(float* data, int count, int seed, float min, float max) { assert(data); std::mt19937 gen(seed); std::uniform_real_distribution<float> uniform(min, max); for (int i = 0; i < count; i++) { data[i] = uniform(gen); } } template <typename Dtype> void setInputData(Blob<Dtype>* bottom0, Blob<Dtype>* bottom1, int mode_option) { int num_rois = bottom1->count() / 5; int raw_count = bottom0->count(); float* data_raw = static_cast<float*>(malloc(raw_count * sizeof(float))); for (int i = 0; i < raw_count; i++) { data_raw[i] = i * 0.01; } float* cx = static_cast<float*>(malloc(num_rois * sizeof(float))); float* cy = static_cast<float*>(malloc(num_rois * sizeof(float))); float* w = static_cast<float*>(malloc(num_rois * sizeof(float))); float* h = static_cast<float*>(malloc(num_rois * sizeof(float))); float* idx = static_cast<float*>(malloc(num_rois * sizeof(float))); memset(idx, 0, num_rois * sizeof(float)); // NOLINT pad_uniform_distribution_data_roi_pooling(cx, num_rois, 1000, 5, 32); pad_uniform_distribution_data_roi_pooling(cy, num_rois, 1000, 5, 32); pad_uniform_distribution_data_roi_pooling(w, num_rois, 1000, 0, 10); pad_uniform_distribution_data_roi_pooling(h, num_rois, 1000, 0, 10); float* x1 = static_cast<float*>(malloc(num_rois * sizeof(float))); float* y1 = static_cast<float*>(malloc(num_rois * sizeof(float))); float* x2 = static_cast<float*>(malloc(num_rois * sizeof(float))); float* y2 = static_cast<float*>(malloc(num_rois * sizeof(float))); for (int i = 0; i < num_rois; i++) { x1[i] = cx[i] - w[i] / 2; x1[i] = std::min(x1[i], static_cast<float>(32)); y1[i] = cy[i] - h[i] / 2; y1[i] = std::min(y1[i], static_cast<float>(32)); x2[i] = cx[i] + w[i] / 2; x2[i] = std::min(x2[i], static_cast<float>(32)); y2[i] = cy[i] + h[i] / 2; y2[i] = std::min(y2[i], static_cast<float>(32)); } free(cx); free(cy); free(w); free(h); int unit_num = 5; if (mode_option == 0) { float* concat_data = static_cast<float*>(malloc(num_rois * unit_num * sizeof(float))); for (int i = 0; i < num_rois; i++) { concat_data[i * unit_num] = idx[i]; concat_data[i * unit_num + 1] = x1[i]; concat_data[i * unit_num + 2] = y1[i]; concat_data[i * unit_num + 3] = x2[i]; concat_data[i * unit_num + 4] = y2[i]; } for (int i = 0; i < bottom0->count(); i++) { bottom0->mutable_cpu_data()[i] = data_raw[i]; } for (int i = 0; i < bottom1->count(); i++) { bottom1->mutable_cpu_data()[i] = concat_data[i]; } } else { float* rois_conc_data = static_cast<float*>(malloc(num_rois * unit_num * sizeof(float))); for (int i = 0; i < num_rois; i++) { rois_conc_data[i * unit_num] = x1[i]; rois_conc_data[i * unit_num + 1] = y1[i]; rois_conc_data[i * unit_num + 2] = x2[i]; rois_conc_data[i * unit_num + 3] = y2[i]; rois_conc_data[i * unit_num + 4] = idx[i]; } for (int i = 0; i < bottom0->count(); i++) { bottom0->mutable_cpu_data()[i] = data_raw[i]; } for (int i = 0; i < bottom1->count(); i++) { bottom1->mutable_cpu_data()[i] = rois_conc_data[i]; } } free(x1); free(y1); free(x2); free(y2); free(idx); } template <typename TypeParam> class RoiPoolingLayerTest : public CPUDeviceTest<TypeParam> { typedef typename TypeParam::Dtype Dtype; protected: RoiPoolingLayerTest() : blob_bottom_(new Blob<Dtype>(1, 38, 20, 12)), blob_bottom2_(new Blob<Dtype>(1, 1, 1, 5)), blob_top_(new Blob<Dtype>()) {} virtual ~RoiPoolingLayerTest() { delete blob_bottom_; delete blob_bottom2_; delete blob_top_; } virtual void SetUp() { FillerParameter filler_param; GaussianFiller<Dtype> filler(filler_param); filler.Fill(this->blob_bottom_); filler.Fill(this->blob_bottom2_); blob_bottom_vec_.push_back(blob_bottom_); blob_bottom_vec_.push_back(blob_bottom2_); blob_top_vec_.push_back(blob_top_); } virtual Blob<Dtype>* MakeReferenceTop(Blob<Dtype>* top) { this->ref_blob_top_.reset(new Blob<Dtype>()); this->ref_blob_top_->ReshapeLike(*top); return this->ref_blob_top_.get(); } Blob<Dtype>* const blob_bottom_; Blob<Dtype>* const blob_bottom2_; Blob<Dtype>* const blob_top_; vector<Blob<Dtype>*> blob_bottom_vec_; vector<Blob<Dtype>*> blob_top_vec_; shared_ptr<Blob<Dtype>> ref_blob_top_; }; TYPED_TEST_CASE(RoiPoolingLayerTest, TestDtypesAndDevices); TYPED_TEST(RoiPoolingLayerTest, TestSetUp) { typedef typename TypeParam::Dtype Dtype; LayerParameter layer_param; ROIPoolingParameter* roi_pool_param = layer_param.mutable_roi_pooling_param(); roi_pool_param->set_pooled_h(3); roi_pool_param->set_pooled_w(3); roi_pool_param->set_spatial_scale(3); shared_ptr<ROIPoolingLayer<Dtype>> layer( new ROIPoolingLayer<Dtype>(layer_param)); layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_); } TYPED_TEST(RoiPoolingLayerTest, Forward) { typedef typename TypeParam::Dtype Dtype; setInputData(this->blob_bottom_, this->blob_bottom2_, 0); LayerParameter layer_param; ROIPoolingParameter* roi_pool_param = layer_param.mutable_roi_pooling_param(); roi_pool_param->set_pooled_h(3); roi_pool_param->set_pooled_w(3); roi_pool_param->set_spatial_scale(3); ROIPoolingLayer<Dtype> layer(layer_param); layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_); layer.Forward(this->blob_bottom_vec_, this->blob_top_vec_); const Dtype* top_data = this->blob_top_->cpu_data(); caffe_roipool(this->blob_bottom_, this->blob_bottom2_, roi_pool_param, this->MakeReferenceTop(this->blob_top_), 0); const Dtype* ref_top_data = this->ref_blob_top_->cpu_data(); const int count = this->blob_top_->count(); for (int i = 0; i < count; i++) { EXPECT_NEAR(top_data[i], ref_top_data[i], 5e-3); } } #ifdef USE_MLU template <typename TypeParam> class MLUBangRoiPoolingLayerTest : public MLUDeviceTest<TypeParam> { typedef typename TypeParam::Dtype Dtype; protected: MLUBangRoiPoolingLayerTest() : blob_bottom_(new Blob<Dtype>(1, 32, 80, 90)), blob_bottom2_(new Blob<Dtype>(1, 1, 1, 5)), blob_top_(new Blob<Dtype>()) {} virtual ~MLUBangRoiPoolingLayerTest() { delete blob_bottom_; delete blob_bottom2_; delete blob_top_; } virtual void SetUp() { FillerParameter filler_param; GaussianFiller<Dtype> filler(filler_param); filler.Fill(this->blob_bottom_); filler.Fill(this->blob_bottom2_); blob_bottom_vec_.push_back(blob_bottom_); blob_bottom_vec_.push_back(blob_bottom2_); blob_top_vec_.push_back(blob_top_); } virtual Blob<Dtype>* MakeReferenceTop(Blob<Dtype>* top) { this->ref_blob_top_.reset(new Blob<Dtype>()); this->ref_blob_top_->ReshapeLike(*top); return this->ref_blob_top_.get(); } Blob<Dtype>* const blob_bottom_; Blob<Dtype>* const blob_bottom2_; Blob<Dtype>* const blob_top_; vector<Blob<Dtype>*> blob_bottom_vec_; vector<Blob<Dtype>*> blob_top_vec_; shared_ptr<Blob<Dtype>> ref_blob_top_; }; TYPED_TEST_CASE(MLUBangRoiPoolingLayerTest, TestMLUDevices); TYPED_TEST(MLUBangRoiPoolingLayerTest, TestSetUpBangOp) { typedef typename TypeParam::Dtype Dtype; LayerParameter layer_param; ROIPoolingParameter* roi_pool_param = layer_param.mutable_roi_pooling_param(); roi_pool_param->set_pooled_h(3); roi_pool_param->set_pooled_w(3); roi_pool_param->set_spatial_scale(3); shared_ptr<MLUROIPoolingLayer<Dtype>> layer( new MLUROIPoolingLayer<Dtype>(layer_param)); layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_); OUTPUT("bottom1", this->blob_bottom_->shape_string().c_str()); } TYPED_TEST(MLUBangRoiPoolingLayerTest, ForwardBangOp) { typedef typename TypeParam::Dtype Dtype; setInputData(this->blob_bottom_, this->blob_bottom2_, 1); LayerParameter layer_param; ROIPoolingParameter* roi_pool_param = layer_param.mutable_roi_pooling_param(); roi_pool_param->set_pooled_h(3); roi_pool_param->set_pooled_w(3); roi_pool_param->set_spatial_scale(3); MLUROIPoolingLayer<Dtype> layer(layer_param); Caffe::setDetectOpMode(1); layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_); layer.Reshape_dispatch(this->blob_bottom_vec_, this->blob_top_vec_); layer.Forward(this->blob_bottom_vec_, this->blob_top_vec_); const Dtype* top_data = this->blob_top_->cpu_data(); caffe_roipool(this->blob_bottom_, this->blob_bottom2_, roi_pool_param, this->MakeReferenceTop(this->blob_top_), 1); const Dtype* ref_top_data = this->ref_blob_top_->cpu_data(); const int count = this->blob_top_->count(); float err_sum = 0, sum = 0; for (int i = 0; i < count; i++) { err_sum += std::abs(top_data[i] - ref_top_data[i]); sum += std::abs(ref_top_data[i]); } EXPECT_LT(err_sum/sum, 0.1); } template <typename TypeParam> class MFUSBangRoiPoolingLayerTest : public MFUSDeviceTest<TypeParam> { typedef typename TypeParam :: Dtype Dtype; protected: MFUSBangRoiPoolingLayerTest() : blob_bottom_(new Blob<Dtype>(1, 32, 80, 90)), blob_bottom2_(new Blob<Dtype>(1, 1, 1, 5)), blob_top_(new Blob<Dtype>()) {} virtual ~MFUSBangRoiPoolingLayerTest() { delete blob_bottom_; delete blob_bottom2_; delete blob_top_; } virtual void SetUp() { FillerParameter filler_param; GaussianFiller<Dtype> filler(filler_param); filler.Fill(this->blob_bottom_); filler.Fill(this->blob_bottom2_); blob_bottom_vec_.push_back(blob_bottom_); blob_bottom_vec_.push_back(blob_bottom2_); blob_top_vec_.push_back(blob_top_); } virtual Blob<Dtype>* MakeReferenceTop(Blob<Dtype>* top) { this->ref_blob_top_.reset(new Blob<Dtype>()); this->ref_blob_top_->ReshapeLike(*top); return this->ref_blob_top_.get(); } Blob<Dtype>* const blob_bottom_; Blob<Dtype>* const blob_bottom2_; Blob<Dtype>* const blob_top_; vector<Blob<Dtype>*> blob_bottom_vec_; vector<Blob<Dtype>*> blob_top_vec_; shared_ptr<Blob<Dtype> > ref_blob_top_; }; TYPED_TEST_CASE(MFUSBangRoiPoolingLayerTest, TestMFUSDevices); TYPED_TEST(MFUSBangRoiPoolingLayerTest, TestSetUp) { typedef typename TypeParam::Dtype Dtype; LayerParameter layer_param; ROIPoolingParameter* roi_pool_param = layer_param.mutable_roi_pooling_param(); roi_pool_param->set_pooled_h(3); roi_pool_param->set_pooled_w(3); roi_pool_param->set_spatial_scale(3); shared_ptr<MLUROIPoolingLayer<Dtype>> layer( new MLUROIPoolingLayer<Dtype>(layer_param)); layer->SetUp(this->blob_bottom_vec_, this->blob_top_vec_); } TYPED_TEST(MFUSBangRoiPoolingLayerTest, ForwardBang) { typedef typename TypeParam::Dtype Dtype; setInputData(this->blob_bottom_, this->blob_bottom2_, 1); LayerParameter layer_param; ROIPoolingParameter* roi_pool_param = layer_param.mutable_roi_pooling_param(); roi_pool_param->set_pooled_h(3); roi_pool_param->set_pooled_w(3); roi_pool_param->set_spatial_scale(3); MLUROIPoolingLayer<Dtype> layer(layer_param); Caffe::setDetectOpMode(1); layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_); ASSERT_TRUE(layer.mfus_supported()); MFusion<Dtype> fuser; fuser.reset(); fuser.addInputs(this->blob_bottom_vec_); fuser.addOutputs(this->blob_top_vec_); layer.Reshape_dispatch(this->blob_bottom_vec_, this->blob_top_vec_); layer.fuse(&fuser); fuser.compile(); fuser.forward(); const Dtype* top_data = this->blob_top_->cpu_data(); caffe_roipool(this->blob_bottom_, this->blob_bottom2_, roi_pool_param, this->MakeReferenceTop(this->blob_top_), 1); const Dtype* ref_top_data = this->ref_blob_top_->cpu_data(); const int count = this->blob_top_->count(); float err_sum = 0, sum = 0; for (int i = 0; i < count; i++) { EXPECT_NEAR(top_data[i], ref_top_data[i], 5e-3); err_sum += std::abs(top_data[i] - ref_top_data[i]); sum += std::abs(ref_top_data[i]); } EXPECT_LT(err_sum/sum, 0.1); } #endif } // namespace caffe
37.203666
92
0.69059
imoisture
f47e51df8e13e457bb26e3ddcc77739cfa3d0c54
195
cc
C++
tests/CompileTests/ElsaTestCases/d0091.cc
maurizioabba/rose
7597292cf14da292bdb9a4ef573001b6c5b9b6c0
[ "BSD-3-Clause" ]
488
2015-01-09T08:54:48.000Z
2022-03-30T07:15:46.000Z
tests/CompileTests/ElsaTestCases/d0091.cc
sujankh/rose-matlab
7435d4fa1941826c784ba97296c0ec55fa7d7c7e
[ "BSD-3-Clause" ]
174
2015-01-28T18:41:32.000Z
2022-03-31T16:51:05.000Z
tests/CompileTests/ElsaTestCases/d0091.cc
sujankh/rose-matlab
7435d4fa1941826c784ba97296c0ec55fa7d7c7e
[ "BSD-3-Clause" ]
146
2015-04-27T02:48:34.000Z
2022-03-04T07:32:53.000Z
// mysql-3.23.54a-11/sql_lex-D6bf.i // member operators are allowed to be static typedef unsigned int size_t; struct String { static void *operator new(size_t size) throw() { return 0; } };
21.666667
62
0.712821
maurizioabba
f47eaa9c3c7d9147e6cf84b23dbbcf03d35c3c84
3,576
cpp
C++
libs/assign/v2/test/chain.cpp
rogard/assign_v2
8735f57177dbee57514b4e80c498dd4b89f845e5
[ "BSL-1.0" ]
null
null
null
libs/assign/v2/test/chain.cpp
rogard/assign_v2
8735f57177dbee57514b4e80c498dd4b89f845e5
[ "BSL-1.0" ]
null
null
null
libs/assign/v2/test/chain.cpp
rogard/assign_v2
8735f57177dbee57514b4e80c498dd4b89f845e5
[ "BSL-1.0" ]
null
null
null
////////////////////////////////////////////////////////////////////////////// // Boost.Assign v2 // // // // Copyright (C) 2003-2004 Thorsten Ottosen // // Copyright (C) 2011 Erwann Rogard // // Use, modification and distribution are subject to the // // Boost Software License, Version 1.0. (See accompanying file // // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // ////////////////////////////////////////////////////////////////////////////// #include <iterator> #include <vector> #include <list> #include <string> #include <boost/assign/v2/include/ref/csv_array.hpp> #include <boost/assign/v2/include/csv_deque_basic.hpp> #include <boost/assign/v2/include/chain.hpp> #include <boost/assign/v2/chain/check.hpp> #include <boost/assign/v2/chain/operator.hpp> #include <boost/next_prior.hpp> #include <boost/range/algorithm/copy.hpp> #include <boost/range/algorithm/equal.hpp> #include <boost/range/algorithm_ext/iota.hpp> #include <boost/range/begin.hpp> #include <boost/range/end.hpp> #include <libs/assign/v2/test/chain.h> namespace test_assign_v2{ namespace xxx_chain{ // MSVC REMINDER : fully qualify boost::begin boost::end - error C2668 void test() { namespace as2 = boost::assign::v2; { namespace ns = as2::check_chain_aux; { typedef int T; ns::static_<T>(); ns::static_<T>(); } { typedef double T; ns::static_<T>(); ns::static_<T>(); } } // Non-Boost.Assign.v2 containers { //[test_chain1 typedef std::string T; std::vector<T> word; boost::copy( as2::csv_deque( "O", "R" ) | as2::_chain( as2::csv_deque( "B", "I", "T" ) ), std::back_inserter( word ) ); BOOST_ASSIGN_V2_CHECK( boost::range::equal( word, as2::csv_deque<T>( "O", "R", "B", "I", "T" ) ) ); //] } { //[test_chain2 typedef int T; boost::array<T, 3> head; std::list<T> tail( 2 ); boost::copy( as2::csv_deque( 1, 2, 3, 4, 5 ), boost::begin( head | as2::_chain( tail ) ) ); BOOST_ASSIGN_V2_CHECK( boost::range::equal( head, as2::csv_deque( 1, 2, 3 ) ) ); BOOST_ASSIGN_V2_CHECK( boost::range::equal( tail, as2::csv_deque( 4, 5 ) ) ); //] } // Boost.Assign.v2 containers { //[test_chain3 std::vector<int> source( 8 ); boost::iota(source, 1); boost::array<int, 4> head; int t, a, i, l; /*<<Brings `&&` to scope>>*/using namespace boost::assign::v2; boost::copy( source, boost::begin( head && (/*<< rvalue! >>*/ as2::ref::csv_array( t, a, i, l ) | as2::ref::_get ) ) ); BOOST_ASSIGN_V2_CHECK( boost::range::equal( head, as2::csv_deque( 1, 2, 3, 4 ) ) ); BOOST_ASSIGN_V2_CHECK( t == 5 ); BOOST_ASSIGN_V2_CHECK( a == 6 ); BOOST_ASSIGN_V2_CHECK( i == 7 ); BOOST_ASSIGN_V2_CHECK( l == 8 ); //] } }// test }// xxx_chain }// test_assign_v2
35.058824
99
0.465324
rogard
f47f3d6e6f3279ce2ce8bb88189f181f14746d16
2,113
cpp
C++
trajectory/designer/generator.cpp
nio1814/3Dcones
704b78a0d73b25ab59269e60babbd13876f8563e
[ "BSD-3-Clause" ]
4
2019-09-10T13:46:41.000Z
2022-03-21T20:19:23.000Z
trajectory/designer/generator.cpp
nio1814/3Dcones
704b78a0d73b25ab59269e60babbd13876f8563e
[ "BSD-3-Clause" ]
1
2017-05-17T07:05:00.000Z
2017-05-17T07:05:38.000Z
trajectory/designer/generator.cpp
nio1814/3Dcones
704b78a0d73b25ab59269e60babbd13876f8563e
[ "BSD-3-Clause" ]
2
2020-04-12T09:39:29.000Z
2022-03-21T20:19:25.000Z
#include "generator.h" extern "C" { #include "spiral.h" #include "radial.h" #include "cones.h" #include "variabledensity.h" } Generator::Generator(QObject *parent) : QObject(parent) { } void Generator::setTrajectory(TrajectoryType type) { bool changed = m_trajectoryType != type; m_trajectoryType = type; TrajectoryGenerator::setTrajectoryType(type); if(changed && m_autoUpdate) update(); } void Generator::setFieldOfView(float fieldOfView, int axis) { bool changed = m_fieldOfView[axis] != fieldOfView; m_fieldOfView[axis] = fieldOfView; if(changed && m_autoUpdate) update(); } QVector<float> Generator::fieldOfView() { QVector<float> fov(3); memcpy(fov.data(), m_fieldOfView, 3*sizeof(float)); return fov; } void Generator::setSpatialResolution(float spatialResolution, int axis) { bool changed = m_spatialResolution[axis] != spatialResolution; m_spatialResolution[axis] = spatialResolution; if(changed && m_autoUpdate) update(); } QVector<float> Generator::spatialResolution() { QVector<float> res(3); memcpy(res.data(), m_spatialResolution, 3*sizeof(float)); return res; } void Generator::setReadoutDuration(float readoutDuration) { bool changed = m_readoutDuration != readoutDuration; m_readoutDuration = readoutDuration; if(changed && m_autoUpdate) update(); } void Generator::setAutoUpdate(bool status) { m_autoUpdate = status; } bool Generator::autoUpdate() { return m_autoUpdate; } void Generator::setVariableDensity(bool status) { if(status) { if(!m_variableDensity) { m_variableDensity = newVariableDensity(); setToFullySampled(m_variableDensity); } } else deleteVariableDensity(&m_variableDensity); } VariableDensity *Generator::variableDensity() { return m_variableDensity; } void Generator::update() { int previousReadouts = m_trajectory ? m_trajectory->numReadouts : 0; generate(); emit updated(m_trajectory); if(previousReadouts!=m_trajectory->numReadouts) emit readoutsChanged(m_trajectory->numReadouts); }
19.385321
72
0.708471
nio1814
f480b2588ac6aaea63bfb023173718530adc59ec
6,976
cpp
C++
PDFWriterTestPlayground/TestsRunner.cpp
thmclellan/PDF-Writer
9d31d12ce12e586b4f7f748e17029a10ccc2c176
[ "Apache-2.0" ]
620
2015-02-10T16:38:47.000Z
2022-03-30T11:06:17.000Z
PDFWriterTestPlayground/TestsRunner.cpp
thmclellan/PDF-Writer
9d31d12ce12e586b4f7f748e17029a10ccc2c176
[ "Apache-2.0" ]
124
2015-01-14T20:50:29.000Z
2021-12-08T09:51:01.000Z
PDFWriterTestPlayground/TestsRunner.cpp
thmclellan/PDF-Writer
9d31d12ce12e586b4f7f748e17029a10ccc2c176
[ "Apache-2.0" ]
185
2015-04-16T11:09:39.000Z
2022-03-07T03:25:15.000Z
/* Source File : TestsRunner.cpp Copyright 2011 Gal Kahana PDFWriter 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 "TestsRunner.h" #include <iostream> using namespace std; using namespace PDFHummus; TestsRunner::TestsRunner(void) { } TestsRunner::~TestsRunner(void) { DeleteTests(); } void TestsRunner::DeleteTests() { StringToStringAndTestUnitListMap::iterator it = mTests.begin(); for(;it!= mTests.end();++it) { StringAndTestUnitList::iterator itList = it->second.begin(); for(; itList != it->second.end();++itList) delete(itList->second); } mTests.clear(); } EStatusCode TestsRunner::RunAll(const TestConfiguration& inTestConfiguration) { StringAndTestUnitList testsList; StringToTestUnitMap::iterator it = mTestsByName.begin(); for(;it != mTestsByName.end();++it) testsList.push_back(StringAndTestUnit(it->first,it->second)); return RunTestsInList(inTestConfiguration,testsList); } EStatusCode TestsRunner::RunTestsInList(const TestConfiguration& inTestConfiguration,const StringAndTestUnitList& inTests) { EStatusCode testsStatus; if(inTests.size() == 0) { cout<<"No tests to run\n"; testsStatus = PDFHummus::eSuccess; } else if(inTests.size() == 1) { testsStatus = RunSingleTest(inTestConfiguration,inTests.front().first,inTests.front().second); } else { unsigned long failedCount = 0,succeededCount = 0; StringAndTestUnitList::const_iterator it = inTests.begin(); EStatusCode testStatus; testsStatus = PDFHummus::eSuccess; cout<<"Start tests run\n"; for(;it!= inTests.end();++it) { testStatus = RunSingleTest(inTestConfiguration,it->first,it->second); if(PDFHummus::eFailure == testStatus) { ++failedCount; testsStatus = PDFHummus::eFailure; } else { ++succeededCount; } } cout<<"--------------------------------------------------------------\n"; cout<<"Test run ended: "<<succeededCount<<" tests succeeded, "<<failedCount<<" tests failed.\n"; } return testsStatus; } EStatusCode TestsRunner::RunSingleTest(const TestConfiguration& inTestConfiguration,const string& inTestName,ITestUnit* inTest) { EStatusCode testStatus; cout<<"Running Test "<<inTestName<<"\n"; testStatus = inTest->Run(inTestConfiguration); if(PDFHummus::eFailure == testStatus) cout<<"Test "<<inTestName<<" Failed\n\n"; else cout<<"Test "<<inTestName<<" Succeeded\n\n"; return testStatus; } void TestsRunner::AddTest(const std::string& inTestLabel,const std::string& inCategory,ITestUnit* inTest) { StringToStringAndTestUnitListMap::iterator it = mTests.find(inCategory); if(it == mTests.end()) it = mTests.insert(StringToStringAndTestUnitListMap::value_type(inCategory,StringAndTestUnitList())).first; it->second.push_back(StringAndTestUnit(inTestLabel,inTest)); mTestsByName.insert(StringToTestUnitMap::value_type(inTestLabel,inTest)); } static const string scGeneral= "General"; void TestsRunner::AddTest(const string& inTestLabel,ITestUnit* inTest) { AddTest(inTestLabel,scGeneral,inTest); } EStatusCode TestsRunner::RunTest(const TestConfiguration& inTestConfiguration,const string& inTestLabel) { StringToTestUnitMap::iterator it = mTestsByName.find(inTestLabel); if(it == mTestsByName.end()) { cout<<"Test not found\n"; return PDFHummus::eSuccess; } else return RunSingleTest(inTestConfiguration,it->first,it->second); } EStatusCode TestsRunner::RunTests(const TestConfiguration& inTestConfiguration,const StringList& inTestsLabels) { StringAndTestUnitList testsList; StringList::const_iterator it = inTestsLabels.begin(); for(; it != inTestsLabels.end(); ++it) { StringToTestUnitMap::iterator itMap = mTestsByName.find(*it); if(itMap != mTestsByName.end()) testsList.push_back(StringAndTestUnit(itMap->first,itMap->second)); else cout<<"Test "<<*it<<" not found\n"; } return RunTestsInList(inTestConfiguration,testsList); } EStatusCode TestsRunner::RunCategory(const TestConfiguration& inTestConfiguration,const string& inCategory) { StringToStringAndTestUnitListMap::iterator it = mTests.find(inCategory); if(it == mTests.end()) { cout<<"Category "<<inCategory<<"not found\n"; return PDFHummus::eSuccess; } else return RunTestsInList(inTestConfiguration,it->second); } EStatusCode TestsRunner::RunCategories(const TestConfiguration& inTestConfiguration,const StringList& inCategories) { StringAndTestUnitList testsList; StringList::const_iterator it = inCategories.begin(); for(; it != inCategories.end(); ++it) { StringToStringAndTestUnitListMap::iterator itMap = mTests.find(*it); if(itMap != mTests.end()) testsList.insert(testsList.end(),itMap->second.begin(),itMap->second.end()); else cout<<"Category "<<*it<<" not found\n"; } return RunTestsInList(inTestConfiguration,testsList); } EStatusCode TestsRunner::RunCategories(const TestConfiguration& inTestConfiguration,const StringList& inCategories, const StringSet& inTestsToExclude) { StringAndTestUnitList testsList; StringList::const_iterator it = inCategories.begin(); for(; it != inCategories.end(); ++it) { StringToStringAndTestUnitListMap::iterator itMap = mTests.find(*it); if(itMap != mTests.end()) { StringAndTestUnitList::iterator itCategoryTests = itMap->second.begin(); for(;itCategoryTests != itMap->second.end();++itCategoryTests) if(inTestsToExclude.find(itCategoryTests->first) == inTestsToExclude.end()) testsList.push_back(StringAndTestUnit(itCategoryTests->first,itCategoryTests->second)); } else cout<<"Category "<<*it<<" not found\n"; } return RunTestsInList(inTestConfiguration,testsList); } EStatusCode TestsRunner::RunExcludeCategories(const TestConfiguration& inTestConfiguration,const StringSet& inCategories) { StringAndTestUnitList testsList; StringToStringAndTestUnitListMap::iterator it = mTests.begin(); for(; it != mTests.end(); ++it) if(inCategories.find(it->first) == inCategories.end()) testsList.insert(testsList.end(),it->second.begin(),it->second.end()); return RunTestsInList(inTestConfiguration,testsList); } EStatusCode TestsRunner::RunExcludeTests(const TestConfiguration& inTestConfiguration,const StringSet& inTests) { StringAndTestUnitList testsList; StringToTestUnitMap::iterator it = mTestsByName.begin(); for(; it != mTestsByName.end();++it) if(inTests.find(it->first) == inTests.end()) testsList.push_back(StringAndTestUnit(it->first,it->second)); return RunTestsInList(inTestConfiguration,testsList); }
30.462882
150
0.743836
thmclellan
f481619b9d3faf9bb1c0053840c7fa61c16127e8
1,093
hpp
C++
ch13/icstring.hpp
bashell/CppStandardLibrary
2aae03019288132c911036aeb9ba36edc56e510b
[ "MIT" ]
null
null
null
ch13/icstring.hpp
bashell/CppStandardLibrary
2aae03019288132c911036aeb9ba36edc56e510b
[ "MIT" ]
null
null
null
ch13/icstring.hpp
bashell/CppStandardLibrary
2aae03019288132c911036aeb9ba36edc56e510b
[ "MIT" ]
null
null
null
#ifndef ICSTRING_HPP #define ICSTRING_HPP #include <iostream> #include <string> #include <cctype> struct ignorecase_traits : public std::char_traits<char> { static bool eq(const char &c1, const char &c2) { return std::toupper(c1) == std::toupper(c2); } static bool lt(const char &c1, const char &c2) { return std::toupper(c1) < std::toupper(c2); } static int compare(const char *s1, const char *s2, std::size_t n) { for(std::size_t i = 0; i < n; ++i) { if(!eq(s1[i], s2[i])) { return lt(s1[i], s2[i]) ? -1 : 1; } } return 0; } static const char *find(const char *s, std::size_t n, const char &c) { for(std::size_t i = 0; i < n; ++i) { if(eq(s[i], c)) { return &(s[i]); } } return 0; } }; typedef std::basic_string<char, ignorecase_traits> icstring; inline std::ostream& operator<<(std::ostream &strm, const icstring &s) { return strm << std::string(s.data(), s.length()); } #endif /* ICSTRING_HPP */
25.418605
74
0.538884
bashell
f484784ac30e6c06835dcc3e07c9b1834d8050ad
14,518
cpp
C++
source/NFmiOracle.cpp
fmidev/fmidb
ad592611f81603db0a87cf2795444b4d96a11088
[ "MIT" ]
null
null
null
source/NFmiOracle.cpp
fmidev/fmidb
ad592611f81603db0a87cf2795444b4d96a11088
[ "MIT" ]
null
null
null
source/NFmiOracle.cpp
fmidev/fmidb
ad592611f81603db0a87cf2795444b4d96a11088
[ "MIT" ]
1
2019-05-29T04:11:11.000Z
2019-05-29T04:11:11.000Z
#include "NFmiOracle.h" #include <algorithm> #include <iomanip> #include <assert.h> using namespace std; /* * class NFmiOracle * * OTL does not read Oracle environment variables (NLS_DATE_FORMAT etc) * --> if special data formats are needed those queries should have * explicit to_char() calls. By default dates are formatted to NEONS * time (YYYYMMDDHH24MI). * * c++ does not have native string-compliant NULL value, replace NULL with * empty string. * */ NFmiOracle& NFmiOracle::Instance() { static NFmiOracle instance_; return instance_; } NFmiOracle::NFmiOracle() : test_mode_(false), verbose_(false), initialized_(false), pooled_connection_(false), credentials_set_(false){}; void NFmiOracle::Connect(const string& user, const string& password, const string& database, const int threadedMode) { if (connected_) return; oracle::otl_connect::otl_initialize(threadedMode); // initialize OCI environment connection_string_ = user + "/" + password + "@" + database; try { db_.rlogon(connection_string_.c_str(), 0); connected_ = true; FMIDEBUG(cout << "DEBUG: connected to Oracle " << database << " as user " << user << endl); } catch (oracle::otl_exception& p) { cerr << "Unable to connect to Oracle with DSN " << user << "/*@" << database << endl; cerr << p.msg << endl; // print out error message exit(1); } } void NFmiOracle::Connect() { return Connect(0); } void NFmiOracle::Connect(const int threadedMode) { if (connected_) return; oracle::otl_connect::otl_initialize(threadedMode); // initialize OCI environment connection_string_ = user_ + "/" + password_ + "@" + database_; try { db_.rlogon(connection_string_.c_str(), 0); // connect to NFmiOracle connected_ = true; FMIDEBUG(cout << "DEBUG: connected to Oracle " << database_ << " as user " << user_ << endl); DateFormat("YYYYMMDDHH24MISS"); } catch (oracle::otl_exception& p) { cerr << "Unable to connect to Oracle with DSN " << user_ << "/*@" << database_ << endl; cerr << p.msg << endl; // print out error message exit(1); } } void NFmiOracle::Query(const string& sql) { return Query(sql, 50); } void NFmiOracle::Query(const string& sql, const unsigned int buffer_size) { if (!connected_) throw runtime_error("ERROR: must be connected before executing query"); BeginSession(); if (TestMode()) return; FMIDEBUG(cout << "DEBUG: " << sql.c_str() << endl); try { if (stream_.good() || stream_.eof()) { // Stream is open but a new query needs to executed OR // stream is at eof rs_iterator_.detach(); stream_.close(); } stream_.open(buffer_size, sql.c_str(), db_); rs_iterator_.attach(stream_); } catch (oracle::otl_exception& p) { if (verbose_) { cerr << p.msg; cerr << "Query: " << p.stm_text << endl; } throw p.code; } } /* * FetchRow() * * Fetch a single row from stream iterator, cast all elements to * string and return to calling function a vector. * */ vector<string> NFmiOracle::FetchRow() { if (!connected_) throw runtime_error("Cannot perform SQL query before connected"); assert(stream_.good()); vector<string> ret; if (!rs_iterator_.next_row()) { rs_iterator_.detach(); stream_.flush(); stream_.close(); return ret; } int desc_len; otl_column_desc* desc = stream_.describe_select(desc_len); otl_datetime tval; string sval; long int ival = 0; double dval = 0.0; const int long_max_size = 70000; otl_long_string long_raw(long_max_size); db_.set_max_long_size(long_max_size); ostringstream strs; for (int n = 0; n < desc_len; ++n) { // Short-circuit logic when value is null if (rs_iterator_.is_null(n + 1)) { ret.push_back(""); continue; } switch (desc[n].otl_var_dbtype) { case 1: // varchar rs_iterator_.get(n + 1, sval); ret.push_back(sval); break; case 4: case 5: case 6: case 20: // different sized integers rs_iterator_.get(n + 1, ival); sval = to_string(ival); ret.push_back(sval); break; case 2: case 3: // double and float // problem is that Oracle NUMBER can be int // or float or double rs_iterator_.get(n + 1, dval); ival = static_cast<long>(dval); if (ival == dval) { // int ret.push_back(to_string(ival)); } else { // Use ostringstream -- boost lexical cast does damage to // doubles -- 30.1033 is suddenly 30.103300000000001 ostringstream strs; strs << dval; sval = strs.str(); ret.push_back(sval); } break; case 8: // timestamp // Force format of timestamp to NEONS time rs_iterator_.get(n + 1, tval); ret.push_back(MakeDate(tval)); break; case 10: /* * Oracle LONG RAW (binary data) * * Long raw comes as unsigned char from OTL -- format that to a hex string * and pass on to the calling function. * Truly an inefficient method to retrieve binary data from database, but we * should cope for now. Must be optimized later on. * */ rs_iterator_.get(n + 1, long_raw); // Make a two "digit" hex from each char for (int i = 0; i < long_raw.len(); i++) strs << setw(2) << setfill('0') << hex << static_cast<int>(long_raw[i]); sval = strs.str(); ret.push_back(sval); break; default: cerr << "OTL: Got unhandled data type: " << desc[n].otl_var_dbtype << endl; break; } } return ret; } /* * FetchRowFromCursor() * * Fetch a single row from refcursor iterator, cast all elements to * string and return to calling function a vector. * */ vector<string> NFmiOracle::FetchRowFromCursor() { if (!connected_) throw runtime_error("NFmiOracle: Cannot perform SQL query before connected"); assert(stream_.good()); assert(refcur_.good()); vector<string> ret; if (!rc_iterator_.next_row()) { rc_iterator_.detach(); refcur_.close(); stream_.close(); return ret; } int desc_len; otl_column_desc* desc = refcur_.describe_select(desc_len); otl_datetime tval; string sval; long int ival = 0; double dval = 0.0; const int long_max_size = 70000; otl_long_string long_raw(long_max_size); db_.set_max_long_size(long_max_size); ostringstream strs; for (int n = 0; n < desc_len; ++n) { // Short-circuit logic when value is null if (rc_iterator_.is_null(n + 1)) { ret.push_back(""); continue; } switch (desc[n].otl_var_dbtype) { case 1: // varchar rc_iterator_.get(n + 1, sval); ret.push_back(sval); break; case 4: case 5: case 6: case 20: // different sized integers rc_iterator_.get(n + 1, ival); sval = to_string(ival); ret.push_back(sval); break; case 2: case 3: // double and float // problem is that Oracle NUMBER can be int // or float or double rc_iterator_.get(n + 1, dval); ival = static_cast<long>(dval); if (ival == dval) { // int ret.push_back(to_string(ival)); } else { // Use ostringstream -- boost lexical cast does damage to // doubles -- 30.1033 is suddenly 30.103300000000001 ostringstream strs; strs << dval; sval = strs.str(); ret.push_back(sval); } break; case 8: // timestamp // Force format of timestamp to NEONS time rc_iterator_.get(n + 1, tval); ret.push_back(MakeDate(tval)); break; case 10: /* * Oracle LONG RAW (binary data) * * Long raw comes as unsigned char from OTL -- format that to a hex string * and pass on to the calling function. * Truly an inefficient method to retrieve binary data from database, but we * should cope for now. Must be optimized later on. * */ rc_iterator_.get(n + 1, long_raw); // Make a two "digit" hex from each char for (int i = 0; i < long_raw.len(); i++) strs << setw(2) << setfill('0') << hex << static_cast<int>(long_raw[i]); sval = strs.str(); ret.push_back(sval); break; default: cerr << "OTL: Got unhandled data type: " << desc[n].otl_var_dbtype << endl; break; } } return ret; } /* * Execute(string) * * Executes an SQL DML command. * */ void NFmiOracle::Execute(const string& sql) { if (!connected_) { cerr << "ERROR: must be connected before executing query" << endl; exit(1); } BeginSession(); FMIDEBUG(cout << "DEBUG: " << sql.c_str() << endl); try { oracle::otl_cursor::direct_exec(db_, sql.c_str(), oracle::otl_exception::enabled); } catch (oracle::otl_exception& p) { if (verbose_) { cerr << p.msg; cerr << "Query: " << p.stm_text << endl; } // re-throw error code throw p.code; } } /* * ExecuteProcedure(string) * * Function to execute NFmiOracle pl/sql packages (procedures). * */ void NFmiOracle::ExecuteProcedure(const string& sql) { if (!connected_) { cerr << "ERROR: must be connected before executing query" << endl; exit(1); } BeginSession(); if (TestMode()) return; string temp_sql = "BEGIN\n:cur<refcur,out> := " + sql + ";\nEND;"; FMIDEBUG(cout << "DEBUG: " << temp_sql.c_str() << endl); try { if (stream_.good()) { // Stream is open but a new query needs to executed rc_iterator_.detach(); stream_.close(); } stream_.set_commit(0); stream_.open(1, temp_sql.c_str(), db_); stream_ >> refcur_; rc_iterator_.attach(refcur_); } catch (oracle::otl_exception& p) { if (verbose_) { cerr << p.msg; cerr << "Query: " << p.stm_text << endl; } throw p.code; } } NFmiOracle::~NFmiOracle() { Disconnect(); } void NFmiOracle::Disconnect() { db_.logoff(); // disconnect from NFmiOracle connected_ = false; initialized_ = false; } /* * MakeStandardDate() * * Format an OTL datetime to string format. */ string NFmiOracle::MakeDate(const otl_datetime& time) { char date[date_mask_.size() + 1]; snprintf(date, date_mask_.size() + 1, date_mask_.c_str(), time.year, time.month, time.day, time.hour, time.minute, time.second); return static_cast<string>(date); } /* * Commit() * * Commit transaction. */ void NFmiOracle::Commit() { FMIDEBUG(cout << "DEBUG: COMMIT" << endl); try { db_.commit(); } catch (oracle::otl_exception& p) { // Always print error if commit fails cerr << p.msg << endl; throw p.code; } } /* * Rollback() * * Rollback transaction. */ void NFmiOracle::Rollback() { FMIDEBUG(cout << "DEBUG: ROLLBACK" << endl); try { // db_.cancel(); if (stream_.good()) { rs_iterator_.detach(); stream_.close(); } db_.rollback(); } catch (oracle::otl_exception& p) { // Always print error if rollback fails (it should be impossible though) cerr << p.msg; throw p.code; } } void NFmiOracle::TransactionIsolationLevel(const std::string& level) { /* * This is supposed to be supported by OTL ?! if (level == "READ UNCOMMITTED") db_.set_transaction_isolation_level(otl_tran_read_uncommitted); else if (level == "READ COMMITTED") db_.set_transaction_isolation_level(otl_tran_read_committed); else if (level == "REPEATABLE READ") db_.set_transaction_isolation_level(otl_tran_repeatable_read); else if (level == "SERIALIZABLE") db_.set_transaction_isolation_level(otl_tran_read_uncommitted); else if (level == "READ ONLY") Execute("SET TRANSACTION TO READ ONLY"); else throw runtime_error("Invalid isolation level: " + level); */ } void NFmiOracle::Attach() { if (connected_) return; oracle::otl_connect::otl_initialize(1); // initialize OCI environment // connection_string_ = user_+"/"+password_+"@"+database_; try { db_.server_attach(database_.c_str()); connected_ = true; FMIDEBUG(cout << "DEBUG: attached to Oracle " << database_ << endl); } catch (oracle::otl_exception& p) { cerr << "Unable to attach to Oracle " << database_ << endl; cerr << p.msg << endl; // print out error message throw p.code; // exit(1); } } void NFmiOracle::Detach() { if (!connected_) return; try { db_.server_detach(); connected_ = false; FMIDEBUG(cout << "DEBUG: detached from Oracle " << database_ << endl); } catch (oracle::otl_exception& p) { cerr << "Unable to detach from Oracle " << database_ << endl; cerr << p.msg << endl; // print out error message throw p.code; // exit(1); } } void NFmiOracle::BeginSession() { if (!connected_) throw runtime_error("Cannot begin session before connected"); if (initialized_ || !pooled_connection_) { return; } try { if (credentials_set_) { db_.session_reopen(); } else { db_.session_begin(user_.c_str(), password_.c_str()); } FMIDEBUG(cout << "DEBUG: session started as " << user_ << "/***" << endl); initialized_ = true; credentials_set_ = true; if (!date_mask_sql_.empty()) { DateFormat("YYYYMMDDHH24MISS"); } } catch (oracle::otl_exception& p) { switch (p.code) { case 3135: cerr << "Got ORA-03135: connection lost contact, reconnecting ...\n"; Detach(); Attach(); // Should we have a counter here? This might turn into an eternal loop ... BeginSession(); break; default: cerr << "Unable to begin session as user " << user_ << endl; cerr << p.msg << endl; // print out error message throw(p.code); break; } } } void NFmiOracle::EndSession() { if (!connected_) throw runtime_error("Cannot end session if not connected"); if (!initialized_) { return; } try { db_.session_end(); initialized_ = false; FMIDEBUG(cout << "DEBUG: session ended" << endl); } catch (oracle::otl_exception& p) { cerr << "Unable to end session" << endl; cerr << p.msg << endl; // print out error message throw p.code; // exit(1); } } void NFmiOracle::DateFormat(const string& dateFormat) { Execute("ALTER SESSION SET NLS_DATE_FORMAT = '" + dateFormat + "'"); // set date mask; only two common cases supported for now string tempFormat = dateFormat; // input being const transform(tempFormat.begin(), tempFormat.end(), tempFormat.begin(), ::toupper); if (tempFormat == "YYYYMMDDHH24MISS") date_mask_ = "%4d%02d%02d%02d%02d"; // Note: seconds missing else if (tempFormat == "YYYY-MM-DD HH24:MI:SS") date_mask_ = "%4d-%02d-%02d %02d:%02d:%02d"; else throw runtime_error("Invalid date mask: " + dateFormat); } void NFmiOracle::PooledConnection(bool pooled_connection) { pooled_connection_ = pooled_connection; } bool NFmiOracle::PooledConnection() const { return pooled_connection_; }
20.080221
116
0.642857
fmidev
f48696bca49c2e0233eabbac093b4b5c4482367b
204
cpp
C++
sources/ECS/Components/ModelMatrixComponent.cpp
Gilqamesh/GameEngineDemo
796bb107df5c01b875c2ae73fcfd44e7c07e3a87
[ "MIT" ]
null
null
null
sources/ECS/Components/ModelMatrixComponent.cpp
Gilqamesh/GameEngineDemo
796bb107df5c01b875c2ae73fcfd44e7c07e3a87
[ "MIT" ]
null
null
null
sources/ECS/Components/ModelMatrixComponent.cpp
Gilqamesh/GameEngineDemo
796bb107df5c01b875c2ae73fcfd44e7c07e3a87
[ "MIT" ]
null
null
null
#include "ECS/Components/ModelMatrixComponent.hpp" namespace NAMESPACE { std::ostream &operator<<(std::ostream &os, const ModelMatrixComponent &a) { TRACE(); os << a.m; return (os); } }
14.571429
73
0.656863
Gilqamesh
f48d81346371534d88557f8527e7c566e7ac2ee2
5,879
cpp
C++
src/ftxui/component/screen_interactive.cpp
dendisuhubdy/FTXUI
1e35687d64eb190dd6cc782ef44d5e8551928ab2
[ "MIT" ]
1
2020-03-03T15:34:49.000Z
2020-03-03T15:34:49.000Z
src/ftxui/component/screen_interactive.cpp
dendisuhubdy/FTXUI
1e35687d64eb190dd6cc782ef44d5e8551928ab2
[ "MIT" ]
null
null
null
src/ftxui/component/screen_interactive.cpp
dendisuhubdy/FTXUI
1e35687d64eb190dd6cc782ef44d5e8551928ab2
[ "MIT" ]
null
null
null
#include "ftxui/component/screen_interactive.hpp" #include <stdio.h> #include <termios.h> #include <unistd.h> #include <csignal> #include <iostream> #include <stack> #include <thread> #include "ftxui/component/component.hpp" #include "ftxui/screen/string.hpp" #include "ftxui/screen/terminal.hpp" #if defined(__clang__) && defined (__APPLE__) // Quick exit is missing in standard CLang headers #define quick_exit(a) exit(a) #endif namespace ftxui { static const char* HIDE_CURSOR = "\x1B[?25l"; static const char* SHOW_CURSOR = "\x1B[?25h"; static const char* DISABLE_LINE_WRAP = "\x1B[7l"; static const char* ENABLE_LINE_WRAP = "\x1B[7h"; std::stack<std::function<void()>> on_exit_functions; void OnExit(int signal) { while (!on_exit_functions.empty()) { on_exit_functions.top()(); on_exit_functions.pop(); } if (signal == SIGINT) quick_exit(SIGINT); } std::function<void()> on_resize = []{}; void OnResize(int /* signal */) { on_resize(); } ScreenInteractive::ScreenInteractive(int dimx, int dimy, Dimension dimension) : Screen(dimx, dimy), dimension_(dimension) {} ScreenInteractive::~ScreenInteractive() {} // static ScreenInteractive ScreenInteractive::FixedSize(int dimx, int dimy) { return ScreenInteractive(dimx, dimy, Dimension::Fixed); } // static ScreenInteractive ScreenInteractive::Fullscreen() { return ScreenInteractive(0, 0, Dimension::Fullscreen); } // static ScreenInteractive ScreenInteractive::TerminalOutput() { return ScreenInteractive(0, 0, Dimension::TerminalOutput); } // static ScreenInteractive ScreenInteractive::FitComponent() { return ScreenInteractive(0, 0, Dimension::FitComponent); } void ScreenInteractive::PostEvent(Event event) { std::unique_lock<std::mutex> lock(events_queue_mutex); events_queue.push(event); events_queue_cv.notify_one(); } void ScreenInteractive::EventLoop(Component* component) { std::unique_lock<std::mutex> lock(events_queue_mutex); while (!quit_ && events_queue.empty()) events_queue_cv.wait(lock); // After the wait, we own the lock. while (!events_queue.empty()) { component->OnEvent(events_queue.front()); events_queue.pop(); } } void ScreenInteractive::Loop(Component* component) { // Install a SIGINT handler and restore the old handler on exit. auto old_sigint_handler = std::signal(SIGINT, OnExit); on_exit_functions.push( [old_sigint_handler]() { std::signal(SIGINT, old_sigint_handler); }); // Save the old terminal configuration and restore it on exit. struct termios terminal_configuration_old; tcgetattr(STDIN_FILENO, &terminal_configuration_old); on_exit_functions.push( [terminal_configuration_old = terminal_configuration_old]() { tcsetattr(STDIN_FILENO, TCSANOW, &terminal_configuration_old); }); // Set the new terminal configuration struct termios terminal_configuration_new; terminal_configuration_new = terminal_configuration_old; // Non canonique terminal. terminal_configuration_new.c_lflag &= ~ICANON; // Do not print after a key press. terminal_configuration_new.c_lflag &= ~ECHO; tcsetattr(STDIN_FILENO, TCSANOW, &terminal_configuration_new); // Hide the cursor and show it at exit. std::cout << HIDE_CURSOR; std::cout << DISABLE_LINE_WRAP; std::cout << std::flush; on_exit_functions.push([&] { std::cout << reset_cursor_position; std::cout << SHOW_CURSOR; std::cout << ENABLE_LINE_WRAP; std::cout << std::endl; }); // Handle resize. on_resize = [&] { PostEvent(Event::Special({0})); }; auto old_sigwinch_handler = std::signal(SIGWINCH, OnResize); on_exit_functions.push([&] { std::signal(SIGWINCH, old_sigwinch_handler); }); std::thread read_char([this] { while (!quit_) { auto event = Event::GetEvent([] { return (char)getchar(); }); PostEvent(std::move(event)); } }); while (!quit_) { std::cout << reset_cursor_position << ResetPosition(); Draw(component); std::cout << ToString() << set_cursor_position << std::flush; Clear(); EventLoop(component); } read_char.join(); OnExit(0); } void ScreenInteractive::Draw(Component* component) { auto document = component->Render(); int dimx = 0; int dimy = 0; switch (dimension_) { case Dimension::Fixed: dimx = dimx_; dimy = dimy_; break; case Dimension::TerminalOutput: document->ComputeRequirement(); dimx = Terminal::Size().dimx; dimy = document->requirement().min.y; break; case Dimension::Fullscreen: dimx = Terminal::Size().dimx; dimy = Terminal::Size().dimy; break; case Dimension::FitComponent: auto terminal = Terminal::Size(); document->ComputeRequirement(); dimx = std::min(document->requirement().min.x, terminal.dimx); dimy = std::min(document->requirement().min.y, terminal.dimy); break; } // Resize the screen if needed. if (dimx != dimx_ || dimy != dimy_) { dimx_ = dimx; dimy_ = dimy; pixels_ = std::vector<std::vector<Pixel>>( dimy, std::vector<Pixel>(dimx)); cursor_.x = dimx_ - 1; cursor_.y = dimy_ - 1; } Render(*this, document.get()); // Set cursor position for user using tools to insert CJK characters. set_cursor_position = ""; reset_cursor_position = ""; int dx = dimx_ - 1 - cursor_.x; int dy = dimy_ - 1 - cursor_.y; if (dx != 0) { set_cursor_position += "\x1B[" + std::to_string(dx) + "D"; reset_cursor_position += "\x1B[" + std::to_string(dx) + "C"; } if (dy != 0) { set_cursor_position += "\x1B[" + std::to_string(dy) + "A"; reset_cursor_position += "\x1B[" + std::to_string(dy) + "B"; } } std::function<void()> ScreenInteractive::ExitLoopClosure() { return [this]() { quit_ = true; }; } } // namespace ftxui.
28.678049
79
0.673244
dendisuhubdy
f48deb148495a1f4ae92dcd20a7e3877b360ff57
2,937
cpp
C++
Framework/Source/Windows/LWVideo/LWVideoDrivers/LWVideoDriver_OpenGL3_3_Windows.cpp
slicer4ever/Lightwaver
1f444e42eab9988632f541ab3c8f491d557c7de7
[ "MIT" ]
3
2017-10-24T08:04:49.000Z
2018-08-28T10:08:08.000Z
Framework/Source/Windows/LWVideo/LWVideoDrivers/LWVideoDriver_OpenGL3_3_Windows.cpp
slicer4ever/Lightwave
1f444e42eab9988632f541ab3c8f491d557c7de7
[ "MIT" ]
null
null
null
Framework/Source/Windows/LWVideo/LWVideoDrivers/LWVideoDriver_OpenGL3_3_Windows.cpp
slicer4ever/Lightwave
1f444e42eab9988632f541ab3c8f491d557c7de7
[ "MIT" ]
null
null
null
#include "LWVideo/LWVideoDrivers/LWVideoDriver_OpenGL3_3.h" #include "LWPlatform/LWWindow.h" LWVideoDriver_OpenGL3_3 *LWVideoDriver_OpenGL3_3::MakeVideoDriver(LWWindow *Window, uint32_t Type) { LWWindowContext WinCon = Window->GetContext(); int32_t PixelFormat; PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0 }; int32_t AttribList[] = { WGL_CONTEXT_MAJOR_VERSION_ARB, 3, WGL_CONTEXT_MINOR_VERSION_ARB, 2, 0, 0 }; LWOpenGL3_3Context Context = { nullptr, nullptr }; LWVideoDriver_OpenGL3_3 *Driver = nullptr; HGLRC GLContext = nullptr; if ((Context.m_DC = GetDC(WinCon.m_WND)) == nullptr) LWWindow::MakeDialog("Error: 'GetDC'", "ERROR", LWWindow::DialogOK); else if ((PixelFormat = ChoosePixelFormat(Context.m_DC, &pfd)) == 0) LWWindow::MakeDialog("Error: 'ChoosePixelFormat'", "ERROR", LWWindow::DialogOK); else if (!SetPixelFormat(Context.m_DC, PixelFormat, &pfd)) LWWindow::MakeDialog("Error: 'SetPixelFormat'", "ERROR", LWWindow::DialogOK); else if ((GLContext = wglCreateContext(Context.m_DC)) == nullptr) LWWindow::MakeDialog("Error: 'wglCreateContext'", "ERROR", LWWindow::DialogOK); else if (!wglMakeCurrent(Context.m_DC, GLContext)) LWWindow::MakeDialog("Error: 'wglMakeCurrent'", "ERROR", LWWindow::DialogOK); else if (glewInit() != GLEW_OK) LWWindow::MakeDialog("Error: 'glewInit'", "ERROR", LWWindow::DialogOK); else if (GLEW_VERSION_3_3) { if ((Context.m_GLRC = wglCreateContextAttribsARB(Context.m_DC, 0, AttribList)) == nullptr) LWWindow::MakeDialog("Error: 'wglCreateContextAttribsARB'", "ERROR", LWWindow::DialogOK); else { wglDeleteContext(GLContext); wglMakeCurrent(Context.m_DC, Context.m_GLRC); int32_t UniformBlockSize = 0; glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, &UniformBlockSize); Driver = Window->GetAllocator()->Allocate<LWVideoDriver_OpenGL3_3>(Window, Context, (uint32_t)UniformBlockSize); } } if (!Driver) { if (GLContext) wglDeleteContext(GLContext); if (Context.m_GLRC) wglDeleteContext(Context.m_GLRC); if (Context.m_DC) ReleaseDC(WinCon.m_WND, Context.m_DC); } return Driver; } bool LWVideoDriver_OpenGL3_3::DestroyVideoContext(LWVideoDriver_OpenGL3_3 *Driver) { LWWindowContext &WinCon = Driver->GetWindow()->GetContext(); LWOpenGL3_3Context &Con = Driver->GetContext(); if (Con.m_GLRC) wglDeleteContext(Con.m_GLRC); if (Con.m_DC) ReleaseDC(WinCon.m_WND, Con.m_DC); LWAllocator::Destroy(Driver); return true; } bool LWVideoDriver_OpenGL3_3::Update(void) { return true; } LWVideoDriver &LWVideoDriver_OpenGL3_3::Present(uint32_t SwapInterval){ wglSwapIntervalEXT(SwapInterval); SwapBuffers(m_Context.m_DC); return *this; }
52.446429
210
0.716377
slicer4ever
f48eb9ce9f49c9e6ed3546c5b0f2289a44e0750d
466
hpp
C++
src/texture/systems/source.hpp
hexoctal/zenith
eeef065ed62f35723da87c8e73a6716e50d34060
[ "MIT" ]
2
2021-03-18T16:25:04.000Z
2021-11-13T00:29:27.000Z
src/texture/systems/source.hpp
hexoctal/zenith
eeef065ed62f35723da87c8e73a6716e50d34060
[ "MIT" ]
null
null
null
src/texture/systems/source.hpp
hexoctal/zenith
eeef065ed62f35723da87c8e73a6716e50d34060
[ "MIT" ]
1
2021-11-13T00:29:30.000Z
2021-11-13T00:29:30.000Z
/** * @file * @author __AUTHOR_NAME__ <mail@host.com> * @copyright 2021 __COMPANY_LTD__ * @license <a href="https://opensource.org/licenses/MIT">MIT License</a> */ #ifndef ZEN_TEXTURES_SYSTEMS_SOURCE_HPP #define ZEN_TEXTURES_SYSTEMS_SOURCE_HPP #include <string> #include "../../ecs/entity.hpp" namespace Zen { Entity CreateTextureSource (Entity texture, std::string src, int index); void DestroyTextureSource (Entity source); } // namespace Zen #endif
20.26087
74
0.740343
hexoctal
f4932bd0df1fe71f9aa4c3962b8921a9258d28d0
3,275
cc
C++
base/core/test/dynamic_fws_multimap_test.cc
dgcl/motis
6b134f80aa3b6445f710418962f1fed9cffda3a0
[ "MIT" ]
null
null
null
base/core/test/dynamic_fws_multimap_test.cc
dgcl/motis
6b134f80aa3b6445f710418962f1fed9cffda3a0
[ "MIT" ]
null
null
null
base/core/test/dynamic_fws_multimap_test.cc
dgcl/motis
6b134f80aa3b6445f710418962f1fed9cffda3a0
[ "MIT" ]
1
2021-10-06T13:48:23.000Z
2021-10-06T13:48:23.000Z
#include "gtest/gtest.h" #include <algorithm> #include <iostream> #include <iterator> #include "motis/core/common/dynamic_fws_multimap.h" namespace motis { namespace { template <typename T, bool ConstBucket> void check_result( std::vector<T> const& ref, typename dynamic_fws_multimap<T>::template bucket<ConstBucket> const& result) { if (ref.size() != result.size() && result.size() < 10) { std::cout << "Invalid result:\n Expected: "; std::copy(begin(ref), end(ref), std::ostream_iterator<T>(std::cout, " ")); std::cout << "\n Result: "; std::copy(begin(result), end(result), std::ostream_iterator<T>(std::cout, " ")); std::cout << std::endl; } ASSERT_EQ(ref.size(), result.size()); for (auto i = 0UL; i < ref.size(); ++i) { EXPECT_EQ(ref[i], result[i]); } } template <typename T, typename SizeType> void print_multimap(dynamic_fws_multimap<T, SizeType>& mm) { for (auto const& bucket : mm) { std::cout << "key={" << bucket.index() << "} => [ "; for (auto const& entry : bucket) { std::cout << entry << " "; } std::cout << "]\n"; } } /* struct test_node { std::uint32_t id_{}; std::uint32_t tag_{}; }; */ struct test_edge { std::uint32_t from_{}; std::uint32_t to_{}; std::uint32_t weight_{}; }; inline std::ostream& operator<<(std::ostream& out, test_edge const& e) { return out << "{from=" << e.from_ << ", to=" << e.to_ << ", weight=" << e.weight_ << "}"; } } // namespace TEST(fws_dynamic_multimap_test, int_1) { dynamic_fws_multimap<int> mm; ASSERT_EQ(0, mm.element_count()); ASSERT_EQ(0, mm.index_size()); mm[0].push_back(42); ASSERT_EQ(1, mm.element_count()); ASSERT_EQ(1, mm.index_size()); check_result<int>({42}, mm[0]); ASSERT_EQ(1, mm[0].size()); mm[1].push_back(4); ASSERT_EQ(2, mm.element_count()); ASSERT_EQ(2, mm.index_size()); check_result<int>({42}, mm[0]); ASSERT_EQ(1, mm[0].size()); check_result<int>({4}, mm[1]); ASSERT_EQ(1, mm[1].size()); mm[1].push_back(8); ASSERT_EQ(3, mm.element_count()); ASSERT_EQ(2, mm.index_size()); check_result<int>({42}, mm[0]); ASSERT_EQ(1, mm[0].size()); check_result<int>({4, 8}, mm[1]); ASSERT_EQ(2, mm[1].size()); mm[1].emplace_back(15); ASSERT_EQ(4, mm.element_count()); ASSERT_EQ(2, mm.index_size()); check_result<int>({42}, mm[0]); ASSERT_EQ(1, mm[0].size()); check_result<int>({4, 8, 15}, mm[1]); ASSERT_EQ(3, mm[1].size()); mm[1].push_back(16); ASSERT_EQ(5, mm.element_count()); ASSERT_EQ(2, mm.index_size()); check_result<int>({42}, mm[0]); ASSERT_EQ(1, mm[0].size()); check_result<int>({4, 8, 15, 16}, mm[1]); ASSERT_EQ(4, mm[1].size()); mm[0].push_back(23); ASSERT_EQ(6, mm.element_count()); ASSERT_EQ(2, mm.index_size()); check_result<int>({42, 23}, mm[0]); ASSERT_EQ(2, mm[0].size()); check_result<int>({4, 8, 15, 16}, mm[1]); ASSERT_EQ(4, mm[1].size()); print_multimap(mm); } TEST(fws_dynamic_multimap_test, graph_1) { dynamic_fws_multimap<test_edge> mm; mm[0].emplace_back(0U, 1U, 10U); mm[1].emplace_back(1U, 2U, 20U); mm[1].emplace_back(1U, 3U, 30U); mm[3].emplace_back(3U, 0U, 50U); mm[2].emplace_back(2U, 3U, 5U); print_multimap(mm); } } // namespace motis
25
78
0.611603
dgcl
f49389d01da292cd85b77f6261c0a4d53d7d35a2
1,581
cpp
C++
UVa Online Judge (UVa)/Volume 5/516 - Prime Land.cpp
sreejonK19/online-judge-solutions
da65d635cc488c8f305e48b49727ad62649f5671
[ "MIT" ]
null
null
null
UVa Online Judge (UVa)/Volume 5/516 - Prime Land.cpp
sreejonK19/online-judge-solutions
da65d635cc488c8f305e48b49727ad62649f5671
[ "MIT" ]
null
null
null
UVa Online Judge (UVa)/Volume 5/516 - Prime Land.cpp
sreejonK19/online-judge-solutions
da65d635cc488c8f305e48b49727ad62649f5671
[ "MIT" ]
2
2018-11-06T19:37:56.000Z
2018-11-09T19:05:46.000Z
#include <cstdio> #include <iostream> #include <sstream> #include <cmath> #include <vector> using namespace std; #define N 32768 #define Check(N, pos) ((bool) ((N)&(1<<(pos)))) #define Set(N, pos) ((N)=((N)|(1<<(pos)))) unsigned status[(N>>5)+2], factor[N], power[N]; vector < unsigned > primes; void bitSieve() { unsigned sqrtN = unsigned (sqrt(N)); for(unsigned i=3 ; i<=sqrtN ; i+=2) if( !Check(status[i>>5], i&31) ) for(unsigned j=i*i ; j<=N ; j+=(i<<1)) Set(status[j>>5], j&31); primes.push_back(2); for(unsigned i=3 ; i<=N ; i+=2) if( !Check(status[i>>5], i&31) ) primes.push_back(i); } int main() { bitSieve(); string input; while( getline(cin, input) && input!="0" ) { stringstream converter(input); unsigned base, exponent, x = 1; while( converter >> base >> exponent ) for(unsigned i=1 ; i<=exponent ; i++) x *= base; x--; for(unsigned i=0 ; i<N ; i++) factor[i] = power[i] = 0; unsigned sz = primes.size(), len = 0; for(unsigned i=0 ; i<sz ; i++) { if( !(x%primes[i]) ) { factor[len] = primes[i]; while( !(x%primes[i]) ) { power[len]++; x /= primes[i]; } len++; } if( x==1 ) break; } for(unsigned i=len-1 ; i>0 ; i--) printf("%u %d ", factor[i], power[i]); printf("%u %d\n", factor[0], power[0]); } return 0; }
23.954545
75
0.460468
sreejonK19
f4943f58625356bfe43c12c8200603a109087dfd
48,678
cpp
C++
CEGUI/src/widgets/Tree.cpp
liang47009/ndk_sources
88155286084d1ebd1c4f34456d84812a46aba212
[ "MIT" ]
5
2016-04-18T23:12:51.000Z
2022-03-06T05:12:07.000Z
CEGUI/src/widgets/Tree.cpp
liang47009/ndk_sources
88155286084d1ebd1c4f34456d84812a46aba212
[ "MIT" ]
11
2021-03-19T18:11:28.000Z
2021-05-13T18:53:40.000Z
CEGUI/src/widgets/Tree.cpp
liang47009/ndk_sources
88155286084d1ebd1c4f34456d84812a46aba212
[ "MIT" ]
15
2015-02-23T16:35:28.000Z
2022-03-25T13:40:33.000Z
/*********************************************************************** created: 5-13-07 author: Jonathan Welch (Based on Code by David Durant) *************************************************************************/ /*************************************************************************** * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team * * 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 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 "CEGUI/Exceptions.h" #include "CEGUI/WindowManager.h" #include "CEGUI/CoordConverter.h" #include "CEGUI/WindowManager.h" #include "CEGUI/falagard/WidgetLookManager.h" #include "CEGUI/falagard/WidgetLookFeel.h" #include "CEGUI/widgets/TreeItem.h" #include "CEGUI/widgets/Tree.h" #include "CEGUI/widgets/Scrollbar.h" #include "CEGUI/widgets/Tooltip.h" #include <algorithm> // Start of CEGUI namespace section namespace CEGUI { const String Tree::EventNamespace("Tree"); const String Tree::WidgetTypeName("CEGUI/Tree"); /************************************************************************* Constants *************************************************************************/ // event names const String Tree::EventListContentsChanged( "ListContentsChanged" ); const String Tree::EventSelectionChanged( "SelectionChanged" ); const String Tree::EventSortModeChanged( "SortModeChanged" ); const String Tree::EventMultiselectModeChanged( "MultiselectModeChanged" ); const String Tree::EventVertScrollbarModeChanged( "VertScrollbarModeChanged" ); const String Tree::EventHorzScrollbarModeChanged( "HorzScrollbarModeChanged" ); const String Tree::EventBranchOpened( "BranchOpened" ); const String Tree::EventBranchClosed( "BranchClosed" ); /************************************************************************* Constructor for Tree base class. *************************************************************************/ Tree::Tree(const String& type, const String& name) : Window(type, name), d_sorted(false), d_multiselect(false), d_forceVertScroll(false), d_forceHorzScroll(false), d_itemTooltips(false), d_vertScrollbar(0), d_horzScrollbar(0), d_lastSelected(0), d_openButtonImagery(0), d_closeButtonImagery(0), d_itemArea(0, 0, 0, 0) { // add new events specific to tree. addTreeEvents(); addTreeProperties(); } void Tree::setLookNFeel(const String& look) { Window::setLookNFeel( look ); initialise(); } /************************************************************************* Destructor for Tree base class. *************************************************************************/ Tree::~Tree(void) { resetList_impl(); } /************************************************************************* Initialise the Window based object ready for use. *************************************************************************/ void Tree::initialise(void) { // get WidgetLookFeel for the assigned look. const WidgetLookFeel &wlf = WidgetLookManager::getSingleton().getWidgetLook(d_lookName); const ImagerySection &tempOpenImagery = wlf.getImagerySection("OpenTreeButton"); const ImagerySection &tempCloseImagery = wlf.getImagerySection("CloseTreeButton"); d_openButtonImagery = &tempOpenImagery; d_closeButtonImagery = &tempCloseImagery; // create the component sub-widgets d_vertScrollbar = createVertScrollbar("__auto_vscrollbar__"); d_horzScrollbar = createHorzScrollbar("__auto_hscrollbar__"); addChild(d_vertScrollbar); addChild(d_horzScrollbar); d_vertScrollbar->subscribeEvent(Scrollbar::EventScrollPositionChanged, Event::Subscriber(&Tree::handle_scrollChange, this)); d_horzScrollbar->subscribeEvent(Scrollbar::EventScrollPositionChanged, Event::Subscriber(&Tree::handle_scrollChange, this)); configureScrollbars(); performChildWindowLayout(); } /************************************************************************* Return the number of selected items in the tree. *************************************************************************/ size_t Tree::getSelectedCount(void) const { size_t count = 0; for (size_t index = 0; index < d_listItems.size(); ++index) { if (d_listItems[index]->isSelected()) count++; } return count; } /************************************************************************* Return a pointer to the first selected item. *************************************************************************/ TreeItem* Tree::getFirstSelectedItem(void) const { bool found_first = true; return getNextSelectedItemFromList(d_listItems, 0, found_first); } /************************************************************************* Return a pointer to the next selected item after item 'start_item' *************************************************************************/ TreeItem* Tree::getNextSelected(const TreeItem* start_item) const { bool found_first = (start_item == 0); return getNextSelectedItemFromList(d_listItems, start_item, found_first); } // Recursive! TreeItem* Tree::getNextSelectedItemFromList(const LBItemList &itemList, const TreeItem* startItem, bool& foundStartItem) const { size_t itemCount = itemList.size(); for (size_t index = 0; index < itemCount; ++index) { if (foundStartItem == true) { // Already found the startItem, now looking for next selected item. if (itemList[index]->isSelected()) return itemList[index]; } else { // Still looking for startItem. Is this it? if (itemList[index] == startItem) foundStartItem = true; } if (itemList[index]->getItemCount() > 0) { if (itemList[index]->getIsOpen()) { TreeItem *foundSelectedTree; foundSelectedTree = getNextSelectedItemFromList(itemList[index]->getItemList(), startItem, foundStartItem); if (foundSelectedTree != 0) return foundSelectedTree; } } } return 0; } // Recursive! TreeItem* Tree::findItemWithTextFromList(const LBItemList &itemList, const String& text, const TreeItem* startItem, bool foundStartItem) { size_t itemCount = itemList.size(); for (size_t index = 0; index < itemCount; ++index) { if (foundStartItem == true) { // Already found the startItem, now looking for the actual text. if (itemList[index]->getText() == text) return itemList[index]; } else { // Still looking for startItem. Is this it? if (itemList[index] == startItem) foundStartItem = true; } if (itemList[index]->getItemCount() > 0) { // Search the current item's itemList regardless if it's open or not. TreeItem *foundSelectedTree; foundSelectedTree = findItemWithTextFromList(itemList[index]->getItemList(), text, startItem, foundStartItem); if (foundSelectedTree != 0) return foundSelectedTree; } } return 0; } /************************************************************************* Search the list for an item with the specified text *************************************************************************/ TreeItem* Tree::findNextItemWithText(const String& text, const TreeItem* start_item) { if (start_item == 0) return findItemWithTextFromList(d_listItems, text, 0, true); else return findItemWithTextFromList(d_listItems, text, start_item, false); } TreeItem* Tree::findFirstItemWithText(const String& text) { return findItemWithTextFromList(d_listItems, text, 0, true); } // Recursive! TreeItem* Tree::findItemWithIDFromList(const LBItemList &itemList, uint searchID, const TreeItem* startItem, bool foundStartItem) { size_t itemCount = itemList.size(); for (size_t index = 0; index < itemCount; ++index) { if (foundStartItem == true) { // Already found the startItem, now looking for the actual text. if (itemList[index]->getID() == searchID) return itemList[index]; } else { // Still looking for startItem. Is this it? if (itemList[index] == startItem) foundStartItem = true; } if (itemList[index]->getItemCount() > 0) { // Search the current item's itemList regardless if it's open or not. TreeItem *foundSelectedTree; foundSelectedTree = findItemWithIDFromList(itemList[index]->getItemList(), searchID, startItem, foundStartItem); if (foundSelectedTree != 0) return foundSelectedTree; } } return 0; } TreeItem* Tree::findNextItemWithID(uint searchID, const TreeItem* start_item) { if (start_item == 0) return findItemWithIDFromList(d_listItems, searchID, 0, true); else return findItemWithIDFromList(d_listItems, searchID, start_item, false); } TreeItem* Tree::findFirstItemWithID(uint searchID) { return findItemWithIDFromList(d_listItems, searchID, 0, true); } /************************************************************************* Return whether the specified TreeItem is in the List *************************************************************************/ bool Tree::isTreeItemInList(const TreeItem* item) const { return std::find(d_listItems.begin(), d_listItems.end(), item) != d_listItems.end(); } /************************************************************************* Remove all items from the list. *************************************************************************/ void Tree::resetList(void) { if (resetList_impl()) { WindowEventArgs args(this); onListContentsChanged(args); } } /************************************************************************* Add the given TreeItem to the list. *************************************************************************/ void Tree::addItem(TreeItem* item) { if (item != 0) { // establish ownership item->setOwnerWindow(this); // if sorting is enabled, re-sort the list if (isSortEnabled()) { d_listItems.insert(std::upper_bound(d_listItems.begin(), d_listItems.end(), item, &lbi_less), item); } // not sorted, just stick it on the end. else { d_listItems.push_back(item); } WindowEventArgs args(this); onListContentsChanged(args); } } /************************************************************************* Insert an item into the tree after a specified item already in the list. *************************************************************************/ void Tree::insertItem(TreeItem* item, const TreeItem* position) { // if the list is sorted, it's the same as a normal add operation if (isSortEnabled()) { addItem(item); } else if (item != 0) { // establish ownership item->setOwnerWindow(this); // if position is NULL begin insert at begining, else insert after item 'position' LBItemList::iterator ins_pos; if (position == 0) { ins_pos = d_listItems.begin(); } else { ins_pos = std::find(d_listItems.begin(), d_listItems.end(), position); // throw if item 'position' is not in the list if (ins_pos == d_listItems.end()) { CEGUI_THROW(InvalidRequestException( "the specified TreeItem for parameter 'position' is not attached to this Tree.")); } } d_listItems.insert(ins_pos, item); WindowEventArgs args(this); onListContentsChanged(args); } } /************************************************************************* Removes the given item from the tree. *************************************************************************/ void Tree::removeItem(const TreeItem* item) { if (item != 0) { LBItemList::iterator pos = std::find(d_listItems.begin(), d_listItems.end(), item); // if item is in the list if (pos != d_listItems.end()) { // disown item (*pos)->setOwnerWindow(0); // remove item d_listItems.erase(pos); // if item was the last selected item, reset that to NULL if (item == d_lastSelected) { d_lastSelected = 0; } // if item is supposed to be deleted by us if (item->isAutoDeleted()) { // clean up this item. CEGUI_DELETE_AO item; } WindowEventArgs args(this); onListContentsChanged(args); } } } /************************************************************************* Clear the selected state for all items. *************************************************************************/ void Tree::clearAllSelections(void) { // only fire events and update if we actually made any changes if (clearAllSelections_impl()) { TreeEventArgs args(this); onSelectionChanged(args); } } /************************************************************************* Set whether the list should be sorted. *************************************************************************/ void Tree::setSortingEnabled(bool setting) { // only react if the setting will change if (d_sorted != setting) { d_sorted = setting; // if we are enabling sorting, we need to sort the list if (d_sorted) { std::sort(d_listItems.begin(), d_listItems.end(), &lbi_less); } WindowEventArgs args(this); onSortModeChanged(args); } } /************************************************************************* Set whether the list should allow multiple selections or just a single selection *************************************************************************/ void Tree::setMultiselectEnabled(bool setting) { // only react if the setting is changed if (d_multiselect != setting) { d_multiselect = setting; // if we change to single-select, deselect all except the first selected item. TreeEventArgs args(this); if ((!d_multiselect) && (getSelectedCount() > 1)) { TreeItem* itm = getFirstSelectedItem(); while ((itm = getNextSelected(itm))) { itm->setSelected(false); } onSelectionChanged(args); } onMultiselectModeChanged(args); } } void Tree::setItemTooltipsEnabled(bool setting) { d_itemTooltips = setting; } /************************************************************************* Set whether the vertical scroll bar should always be shown. *************************************************************************/ void Tree::setShowVertScrollbar(bool setting) { if (d_forceVertScroll != setting) { d_forceVertScroll = setting; configureScrollbars(); WindowEventArgs args(this); onVertScrollbarModeChanged(args); } } /************************************************************************* Set whether the horizontal scroll bar should always be shown. *************************************************************************/ void Tree::setShowHorzScrollbar(bool setting) { if (d_forceHorzScroll != setting) { d_forceHorzScroll = setting; configureScrollbars(); WindowEventArgs args(this); onHorzScrollbarModeChanged(args); } } /************************************************************************* Set the select state of an attached TreeItem. *************************************************************************/ void Tree::setItemSelectState(TreeItem* item, bool state) { if (containsOpenItemRecursive(d_listItems, item)) { TreeEventArgs args(this); args.treeItem = item; if (state && !d_multiselect) clearAllSelections_impl(); item->setSelected(state); d_lastSelected = item->isSelected() ? item : 0; onSelectionChanged(args); } else { CEGUI_THROW(InvalidRequestException("the specified TreeItem is not " "attached to this Tree or not visible.")); } } //----------------------------------------------------------------------------// bool Tree::containsOpenItemRecursive(const LBItemList& itemList, TreeItem* item) { size_t itemCount = itemList.size(); for (size_t index = 0; index < itemCount; ++index) { if (itemList[index] == item) return true; if (itemList[index]->getItemCount() > 0) { if (itemList[index]->getIsOpen()) { if (containsOpenItemRecursive(itemList[index]->getItemList(), item)) return true; } } } return false; } /************************************************************************* Set the select state of an attached TreeItem. *************************************************************************/ void Tree::setItemSelectState(size_t item_index, bool state) { if (item_index < getItemCount()) { // only do this if the setting is changing if (d_listItems[item_index]->isSelected() != state) { // conditions apply for single-select mode if (state && !d_multiselect) { clearAllSelections_impl(); } d_listItems[item_index]->setSelected(state); TreeEventArgs args(this); args.treeItem = d_listItems[item_index]; onSelectionChanged(args); } } else { CEGUI_THROW(InvalidRequestException( "the value passed in the 'item_index' parameter is out of range for this Tree.")); } } /************************************************************************* Causes the tree to update it's internal state after changes have been made to one or more attached TreeItem objects. *************************************************************************/ void Tree::handleUpdatedItemData(void) { configureScrollbars(); invalidate(); } /************************************************************************* Perform the actual rendering for this Window. *************************************************************************/ void Tree::populateGeometryBuffer() { // get the derived class to render general stuff before we handle the items cacheTreeBaseImagery(); // Render list items Vector2f itemPos; float widest = getWidestItemWidth(); // calculate position of area we have to render into //Rect itemsArea(getTreeRenderArea()); //Rect itemsArea(0,0,500,500); // set up some initial positional details for items itemPos.d_x = d_itemArea.left() - d_horzScrollbar->getScrollPosition(); itemPos.d_y = d_itemArea.top() - d_vertScrollbar->getScrollPosition(); drawItemList(d_listItems, d_itemArea, widest, itemPos, *d_geometry, getEffectiveAlpha()); } // Recursive! void Tree::drawItemList(LBItemList& itemList, Rectf& itemsArea, float widest, Vector2f& itemPos, GeometryBuffer& geometry, float alpha) { if (itemList.empty()) return; // loop through the items Sizef itemSize; Rectf itemClipper, itemRect; size_t itemCount = itemList.size(); bool itemIsVisible; for (size_t i = 0; i < itemCount; ++i) { itemSize.d_height = itemList[i]->getPixelSize().d_height; // allow item to have full width of box if this is wider than items itemSize.d_width = ceguimax(itemsArea.getWidth(), widest); // calculate destination area for this item. itemRect.left(itemPos.d_x); itemRect.top(itemPos.d_y); itemRect.setSize(itemSize); itemClipper = itemRect.getIntersection(itemsArea); itemRect.d_min.d_x += 20; // start text past open/close buttons if (itemClipper.getHeight() > 0) { itemIsVisible = true; itemList[i]->draw(geometry, itemRect, alpha, &itemClipper); } else { itemIsVisible = false; } // Process this item's list if it has items in it. if (itemList[i]->getItemCount() > 0) { Rectf buttonRenderRect; buttonRenderRect.left(itemPos.d_x); buttonRenderRect.right(buttonRenderRect.left() + 10); buttonRenderRect.top(itemPos.d_y); buttonRenderRect.bottom(buttonRenderRect.top() + 10); itemList[i]->setButtonLocation(buttonRenderRect); if (itemList[i]->getIsOpen()) { // Draw the Close button if (itemIsVisible) d_closeButtonImagery->render(*this, buttonRenderRect, 0, &itemClipper); // update position ready for next item itemPos.d_y += itemSize.d_height; itemPos.d_x += 20; drawItemList(itemList[i]->getItemList(), itemsArea, widest, itemPos, geometry, alpha); itemPos.d_x -= 20; } else { // Draw the Open button if (itemIsVisible) d_openButtonImagery->render(*this, buttonRenderRect, 0, &itemClipper); // update position ready for next item itemPos.d_y += itemSize.d_height; } } else { // update position ready for next item itemPos.d_y += itemSize.d_height; } } // Successfully drew all items, so vertical scrollbar not needed. // setShowVertScrollbar(false); } #define HORIZONTAL_STEP_SIZE_DIVISOR 20.0f /************************************************************************* display required integrated scroll bars according to current state of the tree and update their values. *************************************************************************/ void Tree::configureScrollbars(void) { Rectf renderArea(getTreeRenderArea()); //This is becuase CEGUI IS GAY! and fires events before the item is initialized if(!d_vertScrollbar) d_vertScrollbar = createVertScrollbar("__auto_vscrollbar__"); if(!d_horzScrollbar) d_horzScrollbar = createHorzScrollbar("__auto_hscrollbar__"); float totalHeight = getTotalItemsHeight(); float widestItem = getWidestItemWidth() + 20; // // First show or hide the scroll bars as needed (or requested) // // show or hide vertical scroll bar as required (or as specified by option) if ((totalHeight > renderArea.getHeight()) || d_forceVertScroll) { d_vertScrollbar->show(); renderArea.d_max.d_x -= d_vertScrollbar->getWidth().d_offset + d_vertScrollbar->getXPosition().d_offset; // show or hide horizontal scroll bar as required (or as specified by option) if ((widestItem > renderArea.getWidth()) || d_forceHorzScroll) { d_horzScrollbar->show(); renderArea.d_max.d_y -= d_horzScrollbar->getHeight().d_offset; } else { d_horzScrollbar->hide(); d_horzScrollbar->setScrollPosition(0); } } else { // show or hide horizontal scroll bar as required (or as specified by option) if ((widestItem > renderArea.getWidth()) || d_forceHorzScroll) { d_horzScrollbar->show(); renderArea.d_max.d_y -= d_vertScrollbar->getHeight().d_offset; // show or hide vertical scroll bar as required (or as specified by option) if ((totalHeight > renderArea.getHeight()) || d_forceVertScroll) { d_vertScrollbar->show(); // renderArea.d_right -= d_vertScrollbar->getAbsoluteWidth(); renderArea.d_max.d_x -= d_vertScrollbar->getWidth().d_offset; } else { d_vertScrollbar->hide(); d_vertScrollbar->setScrollPosition(0); } } else { d_vertScrollbar->hide(); d_vertScrollbar->setScrollPosition(0); d_horzScrollbar->hide(); d_horzScrollbar->setScrollPosition(0); } } // // Set up scroll bar values // float itemHeight; if (!d_listItems.empty()) itemHeight = d_listItems[0]->getPixelSize().d_height; else itemHeight = 10; d_vertScrollbar->setDocumentSize(totalHeight); d_vertScrollbar->setPageSize(renderArea.getHeight()); d_vertScrollbar->setStepSize(ceguimax(1.0f, renderArea.getHeight() / itemHeight)); d_vertScrollbar->setScrollPosition(d_vertScrollbar->getScrollPosition()); d_horzScrollbar->setDocumentSize(widestItem + d_vertScrollbar->getWidth().d_offset); // d_horzScrollbar->setDocumentSize(widestItem + d_vertScrollbar->getAbsoluteWidth()); d_horzScrollbar->setPageSize(renderArea.getWidth()); d_horzScrollbar->setStepSize(ceguimax(1.0f, renderArea.getWidth() / HORIZONTAL_STEP_SIZE_DIVISOR)); d_horzScrollbar->setScrollPosition(d_horzScrollbar->getScrollPosition()); } /************************************************************************* select all strings between positions 'start' and 'end' (inclusive) *************************************************************************/ void Tree::selectRange(size_t start, size_t end) { // only continue if list has some items if (!d_listItems.empty()) { // if start is out of range, start at begining. if (start > d_listItems.size()) { start = 0; } // if end is out of range end at the last item. if (end >= d_listItems.size()) { end = d_listItems.size() - 1; } // ensure start becomes before the end. if (start > end) { size_t tmp; tmp = start; start = end; end = tmp; } // perform selections for( ; start <= end; ++start) { d_listItems[start]->setSelected(true); } } } /************************************************************************* Return the sum of all item heights *************************************************************************/ float Tree::getTotalItemsHeight(void) const { float heightSum = 0; getTotalItemsInListHeight(d_listItems, &heightSum); return heightSum; } // Recursive! void Tree::getTotalItemsInListHeight(const LBItemList &itemList, float *heightSum) const { size_t itemCount = itemList.size(); for (size_t index = 0; index < itemCount; ++index) { *heightSum += itemList[index]->getPixelSize().d_height; if (itemList[index]->getIsOpen() && (itemList[index]->getItemCount() > 0)) getTotalItemsInListHeight(itemList[index]->getItemList(), heightSum); } } /************************************************************************* Return the width of the widest item, including any white space to the left due to indenting. *************************************************************************/ float Tree::getWidestItemWidth(void) const { float widest = 0; getWidestItemWidthInList(d_listItems, 0, &widest); return widest; } // Recursive! void Tree::getWidestItemWidthInList(const LBItemList &itemList, int itemDepth, float *widest) const { size_t itemCount = itemList.size(); for (size_t index = 0; index < itemCount; ++index) { Rectf buttonLocation = itemList[index]->getButtonLocation(); float thisWidth = itemList[index]->getPixelSize().d_width + buttonLocation.getWidth() + (d_horzScrollbar->getScrollPosition() / HORIZONTAL_STEP_SIZE_DIVISOR) + (itemDepth * 20); if (thisWidth > *widest) *widest = thisWidth; if (itemList[index]->getIsOpen() && (itemList[index]->getItemCount() > 0)) getWidestItemWidthInList(itemList[index]->getItemList(), itemDepth + 1, widest); } } /************************************************************************* Clear the selected state for all items (implementation) *************************************************************************/ bool Tree::clearAllSelections_impl(void) { return clearAllSelectionsFromList(d_listItems); } // Recursive! bool Tree::clearAllSelectionsFromList(const LBItemList &itemList) { // flag used so we can track if we did anything. bool modified = false; for (size_t index = 0; index < itemList.size(); ++index) { if (itemList[index]->isSelected()) { itemList[index]->setSelected(false); modified = true; } if (itemList[index]->getItemCount() > 0) { bool modifiedSubList = clearAllSelectionsFromList(itemList[index]->getItemList()); if (modifiedSubList) modified = true; } } return modified; } /************************************************************************* Return the TreeItem under the given window local pixel co-ordinate. *************************************************************************/ TreeItem* Tree::getItemAtPoint(const Vector2f& pt) const { Rectf renderArea(getTreeRenderArea()); // point must be within the rendering area of the Tree. if (renderArea.isPointInRect(pt)) { float y = renderArea.top() - d_vertScrollbar->getScrollPosition(); // test if point is above first item if (pt.d_y >= y) return getItemFromListAtPoint(d_listItems, &y, pt); } return 0; } // Recursive! TreeItem* Tree::getItemFromListAtPoint(const LBItemList &itemList, float *bottomY, const Vector2f& pt) const { size_t itemCount = itemList.size(); for (size_t i = 0; i < itemCount; ++i) { *bottomY += itemList[i]->getPixelSize().d_height; if (pt.d_y < *bottomY) return itemList[i]; if (itemList[i]->getItemCount() > 0) { if (itemList[i]->getIsOpen()) { TreeItem *foundPointedAtTree; foundPointedAtTree = getItemFromListAtPoint(itemList[i]->getItemList(), bottomY, pt); if (foundPointedAtTree != 0) return foundPointedAtTree; } } } return 0; } /************************************************************************* Add tree specific events *************************************************************************/ void Tree::addTreeEvents(void) { addEvent(EventListContentsChanged); addEvent(EventSelectionChanged); addEvent(EventSortModeChanged); addEvent(EventMultiselectModeChanged); addEvent(EventVertScrollbarModeChanged); addEvent(EventHorzScrollbarModeChanged); addEvent(EventBranchOpened); addEvent(EventBranchClosed); } /************************************************************************* Handler called internally when the list contents are changed *************************************************************************/ void Tree::onListContentsChanged(WindowEventArgs& e) { configureScrollbars(); invalidate(); fireEvent(EventListContentsChanged, e, EventNamespace); } /************************************************************************* Handler called internally when the currently selected item or items changes. *************************************************************************/ void Tree::onSelectionChanged(TreeEventArgs& e) { invalidate(); fireEvent(EventSelectionChanged, e, EventNamespace); } /************************************************************************* Handler called internally when the sort mode setting changes. *************************************************************************/ void Tree::onSortModeChanged(WindowEventArgs& e) { invalidate(); fireEvent(EventSortModeChanged, e, EventNamespace); } /************************************************************************* Handler called internally when the multi-select mode setting changes. *************************************************************************/ void Tree::onMultiselectModeChanged(WindowEventArgs& e) { fireEvent(EventMultiselectModeChanged, e, EventNamespace); } /************************************************************************* Handler called internally when the forced display of the vertical scroll bar setting changes. *************************************************************************/ void Tree::onVertScrollbarModeChanged(WindowEventArgs& e) { invalidate(); fireEvent(EventVertScrollbarModeChanged, e, EventNamespace); } /************************************************************************* Handler called internally when the forced display of the horizontal scroll bar setting changes. *************************************************************************/ void Tree::onHorzScrollbarModeChanged(WindowEventArgs& e) { invalidate(); fireEvent(EventHorzScrollbarModeChanged, e, EventNamespace); } /************************************************************************* Handler called internally when the forced display of the horizontal scroll bar setting changes. *************************************************************************/ void Tree::onBranchOpened(TreeEventArgs& e) { invalidate(); fireEvent(EventBranchOpened, e, EventNamespace); } /************************************************************************* Handler called internally when the forced display of the horizontal scroll bar setting changes. *************************************************************************/ void Tree::onBranchClosed(TreeEventArgs& e) { invalidate(); fireEvent(EventBranchClosed, e, EventNamespace); } /************************************************************************* Handler for when we are sized *************************************************************************/ void Tree::onSized(ElementEventArgs& e) { // base class handling Window::onSized(e); configureScrollbars(); ++e.handled; } /************************************************************************* Handler for when mouse button is pressed *************************************************************************/ void Tree::onMouseButtonDown(MouseEventArgs& e) { // base class processing // populateGeometryBuffer(); Window::onMouseButtonDown(e); if (e.button == LeftButton) { //bool modified = false; Vector2f localPos(CoordConverter::screenToWindow(*this, e.position)); // Point localPos(screenToWindow(e.position)); TreeItem* item = getItemAtPoint(localPos); if (item != 0) { //modified = true; TreeEventArgs args(this); args.treeItem = item; populateGeometryBuffer(); Rectf buttonLocation = item->getButtonLocation(); if ((localPos.d_x >= buttonLocation.left()) && (localPos.d_x <= buttonLocation.right()) && (localPos.d_y >= buttonLocation.top()) && (localPos.d_y <= buttonLocation.bottom())) { item->toggleIsOpen(); if (item->getIsOpen()) { TreeItem *lastItemInList = item->getTreeItemFromIndex(item->getItemCount() - 1); ensureItemIsVisible(lastItemInList); ensureItemIsVisible(item); onBranchOpened(args); } else { onBranchClosed(args); } // Update the item screen locations, needed to update the scrollbars. // populateGeometryBuffer(); // Opened or closed a tree branch, so must update scrollbars. configureScrollbars(); } else { // clear old selections if no control key is pressed or if multi-select is off if (!(e.sysKeys & Control) || !d_multiselect) clearAllSelections_impl(); // select range or item, depending upon keys and last selected item #if 0 // TODO: fix this if (((e.sysKeys & Shift) && (d_lastSelected != 0)) && d_multiselect) selectRange(getItemIndex(item), getItemIndex(d_lastSelected)); else #endif item->setSelected(item->isSelected() ^ true); // update last selected item d_lastSelected = item->isSelected() ? item : 0; onSelectionChanged(args); } } else { // clear old selections if no control key is pressed or if multi-select is off if (!(e.sysKeys & Control) || !d_multiselect) { if (clearAllSelections_impl()) { // Changes to the selections were actually made TreeEventArgs args(this); args.treeItem = item; onSelectionChanged(args); } } } ++e.handled; } } /************************************************************************* Handler for mouse wheel changes *************************************************************************/ void Tree::onMouseWheel(MouseEventArgs& e) { // base class processing. Window::onMouseWheel(e); if (d_vertScrollbar->isEffectiveVisible() && (d_vertScrollbar->getDocumentSize() > d_vertScrollbar->getPageSize())) d_vertScrollbar->setScrollPosition(d_vertScrollbar->getScrollPosition() + d_vertScrollbar->getStepSize() * -e.wheelChange); else if (d_horzScrollbar->isEffectiveVisible() && (d_horzScrollbar->getDocumentSize() > d_horzScrollbar->getPageSize())) d_horzScrollbar->setScrollPosition(d_horzScrollbar->getScrollPosition() + d_horzScrollbar->getStepSize() * -e.wheelChange); ++e.handled; } /************************************************************************* Handler for mouse movement *************************************************************************/ void Tree::onMouseMove(MouseEventArgs& e) { if (d_itemTooltips) { static TreeItem* lastItem = 0; Vector2f posi(CoordConverter::screenToWindow(*this, e.position)); // Point posi = relativeToAbsolute(CoordConverter::screenToWindow(*this, e.position)); TreeItem* item = getItemAtPoint(posi); if (item != lastItem) { if (item != 0) { setTooltipText(item->getTooltipText()); } else { setTooltipText(""); } lastItem = item; } // must check the result from getTooltip(), as the tooltip object could // be 0 at any time for various reasons. Tooltip* tooltip = getTooltip(); if (tooltip) { if (tooltip->getTargetWindow() != this) tooltip->setTargetWindow(this); else tooltip->positionSelf(); } } Window::onMouseMove(e); } // Recursive! bool Tree::getHeightToItemInList(const LBItemList &itemList, const TreeItem *treeItem, int itemDepth, float *height) const { size_t itemCount = itemList.size(); for (size_t index = 0; index < itemCount; ++index) { if (treeItem == itemList[index]) return true; *height += itemList[index]->getPixelSize().d_height; if (itemList[index]->getIsOpen() && (itemList[index]->getItemCount() > 0)) { if (getHeightToItemInList(itemList[index]->getItemList(), treeItem, itemDepth + 1, height)) return true; } } return false; } /************************************************************************* Ensure the specified item is visible within the tree. *************************************************************************/ void Tree::ensureItemIsVisible(const TreeItem *treeItem) { if (!treeItem) return; float top = 0; if (!getHeightToItemInList(d_listItems, treeItem, 0, &top)) return; // treeItem wasn't found by getHeightToItemInList // calculate height to bottom of item float bottom = top + treeItem->getPixelSize().d_height; // account for current scrollbar value const float currPos = d_vertScrollbar->getScrollPosition(); top -= currPos; bottom -= currPos; const float listHeight = getTreeRenderArea().getHeight(); // if top is above the view area, or if item is too big to fit if ((top < 0.0f) || ((bottom - top) > listHeight)) { // scroll top of item to top of box. d_vertScrollbar->setScrollPosition(currPos + top); } // if bottom is below the view area else if (bottom >= listHeight) { // position bottom of item at the bottom of the list d_vertScrollbar->setScrollPosition(currPos + bottom - listHeight); } } /************************************************************************* Return whether the vertical scroll bar is always shown. *************************************************************************/ bool Tree::isVertScrollbarAlwaysShown(void) const { return d_forceVertScroll; } /************************************************************************* Return whether the horizontal scroll bar is always shown. *************************************************************************/ bool Tree::isHorzScrollbarAlwaysShown(void) const { return d_forceHorzScroll; } /************************************************************************* Add properties for this class *************************************************************************/ void Tree::addTreeProperties(void) { const String& propertyOrigin = WidgetTypeName; CEGUI_DEFINE_PROPERTY(Tree, bool, "Sort", "Property to get/set the sort setting of the tree. " "Value is either \"true\" or \"false\".", &Tree::setSortingEnabled, &Tree::isSortEnabled, false /* TODO: Inconsistency */ ); CEGUI_DEFINE_PROPERTY(Tree, bool, "MultiSelect", "Property to get/set the multi-select setting of the tree. " "Value is either \"true\" or \"false\".", &Tree::setMultiselectEnabled, &Tree::isMultiselectEnabled, false /* TODO: Inconsistency */ ); CEGUI_DEFINE_PROPERTY(Tree, bool, "ForceVertScrollbar", "Property to get/set the 'always show' setting for the vertical scroll " "bar of the tree. Value is either \"true\" or \"false\".", &Tree::setShowVertScrollbar, &Tree::isVertScrollbarAlwaysShown, false /* TODO: Inconsistency */ ); CEGUI_DEFINE_PROPERTY(Tree, bool, "ForceHorzScrollbar", "Property to get/set the 'always show' setting for the horizontal " "scroll bar of the tree. Value is either \"true\" or \"false\".", &Tree::setShowHorzScrollbar, &Tree::isHorzScrollbarAlwaysShown, false /* TODO: Inconsistency */ ); CEGUI_DEFINE_PROPERTY(Tree, bool, "ItemTooltips", "Property to access the show item tooltips setting of the tree. " "Value is either \"true\" or \"false\".", &Tree::setItemTooltipsEnabled, &Tree::isItemTooltipsEnabled, false /* TODO: Inconsistency */ ); } /************************************************************************* Remove all items from the list. *************************************************************************/ bool Tree::resetList_impl(void) { // just return false if the list is already empty if (getItemCount() == 0) { return false; } // we have items to be removed and possible deleted else { // delete any items we are supposed to for (size_t i = 0; i < getItemCount(); ++i) { // if item is supposed to be deleted by us if (d_listItems[i]->isAutoDeleted()) { // clean up this item. CEGUI_DELETE_AO d_listItems[i]; } } // clear out the list. d_listItems.clear(); d_lastSelected = 0; return true; } } /************************************************************************* Handler for scroll position changes. *************************************************************************/ bool Tree::handle_scrollChange(const EventArgs&) { // simply trigger a redraw of the Tree. invalidate(); return true; } bool Tree::handleFontRenderSizeChange(const EventArgs& args) { bool res = Window::handleFontRenderSizeChange(args); if (!res) { const Font* const font = static_cast<const FontEventArgs&>(args).font; for (size_t i = 0; i < getItemCount(); ++i) res |= d_listItems[i]->handleFontRenderSizeChange(font); if (res) invalidate(); } return res; } ////////////////////////////////////////////////////////////////////////// /************************************************************************* Functions used for predicates in std algorithms *************************************************************************/ ////////////////////////////////////////////////////////////////////////// /************************************************************************* used for < comparisons between TreeItem pointers *************************************************************************/ bool lbi_less(const TreeItem* a, const TreeItem* b) { return *a < *b; } /************************************************************************* used for > comparisons between TreeItem pointers *************************************************************************/ bool lbi_greater(const TreeItem* a, const TreeItem* b) { return *a > *b; } } // End of CEGUI namespace section
34.646263
136
0.513004
liang47009
f4956f9c596c1858cf0e683584313d263b0509c4
1,059
hpp
C++
modules/sdk/include/nt2/sdk/memory/padding.hpp
brycelelbach/nt2
73d7e8dd390fa4c8d251c6451acdae65def70e0b
[ "BSL-1.0" ]
1
2022-03-24T03:35:10.000Z
2022-03-24T03:35:10.000Z
modules/sdk/include/nt2/sdk/memory/padding.hpp
brycelelbach/nt2
73d7e8dd390fa4c8d251c6451acdae65def70e0b
[ "BSL-1.0" ]
null
null
null
modules/sdk/include/nt2/sdk/memory/padding.hpp
brycelelbach/nt2
73d7e8dd390fa4c8d251c6451acdae65def70e0b
[ "BSL-1.0" ]
null
null
null
/******************************************************************************* * Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II * Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI * * Distributed under the Boost Software License, Version 1.0. * See accompanying file LICENSE.txt or copy at * http://www.boost.org/LICENSE_1_0.txt ******************************************************************************/ #ifndef NT2_SDK_MEMORY_PADDING_HPP_INCLUDED #define NT2_SDK_MEMORY_PADDING_HPP_INCLUDED //////////////////////////////////////////////////////////////////////////////// // Padding strategies and related functors //////////////////////////////////////////////////////////////////////////////// namespace nt2 { namespace tag { template<class T> struct padding_ {}; } namespace meta { template<class T> struct padding_ : unspecified_<T> { typedef unspecified_<T> parent; typedef tag::padding_<T> type; }; } } #endif
35.3
80
0.460812
brycelelbach
f495aedea4e41eb706b3880fb79b008473595cf9
1,963
cpp
C++
Source/System/auth/xbox_live_server.cpp
blgrossMS/xbox-live-api
17c586336e11f0fa3a2a3f3acd665b18c5487b24
[ "MIT" ]
2
2021-07-17T13:34:20.000Z
2022-01-09T00:55:51.000Z
Source/System/auth/xbox_live_server.cpp
blgrossMS/xbox-live-api
17c586336e11f0fa3a2a3f3acd665b18c5487b24
[ "MIT" ]
null
null
null
Source/System/auth/xbox_live_server.cpp
blgrossMS/xbox-live-api
17c586336e11f0fa3a2a3f3acd665b18c5487b24
[ "MIT" ]
1
2018-11-18T08:32:40.000Z
2018-11-18T08:32:40.000Z
//********************************************************* // // Copyright (c) Microsoft. All rights reserved. // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. // //********************************************************* #include "pch.h" #include "xsapi/system.h" #include "xbox_live_server_impl.h" using namespace XBOX_LIVE_NAMESPACE; NAMESPACE_MICROSOFT_XBOX_SERVICES_SYSTEM_CPP_BEGIN xbox_live_server::xbox_live_server() { m_server_impl = std::make_shared<xbox_live_server_impl>(); } pplx::task<xbox_live_result<void>> xbox_live_server::signin(_In_ cert_context cert) { return m_server_impl->signin(std::move(cert), false); } pplx::task<xbox_live_result<token_and_signature_result>> xbox_live_server::get_token_and_signature( _In_ const string_t& httpMethod, _In_ const string_t& url, _In_ const string_t& headers ) { return m_server_impl->get_token_and_signature(httpMethod, url, headers); } pplx::task<xbox_live_result<token_and_signature_result>> xbox_live_server::get_token_and_signature( _In_ const string_t& httpMethod, _In_ const string_t& url, _In_ const string_t& headers, _In_ const string_t& requestBodyString ) { return m_server_impl->get_token_and_signature(httpMethod, url, headers, requestBodyString); } pplx::task<xbox_live_result<token_and_signature_result>> xbox_live_server::get_token_and_signature_array( _In_ const string_t& httpMethod, _In_ const string_t& url, _In_ const string_t& headers, _In_ const std::vector<unsigned char>& requestBodyArray ) { return m_server_impl->get_token_and_signature_array(httpMethod, url, headers, requestBodyArray); } bool xbox_live_server::is_signed_in() const { return m_server_impl->is_signed_in(); } NAMESPACE_MICROSOFT_XBOX_SERVICES_SYSTEM_CPP_END
28.449275
100
0.731024
blgrossMS
f495b0417ffb6b2773358e29281900d81e1a8a6d
2,938
cpp
C++
d19/a.cpp
Immortale-dev/adventofcode2022
019c0a08ff23e9fcb79c75a08b1cebd65333ca24
[ "MIT" ]
null
null
null
d19/a.cpp
Immortale-dev/adventofcode2022
019c0a08ff23e9fcb79c75a08b1cebd65333ca24
[ "MIT" ]
null
null
null
d19/a.cpp
Immortale-dev/adventofcode2022
019c0a08ff23e9fcb79c75a08b1cebd65333ca24
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; #include "../helpers/string_helpers.cpp" #include "./scanner.cpp" typedef long long int ll; vector<Scanner> input; vector<bool> done; vector<Beacon> positions; void prepare() { string s; Scanner scan; while(getline(cin, s)){ if(s == ""){ input.push_back(scan); } else if(s[1] == '-') { scan = Scanner(); } else { auto arr = split_line(s, ","); scan.add_beacon({stoi(arr[0]), stoi(arr[1]), stoi(arr[2])}); } } input.push_back(scan); done = vector<bool>(input.size(), false); positions = vector<Beacon>(input.size(), {0,0,0}); } ll get_beacon_id(Beacon b){ return ((ll)(b.x * 100000000LL)) + ((ll)(b.y * 10000LL)) + ((ll)(b.z)); } bool try_resolve(int ia, int ib) { auto& scanA = input[ia]; auto& scanB = input[ib]; set<ll> ids; for(auto& it : scanA.get_beacons()){ ids.insert(get_beacon_id(it)); } for(int xi=0;xi<4;xi++) { for(int yi=0;yi<4;yi++){ for(int zi=0;zi<4;zi++){ // Try to match scans for(auto& itA : scanA.get_beacons()){ for(auto& itB : scanB.get_beacons()){ int mx = itB.x-itA.x; int my = itB.y-itA.y; int mz = itB.z-itA.z; int matchCount = 0; for(auto& itC : scanB.get_beacons()){ Beacon b{itC.x-mx, itC.y-my, itC.z-mz}; if(ids.count(get_beacon_id(b))){ matchCount++; } } if(matchCount >= 12){ // Found! done[ib] = true; positions[ib] = {positions[ia].x+mx, positions[ia].y+my, positions[ia].z+mz}; return true; } } } scanB.rotateZ(1); } scanB.rotateY(1); } scanB.rotateX(1); } return false; } void print_progress(double coof) { cout << "\033[s"; // save pos cout << "\033[K"; // erase line cout << "["; for(int i=0;i<=30;i++){ if((double)i/30 < coof) cout << "*"; else cout <<" "; } cout << "]"; cout << flush; cout << "\033[u"; // restore pos } ll first() { done[0] = true; queue<int> q; q.push(0); int cnt = 0; while(!q.empty()) { int ind = q.front(); q.pop(); print_progress((double)(++cnt)/input.size()); for(int j=0;j<input.size();j++){ if(!done[j]) { if(try_resolve(ind, j)) { q.push(j); } } } } cout << "\033[K"; // erase line for(auto it : done){ assert(it); } int sz = 0; for(auto& scan : input){ sz += scan.get_beacons().size(); } set<ll> ids; for(int i=0;i<input.size();i++){ auto& scan = input[i]; for(auto& it : scan.get_beacons()){ ids.insert(get_beacon_id( {it.x-positions[i].x, it.y-positions[i].y, it.z-positions[i].z} )); } } return ids.size(); } ll second() { int mx = 0; for(auto& ita : positions) { for(auto& itb : positions) { mx = max(mx, abs(ita.x-itb.x) + abs(ita.y-itb.y) + abs(ita.z-itb.z)); } } return mx; } int main() { prepare(); cout << "First: " << first() << endl; cout << "Second: " << second() << endl; return 0; }
18.594937
96
0.544929
Immortale-dev
f496fc72fdd138931d57def66ecf6c8039d63fc7
2,428
cpp
C++
Lumos/src/Graphics/Camera/FPSCamera.cpp
ValtoGameEngines/Lumos-Engine
69b6b9ec0fb43ed963d2080fee93d730cca71ca1
[ "MIT" ]
1
2021-09-24T04:23:52.000Z
2021-09-24T04:23:52.000Z
Lumos/src/Graphics/Camera/FPSCamera.cpp
ValtoGameEngines/Lumos-Engine
69b6b9ec0fb43ed963d2080fee93d730cca71ca1
[ "MIT" ]
null
null
null
Lumos/src/Graphics/Camera/FPSCamera.cpp
ValtoGameEngines/Lumos-Engine
69b6b9ec0fb43ed963d2080fee93d730cca71ca1
[ "MIT" ]
null
null
null
#include "lmpch.h" #include "FPSCamera.h" #include "App/Application.h" #include "Core/OS/Input.h" #include "Core/OS/Window.h" #include "Camera.h" #include <imgui/imgui.h> namespace Lumos { FPSCameraController::FPSCameraController(Camera* camera) : CameraController(camera) { } FPSCameraController::~FPSCameraController() = default; void FPSCameraController::HandleMouse(float dt, float xpos, float ypos) { if (Input::GetInput()->GetWindowFocus()) { { Maths::Vector2 windowCentre = Maths::Vector2(); xpos -= windowCentre.x; ypos -= windowCentre.y; float pitch = m_Camera->GetPitch(); float yaw = m_Camera->GetYaw(); pitch -= (ypos)* m_MouseSensitivity; yaw -= (xpos)* m_MouseSensitivity; Application::Instance()->GetWindow()->SetMousePosition(windowCentre); if (yaw < 0) yaw += 360.0f; if (yaw > 360.0f) yaw -= 360.0f; m_Camera->SetYaw(yaw); m_Camera->SetPitch(pitch); } m_PreviousCurserPos = Maths::Vector2(xpos, ypos); UpdateScroll(Input::GetInput()->GetScrollOffset(), dt); } } void FPSCameraController::HandleKeyboard(float dt) { float pitch = m_Camera->GetPitch(); float yaw = m_Camera->GetYaw(); const Maths::Quaternion orientation = Maths::Quaternion::EulerAnglesToQuaternion(pitch, yaw, 1.0f); Maths::Vector3 up = Maths::Vector3(0, 1, 0), right = Maths::Vector3(1, 0, 0), forward = Maths::Vector3(0, 0, -1); up = orientation * up; right = orientation * right; forward = orientation * forward; m_CameraSpeed = 1000.0f * dt; if (Input::GetInput()->GetKeyHeld(LUMOS_KEY_W)) { m_Velocity += forward * m_CameraSpeed; } if (Input::GetInput()->GetKeyHeld(LUMOS_KEY_S)) { m_Velocity -= forward * m_CameraSpeed; } if (Input::GetInput()->GetKeyHeld(LUMOS_KEY_A)) { m_Velocity -= right * m_CameraSpeed; } if (Input::GetInput()->GetKeyHeld(LUMOS_KEY_D)) { m_Velocity += right * m_CameraSpeed; } if (Input::GetInput()->GetKeyHeld(LUMOS_KEY_SPACE)) { m_Velocity -= up * m_CameraSpeed; } if (Input::GetInput()->GetKeyHeld(LUMOS_KEY_LEFT_SHIFT)) { m_Velocity += up * m_CameraSpeed; } Maths::Vector3 pos = m_Camera->GetPosition(); pos += m_Velocity * dt; m_Velocity = m_Velocity * pow(m_DampeningFactor, dt); m_Camera->SetPosition(pos); } }
23.346154
115
0.639209
ValtoGameEngines
f49b2391c7e107730908b9ec22f27767fe1a3b85
1,241
cpp
C++
test/test_vector.cpp
snorrwe/minomaly
a717934f0f6d1f00c92e46712a808dcd7d278e5d
[ "MIT" ]
1
2018-01-04T04:56:53.000Z
2018-01-04T04:56:53.000Z
test/test_vector.cpp
snorrwe/minomaly
a717934f0f6d1f00c92e46712a808dcd7d278e5d
[ "MIT" ]
20
2018-01-15T09:54:21.000Z
2018-02-01T00:20:35.000Z
test/test_vector.cpp
snorrwe/minomaly
a717934f0f6d1f00c92e46712a808dcd7d278e5d
[ "MIT" ]
null
null
null
#include "minomaly/common/vector.hpp" #include "gtest/gtest.h" namespace { using namespace mino; TEST(Vector2, CanCalculateDotProductWithIdentityMatrix) { auto v = Vector2{std::array{1.0f, 2.0f}}; auto m = Matrix<2, 2>{std::array{1.0f, 0.0f, 0.0f, 1.0f}}; auto result = v.dot(m); const auto expected = Vector2{std::array{1.0f, 2.0f}}; ASSERT_EQ(result, expected); } TEST(Vector2, CanCalculateDotProductWithNullMatrix) { auto v = Vector2{std::array{1.0f, 2.0f}}; auto m = Matrix<2, 2>{std::array{0.0f, 0.0f, 0.0f, 0.0f}}; auto result = v.dot(m); const auto expected = Vector2{std::array{0.0f, 0.0f}}; ASSERT_EQ(result, expected); } TEST(Vector2, CanCalculateDotProductWithRotationMatrix) { auto v = Vector2{std::array{1.0f, 2.0f}}; auto m = Matrix<2, 2>{std::array{0.0f, -1.0f, 1.0f, 0.0f}}; auto result = v.dot(m); const auto expected = Vector2{std::array{2.0f, -1.0f}}; ASSERT_EQ(result, expected); } TEST(Vector2, CanAddTwoVectors) { const auto v1 = Vector2{std::array{1.0f, 2.0f}}; const auto v2 = Vector2{std::array{2.0f, 1.0f}}; const auto result = v1 + v2; EXPECT_EQ(result.at(0), 3.0f); EXPECT_EQ(result.at(1), 3.0f); } } // namespace
21.396552
63
0.636583
snorrwe
f49b45244cf94f256ab7e87288ec6bb5749f3e3d
4,462
inl
C++
src/math/q3Mat3.inl
TraistaRafael/qu3e
abdb7a964ad6278dab21ed5bec5937f231c0f20b
[ "Zlib" ]
791
2015-01-04T02:26:39.000Z
2022-03-30T12:31:36.000Z
src/math/q3Mat3.inl
TraistaRafael/qu3e
abdb7a964ad6278dab21ed5bec5937f231c0f20b
[ "Zlib" ]
48
2015-02-17T19:29:51.000Z
2021-12-21T01:08:28.000Z
src/math/q3Mat3.inl
TraistaRafael/qu3e
abdb7a964ad6278dab21ed5bec5937f231c0f20b
[ "Zlib" ]
108
2015-02-16T08:20:04.000Z
2022-03-01T09:39:47.000Z
//-------------------------------------------------------------------------------------------------- // q3Mat3.inl // // Copyright (c) 2014 Randy Gaul http://www.randygaul.net // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not // be misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- // q3Mat3 //-------------------------------------------------------------------------------------------------- inline void q3Identity( q3Mat3& m ) { m.Set( r32( 1.0 ), r32( 0.0 ), r32( 0.0 ), r32( 0.0 ), r32( 1.0 ), r32( 0.0 ), r32( 0.0 ), r32( 0.0 ), r32( 1.0 ) ); } //-------------------------------------------------------------------------------------------------- inline const q3Mat3 q3Rotate( const q3Vec3& x, const q3Vec3& y, const q3Vec3& z ) { return q3Mat3( x, y, z ); } //-------------------------------------------------------------------------------------------------- inline const q3Mat3 q3Transpose( const q3Mat3& m ) { return q3Mat3( m.ex.x, m.ey.x, m.ez.x, m.ex.y, m.ey.y, m.ez.y, m.ex.z, m.ey.z, m.ez.z ); } //-------------------------------------------------------------------------------------------------- inline void q3Zero( q3Mat3& m ) { memset( &m, 0, sizeof( r32 ) * 9 ); } //-------------------------------------------------------------------------------------------------- inline const q3Mat3 q3Diagonal( r32 a ) { return q3Mat3( r32( a ), r32( 0.0 ), r32( 0.0 ), r32( 0.0 ), r32( a ), r32( 0.0 ), r32( 0.0 ), r32( 0.0 ), r32( a ) ); } //-------------------------------------------------------------------------------------------------- inline const q3Mat3 q3Diagonal( r32 a, r32 b, r32 c ) { return q3Mat3( r32( a ), r32( 0.0 ), r32( 0.0 ), r32( 0.0 ), r32( b ), r32( 0.0 ), r32( 0.0 ), r32( 0.0 ), r32( c ) ); } //-------------------------------------------------------------------------------------------------- inline const q3Mat3 q3OuterProduct( const q3Vec3& u, const q3Vec3& v ) { q3Vec3 a = v * u.x; q3Vec3 b = v * u.y; q3Vec3 c = v * u.z; return q3Mat3( a.x, a.y, a.z, b.x, b.y, b.z, c.x, c.y, c.z ); } //-------------------------------------------------------------------------------------------------- inline const q3Mat3 q3Covariance( q3Vec3 *points, u32 numPoints ) { r32 invNumPoints = r32( 1.0 ) / r32( numPoints ); q3Vec3 c = q3Vec3( r32( 0.0 ), r32( 0.0 ), r32( 0.0 ) ); for ( u32 i = 0; i < numPoints; ++i ) c += points[ i ]; c /= r32( numPoints ); r32 m00, m11, m22, m01, m02, m12; m00 = m11 = m22 = m01 = m02 = m12 = r32( 0.0 ); for ( u32 i = 0; i < numPoints; ++i ) { q3Vec3 p = points[ i ] - c; m00 += p.x * p.x; m11 += p.y * p.y; m22 += p.z * p.z; m01 += p.x * p.y; m02 += p.x * p.z; m12 += p.y * p.z; } r32 m01inv = m01 * invNumPoints; r32 m02inv = m02 * invNumPoints; r32 m12inv = m12 * invNumPoints; return q3Mat3( m00 * invNumPoints, m01inv, m02inv, m01inv, m11 * invNumPoints, m12inv, m02inv, m12inv, m22 * invNumPoints ); }; //-------------------------------------------------------------------------------------------------- inline const q3Mat3 q3Inverse( const q3Mat3& m ) { q3Vec3 tmp0, tmp1, tmp2; r32 detinv; tmp0 = q3Cross( m.ey, m.ez ); tmp1 = q3Cross( m.ez, m.ex ); tmp2 = q3Cross( m.ex, m.ey ); detinv = r32( 1.0 ) / q3Dot( m.ez, tmp2 ); return q3Mat3( tmp0.x * detinv, tmp1.x * detinv, tmp2.x * detinv, tmp0.y * detinv, tmp1.y * detinv, tmp2.y * detinv, tmp0.z * detinv, tmp1.z * detinv, tmp2.z * detinv ); }
30.772414
100
0.44173
TraistaRafael
f49b50d843b661fb801dcd5fcbc1cc05e9c875b0
621
cpp
C++
Kaminec/kits/JsonKit/AssetIndex.cpp
kaniol-lck/Kaminec
bdbb6645035d6124a3772742362e683938b389fb
[ "BSD-2-Clause" ]
23
2017-06-23T11:58:27.000Z
2022-03-05T06:58:49.000Z
Kaminec/kits/JsonKit/AssetIndex.cpp
kaniol-lck/Kaminec
bdbb6645035d6124a3772742362e683938b389fb
[ "BSD-2-Clause" ]
4
2017-12-08T11:41:19.000Z
2021-04-03T17:50:39.000Z
Kaminec/kits/JsonKit/AssetIndex.cpp
kaniol-lck/Kaminec
bdbb6645035d6124a3772742362e683938b389fb
[ "BSD-2-Clause" ]
5
2019-02-19T13:03:42.000Z
2021-11-04T13:58:04.000Z
#include "AssetIndex.h" #include "assistance/utility.h" #include <QUrl> AssetIndex::AssetIndex(const QVariant &assetIndexVariant) : assetIndexVariant_(assetIndexVariant) {} QString AssetIndex::id() const { return value(assetIndexVariant_, "id").toString(); } int AssetIndex::size() const { return value(assetIndexVariant_, "size").toInt(); } QString AssetIndex::sha1() const { return value(assetIndexVariant_, "sha1").toString(); } QUrl AssetIndex::url() const { return value(assetIndexVariant_, "url").toUrl(); } int AssetIndex::totalSize() const { return value(assetIndexVariant_, "totalSize").toInt(); }
17.742857
59
0.73752
kaniol-lck
f49c41d00d8b90333aad4c81d000cc5866e3bc90
10,826
cc
C++
sync/sessions/session_state.cc
gavinp/chromium
681563ea0f892a051f4ef3d5e53438e0bb7d2261
[ "BSD-3-Clause" ]
1
2016-03-10T09:13:57.000Z
2016-03-10T09:13:57.000Z
sync/sessions/session_state.cc
gavinp/chromium
681563ea0f892a051f4ef3d5e53438e0bb7d2261
[ "BSD-3-Clause" ]
1
2022-03-13T08:39:05.000Z
2022-03-13T08:39:05.000Z
sync/sessions/session_state.cc
gavinp/chromium
681563ea0f892a051f4ef3d5e53438e0bb7d2261
[ "BSD-3-Clause" ]
null
null
null
// 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 "sync/sessions/session_state.h" #include <map> #include <set> #include <string> #include <utility> #include <vector> #include "base/base64.h" #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" #include "sync/protocol/proto_enum_conversions.h" using std::set; using std::vector; namespace browser_sync { namespace sessions { SyncSourceInfo::SyncSourceInfo() : updates_source(sync_pb::GetUpdatesCallerInfo::UNKNOWN) {} SyncSourceInfo::SyncSourceInfo( const syncable::ModelTypePayloadMap& t) : updates_source(sync_pb::GetUpdatesCallerInfo::UNKNOWN), types(t) {} SyncSourceInfo::SyncSourceInfo( const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u, const syncable::ModelTypePayloadMap& t) : updates_source(u), types(t) {} SyncSourceInfo::~SyncSourceInfo() {} DictionaryValue* SyncSourceInfo::ToValue() const { DictionaryValue* value = new DictionaryValue(); value->SetString("updatesSource", GetUpdatesSourceString(updates_source)); value->Set("types", syncable::ModelTypePayloadMapToValue(types)); return value; } SyncerStatus::SyncerStatus() : invalid_store(false), num_successful_commits(0), num_successful_bookmark_commits(0), num_updates_downloaded_total(0), num_tombstone_updates_downloaded_total(0), num_reflected_updates_downloaded_total(0), num_local_overwrites(0), num_server_overwrites(0) { } SyncerStatus::~SyncerStatus() { } DictionaryValue* SyncerStatus::ToValue() const { DictionaryValue* value = new DictionaryValue(); value->SetBoolean("invalidStore", invalid_store); value->SetInteger("numSuccessfulCommits", num_successful_commits); value->SetInteger("numSuccessfulBookmarkCommits", num_successful_bookmark_commits); value->SetInteger("numUpdatesDownloadedTotal", num_updates_downloaded_total); value->SetInteger("numTombstoneUpdatesDownloadedTotal", num_tombstone_updates_downloaded_total); value->SetInteger("numReflectedUpdatesDownloadedTotal", num_reflected_updates_downloaded_total); value->SetInteger("numLocalOverwrites", num_local_overwrites); value->SetInteger("numServerOverwrites", num_server_overwrites); return value; } DictionaryValue* DownloadProgressMarkersToValue( const std::string (&download_progress_markers)[syncable::MODEL_TYPE_COUNT]) { DictionaryValue* value = new DictionaryValue(); for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { // TODO(akalin): Unpack the value into a protobuf. std::string base64_marker; bool encoded = base::Base64Encode(download_progress_markers[i], &base64_marker); DCHECK(encoded); value->SetString( syncable::ModelTypeToString(syncable::ModelTypeFromInt(i)), base64_marker); } return value; } ErrorCounters::ErrorCounters() : last_download_updates_result(UNSET), last_post_commit_result(UNSET), last_process_commit_response_result(UNSET) { } SyncSessionSnapshot::SyncSessionSnapshot( const SyncerStatus& syncer_status, const ErrorCounters& errors, int64 num_server_changes_remaining, bool is_share_usable, syncable::ModelTypeSet initial_sync_ended, const std::string (&download_progress_markers)[syncable::MODEL_TYPE_COUNT], bool more_to_sync, bool is_silenced, int64 unsynced_count, int num_encryption_conflicts, int num_hierarchy_conflicts, int num_simple_conflicts, int num_server_conflicts, bool did_commit_items, const SyncSourceInfo& source, bool notifications_enabled, size_t num_entries, base::Time sync_start_time, bool retry_scheduled) : syncer_status(syncer_status), errors(errors), num_server_changes_remaining(num_server_changes_remaining), is_share_usable(is_share_usable), initial_sync_ended(initial_sync_ended), download_progress_markers(), has_more_to_sync(more_to_sync), is_silenced(is_silenced), unsynced_count(unsynced_count), num_encryption_conflicts(num_encryption_conflicts), num_hierarchy_conflicts(num_hierarchy_conflicts), num_simple_conflicts(num_simple_conflicts), num_server_conflicts(num_server_conflicts), did_commit_items(did_commit_items), source(source), notifications_enabled(notifications_enabled), num_entries(num_entries), sync_start_time(sync_start_time), retry_scheduled(retry_scheduled) { for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { const_cast<std::string&>(this->download_progress_markers[i]).assign( download_progress_markers[i]); } } SyncSessionSnapshot::~SyncSessionSnapshot() {} DictionaryValue* SyncSessionSnapshot::ToValue() const { DictionaryValue* value = new DictionaryValue(); value->Set("syncerStatus", syncer_status.ToValue()); // We don't care too much if we lose precision here. value->SetInteger("numServerChangesRemaining", static_cast<int>(num_server_changes_remaining)); value->SetBoolean("isShareUsable", is_share_usable); value->Set("initialSyncEnded", syncable::ModelTypeSetToValue(initial_sync_ended)); value->Set("downloadProgressMarkers", DownloadProgressMarkersToValue(download_progress_markers)); value->SetBoolean("hasMoreToSync", has_more_to_sync); value->SetBoolean("isSilenced", is_silenced); // We don't care too much if we lose precision here, also. value->SetInteger("unsyncedCount", static_cast<int>(unsynced_count)); value->SetInteger("numEncryptionConflicts", num_encryption_conflicts); value->SetInteger("numHierarchyConflicts", num_hierarchy_conflicts); value->SetInteger("numSimpleConflicts", num_simple_conflicts); value->SetInteger("numServerConflicts", num_server_conflicts); value->SetBoolean("didCommitItems", did_commit_items); value->SetInteger("numEntries", num_entries); value->Set("source", source.ToValue()); value->SetBoolean("notificationsEnabled", notifications_enabled); return value; } std::string SyncSessionSnapshot::ToString() const { scoped_ptr<DictionaryValue> value(ToValue()); std::string json; base::JSONWriter::WriteWithOptions(value.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &json); return json; } ConflictProgress::ConflictProgress(bool* dirty_flag) : num_server_conflicting_items(0), num_hierarchy_conflicting_items(0), num_encryption_conflicting_items(0), dirty_(dirty_flag) { } ConflictProgress::~ConflictProgress() { } bool ConflictProgress::HasSimpleConflictItem(const syncable::Id& id) const { return simple_conflicting_item_ids_.count(id) > 0; } std::set<syncable::Id>::const_iterator ConflictProgress::SimpleConflictingItemsBegin() const { return simple_conflicting_item_ids_.begin(); } std::set<syncable::Id>::const_iterator ConflictProgress::SimpleConflictingItemsEnd() const { return simple_conflicting_item_ids_.end(); } void ConflictProgress::AddSimpleConflictingItemById( const syncable::Id& the_id) { std::pair<std::set<syncable::Id>::iterator, bool> ret = simple_conflicting_item_ids_.insert(the_id); if (ret.second) *dirty_ = true; } void ConflictProgress::EraseSimpleConflictingItemById( const syncable::Id& the_id) { int items_erased = simple_conflicting_item_ids_.erase(the_id); if (items_erased != 0) *dirty_ = true; } void ConflictProgress::AddEncryptionConflictingItemById( const syncable::Id& the_id) { std::pair<std::set<syncable::Id>::iterator, bool> ret = unresolvable_conflicting_item_ids_.insert(the_id); if (ret.second) { num_encryption_conflicting_items++; *dirty_ = true; } } void ConflictProgress::AddHierarchyConflictingItemById( const syncable::Id& the_id) { std::pair<std::set<syncable::Id>::iterator, bool> ret = unresolvable_conflicting_item_ids_.insert(the_id); if (ret.second) { num_hierarchy_conflicting_items++; *dirty_ = true; } } void ConflictProgress::AddServerConflictingItemById( const syncable::Id& the_id) { std::pair<std::set<syncable::Id>::iterator, bool> ret = unresolvable_conflicting_item_ids_.insert(the_id); if (ret.second) { num_server_conflicting_items++; *dirty_ = true; } } UpdateProgress::UpdateProgress() {} UpdateProgress::~UpdateProgress() {} void UpdateProgress::AddVerifyResult(const VerifyResult& verify_result, const sync_pb::SyncEntity& entity) { verified_updates_.push_back(std::make_pair(verify_result, entity)); } void UpdateProgress::AddAppliedUpdate(const UpdateAttemptResponse& response, const syncable::Id& id) { applied_updates_.push_back(std::make_pair(response, id)); } std::vector<AppliedUpdate>::iterator UpdateProgress::AppliedUpdatesBegin() { return applied_updates_.begin(); } std::vector<VerifiedUpdate>::const_iterator UpdateProgress::VerifiedUpdatesBegin() const { return verified_updates_.begin(); } std::vector<AppliedUpdate>::const_iterator UpdateProgress::AppliedUpdatesEnd() const { return applied_updates_.end(); } std::vector<VerifiedUpdate>::const_iterator UpdateProgress::VerifiedUpdatesEnd() const { return verified_updates_.end(); } int UpdateProgress::SuccessfullyAppliedUpdateCount() const { int count = 0; for (std::vector<AppliedUpdate>::const_iterator it = applied_updates_.begin(); it != applied_updates_.end(); ++it) { if (it->first == SUCCESS) count++; } return count; } // Returns true if at least one update application failed due to a conflict // during this sync cycle. bool UpdateProgress::HasConflictingUpdates() const { std::vector<AppliedUpdate>::const_iterator it; for (it = applied_updates_.begin(); it != applied_updates_.end(); ++it) { if (it->first != SUCCESS) { return true; } } return false; } AllModelTypeState::AllModelTypeState(bool* dirty_flag) : unsynced_handles(dirty_flag), syncer_status(dirty_flag), error(dirty_flag), num_server_changes_remaining(dirty_flag, 0), commit_set(ModelSafeRoutingInfo()) { } AllModelTypeState::~AllModelTypeState() {} PerModelSafeGroupState::PerModelSafeGroupState(bool* dirty_flag) : conflict_progress(dirty_flag) { } PerModelSafeGroupState::~PerModelSafeGroupState() { } } // namespace sessions } // namespace browser_sync
32.510511
76
0.730926
gavinp
f49d33317c09043a7d03871ead0b17c16930eb5c
4,081
cpp
C++
benchmark/HistoryModelBenchmark.cpp
heftyy/paste-history
fbcdda69fc3770f4eb318c63d69220b2781f27fe
[ "Apache-2.0" ]
null
null
null
benchmark/HistoryModelBenchmark.cpp
heftyy/paste-history
fbcdda69fc3770f4eb318c63d69220b2781f27fe
[ "Apache-2.0" ]
null
null
null
benchmark/HistoryModelBenchmark.cpp
heftyy/paste-history
fbcdda69fc3770f4eb318c63d69220b2781f27fe
[ "Apache-2.0" ]
null
null
null
#include <cctype> #include <chrono> #include <gsl/gsl> #include <iostream> #include <benchmark/benchmark.h> #include <HistoryItem.h> #include <HistoryItemModel.h> #include <QStandardItemModel> #include <FuzzySearch.h> static size_t GetTimestamp() { auto duration = std::chrono::system_clock::now().time_since_epoch(); return std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(); } struct StringWithScore { std::string m_String; int m_MatchScore; }; static std::string_view GetStringFunc(const StringWithScore& obj) { return obj.m_String; } #define HISTORY_MODEL_BENCHMARK(BENCHMARK_NAME) BENCHMARK(BENCHMARK_NAME)->Range(8, 8 << 10)->Unit(benchmark::kMicrosecond); void BM_ModelInsert(benchmark::State& state) { std::vector<std::string> strings = { "git init", "git status", "git add my_new_file.txt", "git commit -m \"Add three files\"", "git reset --soft HEAD^", "git remote add origin https://github.com/heftyy/fuzzy-search.git", }; HistoryItemModel history_model(nullptr); for (const auto _ : state) { for (auto i = 0; i < state.range(0); ++i) { for (std::string text : strings) { text += std::to_string(i); std::hash<std::string> hasher; const size_t text_hash = hasher(text); history_model.AddToHistory({text, text_hash, GetTimestamp()}); } } history_model.Clear(); } } HISTORY_MODEL_BENCHMARK(BM_ModelInsert); void BM_BasicInsert(benchmark::State& state) { std::vector<std::string> strings = { "git init", "git status", "git add my_new_file.txt", "git commit -m \"Add three files\"", "git reset --soft HEAD^", "git remote add origin https://github.com/heftyy/fuzzy-search.git", }; std::vector<HistoryItem> history_items; for (const auto _ : state) { for (auto i = 0; i < state.range(0); ++i) { for (std::string text : strings) { text += std::to_string(i); std::hash<std::string> hasher; const size_t text_hash = hasher(text); history_items.emplace_back(HistoryItemData{text, text_hash, GetTimestamp()}); } } history_items.clear(); } } HISTORY_MODEL_BENCHMARK(BM_BasicInsert); #include <thread> void BM_ModelFilterAndSort(benchmark::State& state) { std::vector<std::string> strings = { "git init", "git status", "git add my_new_file.txt", "git commit -m \"Add three files\"", "git reset --soft HEAD^", "git remote add origin https://github.com/heftyy/fuzzy-search.git", }; HistoryItemModel history_model(nullptr); std::vector<HistoryItemData> history_items_data; for (auto i = 0; i < state.range(0); ++i) { for (std::string text : strings) { text += std::to_string(i); std::hash<std::string> hasher; const size_t text_hash = hasher(text); history_model.AddToHistory({text, text_hash, GetTimestamp()}); } } bool pattern_switch = false; for (const auto _ : state) { //! Need to switch the pattern for every other search because UpdateFilterPattern won't search and resort //! for the same pattern twice in a row bool result = history_model.UpdateFilterPattern(pattern_switch ? "add1" : "add2"); pattern_switch = !pattern_switch; benchmark::DoNotOptimize(result); } } HISTORY_MODEL_BENCHMARK(BM_ModelFilterAndSort); void BM_BasicFilterAndSort(benchmark::State& state) { std::vector<std::string> strings = { "git init", "git status", "git add my_new_file.txt", "git commit -m \"Add three files\"", "git reset --soft HEAD^", "git remote add origin https://github.com/heftyy/fuzzy-search.git", }; std::vector<StringWithScore> benchmark_strings; for (auto i = 0; i < state.range(0); ++i) { for (std::string text : strings) { text += std::to_string(i); benchmark_strings.push_back({text, 0}); } } for (const auto _ : state) { auto result = FuzzySearch::Search("add", benchmark_strings.begin(), benchmark_strings.end(), &GetStringFunc, FuzzySearch::MatchMode::E_STRINGS); benchmark::DoNotOptimize(result); } } HISTORY_MODEL_BENCHMARK(BM_BasicFilterAndSort); BENCHMARK_MAIN();
25.191358
146
0.682431
heftyy
f49e07f365f787bcedbec5ce897041ead0d96fc2
9,072
cpp
C++
Development/Src/Engine/Src/UnSkeletalRender.cpp
addstone/unrealengine3
4579d360dfd52b12493292120b27bb430f978fc8
[ "FSFAP" ]
37
2020-05-22T18:18:47.000Z
2022-03-19T06:51:54.000Z
Development/Src/Engine/Src/UnSkeletalRender.cpp
AdanosGotoman/unrealengine3
4579d360dfd52b12493292120b27bb430f978fc8
[ "FSFAP" ]
null
null
null
Development/Src/Engine/Src/UnSkeletalRender.cpp
AdanosGotoman/unrealengine3
4579d360dfd52b12493292120b27bb430f978fc8
[ "FSFAP" ]
27
2020-05-17T01:03:30.000Z
2022-03-06T19:10:14.000Z
/*============================================================================= UnSkeletalRender.cpp: Skeletal mesh skinning/rendering code. Copyright 2003 Epic Games, Inc. All Rights Reserved. Revision history: * Created by Andrew Scheidecker * Vectorized versions of CacheVertices by Daniel Vogel * Optimizations by Bruce Dawson * Split into own file by James Golding =============================================================================*/ #include "EnginePrivate.h" #include "EngineAnimClasses.h" #include "UnSkeletalRender.h" // // FFinalSkinVertexBuffer::GetData // void FFinalSkinVertexBuffer::GetData(void* Buffer) { if(SkeletalMeshComponent->MeshObject->CachedVertexLOD != LOD) SkeletalMeshComponent->MeshObject->CacheVertices(LOD); appMemcpy(Buffer,&SkeletalMeshComponent->MeshObject->CachedFinalVertices(0),Size); } // // FSkinShadowVertexBuffer::GetData // void FSkinShadowVertexBuffer::GetData(void* Buffer) { if(SkeletalMeshComponent->MeshObject->CachedVertexLOD != LOD) SkeletalMeshComponent->MeshObject->CacheVertices(LOD); FSkinShadowVertex* DestVertex = (FSkinShadowVertex*)Buffer; const TArray<FFinalSkinVertex>& SrcVertices = SkeletalMeshComponent->MeshObject->CachedFinalVertices; for(UINT VertexIndex = 0;VertexIndex < (UINT)SrcVertices.Num();VertexIndex++) *DestVertex++ = FSkinShadowVertex(SrcVertices(VertexIndex).Position,0); for(UINT VertexIndex = 0;VertexIndex < (UINT)SrcVertices.Num();VertexIndex++) *DestVertex++ = FSkinShadowVertex(SrcVertices(VertexIndex).Position,1); } // // USkeletalMeshComponent::Render // void USkeletalMeshComponent::Render(const FSceneContext& Context,struct FPrimitiveRenderInterface* PRI) { if(MeshObject && !bHideSkin) { INT LODLevel = GetLODLevel(Context); if(Context.View->ViewMode & SVM_WireframeMask) { for(UINT SectionIndex = 0;SectionIndex < (UINT)SkeletalMesh->LODModels(LODLevel).Sections.Num();SectionIndex++) { FSkelMeshSection& Section = SkeletalMesh->LODModels(LODLevel).Sections(SectionIndex); PRI->DrawWireframe( &MeshObject->LODs(LODLevel).VertexFactory, &SkeletalMesh->LODModels(LODLevel).IndexBuffer, WT_TriList, SelectedColor(Context,GEngine->C_AnimMesh), Section.FirstIndex, Section.TotalFaces, Section.MinIndex, Section.MaxIndex ); } } else { for(UINT SectionIndex = 0;SectionIndex < (UINT)SkeletalMesh->LODModels(LODLevel).Sections.Num();SectionIndex++) { FSkelMeshSection& Section = SkeletalMesh->LODModels(LODLevel).Sections(SectionIndex); GEngineStats.SkeletalMeshTriangles.Value += Section.TotalFaces; PRI->DrawMesh( &MeshObject->LODs(LODLevel).VertexFactory, &SkeletalMesh->LODModels(LODLevel).IndexBuffer, SelectedMaterial(Context,GetMaterial(Section.MaterialIndex)), GetMaterial(Section.MaterialIndex)->GetInstanceInterface(), Section.FirstIndex, Section.TotalFaces, Section.MinIndex, Section.MaxIndex ); } } } // Debug drawing for assets. if( PhysicsAsset ) { FVector TotalScale; if(Owner) TotalScale = Owner->DrawScale * Owner->DrawScale3D; else TotalScale = FVector(1.f); // Only valid if scaling if uniform. if( TotalScale.IsUniform() ) { if(Context.View->ShowFlags & SHOW_Collision) PhysicsAsset->DrawCollision(PRI, this, TotalScale.X); if(Context.View->ShowFlags & SHOW_Constraints) PhysicsAsset->DrawConstraints(PRI, this, TotalScale.X); } } } // // USkeletalMeshComponent::RenderForeground // void USkeletalMeshComponent::RenderForeground(const FSceneContext& Context,FPrimitiveRenderInterface* PRI) { // Debug drawing of wire skeleton. if( bDisplayBones ) { TArray<FMatrix> WorldBases; WorldBases.Add( SpaceBases.Num() ); WorldBases(0) = SpaceBases(0) * LocalToWorld; for(INT i=0; i<SpaceBases.Num(); i++) { WorldBases(i) = SpaceBases(i) * LocalToWorld; if(i == 0) { PRI->DrawLine(WorldBases(i).GetOrigin(), LocalToWorld.GetOrigin(), FColor(255, 0, 255)); } else { INT ParentIdx = SkeletalMesh->RefSkeleton(i).ParentIndex; PRI->DrawLine(WorldBases(i).GetOrigin(), WorldBases(ParentIdx).GetOrigin(), FColor(230, 230, 255)); } // Display colored coordinate system axes for each joint. FVector XAxis = WorldBases(i).TransformNormal( FVector(1.0f,0.0f,0.0f)); XAxis.Normalize(); PRI->DrawLine( WorldBases(i).GetOrigin(), WorldBases(i).GetOrigin() + XAxis * 3.75f, FColor( 255, 80, 80) ); // Red = X FVector YAxis = WorldBases(i).TransformNormal( FVector(0.0f,1.0f,0.0f)); YAxis.Normalize(); PRI->DrawLine( WorldBases(i).GetOrigin(), WorldBases(i).GetOrigin() + YAxis * 3.75f, FColor( 80, 255, 80) ); // Green = Y FVector ZAxis = WorldBases(i).TransformNormal( FVector(0.0f,0.0f,1.0f)); ZAxis.Normalize(); PRI->DrawLine( WorldBases(i).GetOrigin(), WorldBases(i).GetOrigin() + ZAxis * 3.75f, FColor( 80, 80, 255) ); // Blue = Z } } // Debug drawing of bounding primitives. if( (Context.View->ShowFlags & SHOW_Bounds) && (!GIsEditor || !Owner || GSelectionTools.IsSelected( Owner ) ) ) { // Draw bounding wireframe box. PRI->DrawWireBox( Bounds.GetBox(), FColor(72,72,255)); PRI->DrawCircle(Bounds.Origin,FVector(1,0,0),FVector(0,1,0),FColor(255,255,0),Bounds.SphereRadius,32); PRI->DrawCircle(Bounds.Origin,FVector(1,0,0),FVector(0,0,1),FColor(255,255,0),Bounds.SphereRadius,32); PRI->DrawCircle(Bounds.Origin,FVector(0,1,0),FVector(0,0,1),FColor(255,255,0),Bounds.SphereRadius,32); } } // // USkeletalMeshComponent::RenderShadowVolume // void USkeletalMeshComponent::RenderShadowVolume(const FSceneContext& Context,struct FShadowRenderInterface* SRI,ULightComponent* Light) { FCycleCounterSection CycleCounter(GEngineStats.ShadowTime); EShadowStencilMode Mode = SSM_ZFail; INT LODLevel = GetLODLevel(Context); if(SkeletalMesh && SkeletalMesh->LODModels(LODLevel).ShadowIndices.Num() && MeshObject) { // Find the homogenous light position in local space. FPlane LightPosition = LocalToWorld.Inverse().TransformFPlane(Light->GetPosition()); FStaticLODModel& LODModel = SkeletalMesh->LODModels(LODLevel); if(MeshObject->CachedVertexLOD != LODLevel) MeshObject->CacheVertices(LODLevel); // Find the orientation of the triangles relative to the light position. FLOAT* PlaneDots = new FLOAT[LODModel.ShadowIndices.Num() / 3]; for(UINT TriangleIndex = 0;TriangleIndex < (UINT)LODModel.ShadowIndices.Num() / 3;TriangleIndex++) { const FVector& V1 = MeshObject->CachedFinalVertices(LODModel.ShadowIndices(TriangleIndex * 3 + 0)).Position, V2 = MeshObject->CachedFinalVertices(LODModel.ShadowIndices(TriangleIndex * 3 + 1)).Position, V3 = MeshObject->CachedFinalVertices(LODModel.ShadowIndices(TriangleIndex * 3 + 2)).Position; PlaneDots[TriangleIndex] = ((V2-V3) ^ (V1-V3)) | (FVector(LightPosition) - V1 * LightPosition.W); } // Extrude a shadow volume. FShadowIndexBuffer IndexBuffer; _WORD FirstExtrudedVertex = (LODModel.RigidVertices.Num() + LODModel.SoftVertices.Num()); IndexBuffer.Indices.Empty(LODModel.ShadowIndices.Num() * 2); for(UINT TriangleIndex = 0;TriangleIndex < (UINT)LODModel.ShadowIndices.Num() / 3;TriangleIndex++) { _WORD* TriangleIndices = &LODModel.ShadowIndices(TriangleIndex * 3); _WORD Offset = IsNegativeFloat(PlaneDots[TriangleIndex]) ? FirstExtrudedVertex : 0; if(Mode == SSM_ZFail || IsNegativeFloat(PlaneDots[TriangleIndex])) IndexBuffer.AddFace( Offset + TriangleIndices[0], Offset + TriangleIndices[1], Offset + TriangleIndices[2] ); if(LODModel.ShadowTriangleDoubleSided(TriangleIndex) && (Mode == SSM_ZFail || !IsNegativeFloat(PlaneDots[TriangleIndex]))) IndexBuffer.AddFace( (FirstExtrudedVertex - Offset) + TriangleIndices[2], (FirstExtrudedVertex - Offset) + TriangleIndices[1], (FirstExtrudedVertex - Offset) + TriangleIndices[0] ); } for(UINT EdgeIndex = 0;EdgeIndex < (UINT)LODModel.Edges.Num();EdgeIndex++) { FMeshEdge& Edge = LODModel.Edges(EdgeIndex); if(Edge.Faces[1] == INDEX_NONE || IsNegativeFloat(PlaneDots[Edge.Faces[0]]) != IsNegativeFloat(PlaneDots[Edge.Faces[1]])) { IndexBuffer.AddEdge( Edge.Vertices[IsNegativeFloat(PlaneDots[Edge.Faces[0]]) ? 1 : 0], Edge.Vertices[IsNegativeFloat(PlaneDots[Edge.Faces[0]]) ? 0 : 1], FirstExtrudedVertex ); if(LODModel.ShadowTriangleDoubleSided(Edge.Faces[0]) && Edge.Faces[1] != INDEX_NONE) IndexBuffer.AddEdge( Edge.Vertices[IsNegativeFloat(PlaneDots[Edge.Faces[0]]) ? 1 : 0], Edge.Vertices[IsNegativeFloat(PlaneDots[Edge.Faces[0]]) ? 0 : 1], FirstExtrudedVertex ); } } IndexBuffer.CalcSize(); delete [] PlaneDots; GEngineStats.ShadowTriangles.Value += IndexBuffer.Indices.Num() / 3; SRI->DrawShadowVolume( &MeshObject->LODs(LODLevel).ShadowVertexFactory, &IndexBuffer, 0, IndexBuffer.Indices.Num() / 3, 0, (LODModel.RigidVertices.Num() + LODModel.SoftVertices.Num()) * 2 -1, Mode ); } }
34.105263
135
0.706459
addstone
f49f96b04b4b364bcf289554f5f51b7b81a0b7c0
5,486
cpp
C++
Project/zoolib/GameEngine/Util.cpp
ElectricMagic/zoolib_cxx
cb3ccfde931b3989cd420fa093153204a7899805
[ "MIT" ]
13
2015-01-28T21:05:09.000Z
2021-11-03T22:21:11.000Z
Project/zoolib/GameEngine/Util.cpp
ElectricMagic/zoolib_cxx
cb3ccfde931b3989cd420fa093153204a7899805
[ "MIT" ]
null
null
null
Project/zoolib/GameEngine/Util.cpp
ElectricMagic/zoolib_cxx
cb3ccfde931b3989cd420fa093153204a7899805
[ "MIT" ]
4
2018-11-16T08:33:33.000Z
2021-12-11T19:40:46.000Z
// Copyright (c) 2019 Andrew Green. MIT License. http://www.zoolib.org #include "zoolib/GameEngine/Util.h" #include "zoolib/Callable_Function.h" #include "zoolib/Cartesian_Matrix.h" #include "zoolib/Chan_XX_Buffered.h" #include "zoolib/ChanRU_UTF_Std.h" #include "zoolib/Log.h" #include "zoolib/NameUniquifier.h" // For ThreadVal_NameUniquifier #include "zoolib/Util_Chan.h" #include "zoolib/Util_string.h" #include "zoolib/Util_ZZ_JSON.h" #include "zoolib/Util_ZZ_JSONB.h" //#include "zoolib/ZMACRO_auto.h" #include "zoolib/Apple/CGData_Channer.h" #include "zoolib/Apple/Pixmap_CGImage.h" #include "zoolib/GameEngine/Util_TextData.h" #include "zoolib/Pixels/Blit.h" #include "zoolib/Pixels/Formats.h" #include "zoolib/Pixels/PixmapCoder_PNG.h" namespace ZooLib { namespace GameEngine { using namespace Util_string; using Pixels::Ord; // ================================================================================================= #pragma mark - ZQ<GPoint> sQGPoint(const ZQ<Val>& iValQ) { if (iValQ) return sQGPoint(*iValQ); return null; } ZQ<GPoint> sQGPoint(const Val& iVal) { if (ZQ<CVec3> theCVecQ = sQCVec3(1, iVal)) return sCartesian(*theCVecQ); return null; } ZQ<GPoint> sQGPoint(const ZQ<Val_ZZ>& iValQ) { if (iValQ) return sQGPoint(*iValQ); return null; } ZQ<GPoint> sQGPoint(const Val_ZZ& iVal) { if (ZQ<CVec3> theCVecQ = sQCVec3(1, iVal)) return sCartesian(*theCVecQ); return null; } // ================================================================================================= #pragma mark - template <class Rect_p, class Seq_p> ZQ<Rect_p> spQGRect_T(const Seq_p& iSeq) { if (iSeq.Count() == 4) { if (false) {} else if (NotQ<Rat> l = sQRat(iSeq[0])) {} else if (NotQ<Rat> t = sQRat(iSeq[1])) {} else if (NotQ<Rat> r = sQRat(iSeq[2])) {} else if (NotQ<Rat> b = sQRat(iSeq[3])) {} else { return sRect<Rect_p>(*l, *t, *r, *b); } } if (ZMACRO_auto_(theFirstQ, sQCVec3(0, iSeq[0]))) { if (ZMACRO_auto_(theSecondQ, sQCVec3(0, iSeq[1]))) return sRect(*theFirstQ, *theFirstQ + *theSecondQ); else return sRect<Rect_p>(*theFirstQ); } return null; } ZQ<GRect> sQGRect(const ZQ<Val>& iValQ) { if (iValQ) return sQGRect(*iValQ); return null; } ZQ<GRect> sQGRect(const ZQ<Val_ZZ>& iValQ) { if (iValQ) return sQGRect(*iValQ); return null; } ZQ<GRect> sQGRect(const Val& iVal) { if (ZMACRO_auto_(theSeqQ, iVal.QGet<Seq>())) return spQGRect_T<GRect>(*theSeqQ); else if (ZMACRO_auto_(theSeqQ, iVal.QGet<Seq_ZZ>())) return spQGRect_T<GRect>(*theSeqQ); return null; } ZQ<GRect> sQGRect(const Val_ZZ& iVal) { if (ZMACRO_auto_(theSeqQ, iVal.QGet<Seq>())) return spQGRect_T<GRect>(*theSeqQ); else if (ZMACRO_auto_(theSeqQ, iVal.QGet<Seq_ZZ>())) return spQGRect_T<GRect>(*theSeqQ); return null; } // ================================================================================================= #pragma mark - static ZP<ChannerR_Bin> spChanner_Buffered(const ZP<ChannerR_Bin>& iChanner) { return sChannerR_Buffered(iChanner, 4096); } ZP<ChannerW_Bin> sCreateW_Clear(const FileSpec& iFS) { if (ZP<ChannerWPos_Bin> theChannerWPos = iFS.CreateWPos(true, true)) { sClear(*theChannerWPos); return theChannerWPos; } return null; } ZP<ChannerR_Bin> sOpenR_Buffered(const FileSpec& iFS) { if (ZP<ChannerR_Bin> theChannerR = iFS.OpenR()) return spChanner_Buffered(theChannerR); return null; } void sWriteBin(const ChanW_Bin& ww, const Val_ZZ& iVal) { Util_ZZ_JSONB::sWrite(ww, iVal); } Val_ZZ sReadBin(const ChanR_Bin& iChanR) { ThreadVal_NameUniquifier theNU; if (ZQ<Val_ZZ> theQ = Util_ZZ_JSONB::sQRead(iChanR)) return *theQ; return Val_ZZ(); } void sDump(const ChanW_UTF& ww, const Val& iVal) { sDump(ww, iVal.As<Val_ZZ>()); } void sDump(const Val& iVal) { sDump(iVal.As<Val_ZZ>()); } void sDump(const ChanW_UTF& ww, const Val_ZZ& iVal) { ww << "\n"; Util_ZZ_JSON::sWrite(ww, iVal, true); } void sDump(const Val_ZZ& iVal) { if (ZLOGF(w, eDebug-1)) sDump(w, iVal); } // ================================================================================================= #pragma mark - uint64 sNextID() { static uint64 spID; return ++spID; } // ================================================================================================= #if ZMACRO_IOS #else static bool spPremultiply(Ord iH, Ord iV, RGBA& ioColor, void* iRefcon) { sRed(ioColor) *= sAlpha(ioColor); sGreen(ioColor) *= sAlpha(ioColor); sBlue(ioColor) *= sAlpha(ioColor); return true; } #endif Pixmap sPixmap_PNG(const ZP<ChannerR_Bin>& iChannerR) { #if ZMACRO_IOS if (ZP<CGDataProviderRef> theProvider_File = CGData_Channer::sProvider(iChannerR)) { if (ZP<CGImageRef> theImageRef = sAdopt& ::CGImageCreateWithPNGDataProvider( theProvider_File, nullptr, true, kCGRenderingIntentDefault)) { //CGImageAlphaInfo theInfo = ::CGImageGetAlphaInfo(theImageRef); return sPixmap(theImageRef); } } #else if (Pixmap thePixmap = Pixels::sReadPixmap_PNG(*iChannerR)) { if (thePixmap.GetRasterDesc().fPixvalDesc.fDepth != 32) { const PointPOD theSize = thePixmap.Size(); Pixmap target = sPixmap(theSize, Pixels::EFormatStandard::RGBA_32, sRGBA(0,0,0,0)); sBlit(thePixmap, sRect<RectPOD>(theSize), target, sPointPOD(0,0)); thePixmap = target; } sMunge(thePixmap, spPremultiply, nullptr); return thePixmap; } #endif return null; } } // namespace GameEngine } // namespace ZooLib
23.545064
100
0.635436
ElectricMagic
f4a17da42ad498394629dca2918d914e5a087839
921
cpp
C++
test/types.cpp
jfalcou/tts
5b8326aa8706feb2a03d56d2b0a5ef0e1aa47b40
[ "MIT" ]
12
2020-11-12T17:15:44.000Z
2022-03-15T12:59:17.000Z
test/types.cpp
jfalcou/tts
5b8326aa8706feb2a03d56d2b0a5ef0e1aa47b40
[ "MIT" ]
14
2019-09-28T14:04:18.000Z
2021-12-11T20:08:31.000Z
test/types.cpp
jfalcou/tts
5b8326aa8706feb2a03d56d2b0a5ef0e1aa47b40
[ "MIT" ]
null
null
null
//================================================================================================== /** TTS - Tiny Test System Copyright : TTS Contributors & Maintainers SPDX-License-Identifier: MIT **/ //================================================================================================== #define TTS_MAIN #include <tts/tts.hpp> #include <array> TTS_CASE( "Check that types can be tested for equality" ) { TTS_TYPE_IS( std::add_pointer<float const>::type, float const* ); }; TTS_CASE( "Check that expression types can be tested for equality" ) { [[maybe_unused]] double d; TTS_EXPR_IS( &d + 5 , double* ); TTS_EXPR_IS( std::move(d) , double&& ); TTS_EXPR_IS( std::swap(d,d), void ); }; TTS_CASE_TPL( "Check interaction with templates" , int,float,char,void* ) <typename Type>(::tts::type<Type>) { TTS_TYPE_IS( std::add_const_t<Type>, Type const); };
27.909091
100
0.510315
jfalcou
f4a2bd62ae20afd210fd1a4f437a062a23cb1537
937
hpp
C++
src/Core/Game.hpp
iceonepiece/strong-man
c880b5ecadef87fe4bbcd1195526de8f020929cf
[ "MIT" ]
null
null
null
src/Core/Game.hpp
iceonepiece/strong-man
c880b5ecadef87fe4bbcd1195526de8f020929cf
[ "MIT" ]
null
null
null
src/Core/Game.hpp
iceonepiece/strong-man
c880b5ecadef87fe4bbcd1195526de8f020929cf
[ "MIT" ]
null
null
null
#pragma once #include <unordered_map> #include <string> #include <SDL2/SDL.h> #include <SDL2/SDL_ttf.h> #include "Input.hpp" class Game { public: Game(); virtual ~Game(); bool Initialize(); void Run(); void Shutdown(); void SetCurrentScene(std::string sceneName); unsigned int GetScreenWidth() { return m_ScreenWidth; } unsigned int GetScreenHeight() { return m_ScreenHeight; } class Font* GetFont(const std::string& name); class Audio* GetAudio() { return m_Audio; } protected: virtual void LoadData() = 0; virtual void UnloadData() = 0; bool m_Running; Uint32 m_TicksCount; unsigned int m_ScreenWidth; unsigned int m_ScreenHeight; class Renderer* m_Renderer; class Audio* m_Audio; Input m_Input; class Scene* m_CurrentScene; std::unordered_map<std::string, class Scene*> m_Scenes; std::unordered_map<std::string, class Font*> m_Fonts; private: void ProcessInput(); void Update(); void Render(); };
18.74
58
0.726788
iceonepiece
f4a32544899efae62c484bd86b3d20fcef64f0ed
4,530
cc
C++
ns-allinone-3.27/ns-3.27/src/stats/model/get-wildcard-matches.cc
zack-braun/4607_NS
43c8fb772e5552fb44bd7cd34173e73e3fb66537
[ "MIT" ]
93
2019-04-21T08:22:26.000Z
2022-03-30T04:26:29.000Z
ns-allinone-3.27/ns-3.27/src/stats/model/get-wildcard-matches.cc
zack-braun/4607_NS
43c8fb772e5552fb44bd7cd34173e73e3fb66537
[ "MIT" ]
12
2019-04-19T16:39:58.000Z
2021-06-22T13:18:32.000Z
ns-allinone-3.27/ns-3.27/src/stats/model/get-wildcard-matches.cc
zack-braun/4607_NS
43c8fb772e5552fb44bd7cd34173e73e3fb66537
[ "MIT" ]
21
2019-05-27T19:36:12.000Z
2021-07-26T02:37:41.000Z
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2013 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mitch Watrous (watrous@u.washington.edu) */ #include <string> #include <vector> #include "get-wildcard-matches.h" #include "ns3/assert.h" namespace ns3 { std::string GetWildcardMatches (const std::string &configPath, const std::string &matchedPath, const std::string &wildcardSeparator) { // If the Config path is just "*", return the whole matched path. if (configPath == "*") { return matchedPath; } std::vector<std::string> nonWildcardTokens; std::vector<std::size_t> nonWildcardTokenPositions; size_t nonWildcardTokenCount; size_t wildcardCount = 0; // Get the non-wildcard tokens from the Config path. size_t tokenStart; size_t asterisk = -1; do { // Find the non-wildcard token. tokenStart = asterisk + 1; asterisk = configPath.find ("*", tokenStart); // If a wildcard character was found, increment this counter. if (asterisk != std::string::npos) { wildcardCount++; } // Save this non-wildcard token. nonWildcardTokens.push_back (configPath.substr (tokenStart, asterisk - tokenStart)); } while (asterisk != std::string::npos); // If there are no wildcards, return an empty string. if (wildcardCount == 0) { return ""; } // Set the number of non-wildcard tokens in the Config path. nonWildcardTokenCount = nonWildcardTokens.size (); size_t i; // Find the positions of the non-wildcard tokens in the matched path. size_t token; tokenStart = 0; for (i = 0; i < nonWildcardTokenCount; i++) { // Look for the non-wilcard token. token = matchedPath.find (nonWildcardTokens[i], tokenStart); // Make sure that the token is found. if (token == std::string::npos) { NS_ASSERT_MSG (false, "Error: non-wildcard token not found in matched path"); } // Save the position of this non-wildcard token. nonWildcardTokenPositions.push_back (token); // Start looking for the next non-wildcard token after the end of // this one. tokenStart = token + nonWildcardTokens[i].size (); } std::string wildcardMatches = ""; // Put the text matches from the matched path for each of the // wildcards in the Config path into a string, separated by the // specified separator. size_t wildcardMatchesSet = 0; size_t matchStart; size_t matchEnd; for (i = 0; i < nonWildcardTokenCount; i++) { // Find the start and end of this wildcard match. matchStart = nonWildcardTokenPositions[i] + nonWildcardTokens[i].size (); if (i != nonWildcardTokenCount - 1) { matchEnd = nonWildcardTokenPositions[i + 1] - 1; } else { matchEnd = matchedPath.length () - 1; } // This algorithm gets confused by zero length non-wildcard // tokens. So, only add this wildcard match and update the // counters if the match was calculated to start before it began. if (matchStart <= matchEnd) { // Add the wildcard match. wildcardMatches += matchedPath.substr (matchStart, matchEnd - matchStart + 1); // See if all of the wilcard matches have been set. wildcardMatchesSet++; if (wildcardMatchesSet == wildcardCount) { break; } else { // If there are still more to set, add the separator to // the end of the one just added. wildcardMatches += wildcardSeparator; } } } // Return the wildcard matches. return wildcardMatches; } } // namespace ns3
30.402685
90
0.629801
zack-braun
f4a43b686d4dbbefc7439ece623d1823bfadcd31
7,369
cc
C++
userFiles/simu/main/SimuCtrl.cc
mharding01/augmented-neuromuscular-RT-running
7e1ef00d3fdf9cfa9d59fc4f3a6a0e6dd792a834
[ "MIT" ]
null
null
null
userFiles/simu/main/SimuCtrl.cc
mharding01/augmented-neuromuscular-RT-running
7e1ef00d3fdf9cfa9d59fc4f3a6a0e6dd792a834
[ "MIT" ]
null
null
null
userFiles/simu/main/SimuCtrl.cc
mharding01/augmented-neuromuscular-RT-running
7e1ef00d3fdf9cfa9d59fc4f3a6a0e6dd792a834
[ "MIT" ]
null
null
null
#include "SimuCtrl.hh" #include "SensorsInfo.hh" #include "GaitFeatures.hh" #include "FitnessRun.hh" #include "FitnessQq.hh" #include "StopSimu.hh" #include "SwingStanceAnalysis.hh" #include "user_IO.h" #include "SimuOptions.h" #include "ContactGestion.hh" #include "SimuIndex.hh" #include "user_all_id.h" #include "cmake_config.h" #include <fstream> #define PERIOD_CTRL 1.0e-3 ///< period of the controller [s] #define TIME_EPSILON 1.0e-5 ///< safety to check the period of the controller [s] /*! \brief constructor * * \param[in] mbs_data Robotran structure * \param[in] ctrl controller */ SimuCtrl::SimuCtrl(MbsData *mbs_data, Ctrl *ctrl) { int flag_info, flag_features; SensorsInfo *sens_info; GaitFeatures *gait_features; this->ctrl = ctrl; this->mbs_data = mbs_data; options = mbs_data->user_IO->options; gcm_model = options->gcm_model; simu_constraint = options->simu_constraint; last_t_ctrl = 0.0; flag_info = 0; flag_features = 0; sens_info = NULL; gait_features = NULL; simu_index = new ModelSimuIndex(mbs_data, options); actuators = new RobotActuators(mbs_data, simu_index); for(int i=0; i<SIMU_CTRL_NB; i++) { switch (i) { case SENSORS_INFO: compute_tab.push_back(new SensorsInfo(mbs_data, simu_index)); sens_info = static_cast<SensorsInfo*>(compute_tab.back()); flag_info = 1; break; case GAIT_FEATURES: if (!flag_info) { std::cout << "Error: SensorsInfo not initialized !" << std::endl; exit(EXIT_FAILURE); } compute_tab.push_back(new GaitFeatures(mbs_data, simu_index, sens_info)); gait_features = static_cast<GaitFeatures*>(compute_tab.back()); flag_features = 1; break; case STOP_SIMULATION: if (!flag_info) { std::cout << "Error: SensorsInfo not initialized !" << std::endl; exit(EXIT_FAILURE); } compute_tab.push_back(new StopSimu(mbs_data, simu_index, sens_info)); break; case FITNESS: if (!flag_info) { std::cout << "Error: SensorsInfo not initialized !" << std::endl; exit(EXIT_FAILURE); } if (simu_constraint == SIMU_Qq_MATCH_WANG) { compute_tab.push_back(new FitnessQq(mbs_data, ctrl)); } else { compute_tab.push_back(new FitnessRun(mbs_data, ctrl, sens_info)); } break; default: break; } } if (!flag_info) { std::cout << "Error: SensorsInfo not initialized !" << std::endl; exit(EXIT_FAILURE); } if (!flag_features) { std::cout << "Error: GaitFeatures not initialized !" << std::endl; exit(EXIT_FAILURE); } if (gcm_model == MESH_GCM_MODEL) { gcm_mesh = new ComputeGCM(mbs_data, gait_features, sens_info); } links = new LinksRobot(mbs_data, simu_index, options); contact_shapes = NULL; rfoot_shape = NULL; lfoot_shape = NULL; dt = mbs_data->dt0; if (simu_constraint == SIMU_Qq_MATCH_WANG) { // position of driven joint std::ifstream ihip(PROJECT_SOURCE_DIR"/../userFiles/dataWang/hip.txt", std::ios::in); std::ifstream ihipp(PROJECT_SOURCE_DIR"/../userFiles/dataWang/hipp.txt", std::ios::in); std::ifstream ihippp(PROJECT_SOURCE_DIR"/../userFiles/dataWang/hippp.txt", std::ios::in); std::ifstream iknee(PROJECT_SOURCE_DIR"/../userFiles/dataWang/knee.txt", std::ios::in); std::ifstream ikneep(PROJECT_SOURCE_DIR"/../userFiles/dataWang/kneep.txt", std::ios::in); std::ifstream ikneepp(PROJECT_SOURCE_DIR"/../userFiles/dataWang/kneepp.txt", std::ios::in); std::ifstream iankle(PROJECT_SOURCE_DIR"/../userFiles/dataWang/ankle.txt", std::ios::in); std::ifstream ianklep(PROJECT_SOURCE_DIR"/../userFiles/dataWang/anklep.txt", std::ios::in); std::ifstream ianklepp(PROJECT_SOURCE_DIR"/../userFiles/dataWang/anklepp.txt", std::ios::in); if (!ihip.is_open() || !ihipp.is_open() || !ihippp.is_open()) { std::cout << "Error: cant open wang hip files" << std::endl; exit(1); } double num = 0.0; while (ihip >> num) RHipPos.push_back(num); num = 0.0; while (ihipp >> num) RHipVit.push_back(num); num = 0.0; while (ihippp >> num) RHipAcc.push_back(num); if (!iknee.is_open() || !ikneep.is_open() || !ikneepp.is_open()) { std::cout << "Error: cant open wang knee files" << std::endl; exit(1); } num = 0.0; while (iknee >> num) RKneePos.push_back(num); while (ikneep >> num) RKneeVit.push_back(num); num = 0.0; while (ikneepp >> num) RKneeAcc.push_back(num); if (!iankle.is_open() || !ianklep.is_open() || !ianklepp.is_open()) { std::cout << "Error: cant open wang ankle files" << std::endl; exit(1); } num = 0.0; while (iankle >> num) RAnklePos.push_back(num); while (ianklep >> num) RAnkleVit.push_back(num); num = 0.0; while (ianklepp >> num) RAnkleAcc.push_back(num); } } /*! \brief destructor */ SimuCtrl::~SimuCtrl() { if (gcm_model == MESH_GCM_MODEL) { delete gcm_mesh; } delete simu_index; delete actuators; delete links; for(unsigned int i=0; i<compute_tab.size(); i++) { delete compute_tab[i]; } } /*! \brief initialize the contactGeom parameters */ void SimuCtrl::init_contactGeom() { StopSimu *stop_simu; SwingStanceAnalysis *swing_stance; ContactGeom::RigidShape *cur_rigid; contact_shapes = static_cast<ContactGeom::ContactGestion*>(mbs_data->user_IO->contactGestion)->get_main_union(); if (gcm_model == PRIM_GCM_MODEL) { for(int i=0; i<contact_shapes->get_rigid_F_size(); i++) { cur_rigid = contact_shapes->get_rigid_F(i); if (cur_rigid->get_Fsens() == simu_index->get_mbs_F(SimuFsensIndex::RightFoot)) { rfoot_shape = cur_rigid; } else if (cur_rigid->get_Fsens() == simu_index->get_mbs_F(SimuFsensIndex::LeftFoot)) { lfoot_shape = cur_rigid; } } stop_simu = static_cast<StopSimu*>(compute_tab[STOP_SIMULATION]); swing_stance = static_cast<SwingStanceAnalysis*>(static_cast<GaitFeatures*>(compute_tab[GAIT_FEATURES])->get_feature(SWING_STANCE_FEAT)); stop_simu->set_rfoot_shape(rfoot_shape); stop_simu->set_lfoot_shape(lfoot_shape); swing_stance->set_rfoot_shape(rfoot_shape); swing_stance->set_lfoot_shape(lfoot_shape); } } /*! \brief computations */ void SimuCtrl::compute() { double t = mbs_data->tsim; compute_tab[SENSORS_INFO]->compute(); // controller if (t >= last_t_ctrl + PERIOD_CTRL - TIME_EPSILON) { last_t_ctrl = t; controller_loop_interface(mbs_data); } // normal computations for(unsigned int i=GAIT_FEATURES; i<compute_tab.size(); i++) { compute_tab[i]->compute(); } // GCM mesh if (gcm_model == MESH_GCM_MODEL) { gcm_mesh->state_compute(); } } /*! \brief driven variables */ void SimuCtrl::compute_driven() { if (simu_constraint == SIMU_Qq_MATCH_WANG) { double t = mbs_data->tsim; double index = t/dt; // position, speed, accel of hip from Wang data mbs_data->q[RHipSag_id] = RHipPos[index]; mbs_data->qd[RHipSag_id] = RHipVit[index]; mbs_data->qdd[RHipSag_id] = RHipAcc[index]; // position, speed, accel of knee from Wang data mbs_data->q[RKneeSag_id] = RKneePos[index]; mbs_data->qd[RKneeSag_id] = RKneeVit[index]; mbs_data->qdd[RKneeSag_id]= RKneeAcc[index]; // position, speed, accel of ankle from Wang data mbs_data->q[RAnkSag_id] = RAnklePos[index]; mbs_data->qd[RAnkSag_id] = RAnkleVit[index]; mbs_data->qdd[RAnkSag_id] = RAnkleAcc[index]; } }
25.150171
139
0.680011
mharding01
f4a47ce6fad08680e565e8ea9a255b563417cd40
535
hpp
C++
include/boost/url/url.hpp
syoliver/url
7a992f6aa758807bbcd2e92e413453da98ee0c3d
[ "BSL-1.0" ]
null
null
null
include/boost/url/url.hpp
syoliver/url
7a992f6aa758807bbcd2e92e413453da98ee0c3d
[ "BSL-1.0" ]
null
null
null
include/boost/url/url.hpp
syoliver/url
7a992f6aa758807bbcd2e92e413453da98ee0c3d
[ "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/vinniefalco/url // #ifndef BOOST_URL_URL_HPP #define BOOST_URL_URL_HPP #include <boost/url/config.hpp> #include <boost/url/basic_url.hpp> #include <memory> namespace boost { namespace urls { using url = basic_url<std::allocator<char>>; } // urls } // boost #endif
20.576923
79
0.73271
syoliver
f4a52da293b8216b7235307e5da9abb35c5b810c
3,952
cpp
C++
Packet/PacketCondenser.cpp
RodrigoHolztrattner/Packet
ea514f326b7678414ef6521a6b4546e878f5c4ec
[ "MIT" ]
6
2018-03-15T09:11:07.000Z
2021-05-11T16:19:53.000Z
Packet/PacketCondenser.cpp
RodrigoHolztrattner/Packet
ea514f326b7678414ef6521a6b4546e878f5c4ec
[ "MIT" ]
16
2019-02-14T22:56:21.000Z
2019-07-08T20:21:01.000Z
Packet/PacketCondenser.cpp
RodrigoHolztrattner/Packet
ea514f326b7678414ef6521a6b4546e878f5c4ec
[ "MIT" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// // Filename: FluxMyWrapper.cpp //////////////////////////////////////////////////////////////////////////////// #include "PacketCondenser.h" #include <filesystem> #include <fstream> /////////////// // NAMESPACE // /////////////// PacketUsingDevelopmentNamespace(Packet) PacketCondenser::PacketCondenser() { // Set the initial data // ... } PacketCondenser::~PacketCondenser() { } std::vector<CondensedFileInfo> PacketCondenser::CondenseFolder(std::string _rootPath, uint32_t _currentCondenseFileCount, std::vector<std::pair<Hash, std::string>>& _fileInfos) { // Out output vector std::vector<CondensedFileInfo> output; // Check if we have at last one file if (_fileInfos.size() == 0) { // There is nothing to be done return output; } // Get the root folder name auto rootFolderName = GetRootFolder(_rootPath); // Return a valid name for the condensed file auto GetCondensedFilename = [&]() { std::string temp = CondensedName; return rootFolderName.append(temp.append(std::to_string(_currentCondenseFileCount + output.size()).append(CondensedExtension))); }; // The current condensed file info CondensedFileInfo currentCondensedFileInfo = {}; currentCondensedFileInfo.filePath = GetCondensedFilename(); // The current condensed file size and the current output write file uint64_t currentCondensedFileSize = 0; std::ofstream writeFile(currentCondensedFileInfo.filePath, std::ios::out); if (!writeFile.is_open()) { // Error creating the file return std::vector<CondensedFileInfo>(); } // For each file inside the given folder for (auto&[hash, filePath] : _fileInfos) { // Get the path to the file auto path = std::filesystem::path(filePath); // Get the file size auto fileSize = std::filesystem::file_size(path); // The condensed internal file info that we will use for this file CondensedFileInfo::InternalFileInfo internalFileInfo = {}; internalFileInfo.hash = hash; internalFileInfo.size = uint64_t(fileSize); internalFileInfo.time = uint64_t(std::filesystem::last_write_time(filePath).time_since_epoch().count()); // Check if we need to generate another condensed file info if (currentCondensedFileSize + fileSize >= MaximumPackageSize) { // Insert it into the output vector output.push_back(currentCondensedFileInfo); // Create another condensed file info currentCondensedFileInfo = CondensedFileInfo(); currentCondensedFileInfo.filePath = GetCondensedFilename(); // Close the current file and write to a new one writeFile.close(); writeFile = std::ofstream(currentCondensedFileInfo.filePath, std::ios::out); if (!writeFile.is_open()) { // Error creating the file return std::vector<CondensedFileInfo>(); } // Zero the current condensed file size currentCondensedFileSize = 0; } // Set the file location internalFileInfo.location = currentCondensedFileSize; // Open the target file and write it into the current condensed file { // Open the file std::ifstream file(filePath, std::ios::binary); if (!file.is_open()) { // Error openning this file return std::vector<CondensedFileInfo>(); } // Get the file data and close the file std::vector<char> buffer((unsigned int)fileSize); file.read(buffer.data(), fileSize); file.close(); // Write the file data writeFile.write(buffer.data(), fileSize); // Increment the current condensed file size currentCondensedFileSize += fileSize; } // Set the file info currentCondensedFileInfo.fileInfos[currentCondensedFileInfo.totalNumberFiles] = internalFileInfo; // Increment the total number of files currentCondensedFileInfo.totalNumberFiles++; } // Close the current condensed file writeFile.close(); // Insert the current condensed file into the output vector output.push_back(currentCondensedFileInfo); return output; }
29.274074
176
0.698381
RodrigoHolztrattner
f4a5ccdefd09cbf1852aff88879c7a6ed81d461b
1,467
cpp
C++
done/124_max_path_sum.cpp
zjuMrzhang/leetcode
35ab78be5b9a2ef0fb35f99c146c2190b2bed148
[ "MIT" ]
null
null
null
done/124_max_path_sum.cpp
zjuMrzhang/leetcode
35ab78be5b9a2ef0fb35f99c146c2190b2bed148
[ "MIT" ]
null
null
null
done/124_max_path_sum.cpp
zjuMrzhang/leetcode
35ab78be5b9a2ef0fb35f99c146c2190b2bed148
[ "MIT" ]
1
2020-09-30T19:03:01.000Z
2020-09-30T19:03:01.000Z
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: int tmpmax=0x80000000; int maxPathSumofRoot(TreeNode* root){ // if(root==NULL) return 0; int v=root->val; if(root->left==NULL && root->right==NULL) return v; int l=maxPathSumofRoot(root->left); int r=maxPathSumofRoot(root->right); // 最大值不包括自己,在最左右的下面 // 这里需要注意,必须要有才更新,否则空子树传 // 来的0会对结果产生影响 [-1,-2], if(root->left!=NULL){ tmpmax=max(tmpmax,l); } if(root->right!=NULL){ tmpmax=max(tmpmax,r); } // 最大值 包括自己,但是不向上传递 tmpmax=max(tmpmax,max(v,v+l+r)); // l+r+v 这里如果lr 都是0x80000000 会反向越界错误 // 只针对 空子树返回负最小值的情况,改为返回0消失 printf("%d ",tmpmax); // 最大值包括上面节点,上面处理 return max(v,max(v+l,v+r)); } int maxPathSum(TreeNode* root) { // 这题需要往上传递参数,后续遍历更合适 // 一个最长路径可能出现在的位置: // 已经记录的位置 // 左边子树里面l--记录在最大位置 // 右边子树里面r--记录在最大位置 // 包含自己:本次需要处理的 // max( v+l / v+r / v ) --todo -传递到上面 // v+l+r --记录在最大位置 // l / r --记录在最大位置 return max(tmpmax,maxPathSumofRoot(root)); } };
27.166667
77
0.479891
zjuMrzhang
f4a93f8f7a28876b665f8ae95431ed0967b896eb
2,147
cpp
C++
src/test/test_print.cpp
victoryang00/ebpf-verifier
0ff1b15e4f45e45073a6ef9862b8da10c3d7932f
[ "Apache-2.0", "MIT" ]
1
2018-07-18T16:20:46.000Z
2018-07-18T16:20:46.000Z
src/test/test_print.cpp
victoryang00/ebpf-verifier
0ff1b15e4f45e45073a6ef9862b8da10c3d7932f
[ "Apache-2.0", "MIT" ]
24
2018-06-26T23:55:23.000Z
2018-11-20T21:33:03.000Z
src/test/test_print.cpp
victoryang00/ebpf-verifier
0ff1b15e4f45e45073a6ef9862b8da10c3d7932f
[ "Apache-2.0", "MIT" ]
1
2018-08-01T05:50:52.000Z
2018-08-01T05:50:52.000Z
// Copyright (c) Prevail Verifier contributors. // SPDX-License-Identifier: MIT #include "catch.hpp" #include <string> #include <variant> #include <boost/algorithm/string/trim.hpp> #if !defined(MAX_PATH) #define MAX_PATH (256) #endif #include "asm_files.hpp" #include "asm_ostream.hpp" #include "asm_unmarshal.hpp" #define TEST_OBJECT_FILE_DIRECTORY "ebpf-samples/build/" #define TEST_ASM_FILE_DIRECTORY "ebpf-samples/asm/" #define PRINT_CASE(file) \ TEST_CASE("Print suite: " #file, "[print]") { \ verify_printed_string(#file);\ } void verify_printed_string(const std::string& file) { std::stringstream generated_output; auto raw_progs = read_elf(std::string(TEST_OBJECT_FILE_DIRECTORY) + file + ".o", "", nullptr, &g_ebpf_platform_linux); raw_program raw_prog = raw_progs.back(); std::variant<InstructionSeq, std::string> prog_or_error = unmarshal(raw_prog); REQUIRE(std::holds_alternative<InstructionSeq>(prog_or_error)); auto& program = std::get<InstructionSeq>(prog_or_error); print(program, generated_output, {}, true); std::ifstream expected_stream(std::string(TEST_ASM_FILE_DIRECTORY) + file + std::string(".asm")); REQUIRE(expected_stream); std::string expected_line; std::string actual_line; while (std::getline(expected_stream, expected_line)) { bool has_more = (bool)std::getline(generated_output, actual_line); REQUIRE(has_more); boost::algorithm::trim_right(expected_line); boost::algorithm::trim_right(actual_line); REQUIRE(expected_line == actual_line); } bool has_more = (bool)std::getline(expected_stream, actual_line); REQUIRE_FALSE(has_more); } PRINT_CASE(byteswap) PRINT_CASE(ctxoffset) PRINT_CASE(exposeptr) PRINT_CASE(exposeptr2) PRINT_CASE(map_in_map) PRINT_CASE(mapoverflow) PRINT_CASE(mapunderflow) PRINT_CASE(mapvalue-overrun) PRINT_CASE(nullmapref) PRINT_CASE(packet_access) PRINT_CASE(packet_overflow) PRINT_CASE(packet_reallocate) PRINT_CASE(packet_start_ok) PRINT_CASE(stackok) PRINT_CASE(tail_call) PRINT_CASE(tail_call_bad) PRINT_CASE(twomaps) PRINT_CASE(twostackvars) PRINT_CASE(twotypes)
31.115942
122
0.752678
victoryang00
f4ac91a9600d3531e53d13dffe0288d651178e72
9,633
hxx
C++
main/svtools/inc/svtools/table/tablecontrolinterface.hxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
679
2015-01-06T06:34:58.000Z
2022-03-30T01:06:03.000Z
main/svtools/inc/svtools/table/tablecontrolinterface.hxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
102
2017-11-07T08:51:31.000Z
2022-03-17T12:13:49.000Z
main/svtools/inc/svtools/table/tablecontrolinterface.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 SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX #define SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX #include <sal/types.h> #include <vcl/event.hxx> #include <vcl/seleng.hxx> #include "svtools/table/tabletypes.hxx" #include "svtools/table/tablemodel.hxx" class Pointer; //...................................................................................................................... namespace svt { namespace table { //...................................................................................................................... //================================================================================================================== //= TableControlAction //================================================================================================================== enum TableControlAction { /// moves the cursor in the table control one row up, if possible, by keeping the current column cursorUp, /// moves the cursor in the table control one row down, if possible, by keeping the current column cursorDown, /// moves the cursor in the table control one column to the left, if possible, by keeping the current row cursorLeft, /// moves the cursor in the table control one column to the right, if possible, by keeping the current row cursorRight, /// moves the cursor to the beginning of the current line cursorToLineStart, /// moves the cursor to the end of the current line cursorToLineEnd, /// moves the cursor to the first row, keeping the current column cursorToFirstLine, /// moves the cursor to the last row, keeping the current column cursorToLastLine, /// moves the cursor one page up, keeping the current column cursorPageUp, /// moves the cursor one page down, keeping the current column cursorPageDown, /// moves the cursor to the top-most, left-most cell cursorTopLeft, /// moves the cursor to the bottom-most, right-most cell cursorBottomRight, /// selects the row, where the actual cursor is cursorSelectRow, /// selects the rows, above the actual cursor is cursorSelectRowUp, /// selects the row, beneath the actual cursor is cursorSelectRowDown, /// selects the row, from the actual cursor till top cursorSelectRowAreaTop, /// selects the row, from the actual cursor till bottom cursorSelectRowAreaBottom, /// invalid and final enumeration value, not to be actually used invalidTableControlAction }; //================================================================================================================== //= TableCellArea //================================================================================================================== enum TableCellArea { CellContent, ColumnDivider }; //================================================================================================================== //= TableCell //================================================================================================================== struct TableCell { ColPos nColumn; RowPos nRow; TableCellArea eArea; TableCell() :nColumn( COL_INVALID ) ,nRow( ROW_INVALID ) ,eArea( CellContent ) { } TableCell( ColPos const i_column, RowPos const i_row ) :nColumn( i_column ) ,nRow( i_row ) ,eArea( CellContent ) { } }; //================================================================================================================== //= ColumnMetrics //================================================================================================================== struct ColumnMetrics { /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible area. */ long nStartPixel; /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of a all columns up to the current one. */ long nEndPixel; ColumnMetrics() :nStartPixel(0) ,nEndPixel(0) { } ColumnMetrics( long const i_start, long const i_end ) :nStartPixel( i_start ) ,nEndPixel( i_end ) { } }; //================================================================================================================== //= TableArea //================================================================================================================== enum TableArea { TableAreaColumnHeaders, TableAreaRowHeaders, TableAreaDataArea, TableAreaAll }; //================================================================================================================== //= ITableControl //================================================================================================================== /** defines a callback interface to be implemented by a concrete table control */ class SAL_NO_VTABLE ITableControl { public: /** hides the cell cursor The method cares for successive calls, that is, for every call to ->hideCursor(), you need one call to ->showCursor. Only if the number of both calls matches, the cursor is really shown. @see showCursor */ virtual void hideCursor() = 0; /** shows the cell cursor @see hideCursor */ virtual void showCursor() = 0; /** dispatches an action to the table control @return <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual failure conditions include some other instance vetoing the action, or impossibility to execute the action at all (for instance moving up one row when already positioned on the very first row). @see TableControlAction */ virtual bool dispatchAction( TableControlAction _eAction ) = 0; /** returns selection engine*/ virtual SelectionEngine* getSelEngine() = 0; /** returns the table model The returned model is guaranteed to not be <NULL/>. */ virtual PTableModel getModel() const = 0; /// returns the index of the currently active column virtual ColPos getCurrentColumn() const = 0; /// returns the index of the currently active row virtual RowPos getCurrentRow() const = 0; /// activates the given cell virtual bool activateCell( ColPos const i_col, RowPos const i_row ) = 0; /// retrieves the size of the table window, in pixels virtual ::Size getTableSizePixel() const = 0; /// sets a new mouse pointer for the table window virtual void setPointer( Pointer const & i_pointer ) = 0; /// captures the mouse to the table window virtual void captureMouse() = 0; /// releases the mouse, after it had previously been captured virtual void releaseMouse() = 0; /// invalidates the table window virtual void invalidate( TableArea const i_what ) = 0; /// calculates a width, given in pixels, into a AppFont-based width virtual long pixelWidthToAppFont( long const i_pixels ) const = 0; /// shows a trackign rectangle virtual void showTracking( Rectangle const & i_location, sal_uInt16 const i_flags ) = 0; /// hides a prviously shown tracking rectangle virtual void hideTracking() = 0; /// does a hit test for the given pixel coordinates virtual TableCell hitTest( const Point& rPoint ) const = 0; /// retrieves the metrics for a given column virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const = 0; /// determines whether a given row is selected virtual bool isRowSelected( RowPos _nRow ) const = 0; virtual ~ITableControl() {}; }; //...................................................................................................................... } } // namespace svt::table //...................................................................................................................... #endif // SVTOOLS_INC_TABLE_ABSTRACTTABLECONTROL_HXX
38.22619
120
0.499118
Grosskopf
f4add7de75cad197cfc5abeed7b2fe84dba7fc11
562
cpp
C++
codeBase/HackerRank/Algorithms/Game Theory/Deforestation/Solution.cpp
suren3141/codeBase
10ed9a56aca33631dc8c419cd83859c19dd6ff09
[ "Apache-2.0" ]
3
2020-03-16T14:59:08.000Z
2021-07-28T20:51:53.000Z
codeBase/HackerRank/Algorithms/Game Theory/Deforestation/Solution.cpp
suren3141/codeBase
10ed9a56aca33631dc8c419cd83859c19dd6ff09
[ "Apache-2.0" ]
1
2020-03-15T10:57:02.000Z
2020-03-15T10:57:02.000Z
codeBase/HackerRank/Algorithms/Game Theory/Deforestation/Solution.cpp
killerilaksha/codeBase
91cbd950fc90066903e58311000784aeba4ffc02
[ "Apache-2.0" ]
18
2020-02-17T23:17:37.000Z
2021-07-28T20:52:13.000Z
/* Copyright (C) 2020, Sathira Silva. */ #include <bits/stdc++.h> using namespace std; int grundy[501]; int dfs(int u, int p, vector<vector<int>>& G){ for(auto ch : G[u]){ if(ch != p) grundy[u] ^= dfs(ch,u,G); } return u == 1 ? grundy[u] : ++grundy[u]; } string deforestation(int n, vector<vector<int>> tree) { memset(gr, 0, sizeof(gr)); vector<vector<int>> graph(n+1); for(auto p : tree){ graph[p[0]].push_back(p[1]); graph[p[1]].push_back(p[0]); } return dfs(1, -1, graph) ? "Alice" : "Bob"; }
20.071429
55
0.544484
suren3141
f4ae671f7f0a91b5870071b7a2a763969ae012e8
190,564
cpp
C++
src/configwin.cpp
filipecosta90/im2model
ed43ed236c5a62b3af095fb949c517f680986ac5
[ "Apache-2.0" ]
7
2017-05-30T12:30:07.000Z
2017-09-07T08:35:26.000Z
src/configwin.cpp
filipecosta90/im2model_app
ed43ed236c5a62b3af095fb949c517f680986ac5
[ "Apache-2.0" ]
null
null
null
src/configwin.cpp
filipecosta90/im2model_app
ed43ed236c5a62b3af095fb949c517f680986ac5
[ "Apache-2.0" ]
null
null
null
/* * This file is subject to the terms and conditions defined in * file 'LICENSE', which is part of this source code package. * * Partialy financiated as part of the protocol between UTAustin I Portugal - UTA-P. * [2017] - [2018] University of Minho, Filipe Costa Oliveira * All Rights Reserved. */ #include "configwin.h" bool MainWindow::create_3d_widgets( QMainWindow *parent , SuperCell* tdmap_vis_sim_unit_cell, SuperCell* tdmap_full_sim_super_cell ){ ui->qwidget_qt_scene_view_roi_tdmap_super_cell->set_super_cell( tdmap_vis_sim_unit_cell ); return true; } MainWindow::MainWindow( ApplicationLog::ApplicationLog* logger, std::string version, QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { im2model_logger = logger; _flag_im2model_logger = true; im2model_logger->logEvent(ApplicationLog::notification, "Application logger setted for MainWindow class."); if (_flag_im2model_logger) { im2model_logger->logEvent(ApplicationLog::normal, "Setting up UI."); } ui->setupUi(this); ui->td_map_splitter->setStretchFactor(0,3); ui->td_map_splitter->setStretchFactor(1,7); ui->td_map_splitter->setStretchFactor(2,2); ui->super_cell_splitter->setStretchFactor(0,3); ui->super_cell_splitter->setStretchFactor(1,7); if (_flag_im2model_logger) { im2model_logger->logEvent(ApplicationLog::normal, "Creating actions."); } createActions(); if (_flag_im2model_logger) { im2model_logger->logEvent(ApplicationLog::normal, "Creating progress bar."); } createProgressBar(); setUnifiedTitleAndToolBarOnMac(true); if (_flag_im2model_logger) { im2model_logger->logEvent(ApplicationLog::normal, "Loading file delegate."); } _load_file_delegate = new TreeItemFileDelegate(this); if (_flag_im2model_logger) { im2model_logger->logEvent(ApplicationLog::normal, "Going to read settings."); } _settings_ok = readSettings(); if( ! _settings_ok ){ if( _flag_im2model_logger ){ im2model_logger->logEvent( ApplicationLog::critical, "Preferences are not setted. Trying to resolve." ); } _settings_ok = maybeSetPreferences(); } /* if the preferences are still not correct set the flag */ if ( !_settings_ok ){ _failed_initialization = true; if( _flag_im2model_logger ){ im2model_logger->logEvent( ApplicationLog::critical, "Failed to initialize preferences." ); } } else{ _core_td_map = new TDMap( _sim_tdmap_celslc_ostream_buffer, _sim_tdmap_msa_ostream_buffer, _sim_tdmap_wavimg_ostream_buffer, _sim_tdmap_simgrid_ostream_buffer, _sim_supercell_celslc_ostream_buffer, _sim_supercell_msa_ostream_buffer, _sim_supercell_wavimg_ostream_buffer ); _core_td_map->set_application_version(version); SuperCell* tdmap_vis_sim_unit_cell = _core_td_map->get_tdmap_vis_sim_unit_cell(); SuperCell* tdmap_full_sim_super_cell = _core_td_map->get_tdmap_full_sim_super_cell(); celslc_step_group_options = new group_options("celslc_step"); msa_step_group_options = new group_options("msa_step"); wavimg_step_group_options = new group_options("wavimg_step"); simgrid_step_group_options = new group_options("simgrid_step"); super_cell_target_step_group_options = new group_options("super_cell_target_step"); // dr probe pipeline dependencies msa_step_group_options->listen_group_update_required( celslc_step_group_options ); wavimg_step_group_options->listen_group_update_required( msa_step_group_options ); // tdmap dependency simgrid_step_group_options->listen_group_update_required( wavimg_step_group_options ); _core_td_map->set_group_options( celslc_step_group_options, msa_step_group_options, wavimg_step_group_options, simgrid_step_group_options ); if (_flag_im2model_logger) { im2model_logger->logEvent(ApplicationLog::critical, "Trying to set application logger for TDMap and SuperCell."); _core_td_map->set_application_logger(im2model_logger); im2model_logger->logEvent(ApplicationLog::critical, "Trying to set application logger for Visualization Widgets."); ui->tdmap_table->set_application_logger(im2model_logger); ui->qgraphics_tdmap_selection->set_application_logger( im2model_logger ); } bool status = true; // status &= _core_td_map->set_dr_probe_bin_path( _dr_probe_bin_path.toStdString() ); status &= _core_td_map->set_dr_probe_celslc_execname( _dr_probe_celslc_bin.toStdString() ); status &= _core_td_map->set_dr_probe_msa_execname( _dr_probe_msa_bin.toStdString() ); status &= _core_td_map->set_dr_probe_wavimg_execname( _dr_probe_wavimg_bin.toStdString() ); status &= _core_td_map->set_im2model_api_url( im2model_api_url.toStdString() ); create_3d_widgets( this , tdmap_vis_sim_unit_cell, tdmap_full_sim_super_cell ); if( status == false ){ _failed_initialization = true; if( _flag_im2model_logger ){ im2model_logger->logEvent( ApplicationLog::critical, "Failed setting dr probe bins." ); } } else { setCurrentFile(QString()); create_box_options(); /* TDMap simulation thread */ _sim_tdmap_thread = new QThread( this ); sim_tdmap_worker = new GuiSimOutUpdater( _core_td_map ); // set logger sim_tdmap_worker->set_application_logger(im2model_logger); sim_tdmap_worker->moveToThread( _sim_tdmap_thread ); // will only start thread when needed connect(sim_tdmap_worker, SIGNAL(TDMap_request()), _sim_tdmap_thread, SLOT( start() ) ); connect(_sim_tdmap_thread, SIGNAL(started() ), sim_tdmap_worker, SLOT( newTDMapSim() ) ); connect(sim_tdmap_worker, SIGNAL(TDMap_sucess()), this, SLOT(update_from_TDMap_sucess())); connect(sim_tdmap_worker, SIGNAL(TDMap_failure()), this, SLOT(update_from_TDMap_failure())); // will quit thread after work done connect(sim_tdmap_worker, SIGNAL( TDMap_finished() ), _sim_tdmap_thread, SLOT(quit()) , Qt::DirectConnection ); /* Super-Cell Full simulation thread */ full_sim_super_cell_thread = new QThread( this ); full_sim_super_cell_worker = new GuiSimOutUpdater( _core_td_map ); full_sim_super_cell_worker->moveToThread( full_sim_super_cell_thread ); // will only start thread when needed connect( full_sim_super_cell_worker, SIGNAL(SuperCell_full_request()), full_sim_super_cell_thread, SLOT(start()),Qt::DirectConnection ); connect(full_sim_super_cell_thread, SIGNAL( started() ), full_sim_super_cell_worker, SLOT( newSuperCellFull() ) ); connect(full_sim_super_cell_worker, SIGNAL(SuperCell_full_sucess()), this, SLOT(update_from_full_SuperCell_sucess())); connect(full_sim_super_cell_worker, SIGNAL(SuperCell_full_failure()), this, SLOT(update_from_full_SuperCell_failure())); // will quit thread after work done connect(full_sim_super_cell_worker, SIGNAL(SuperCell_full_finished()), full_sim_super_cell_thread, SLOT(quit()) , Qt::DirectConnection ); /* Super-Cell Full simulation thread */ full_sim_super_cell_intensity_cols_thread = new QThread( this ); full_sim_super_cell_intensity_cols_worker = new GuiSimOutUpdater( _core_td_map ); full_sim_super_cell_intensity_cols_worker->moveToThread( full_sim_super_cell_intensity_cols_thread ); // will only start thread when needed QMetaObject::Connection c1 = connect( full_sim_super_cell_intensity_cols_worker, SIGNAL(SuperCell_full_intensity_cols_request()), full_sim_super_cell_intensity_cols_thread, SLOT(start()) ); QMetaObject::Connection c2 = connect( full_sim_super_cell_intensity_cols_thread, &QThread::started, full_sim_super_cell_intensity_cols_worker, &GuiSimOutUpdater::newSuperCellFull_intensity_cols ); connect(full_sim_super_cell_intensity_cols_worker, SIGNAL(SuperCell_full_intensity_cols_sucess()), this, SLOT(update_from_full_SuperCell_intensity_cols_sucess())); connect(full_sim_super_cell_intensity_cols_worker, SIGNAL(SuperCell_full_intensity_cols_failure()), this, SLOT(update_from_full_SuperCell_intensity_cols_failure())); // will quit thread after work done connect(full_sim_super_cell_intensity_cols_worker, SIGNAL(SuperCell_full_intensity_cols_finished()), full_sim_super_cell_intensity_cols_thread, SLOT(quit()) , Qt::DirectConnection ); /* Super-Cell Edge Detection thread */ _sim_super_cell_thread = new QThread( this ); sim_super_cell_worker = new GuiSimOutUpdater( _core_td_map ); sim_super_cell_worker->moveToThread( _sim_super_cell_thread ); // will only start thread when needed connect( sim_super_cell_worker, SIGNAL(SuperCell_edge_request()), _sim_super_cell_thread, SLOT(start())); connect(_sim_super_cell_thread, SIGNAL( started() ), sim_super_cell_worker, SLOT( newSuperCellEdge() ) ); connect(sim_super_cell_worker, SIGNAL(SuperCell_edge_sucess()), this, SLOT(update_from_SuperCell_edge_sucess())); connect(sim_super_cell_worker, SIGNAL(SuperCell_edge_failure()), this, SLOT(update_from_SuperCell_edge_failure())); // will quit thread after work done connect(sim_super_cell_worker, SIGNAL(SuperCell_edge_finished()), _sim_super_cell_thread, SLOT(quit()), Qt::DirectConnection ); connect(ui->tdmap_table, SIGNAL( cellClicked( int , int )), this, SLOT( update_tdmap_current_selection(int,int)) ); connect(ui->tdmap_table, SIGNAL( export_overlay( int , int )), this, SLOT( export_current_simulated_image_overlay_selection(int,int)) ); connect(ui->tdmap_table, SIGNAL( export_simulated_image( int , int )), this, SLOT( export_current_simulated_image_selection(int,int)) ); connect(this, SIGNAL(experimental_image_filename_changed()), this, SLOT(update_full_experimental_image()) ); connect(this, SIGNAL(simulated_grid_changed( )), this, SLOT(update_simgrid_frame( )) ); connect(this, SIGNAL(super_cell_target_region_changed()), this, SLOT(update_super_cell_target_region()) ); connect( _core_td_map, SIGNAL( TDMap_started_celslc()), this, SLOT(update_tdmap_celslc_started( )) ); connect( _core_td_map, SIGNAL( TDMap_started_celslc()), this, SLOT(update_tdmap_sim_ostream_celslc()) ); connect( _core_td_map, SIGNAL( TDMap_inform_celslc_n_steps( int )), this, SLOT(update_tdmap_celslc_started_with_steps_info( int ) ) ); connect( _core_td_map, SIGNAL(TDMap_started_supercell_celslc( )), this, SLOT( update_supercell_celslc_started( ) ) ); connect( _core_td_map, SIGNAL(TDMap_inform_supercell_celslc_n_steps( int )), this, SLOT(update_supercell_celslc_started_with_steps_info( int ) ) ); connect( _core_td_map, SIGNAL(TDMap_at_celslc_step( int )), this, SLOT(update_tdmap_celslc_step( int ) ) ); connect( _core_td_map, SIGNAL(TDMap_ended_supercell_celslc_ssc_single_slice_ended( bool )), this, SLOT(update_supercell_celslc_ssc_single_slice_step( bool ) ) ); connect( _core_td_map, SIGNAL(TDMap_ended_celslc_ssc_single_slice_ended( bool )), this, SLOT(update_tdmap_celslc_ssc_single_slice_step( bool ) ) ); connect( _core_td_map, SIGNAL(TDMap_ended_celslc( bool )), this, SLOT(update_tdmap_celslc_ended( bool ) ) ); connect( _core_td_map, SIGNAL(TDMap_ended_supercell_celslc( bool )), this, SLOT(update_supercell_celslc_ended( bool ) ) ); connect( _core_td_map, SIGNAL(TDMap_started_msa( )), this, SLOT(update_tdmap_msa_started( ) ) ); connect(_core_td_map, SIGNAL(TDMap_started_msa()), this, SLOT(update_tdmap_sim_ostream_msa())); connect( _core_td_map, SIGNAL(TDMap_started_supercell_msa( )), this, SLOT(update_supercell_msa_started( ) ) ); connect( _core_td_map, SIGNAL(TDMap_ended_msa( bool )), this, SLOT(update_tdmap_msa_ended( bool ) ) ); connect( _core_td_map, SIGNAL(TDMap_ended_supercell_msa( bool )), this, SLOT(update_supercell_msa_ended( bool ) ) ); connect( _core_td_map, SIGNAL(TDMap_started_wavimg( )), this, SLOT(update_tdmap_wavimg_started( ) ) ); connect(_core_td_map, SIGNAL(TDMap_started_wavimg()), this, SLOT(update_tdmap_sim_ostream_wavimg())); connect( _core_td_map, SIGNAL(TDMap_started_supercell_wavimg( )), this, SLOT(update_supercell_wavimg_started( ) ) ); connect( _core_td_map, SIGNAL(TDMap_ended_wavimg( bool )), this, SLOT(update_tdmap_wavimg_ended( bool ) ) ); connect( _core_td_map, SIGNAL(TDMap_ended_supercell_wavimg( bool )), this, SLOT(update_supercell_wavimg_ended( bool ) ) ); connect( _core_td_map, SIGNAL(TDMap_started_simgrid( )), this, SLOT(update_tdmap_simgrid_started( ) ) ); connect(_core_td_map, SIGNAL(TDMap_started_simgrid()), this, SLOT(update_tdmap_sim_ostream_simgrid())); connect( _core_td_map, SIGNAL(TDMap_ended_simgrid( bool )), this, SLOT(update_tdmap_simgrid_ended( bool ) ) ); connect( _core_td_map, SIGNAL(TDMap_no_simgrid( bool )), this, SLOT(update_tdmap_no_simgrid_ended( bool ) ) ); connect( _core_td_map, SIGNAL(supercell_roi_simulated_image_changed( )), this, SLOT(update_super_cell_simulated_image_roi_image() ) ); connect( _core_td_map, SIGNAL(supercell_full_simulated_image_intensity_columns_changed( )), this, SLOT(update_super_cell_simulated_image_intensity_columns() ) ); connect( _core_td_map, SIGNAL(supercell_full_experimental_image_centroid_translation_changed( )), this, SLOT(update_super_cell_target_region()) ); connect( _core_td_map, SIGNAL(start_update_atoms( )), this, SLOT( update_tdmap_start_update_atoms( )) ); connect( _core_td_map, SIGNAL(end_update_atoms( int )), this, SLOT(update_tdmap_end_update_atoms( int )) ); connect( _core_td_map, SIGNAL(start_update_atoms( )), this, SLOT( update_tdmap_start_update_atoms( )) ); connect( _core_td_map, SIGNAL(end_update_atoms( int )), this, SLOT(update_tdmap_end_update_atoms( int )) ); connect( _core_td_map, SIGNAL(uploadProgress( qint64, qint64 )), this, SLOT(update_tdmap_uploadProgess( qint64, qint64 )) ); connect( _core_td_map, SIGNAL(uploadError( QNetworkReply::NetworkError )), this, SLOT(update_tdmap_uploadError( QNetworkReply::NetworkError )) ); _reset_document_modified_flags(); if( _flag_im2model_logger ){ im2model_logger->logEvent( ApplicationLog::notification, "Finished initializing App. Launching Open/Create" ); } const bool initialize_result = initialize(); if( initialize_result == false ){ std::cout << "close" << std::endl; this->close(); } } } } void MainWindow::update_tdmap_uploadError( QNetworkReply::NetworkError err ){ updateProgressBar(0,0,100, true); std::stringstream message; message << "Upload error " << err << " ."; std::cout << message.str() << std::endl; ui->statusBar->showMessage(QString::fromStdString(message.str()), 5000); } void MainWindow::update_tdmap_uploadProgess( qint64 bytesSent, qint64 bytesTotal ){ const int percent = (int) (( static_cast<double>(bytesSent) * 100) / static_cast<double>(bytesTotal) ); updateProgressBar(0, percent,100); std::stringstream message; message << "Uploaded " << bytesSent << " bytes of " << bytesTotal << " ."; std::cout << message.str() << std::endl; ui->statusBar->showMessage(QString::fromStdString(message.str()), 2000); } void MainWindow::setApplicationVersion( std::string app_version ){ application_version = app_version; if ( _core_td_map ){ _core_td_map->set_application_version( app_version ); } _flag_application_version = true; } void MainWindow::update_tdmap_celslc_started( ){ updateProgressBar(0,0,100); ui->statusBar->showMessage(tr("Started multislice step"), 2000); SuperCell* tdmap_roi_sim_super_cell = _core_td_map->get_tdmap_roi_sim_super_cell(); ui->qgraphics_tdmap_selection->set_super_cell( tdmap_roi_sim_super_cell , false ); ui->qgraphics_tdmap_selection->view_along_c_axis(); ui->qgraphics_tdmap_selection->reload_data_from_super_cell(); } void MainWindow::update_tdmap_start_update_atoms( ){ std::cout << "update_tdmap_start_update_atoms " << std::endl; updateProgressBar(0,0,100); ui->statusBar->showMessage(QString::fromStdString( "Super-Cell is updating atoms." ), 5000); } void MainWindow::update_tdmap_end_update_atoms( int n_atoms ){ updateProgressBar(0,100,100); std::stringstream message; message << "Super-Cell updated with " << n_atoms << " atoms."; std::cout << message.str() << std::endl; ui->statusBar->showMessage(QString::fromStdString(message.str()), 5000); } void MainWindow::update_tdmap_celslc_started_with_steps_info( int n_steps ){ updateProgressBar(0,0,100); std::stringstream message; _core_td_map_info_supercell_celslc_n_steps = n_steps; message << "Launching " << n_steps << " concurrent processes to calculate the multislice step."; ui->statusBar->showMessage(QString::fromStdString(message.str()), 5000); } void MainWindow::update_supercell_celslc_started_with_steps_info( int n_steps ){ updateProgressBar(0,0,100); std::stringstream message; message << "Launching " << n_steps << " concurrent processes to calculate the multislice step for supercell."; ui->statusBar->showMessage(QString::fromStdString(message.str()), 5000); } void MainWindow::update_supercell_celslc_ssc_single_slice_step( bool result ){ std::stringstream message; _core_td_map_info_supercell_celslc_at_step++; const int _core_td_map_info_supercell_celslc_step_to_percent = (int) ( ( (float) _core_td_map_info_supercell_celslc_at_step ) / ( (float) _core_td_map_info_supercell_celslc_n_steps ) * 25.0f ); updateProgressBar(0,_core_td_map_info_supercell_celslc_step_to_percent,100); message << "Multislice process ended with result " << std::boolalpha << result << "."; ui->statusBar->showMessage(QString::fromStdString(message.str()), 5000); } void MainWindow::update_tdmap_celslc_ssc_single_slice_step( bool result ){ std::stringstream message; _core_td_map_info_celslc_at_step++; const int _core_td_map_info_supercell_celslc_step_to_percent = (int) ( ( (float) _core_td_map_info_celslc_at_step ) / ( (float) _core_td_map_info_celslc_n_steps ) * 25.0f ); updateProgressBar(0,_core_td_map_info_supercell_celslc_step_to_percent,100); message << "TDmap multislice process ended with result " << std::boolalpha << result << "."; ui->statusBar->showMessage(QString::fromStdString(message.str()), 5000); } void MainWindow::update_supercell_celslc_started( ){ updateProgressBar(0,0,100); ui->statusBar->showMessage(tr("Started multislice step for supercell"), 2000); } void MainWindow::update_tdmap_celslc_ended( bool result ){ // reset pipe _sim_tdmap_celslc_ostream_buffer.pipe( boost::process::pipe() ); if( result ){ ui->statusBar->showMessage(tr("Sucessfully ended multislice step"), 2000); } else{ ui->statusBar->showMessage(tr("Error while running multislice step") ); } } void MainWindow::update_supercell_celslc_ended( bool result ){ // reset pipe _sim_supercell_celslc_ostream_buffer.pipe( boost::process::pipe() ); if( result ){ ui->statusBar->showMessage(tr("Sucessfully ended multislice step for supercell"), 2000); } else{ ui->statusBar->showMessage(tr("Error while running multislice step for supercell") ); } } void MainWindow::update_tdmap_msa_started( ){ updateProgressBar(0,25,100); ui->statusBar->showMessage(tr("Started calculating electron diffraction patterns"), 2000); } void MainWindow::update_supercell_msa_started( ){ updateProgressBar(0,25,100); ui->statusBar->showMessage(tr("Started calculating electron diffraction patterns for supercell"), 2000); } void MainWindow::update_tdmap_msa_ended( bool result ){ // reset pipe _sim_tdmap_msa_ostream_buffer.pipe( boost::process::pipe() ); if( result ){ updateProgressBar(0,50,100); ui->statusBar->showMessage(tr("Sucessfully ended calculating the electron diffraction patterns"), 2000); } else{ updateProgressBar(0,50,100, true); ui->statusBar->showMessage(tr("Error while calculating the electron diffraction patterns") ); } } void MainWindow::update_supercell_msa_ended( bool result ){ // reset pipe _sim_supercell_msa_ostream_buffer.pipe( boost::process::pipe() ); if( result ){ updateProgressBar(0,50,100); ui->statusBar->showMessage(tr("Sucessfully ended calculating the electron diffraction patterns for supercell"), 2000); } else{ updateProgressBar(0,50,100, true); ui->statusBar->showMessage(tr("Error while calculating the electron diffraction patterns for supercell") ); } } void MainWindow::update_tdmap_wavimg_started( ){ updateProgressBar(0,50,100); ui->statusBar->showMessage(tr("Started calculating image intensity distribuitions"), 2000); } void MainWindow::update_tdmap_wavimg_ended( bool result ){ // reset pipe _sim_tdmap_wavimg_ostream_buffer.pipe( boost::process::pipe() ); if( result ){ updateProgressBar(0,75,100); ui->statusBar->showMessage(tr("Sucessfully ended calculating the image intensity distribuitions"), 2000); } else{ updateProgressBar(0,75,100, true); ui->statusBar->showMessage(tr("Error while calculating the image intensity distribuitions") ); } } void MainWindow::update_supercell_wavimg_started( ){ updateProgressBar(0,50,100); ui->statusBar->showMessage(tr("Started calculating image intensity distribuitions for supercell"), 2000); } void MainWindow::update_supercell_wavimg_ended( bool result ){ // reset pipe _sim_supercell_wavimg_ostream_buffer.pipe( boost::process::pipe() ); if( result ){ updateProgressBar(0,75,100); ui->statusBar->showMessage(tr("Sucessfully ended calculating the image intensity distribuitions for supercell"), 2000); } else{ updateProgressBar(0,75,100, true); ui->statusBar->showMessage(tr("Error while calculating the image intensity distribuitions for supercell") ); } } void MainWindow::update_tdmap_simgrid_started( ){ // reset pipe _sim_tdmap_simgrid_ostream_buffer.pipe( boost::process::pipe() ); updateProgressBar(0,75,100); ui->statusBar->showMessage(tr("Started image correlation step"), 2000); } void MainWindow::update_tdmap_simgrid_ended( bool result ){ if( result ){ emit simulated_grid_changed( ); updateProgressBar(0,100,100); ui->statusBar->showMessage(tr("Sucessfully ended image correlation step"), 2000); } else{ updateProgressBar(0,100,100, true); // TO DO: clear ui->qgraphics_tdmap_selection ui->statusBar->showMessage(tr("Error while running image correlation step") ); } } void MainWindow::update_tdmap_no_simgrid_ended( bool result ){ if( result ){ emit simulated_grid_changed( ); updateProgressBar(0,100,100); ui->statusBar->showMessage(tr("Sucessfully ended creating TDMap without image correlation step"), 2000); } else{ updateProgressBar(0,100,100, true); ui->statusBar->showMessage(tr("Error while creating TDMap without image correlation step") ); } } void MainWindow::update_tdmap_celslc_step( int at_step ){ } bool MainWindow::set_application_logger( ApplicationLog::ApplicationLog* logger ){ im2model_logger = logger; _flag_im2model_logger = true; im2model_logger->logEvent( ApplicationLog::notification, "Application logger setted for MainWindow class." ); _core_td_map->set_application_logger( logger ); return true; } bool MainWindow::_is_initialization_ok(){ return !_failed_initialization; } bool MainWindow::maybeSetPreferences(){ const QMessageBox::StandardButton ret = QMessageBox::warning(this, tr("Application"), tr("The saved prefences file is incomplete.\n""To use Im2Model all preferences vars must be setted.\n" "Do you want to open the preferences panel?"), QMessageBox::Yes | QMessageBox::Close); switch (ret) { case QMessageBox::Yes: return edit_preferences(); case QMessageBox::Close: return false; default: break; } return false; } void MainWindow::update_tdmap_current_selection(int x,int y){ if (_flag_im2model_logger) { std::stringstream message; message << "update_tdmap_current_selection to x : " << x << " y: " << y; im2model_logger->logEvent(ApplicationLog::notification, message.str()); message = std::stringstream(); } const double full_image_height_nm = _core_td_map->get_sim_image_properties_roi_ny_size_height_nm(); const double full_image_width_nm = _core_td_map->get_sim_image_properties_roi_nx_size_width_nm(); //std::cout << "full_image_width_nm" << full_image_width_nm << std::endl; //std::cout << "full_image_height_nm" << full_image_height_nm << std::endl; if( _core_td_map->validate_simulated_grid_position( x , y )){ tdmap_current_selection_pos.x = x; tdmap_current_selection_pos.y = y; Qt3DCore::QTransform* transform = new Qt3DCore::QTransform( ); transform->setRotation(QQuaternion::fromAxisAndAngle(1,0,0,90)); const cv::Mat _simulated_image = _core_td_map->get_simulated_image_in_grid_visualization(x,y); double _simulated_image_match = 0.0f; const bool correlation_active = _core_td_map->get_run_simgrid_switch(); QStandardItem *match_item; if( correlation_active ){ _simulated_image_match = _core_td_map->get_simulated_image_match_in_grid(x,y); match_item = new QStandardItem( QString::number( _simulated_image_match ) ); } else{ match_item = new QStandardItem(tr("N/A")); } const double _simulated_image_thickness = _core_td_map->get_simulated_image_thickness_nm_in_grid(x,y); const double _simulated_image_defocus = _core_td_map->get_simulated_image_defocus_in_grid(x,y); QStandardItemModel* model = new QStandardItemModel(3, 2,this); model->setHeaderData(0, Qt::Horizontal, tr("Parameter")); model->setHeaderData(1, Qt::Horizontal, tr("Value")); QStandardItem *label_match_item = new QStandardItem( tr("Match %") ); QStandardItem *label_defocus_item = new QStandardItem( tr("Defocus") ); QStandardItem *label_thickness_item = new QStandardItem( tr("Thickness") ); QStandardItem *thickness_item = new QStandardItem( QString::number( _simulated_image_thickness ) ); QStandardItem *defocus_item = new QStandardItem( QString::number( _simulated_image_defocus ) ); model->setItem(0, 0, label_match_item); model->setItem(1, 0, label_thickness_item); model->setItem(2, 0, label_defocus_item); model->setItem(0, 1, match_item); model->setItem(1, 1, thickness_item); model->setItem(2, 1, defocus_item); ui->qgraphics_tdmap_selection->setModel(model); ui->qgraphics_tdmap_selection->update_image_layer( _simulated_image , full_image_width_nm , full_image_height_nm , transform, "Simulated image layer" , 2 ); if( correlation_active ){ const cv::Point2i simulated_match_location = _core_td_map->get_simulated_match_location(x,y); if( _core_td_map->get_exp_image_properties_flag_roi_image() ){ cv::Mat roi_image = _core_td_map->get_exp_image_properties_roi_image_visualization(); cv::Mat roi_image_clone = roi_image.clone(); _simulated_image.copyTo(roi_image_clone(cv::Rect(simulated_match_location.x,simulated_match_location.y,_simulated_image.cols, _simulated_image.rows))); const double roi_image_height_nm = _core_td_map->get_exp_image_properties_roi_ny_size_height_nm(); const double roi_image_width_nm = _core_td_map->get_exp_image_properties_roi_nx_size_width_nm(); // start position x const int right_side_cols = roi_image_clone.cols - _simulated_image.cols - simulated_match_location.x; const int right_side_cols_compensation = ( right_side_cols < simulated_match_location.x ) ? ( simulated_match_location.x - right_side_cols ) : 0; const int left_side_cols_compensation = ( simulated_match_location.x < right_side_cols ) ? ( right_side_cols - simulated_match_location.x ) : 0; const int _simulated_on_exp_centered_cols = left_side_cols_compensation + roi_image_clone.cols + right_side_cols_compensation; const double _simulated_on_exp_centered_cols_width_nm = (roi_image_width_nm/roi_image_clone.cols) * _simulated_on_exp_centered_cols; std::cout << " roi_image_clone.cols " << roi_image_clone.cols << std::endl; std::cout << " _simulated_image.cols " << _simulated_image.cols << std::endl; std::cout << " simulated_match_location.x " << simulated_match_location.x << std::endl; std::cout << " left_side_cols_compensation " << left_side_cols_compensation << std::endl; std::cout << " right_side_cols " << right_side_cols << std::endl; std::cout << " right_side_cols_compensation " << right_side_cols_compensation << std::endl; std::cout << " _simulated_on_exp_centered_cols " << _simulated_on_exp_centered_cols << std::endl; std::cout << " _simulated_on_exp_centered_cols_width_nm " << _simulated_on_exp_centered_cols_width_nm << std::endl; // start position y // start position x const int bottom_side_rows = roi_image_clone.rows - _simulated_image.rows - simulated_match_location.y; const int bottom_side_rows_compensation = ( bottom_side_rows < simulated_match_location.y ) ? ( simulated_match_location.y - bottom_side_rows ) : 0; const int top_side_rows_compensation = ( simulated_match_location.y < bottom_side_rows ) ? ( bottom_side_rows - simulated_match_location.y ) : 0; const int _simulated_on_exp_centered_rows = top_side_rows_compensation + roi_image_clone.rows + bottom_side_rows_compensation; const double _simulated_on_exp_centered_rows_height_nm = (roi_image_height_nm/roi_image_clone.rows) * _simulated_on_exp_centered_rows; std::cout << " roi_image_clone.rows " << roi_image_clone.rows << std::endl; std::cout << " _simulated_image.rows " << _simulated_image.rows << std::endl; std::cout << " simulated_match_location.y " << simulated_match_location.y << std::endl; std::cout << " top_side_rows_compensation " << top_side_rows_compensation << std::endl; std::cout << " bottom_side_rows " << bottom_side_rows << std::endl; std::cout << " bottom_side_rows_compensation " << bottom_side_rows_compensation << std::endl; std::cout << " _simulated_on_exp_centered_rows " << _simulated_on_exp_centered_rows << std::endl; std::cout << " _simulated_on_exp_centered_rows_height_nm " << _simulated_on_exp_centered_rows_height_nm << std::endl; cv::Mat _simulated_on_exp_centered( _simulated_on_exp_centered_rows, _simulated_on_exp_centered_cols , roi_image_clone.type(), cv::Scalar::all( 255 ) ); roi_image_clone.copyTo(_simulated_on_exp_centered(cv::Rect( left_side_cols_compensation, top_side_rows_compensation, roi_image_clone.cols, roi_image_clone.rows))); cv::imwrite( "_simulated_on_exp_centered.png", _simulated_on_exp_centered ); ui->qgraphics_tdmap_selection->update_image_layer( _simulated_on_exp_centered , _simulated_on_exp_centered_cols_width_nm , _simulated_on_exp_centered_rows_height_nm , transform, "Overlaped images layer", 3 ); ui->qgraphics_tdmap_selection->update(); } } } else{ if (_flag_im2model_logger) { std::stringstream message; message << "the current selection (x " << x << ", y " << y << " ) does not map to the simgrid bounds"; im2model_logger->logEvent(ApplicationLog::error, message.str()); message = std::stringstream(); } } } MainWindow::~MainWindow(){ /* check if the initialization process was done */ if( !_failed_initialization ){ /* END TDMap simulation thread */ sim_tdmap_worker->abort(); sim_super_cell_worker->abort(); _sim_tdmap_thread->wait(); _sim_super_cell_thread->wait(); delete _sim_tdmap_thread; delete _sim_super_cell_thread; delete sim_tdmap_worker; delete sim_super_cell_worker; } /* DELETE UI */ delete ui; } bool MainWindow::update_qline_image_path( std::string fileName ){ bool status = false; const bool project_setted = maybeSetProject(); if ( project_setted ){ const bool _td_map_load_ok = _core_td_map->set_exp_image_properties_full_image( fileName ); if( _td_map_load_ok ){ emit experimental_image_filename_changed(); status = true; } } return status; } bool MainWindow::update_qline_cif_path( std::string fileName ){ bool status = false; const bool project_setted = maybeSetProject(); if ( project_setted ){ status = _core_td_map->set_unit_cell_cif_path( fileName ); } return status; } bool MainWindow::update_qline_mtf_path( std::string fileName ){ bool status = false; const bool project_setted = maybeSetProject(); if ( project_setted ){ status = _core_td_map->set_mtf_filename( fileName ); } return status; } void MainWindow::update_simgrid_frame(){ std::vector< std::vector<cv::Mat> > _simulated_images_grid = _core_td_map->get_simulated_images_grid_visualization(); try { this->ui->tdmap_table->set_simulated_images_grid( _simulated_images_grid ); } catch (std::exception &ex) { if (_flag_im2model_logger) { std::stringstream message; message << "error on update_simgrid_frame "; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( ApplicationLog::error , message.str() ); } } } bool MainWindow::copy_external_files_to_project_dir(){ bool result = false; const bool project_setted = maybeSetProject(); if ( project_setted ){ result = _core_td_map->copy_external_files_to_project_dir(); if ( result ){ image_path->load_data_from_getter_string(); unit_cell_file_cif->load_data_from_getter_string(); _mtf_parameters->load_data_from_getter_string(); } } return result; } void MainWindow::update_super_cell_target_region(){ this->ui->qgraphics_super_cell_edge_detection->cleanRenderAreas(); update_super_cell_target_region_shapes(); this->ui->qgraphics_super_cell_edge_detection->show(); update_super_cell_target_region_image(); } void MainWindow::update_super_cell_target_region_image(){ if( _core_td_map->get_exp_image_bounds_flag_roi_boundary_image() ){ const cv::Mat super_cell_target_region_image = _core_td_map->get_exp_image_bounds_roi_boundary_image_visualization(); if( !super_cell_target_region_image.empty() && super_cell_target_region_image.cols > 0 && super_cell_target_region_image.rows > 0 ){ const int full_boundary_polygon_margin_x_px = _core_td_map->get_exp_image_bounds_full_boundary_polygon_margin_x_px(); const int full_boundary_polygon_margin_y_px = _core_td_map->get_exp_image_bounds_full_boundary_polygon_margin_y_px(); const cv::Point2i centroid_translation_px = _core_td_map->get_super_cell_exp_image_properties_centroid_translation_px(); const cv::Point2i top_right_corner_margin ( full_boundary_polygon_margin_x_px, full_boundary_polygon_margin_y_px); ui->qgraphics_super_cell_refinement->setImage( super_cell_target_region_image, 1 , tr("Super-cell experimental image target region"), centroid_translation_px + top_right_corner_margin ); } else{ if (_flag_im2model_logger) { std::stringstream message; message << " On update_super_cell_target_region_image() mat is empty or has dimensions with 0 value. empty? " << std::boolalpha << super_cell_target_region_image.empty() << ", width: " << super_cell_target_region_image.cols << ", height: " << super_cell_target_region_image.rows; im2model_logger->logEvent(ApplicationLog::error, message.str()); } } } } void MainWindow::update_super_cell_target_region_shapes(){ this->ui->qgraphics_super_cell_edge_detection->cleanRenderAreas(); // boundary rect if( _core_td_map->get_exp_image_bounds_flag_roi_boundary_rect() ){ cv::Rect _rect_boundary_polygon = _core_td_map->get_exp_image_bounds_roi_boundary_rect(); ui->qgraphics_super_cell_edge_detection->addShapeRect( _rect_boundary_polygon, 10 , tr("Target region bounding rectangle") ); } // boundary rect with margin if( _core_td_map->get_exp_image_bounds_flag_roi_boundary_rect_w_margin() ){ cv::Rect _rect_w_margin_boundary_polygon = _core_td_map->get_exp_image_bounds_roi_boundary_rect_w_margin(); ui->qgraphics_super_cell_edge_detection->addShapeRect( _rect_w_margin_boundary_polygon, 10, cv::Vec3b(255,0,255), tr("Target region with margin bounding rectangle") ); } // experimental image boundary polygon if( _core_td_map->get_exp_image_bounds_flag_full_boundary_polygon() ){ std::vector<cv::Point2i> boundary_polygon = _core_td_map->get_exp_image_bounds_full_boundary_polygon(); ui->qgraphics_super_cell_edge_detection->addShapePolygon( boundary_polygon, cv::Point2i( 0,0 ), 10, cv::Vec3b(0,255,0) , tr("Target region boundary") ); } // experimental image boundary polygon w margin if( _core_td_map->get_exp_image_bounds_flag_full_boundary_polygon_w_margin() ){ std::vector<cv::Point2i> boundary_polygon_w_margin = _core_td_map->get_exp_image_bounds_full_boundary_polygon_w_margin(); ui->qgraphics_super_cell_edge_detection->addShapePolygon( boundary_polygon_w_margin, cv::Point2i( 0,0 ), 10, cv::Vec3b(0,0,255) , tr("Target region with margin boundary") ); } this->ui->qgraphics_super_cell_edge_detection->show(); } void MainWindow::update_full_experimental_image(){ if( _core_td_map->get_exp_image_properties_flag_full_image() ){ const cv::Mat full_image = _core_td_map->get_exp_image_properties_full_image_visualization(); // update tab 1 ui->qgraphics_full_experimental_image->setImage( full_image ); ui->qgraphics_full_experimental_image->enableRectangleSelection(); connect(ui->qgraphics_full_experimental_image, SIGNAL(selectionRectangleChanged(QRect)), this, SLOT( update_exp_image_roi_from_rectangle_selection(QRect)) ); ui->qgraphics_full_experimental_image->show(); // update tab 3 this->ui->qgraphics_super_cell_edge_detection->setImage( full_image ); this->ui->qgraphics_super_cell_edge_detection->enableRectangleSelection(); connect(ui->qgraphics_super_cell_edge_detection, SIGNAL(selectionRectangleChanged(QRect)), this, SLOT( update_tab3_exp_image_bounds_from_rectangle_selection(QRect)) ); connect(ui->qgraphics_super_cell_edge_detection, SIGNAL(selectionStatisticalRectangleChanged(QRect)), this, SLOT( update_exp_image_properties_roi_rectangle_statistical_from_rectangle_selection(QRect)) ); this->ui->qgraphics_super_cell_edge_detection->show(); update_roi_experimental_image_frame(); } } void MainWindow::update_roi_experimental_image_frame(){ if( _core_td_map->get_exp_image_properties_flag_roi_image() ){ cv::Mat roi_image = _core_td_map->get_exp_image_properties_roi_image_visualization(); const double roi_image_height_nm = _core_td_map->get_exp_image_properties_roi_ny_size_height_nm(); const double roi_image_width_nm = _core_td_map->get_exp_image_properties_roi_nx_size_width_nm(); ui->qgraphics_roi_experimental_image_tab1->setImage( roi_image ); //ui->qgraphics_roi_experimental_image_tab2->setImage( roi_image ); std::cout << "roi_image_width_nm " << roi_image_width_nm << std::endl; std::cout << "roi_image_height_nm " << roi_image_height_nm << std::endl; Qt3DCore::QTransform* transform = new Qt3DCore::QTransform( ); transform->setRotation(QQuaternion::fromAxisAndAngle(1,0,0,90)); ui->qgraphics_tdmap_selection->update_image_layer( roi_image , roi_image_width_nm , roi_image_height_nm , transform, "Experimental image layer", 1 ); ui->qgraphics_roi_experimental_image_tab1->show(); //ui->qgraphics_roi_experimental_image_tab2->show(); } } //update tab 4 ROI experimental image void MainWindow::update_roi_full_experimental_image_frame(){ if( _core_td_map->get_exp_image_properties_flag_roi_rectangle() ){ cv::Rect _roi_rect = _core_td_map->get_exp_image_properties_roi_rectangle(); ui->qgraphics_full_experimental_image->cleanRenderAreas(); ui->qgraphics_full_experimental_image->addShapeRect( _roi_rect, 10 , tr("ROI boundary") ); ui->qgraphics_full_experimental_image->show(); } } //update tab 4 void MainWindow::update_super_cell_experimental_image_intensity_columns(){ std::cout << " update_super_cell_experimental_image_intensity_columns " << std::endl; const int full_boundary_polygon_margin_x_px = _core_td_map->get_exp_image_bounds_full_boundary_polygon_margin_x_px(); const int full_boundary_polygon_margin_y_px = _core_td_map->get_exp_image_bounds_full_boundary_polygon_margin_y_px(); const int margin_point_px = _core_td_map->get_super_cell_sim_image_properties_ignore_edge_pixels(); const cv::Point2i top_right_corner_margin ( full_boundary_polygon_margin_x_px, full_boundary_polygon_margin_y_px); std::vector<cv::KeyPoint> exp_image_keypoints = _core_td_map->get_super_cell_exp_image_properties_keypoints(); std::vector<cv::Point2i> exp_image_renderPoints; for( int keypoint_pos = 0; keypoint_pos < exp_image_keypoints.size(); keypoint_pos++ ){ exp_image_renderPoints.push_back( exp_image_keypoints[keypoint_pos].pt ); } ui->qgraphics_super_cell_refinement->addRenderPoints( exp_image_renderPoints , 5, cv::Vec3b(0,255,0), tr("Experimental image intensity columns") , top_right_corner_margin); ui->qgraphics_super_cell_refinement->show(); } //update tab 4 void MainWindow::update_super_cell_simulated_image_intensity_columns(){ const std::vector<cv::KeyPoint> sim_image_keypoints = _core_td_map->get_super_cell_sim_image_properties_keypoints(); const std::vector<bool> sim_image_keypoints_marked_delete = _core_td_map->get_super_cell_sim_image_intensity_columns_marked_delete(); const std::vector<cv::Point2i> sim_image_intensity_columns_projective_2D_coordinate = _core_td_map->get_super_cell_sim_image_intensity_columns_projective_2D_coordinate(); const std::vector<cv::Point2i> sim_image_intensity_columns_center = _core_td_map->get_super_cell_sim_image_intensity_columns_center(); const std::vector<int> sim_image_intensity_columns_mean_statistical = _core_td_map->get_super_cell_sim_image_intensity_columns_mean_statistical(); const std::vector<int> exp_image_intensity_columns_mean_statistical = _core_td_map->get_super_cell_exp_image_intensity_columns_mean_statistical(); const std::vector<int> sim_image_intensity_columns_stddev_statistical = _core_td_map->get_super_cell_sim_image_intensity_columns_stddev_statistical(); const std::vector<int> exp_image_intensity_columns_stddev_statistical = _core_td_map->get_super_cell_exp_image_intensity_columns_stddev_statistical(); const std::vector<int> sim_image_intensity_columns_threshold_value = _core_td_map->get_super_cell_sim_image_intensity_columns_threshold_value(); const std::vector<double> sim_image_intensity_columns_integrate_intensity = _core_td_map->get_super_cell_sim_image_intensity_columns_integrate_intensity(); const std::vector<double> exp_image_intensity_columns_integrate_intensity = _core_td_map->get_super_cell_exp_image_intensity_columns_integrate_intensity(); for( int keypoint_pos = 0; keypoint_pos < sim_image_intensity_columns_center.size(); keypoint_pos++ ){ std::vector<cv::Point2i> sim_image_renderPoints; std::vector<cv::Vec3b> sim_image_renderPoints_color; const cv::Point2i delta = sim_image_intensity_columns_projective_2D_coordinate[keypoint_pos]; const cv::Point2i column_center = sim_image_intensity_columns_center[keypoint_pos]; const int sim_image_intensity_col_mean_statistical = sim_image_intensity_columns_mean_statistical[keypoint_pos]; const int exp_image_intensity_col_mean_statistical = exp_image_intensity_columns_mean_statistical[keypoint_pos]; const int sim_image_intensity_col_stddev_statistical = sim_image_intensity_columns_stddev_statistical[keypoint_pos]; const int exp_image_intensity_col_stddev_statistical = exp_image_intensity_columns_stddev_statistical[keypoint_pos]; const int sim_image_intensity_col_threshold_value = sim_image_intensity_columns_threshold_value[keypoint_pos]; const double sim_image_integrated_intensity = sim_image_intensity_columns_integrate_intensity[keypoint_pos]; const double exp_image_integrated_intensity = exp_image_intensity_columns_integrate_intensity[keypoint_pos]; const bool marked_del = sim_image_keypoints_marked_delete[keypoint_pos]; QString col_status = marked_del ? QString("Marked delete") : QString("OK"); QVector<QVariant> keypoint_option = {"# " + QString::number( keypoint_pos ), QString::number( column_center.x ) , QString::number( column_center.y ) , QString::number( delta.x ), QString::number( delta.y ) , col_status , QString::number( sim_image_integrated_intensity ) , QString::number( exp_image_integrated_intensity ), QString::number( sim_image_intensity_col_mean_statistical ), QString::number( exp_image_intensity_col_mean_statistical ), QString::number( sim_image_intensity_col_threshold_value ), QString::number( sim_image_intensity_col_stddev_statistical ), QString::number( exp_image_intensity_col_stddev_statistical )}; TreeItem* keypoint_item = new TreeItem ( keypoint_option ); std::stringstream sstream; sstream << "Simulated image intensity column "; sstream << std::to_string( keypoint_pos ); keypoint_item->set_variable_name( sstream.str() ); intensity_columns_listing_root->insertChildren( keypoint_item ); sim_image_renderPoints.push_back( sim_image_keypoints[keypoint_pos].pt ); if( marked_del ){ sim_image_renderPoints_color.push_back(cv::Vec3b(255,0,0)); } else{ sim_image_renderPoints_color.push_back(cv::Vec3b(0,255,0)); } ui->qgraphics_super_cell_refinement->addRenderPoints( sim_image_renderPoints, 10, sim_image_renderPoints_color, QString::fromStdString( sstream.str() ) ); ui->qgraphics_super_cell_refinement->addRenderPoints_key_to_group( QString::fromStdString( sstream.str() ), tr("Simulated image intensity columns") ); } intensity_columns_listing_model->force_layout_change(); ui->qgraphics_super_cell_refinement->show(); } void MainWindow::update_super_cell_simulated_image_roi_image(){ if( _core_td_map->get_flag_super_cell_sim_image_properties_roi_image() ){ const cv::Mat roi_image = _core_td_map->get_super_cell_sim_image_properties_roi_image_visualization(); // update tab 4 ui->qgraphics_super_cell_refinement->setImage( roi_image, 0, "ROI super-cell simulated image" ); ui->qgraphics_super_cell_refinement->show(); } } void MainWindow::update_super_cell_simulated_image_full_image(){ if( _core_td_map->get_flag_super_cell_sim_image_properties_full_image() ){ const cv::Mat full_image = _core_td_map->get_super_cell_sim_image_properties_full_image_visualization(); // update tab 4 ui->qgraphics_super_cell_refinement->setImage( full_image, 0, "Full super-cell simulated image" ); ui->qgraphics_super_cell_refinement->show(); } } bool MainWindow::_was_document_modified(){ bool result = false; if( _settings_ok ){ result |= project_setup_image_fields_model->_was_model_modified(); result |= project_setup_crystalographic_fields_model->_was_model_modified(); result |= tdmap_simulation_setup_model->_was_model_modified(); result |= tdmap_running_configuration_model->_was_model_modified(); result |= super_cell_setup_model->_was_model_modified(); } return result; } bool MainWindow::_reset_document_modified_flags(){ bool result = false; if( _settings_ok ){ result |= project_setup_image_fields_model->_reset_model_modified(); result |= project_setup_crystalographic_fields_model->_reset_model_modified(); result |= tdmap_simulation_setup_model->_reset_model_modified(); result |= tdmap_running_configuration_model->_reset_model_modified(); result |= super_cell_setup_model->_reset_model_modified(); std::cout << " _reset_document_modified_flags REESULT " << std::boolalpha << result << std::endl; } return result; } void MainWindow::update_from_full_SuperCell_failure( ){ ui->statusBar->showMessage(tr("Error while running Full-Super-Cell simulation") ); updateProgressBar(0,100,100); } void MainWindow::update_from_full_SuperCell_intensity_cols_failure( ){ ui->statusBar->showMessage(tr("Error while running Full-Super-Cell image segmentation") ); updateProgressBar(0,100,100); } void MainWindow::update_from_full_SuperCell_sucess( ){ ui->statusBar->showMessage(tr("Sucessfully runned Full-Super-Cell simulation"), 2000); updateProgressBar(0,100,100); } void MainWindow::update_from_full_SuperCell_intensity_cols_sucess( ){ ui->statusBar->showMessage(tr("Sucessfully runned Full-Super-Cell image segmentation"), 2000); updateProgressBar(0,100,100); } void MainWindow::update_from_TDMap_sucess( ){ ui->statusBar->showMessage(tr("Sucessfully runned TD-Map requested tasks"), 2000); updateProgressBar(0,100,100); } void MainWindow::update_from_TDMap_failure(){ ui->statusBar->showMessage(tr("Error while running TD-Map requested tasks") ); std::vector <std::string> errors = _core_td_map->get_test_run_config_errors(); std::ostringstream os; for( int pos = 0; pos < errors.size(); pos++ ){ os << errors.at(pos) << "\n"; } QMessageBox messageBox; QFont font; font.setBold(false); messageBox.setFont(font); messageBox.critical(0,"Error",QString::fromStdString( os.str() )); } void MainWindow::update_from_SuperCell_edge_sucess(){ ui->statusBar->showMessage(tr("Sucessfully runned edge detection"), 2000); emit super_cell_target_region_changed(); } void MainWindow::update_from_SuperCell_edge_failure(){ ui->statusBar->showMessage(tr("Error while running edge detection") ); } void MainWindow::clear_tdmap_sim_ostream_containers(){ QModelIndex celslc_index = tdmap_running_configuration_model->index(1,0); QModelIndex celslc_out_legend_index = tdmap_running_configuration_model->index(0,0,celslc_index); QModelIndex celslc_out_index = project_setup_crystalographic_fields_model->index(0,1,celslc_out_legend_index); tdmap_running_configuration_model->clearData( celslc_out_index ); QModelIndex msa_index = tdmap_running_configuration_model->index(2,0); QModelIndex msa_out_legend_index = tdmap_running_configuration_model->index(0,0,msa_index); QModelIndex msa_out_index = project_setup_crystalographic_fields_model->index(0,1,msa_out_legend_index); tdmap_running_configuration_model->clearData( msa_out_index ); QModelIndex wavimg_index = tdmap_running_configuration_model->index(3,0); QModelIndex wavimg_out_legend_index = tdmap_running_configuration_model->index(0,0,wavimg_index); QModelIndex wavimg_out_index = project_setup_crystalographic_fields_model->index(0,1,wavimg_out_legend_index); tdmap_running_configuration_model->clearData( wavimg_out_index ); QModelIndex simgrid_index = tdmap_running_configuration_model->index(2,0); QModelIndex simgrid_out_legend_index = tdmap_running_configuration_model->index(0,0,simgrid_index); QModelIndex simgrid_out_index = project_setup_crystalographic_fields_model->index(0,1,simgrid_out_legend_index); tdmap_running_configuration_model->clearData( simgrid_out_index ); } void MainWindow::update_tdmap_sim_ostream_celslc(){ std::string line; if( _core_td_map->get_run_celslc_switch() ){ QModelIndex celslc_index = tdmap_running_configuration_model->index(1,0); QModelIndex celslc_out_legend_index = tdmap_running_configuration_model->index(0,0,celslc_index); QModelIndex celslc_out_index = project_setup_crystalographic_fields_model->index(0,1,celslc_out_legend_index); if( _core_td_map->get_flag_celslc_io_ap_pipe_out() ){ while(std::getline(_sim_tdmap_celslc_ostream_buffer, line)){ QString qt_linw = QString::fromStdString( line ); QVariant _new_line_var = QVariant::fromValue(qt_linw + "\n"); bool result = tdmap_running_configuration_model->appendData( celslc_out_index, _new_line_var ); ui->qtree_view_tdmap_simulation_setup->update(); QApplication::processEvents(); } } } } void MainWindow::update_tdmap_sim_ostream_msa(){ std::string line; if( _core_td_map->get_run_msa_switch() ){ QModelIndex msa_index = tdmap_running_configuration_model->index(2,0); QModelIndex msa_out_legend_index = tdmap_running_configuration_model->index(0,0,msa_index); QModelIndex msa_out_index = project_setup_crystalographic_fields_model->index(0,1,msa_out_legend_index); if( _core_td_map->get_flag_msa_io_ap_pipe_out() ){ while(std::getline(_sim_tdmap_msa_ostream_buffer, line)){ QString qt_linw = QString::fromStdString( line ); QVariant _new_line_var = QVariant::fromValue(qt_linw + "\n"); bool result = tdmap_running_configuration_model->appendData( msa_out_index, _new_line_var ); ui->qtree_view_tdmap_simulation_setup->update(); QApplication::processEvents(); } } } } void MainWindow::update_tdmap_sim_ostream_wavimg(){ std::string line; if( _core_td_map->get_run_wavimg_switch() ){ QModelIndex wavimg_index = tdmap_running_configuration_model->index(3,0); QModelIndex wavimg_out_legend_index = tdmap_running_configuration_model->index(0,0,wavimg_index); QModelIndex wavimg_out_index = project_setup_crystalographic_fields_model->index(0,1,wavimg_out_legend_index); if( _core_td_map->get_flag_wavimg_io_ap_pipe_out() ){ while(std::getline(_sim_tdmap_wavimg_ostream_buffer, line)){ QString qt_linw = QString::fromStdString( line ); QVariant _new_line_var = QVariant::fromValue(qt_linw + "\n"); bool result = tdmap_running_configuration_model->appendData( wavimg_out_index, _new_line_var ); ui->qtree_view_tdmap_simulation_setup->update(); QApplication::processEvents(); } } } } void MainWindow::update_tdmap_sim_ostream_simgrid(){ std::string line; if( _core_td_map->get_run_simgrid_switch() ){ if( _core_td_map->get_flag_simgrid_io_ap_pipe_out() ){ QModelIndex simgrid_index = tdmap_running_configuration_model->index(2,0); QModelIndex simgrid_out_legend_index = tdmap_running_configuration_model->index(0,0,simgrid_index); QModelIndex simgrid_out_index = project_setup_crystalographic_fields_model->index(0,1,simgrid_out_legend_index); } } } void MainWindow::closeEvent(QCloseEvent *event){ if (maybeSave()) { writeSettings(); event->accept(); } else { event->ignore(); } } void MainWindow::newFile(){ if (maybeSave()) { // request tdmap identifier to api //setCurrentFile(QString()); } //const bool api_status = _core_td_map->request_api_tdmap_setup_id(); //std::cout << " api_status " << api_status << std::endl; } void MainWindow::open(){ if ( maybeSave() ) { QString fileName = QFileDialog::getOpenFileName(this); if (!fileName.isEmpty()) loadFile(fileName); } } bool MainWindow::save(){ bool result = false; if ( curFile.isEmpty() ){ result = saveAs(); } else { result = saveFile(curFile); } // if the saving was ok, then we are in a project if( result ){ _flag_project_setted = true; } return result; } bool MainWindow::saveAs() { bool result = false; QFileDialog dialog(this); dialog.setWindowModality(Qt::WindowModal); dialog.setAcceptMode(QFileDialog::AcceptSave); if ( dialog.exec() == QDialog::Accepted ){ QString folder_path = dialog.selectedFiles().first(); result = _core_td_map->set_project_dir_path( folder_path.toStdString() ); if( result ){ //_load_file_delegate->set_base_dir_path( folder_path.toStdString(), false ); std::string project_filename_with_path = _core_td_map->get_project_filename_with_path(); QString qt_project_filename_with_path = QString::fromStdString( project_filename_with_path ); result = saveFile( qt_project_filename_with_path ); } } return result; } bool MainWindow::copy_external_dependencies(){ return true; } bool MainWindow::export_TDMap_full( ){ return export_TDMap( false ); } bool MainWindow::export_TDMap_cutted( ){ return export_TDMap( true ); } bool MainWindow::export_current_simulated_image_overlay_selection( int x, int y ){ bool result = false; if( _core_td_map ){ if( _core_td_map->get_flag_raw_simulated_images_grid() ){ QFileDialog dialog(this); dialog.setWindowModality(Qt::WindowModal); std::stringstream message; message << "current_simulated_image_selection_overlay_row_" << x << "_col_" << y << ".png"; boost::filesystem::path base_dir_path = _core_td_map->get_project_dir_path(); boost::filesystem::path preset_filename( message.str() ); boost::filesystem::path full_path_filename = base_dir_path / preset_filename ; dialog.selectFile( QString::fromStdString( full_path_filename.string() ) ); dialog.setAcceptMode(QFileDialog::AcceptSave); if (dialog.exec() != QDialog::Accepted){ result = false; } else{ QString tdmap_filename = dialog.selectedFiles().first(); result = _core_td_map->export_sim_image_overlay_in_grid_pos( tdmap_filename.toStdString() , x, y ); if( result ){ ui->statusBar->showMessage(tr("TDMap correctly current tdmap sim|exp overlayed images to file: " ) + tdmap_filename , 2000); } } } } if( !result ){ ui->statusBar->showMessage(tr("Error while exporting current tdmap simulated image") ); } return result; } bool MainWindow::export_current_simulated_image_selection( int x, int y ){ bool result = false; if( _core_td_map ){ if( _core_td_map->get_flag_raw_simulated_images_grid() ){ QFileDialog dialog(this); dialog.setWindowModality(Qt::WindowModal); std::stringstream message; message << "current_simulated_image_selection_row_" << x << "_col_" << y << ".png"; boost::filesystem::path base_dir_path = _core_td_map->get_project_dir_path(); boost::filesystem::path preset_filename( message.str() ); boost::filesystem::path full_path_filename = base_dir_path / preset_filename ; dialog.selectFile( QString::fromStdString( full_path_filename.string() ) ); dialog.setAcceptMode(QFileDialog::AcceptSave); if (dialog.exec() != QDialog::Accepted){ result = false; } else{ QString tdmap_filename = dialog.selectedFiles().first(); result = _core_td_map->export_sim_image_in_grid_pos( tdmap_filename.toStdString() , x, y ); if( result ){ ui->statusBar->showMessage(tr("TDMap correctly current tdmap simulated image to file: " ) + tdmap_filename , 2000); } } } } if( !result ){ ui->statusBar->showMessage(tr("Error while exporting current tdmap simulated image") ); } return result; } bool MainWindow::export_TDMap( bool cut_margin ){ // returns false if no settings were saved bool result = false; if( _core_td_map ){ if( _core_td_map->get_flag_raw_simulated_images_grid() ){ QFileDialog dialog(this); dialog.setWindowModality(Qt::WindowModal); std::string preset_filename = _core_td_map->get_export_sim_grid_filename_hint(); boost::filesystem::path base_dir_path = _core_td_map->get_project_dir_path(); boost::filesystem::path filename( preset_filename ); boost::filesystem::path full_path_filename = base_dir_path / preset_filename ; dialog.selectFile( QString::fromStdString(full_path_filename.string() ) ); dialog.setAcceptMode(QFileDialog::AcceptSave); if (dialog.exec() != QDialog::Accepted){ result = false; } else{ QString tdmap_filename = dialog.selectedFiles().first(); result = _core_td_map->export_sim_grid( tdmap_filename.toStdString() , cut_margin ); if( result ){ ui->statusBar->showMessage(tr("TDMap correctly exported to file: " ) + tdmap_filename , 2000); } } } } if( !result ){ ui->statusBar->showMessage(tr("Error while exporting TDMap") ); } return result; } bool MainWindow::export_IntegratedIntensities_onlymapped(){ return export_IntegratedIntensities( true ); } bool MainWindow::export_IntegratedIntensities_full(){ return export_IntegratedIntensities( false ); } bool MainWindow::export_IntegratedIntensities( bool onlymapped ){ // returns false if no settings were saved bool result = false; if( _core_td_map ){ if( _core_td_map->get_flag_super_cell_simulated_image_intensity_columns_integrated_intensities() ){ QFileDialog dialog(this); dialog.setWindowModality(Qt::WindowModal); std::string preset_filename = _core_td_map->get_export_integrated_intensities_filename_hint(); boost::filesystem::path base_dir_path = _core_td_map->get_project_dir_path(); boost::filesystem::path filename( preset_filename ); boost::filesystem::path full_path_filename = base_dir_path / preset_filename ; dialog.selectFile( QString::fromStdString(full_path_filename.string() ) ); dialog.setAcceptMode(QFileDialog::AcceptSave); if (dialog.exec() != QDialog::Accepted){ result = false; } else{ QString tdmap_filename = dialog.selectedFiles().first(); result = _core_td_map->export_super_cell_simulated_image_intensity_columns_integrated_intensities( tdmap_filename.toStdString() , onlymapped ); if( result ){ ui->statusBar->showMessage(tr("Integrated intensities CSV correctly exported to file: " ) + tdmap_filename , 2000); } } } } if( !result ){ ui->statusBar->showMessage(tr("Error while exporting Integrated intensities CSV") ); } return result; } bool MainWindow::edit_preferences(){ // returns false if no settings were saved bool result = false; QSettings settings; Settings dialog; dialog.setWindowTitle ( "Configurations panel" ); _q_settings_fileName = settings.fileName(); dialog.set_q_settings_fileName( _q_settings_fileName.toStdString() ); dialog.set_dr_probe_celslc_bin( _dr_probe_celslc_bin.toStdString() ); dialog.set_dr_probe_msa_bin( _dr_probe_msa_bin.toStdString() ); dialog.set_dr_probe_wavimg_bin( _dr_probe_wavimg_bin.toStdString() ); dialog.set_im2model_api_url( im2model_api_url.toStdString() ); dialog.produce_settings_panel(); dialog.exec(); if ( dialog._is_save_preferences() ){ _dr_probe_celslc_bin = dialog.get_dr_probe_celslc_bin(); _dr_probe_msa_bin = dialog.get_dr_probe_msa_bin(); _dr_probe_wavimg_bin = dialog.get_dr_probe_wavimg_bin(); im2model_api_url = dialog.get_im2model_api_url(); writeSettings(); result = checkSettings(); } return result; } void MainWindow::about(){ QMessageBox::about(this, tr("Im2Model"), tr("<b>Im2Model</b> combines transmission electron microscopy, image correlation and matching procedures," "enabling the determination of a three-dimensional atomic structure based strictly on a single high-resolution experimental image." "Partialy financiated as part of the protocol between UTAustin I Portugal - UTA-P.")); } void MainWindow::documentWasModified(){ // setWindowModified(textEdit->document()->isModified()); } void MainWindow::createActions(){ QMenu *fileMenu = ui->menuBar->addMenu(tr("&File")); //QToolBar *fileToolBar = addToolBar(tr("File")); const QIcon newIcon = QIcon::fromTheme("document-new", QIcon(":/Icons/MenuIconNew32")); QAction *newAct = new QAction(newIcon, tr("&New"), this); newAct->setShortcuts(QKeySequence::New); newAct->setStatusTip(tr("Create a new file")); connect(newAct, &QAction::triggered, this, &MainWindow::newFile); fileMenu->addAction(newAct); const QIcon openIcon = QIcon::fromTheme("document-open", QIcon( ":/Icons/MenuIconOpen32")); QAction *openAct = new QAction(openIcon, tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing file")); connect(openAct, &QAction::triggered, this, &MainWindow::open); fileMenu->addAction(openAct); const QIcon saveIcon = QIcon::fromTheme("document-save", QIcon(":/Icons/MenuIconSave32")); QAction *saveAct = new QAction(saveIcon, tr("&Save"), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the document to disk")); connect(saveAct, &QAction::triggered, this, &MainWindow::save); fileMenu->addAction(saveAct); const QIcon saveAsIcon = QIcon::fromTheme("document-save-as"); QAction *saveAsAct = fileMenu->addAction(saveAsIcon, tr("Save &As..."), this, &MainWindow::saveAs); saveAsAct->setShortcuts(QKeySequence::SaveAs); saveAsAct->setStatusTip(tr("Save the document under a new name")); QAction *copyExternal = fileMenu->addAction( tr("Copy external dependencies..."), this, &MainWindow::copy_external_files_to_project_dir); copyExternal->setStatusTip(tr("Copy external dependencies to folder inside project")); fileMenu->addSeparator(); const QIcon exitIcon = QIcon::fromTheme("application-exit"); QAction *exitAct = fileMenu->addAction(exitIcon, tr("E&xit"), this, &QWidget::close ); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); QMenu *editMenu = ui->menuBar->addMenu(tr("&Edit")); QAction* preferencesAct = editMenu->addAction(tr("&Preferences"), this, &MainWindow::edit_preferences); preferencesAct->setShortcuts(QKeySequence::UnknownKey); editMenu->addAction(preferencesAct); QMenu *helpMenu = ui->menuBar->addMenu(tr("&Help")); QAction *aboutAct = helpMenu->addAction(tr("&About"), this, &MainWindow::about); aboutAct->setStatusTip(tr("Show the application's About box")); QMenu *tdmapMenu = ui->menuBar->addMenu(tr("&TD Map")); //QToolBar *fileToolBar = addToolBar(tr("File")); QAction *exportTDMap_cut = tdmapMenu->addAction( tr("&Export "), this , &MainWindow::export_TDMap_cutted ); // newAct->setShortcuts(QKeySequence::); exportTDMap_cut->setStatusTip(tr("Export the current TD Map")); tdmapMenu->addAction( exportTDMap_cut ); QAction *exportTDMap_mrg = tdmapMenu->addAction( tr("&Export with super-cell margins"), this , &MainWindow::export_TDMap_full ); // newAct->setShortcuts(QKeySequence::); exportTDMap_mrg->setStatusTip(tr("Export the current TD Map with super-cell margin")); tdmapMenu->addAction( exportTDMap_mrg ); QMenu *supercellMenu = ui->menuBar->addMenu(tr("&SuperCell")); //QToolBar *fileToolBar = addToolBar(tr("File")); QAction *exportAllIntensityCols = supercellMenu->addAction( tr("&Export All Intensity Columns data"), this , &MainWindow::export_IntegratedIntensities_full ); // newAct->setShortcuts(QKeySequence::); exportAllIntensityCols->setStatusTip(tr("Export All Intensity Columns data to a CSV")); supercellMenu->addAction( exportAllIntensityCols ); QAction *exportMappedIntensityCols = tdmapMenu->addAction( tr("&Export Mapped Intensity Columns data"), this , &MainWindow::export_IntegratedIntensities_onlymapped ); // newAct->setShortcuts(QKeySequence::); exportMappedIntensityCols->setStatusTip(tr("Export only the mapped agains EXP image Intensity Columns data to a CSV")); supercellMenu->addAction( exportMappedIntensityCols ); } void MainWindow::createProgressBar(){ running_progress = new QProgressBar(this); running_progress->setVisible(false); ui->statusBar->addPermanentWidget(running_progress); } void MainWindow::updateProgressBar( int lower_range, int current_value, int upper_range ){ running_progress->setRange( lower_range, upper_range ); running_progress->setValue( current_value ); running_progress->setVisible(true); } void MainWindow::updateProgressBar( int lower_range, int current_value, int upper_range, bool error ){ updateProgressBar( lower_range, current_value, upper_range); if( error ){ QPalette p = palette(); p.setColor(QPalette::Highlight, Qt::red); running_progress->setPalette(p); } } bool MainWindow::checkSettings(){ bool status = true; bool _temp_flag_dr_probe_celslc_bin = _flag_dr_probe_celslc_bin; bool _temp_flag_dr_probe_msa_bin = _flag_dr_probe_msa_bin; bool _temp_flag_dr_probe_wavimg_bin = _flag_dr_probe_wavimg_bin; bool _temp_flag_im2model_api_url = _flag_im2model_api_url; if (_flag_im2model_logger) { std::stringstream message; message << " MainWindow::checkSettings()"; im2model_logger->logEvent(ApplicationLog::notification, message.str()); message = std::stringstream(); message << "_flag_dr_probe_celslc_bin: " << _flag_dr_probe_celslc_bin; im2model_logger->logEvent(ApplicationLog::notification, message.str()); message = std::stringstream(); message << "_flag_dr_probe_msa_bin: " << _flag_dr_probe_msa_bin; im2model_logger->logEvent(ApplicationLog::notification, message.str()); message = std::stringstream(); message << "_flag_dr_probe_wavimg_bin: " << _flag_dr_probe_wavimg_bin; im2model_logger->logEvent(ApplicationLog::notification, message.str()); } // check if the bins are not equal to "" _temp_flag_dr_probe_celslc_bin &= (_dr_probe_celslc_bin == QString("")) ? false : true; _temp_flag_dr_probe_msa_bin &= (_dr_probe_msa_bin == QString("")) ? false : true; _temp_flag_dr_probe_wavimg_bin &= (_dr_probe_wavimg_bin == QString("")) ? false : true; _temp_flag_im2model_api_url &= (im2model_api_url == QString("")) ? false : true; if (_temp_flag_dr_probe_celslc_bin) { boost::filesystem::path full_path_filename(_dr_probe_celslc_bin.toStdString()); if (boost::filesystem::exists(full_path_filename)) { _temp_flag_dr_probe_celslc_bin = true; } else { _temp_flag_dr_probe_celslc_bin = false; } } if (_temp_flag_dr_probe_msa_bin) { boost::filesystem::path full_path_filename(_dr_probe_msa_bin.toStdString()); if (boost::filesystem::exists(full_path_filename)) { _temp_flag_dr_probe_msa_bin = true; } else { _temp_flag_dr_probe_msa_bin = false; } } if (_temp_flag_dr_probe_wavimg_bin) { boost::filesystem::path full_path_filename(_dr_probe_celslc_bin.toStdString()); if (boost::filesystem::exists(full_path_filename)) { _temp_flag_dr_probe_wavimg_bin = true; } else { _temp_flag_dr_probe_wavimg_bin = false; } } status &= _temp_flag_dr_probe_celslc_bin; status &= _temp_flag_dr_probe_msa_bin; status &= _temp_flag_dr_probe_wavimg_bin; status &= _temp_flag_im2model_api_url; if (_flag_im2model_logger) { std::stringstream message; message << "celslc path: " << _dr_probe_celslc_bin.toStdString() << " _flag_dr_probe_celslc_bin: " << _temp_flag_dr_probe_celslc_bin; im2model_logger->logEvent(ApplicationLog::notification, message.str()); message = std::stringstream(); message << "msa path: " << _dr_probe_msa_bin.toStdString() << "_flag_dr_probe_msa_bin: " << _temp_flag_dr_probe_msa_bin; im2model_logger->logEvent(ApplicationLog::notification, message.str()); message = std::stringstream(); message << "wavimg path: " << _dr_probe_wavimg_bin.toStdString() << "_flag_dr_probe_wavimg_bin: " << _temp_flag_dr_probe_wavimg_bin; im2model_logger->logEvent(ApplicationLog::notification, message.str()); message = std::stringstream(); message << "im2model_api_url: " << im2model_api_url.toStdString() << "_flag_im2model_api_url: " << _flag_im2model_api_url; im2model_logger->logEvent(ApplicationLog::notification, message.str()); } return status; } bool MainWindow::readSettings(){ QSettings settings; settings.beginGroup("DrProbe"); _flag_dr_probe_celslc_bin = (settings.childKeys().contains("celslc", Qt::CaseInsensitive)) ? true : false; _flag_dr_probe_msa_bin = (settings.childKeys().contains("msa", Qt::CaseInsensitive)) ? true : false; _flag_dr_probe_wavimg_bin = (settings.childKeys().contains("wavimg", Qt::CaseInsensitive)) ? true : false; _flag_im2model_api_url = (settings.childKeys().contains("im2model_api_url", Qt::CaseInsensitive)) ? true : false; _q_settings_fileName = settings.fileName(); _dr_probe_celslc_bin = settings.value("celslc","").toString(); _dr_probe_msa_bin = settings.value("msa","").toString(); _dr_probe_wavimg_bin = settings.value("wavimg","").toString(); im2model_api_url = settings.value("im2model_api_url","").toString(); settings.endGroup(); restoreGeometry(settings.value("geometry.main_window").toByteArray()); ui->td_map_splitter->restoreGeometry( settings.value("geometry.tdmap_splitter").toByteArray() ); ui->td_map_splitter->restoreState( settings.value("state.tdmap_splitter").toByteArray() ); restoreState(settings.value("windowState").toByteArray()); return checkSettings(); } void MainWindow::writeSettings(){ QSettings settings; settings.beginGroup("DrProbe"); settings.setValue("celslc",_dr_probe_celslc_bin); settings.setValue("msa",_dr_probe_msa_bin); settings.setValue("wavimg",_dr_probe_wavimg_bin); settings.setValue("im2model_api_url",im2model_api_url); settings.endGroup(); settings.setValue("geometry.main_window", saveGeometry() ); settings.setValue("windowState", saveState() ); settings.setValue("geometry.tdmap_splitter", ui->td_map_splitter->saveGeometry() ); settings.setValue("state.tdmap_splitter", ui->td_map_splitter->saveState() ); settings.setValue("geometry.super_cell_splitter", ui->super_cell_splitter->saveGeometry() ); settings.setValue("state.super_cell_splitter", ui->super_cell_splitter->saveState() ); settings.setValue("geometry.refinement_splitter", ui->refinement_splitter->saveGeometry() ); settings.setValue("state.refinement_splitter", ui->refinement_splitter->saveState() ); } bool MainWindow::initialize(){ bool result = false; QMessageBox msgBox; msgBox.setWindowTitle( tr("Application") ); msgBox.setText( tr("In order to proceed you need to either create or open an project.") ); QAbstractButton *myCloseButton = msgBox.addButton( tr("Close"), QMessageBox::NoRole ); QAbstractButton *myCreateButton = msgBox.addButton( tr("Create"), QMessageBox::YesRole ); QAbstractButton *myOpenButton = msgBox.addButton( tr("Open"), QMessageBox::YesRole ); //QObject::connect(myCloseButton, SIGNAL(clicked()), this, SLOT(close())); msgBox.setIcon(QMessageBox::Question); msgBox.exec(); if(msgBox.clickedButton() == myCreateButton){ std::cout << "new " << std::endl; this->save(); result = true; } if(msgBox.clickedButton() == myOpenButton){ std::cout << "open " << std::endl; this->open(); result = true; } return result; } bool MainWindow::maybeSave(){ bool result = false; if ( ! _was_document_modified() ){ return true; } const QMessageBox::StandardButton ret = QMessageBox::warning(this, tr("Application"), tr("The document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); switch (ret) { case QMessageBox::Save: { return save(); } case QMessageBox::Cancel: { return false; } default: break; } return true; } bool MainWindow::maybeSetProject(){ bool result = false; if ( _flag_project_setted ){ result = true; } else{ const QMessageBox::StandardButton ret = QMessageBox::warning(this, tr("Application"), tr("To make that action you need to set the project.\n" "Do you want to set the project?"), QMessageBox::Yes | QMessageBox::Cancel); switch (ret) { case QMessageBox::Yes: { result = save(); break; } case QMessageBox::Cancel: { result = false; break; } default: { result = false; break; } } } return result; } void MainWindow::loadFile(const QString &fileName){ #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::WaitCursor); #endif // The first parameter in the constructor is the character used for indentation, whilst the second is the indentation length. boost::property_tree::xml_writer_settings<std::string> pt_settings( ' ', 4 ); boost::property_tree::ptree config; boost::filesystem::path filename_path ( fileName.toStdString() ); //_load_file_delegate->set_base_dir_path( filename_path.parent_path().string(), false ); if ( _flag_im2model_logger ){ im2model_logger->add_sync( filename_path.parent_path() ); } bool result = _core_td_map->set_project_filename_with_path( fileName.toStdString() ); if( result ){ // temporary set flag _flag_project_setted = true; bool missing_version = false; bool old_version = false; std::string file_version; try { boost::property_tree::read_xml( fileName.toStdString(), config); } catch (const boost::property_tree::xml_parser::xml_parser_error& ex) { _flag_project_setted = false; result = false; std::stringstream message; message << "error in file " << ex.filename() << " line " << ex.line(); ui->statusBar->showMessage( QString::fromStdString(message.str()) ); if( _flag_im2model_logger ){ ApplicationLog::severity_level _log_type = ApplicationLog::error; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } /* check for version */ try{ file_version = config.get<std::string>("version"); if( application_version > file_version ){ old_version = true; std::stringstream message; message << "The file seems to be from an old Im2model Version. Will try to load project anyway." << "File version \"" << file_version << "\" is older than \"" << application_version << "\""; ui->statusBar->showMessage( QString::fromStdString(message.str()) ); if( _flag_im2model_logger ){ ApplicationLog::severity_level _log_type = ApplicationLog::normal; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } } catch(const boost::property_tree::ptree_error &e) { _flag_project_setted = false; missing_version = true; std::stringstream message; message << "Version parameter is missing. Will try to load project anyway."; ui->statusBar->showMessage( QString::fromStdString(message.str()) ); if( _flag_im2model_logger ){ ApplicationLog::severity_level _log_type = ApplicationLog::normal; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } bool project_setup_image_fields_ptree_result = false; bool project_setup_crystalographic_fields_ptree_result = false; bool atom_info_fields_model_ptree_result = false; bool tdmap_simulation_setup_ptree_result = false; bool tdmap_running_configuration_ptree_result = false; bool super_cell_setup_ptree_result = false; if(result){ try{ boost::property_tree::ptree project_setup_image_fields_ptree = config.get_child("project_setup_image_fields_ptree"); project_setup_image_fields_ptree_result = project_setup_image_fields_model->load_data_from_property_tree( project_setup_image_fields_ptree ); result &= project_setup_image_fields_ptree_result; ui->qtree_view_project_setup_image->update(); } catch(const boost::property_tree::ptree_error &e) { _flag_project_setted = false; result = false; if( _flag_im2model_logger ){ std::stringstream message; message << "Caught an ptree_error : " << e.what(); ApplicationLog::severity_level _log_type = ApplicationLog::error; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } try{ boost::property_tree::ptree project_setup_crystalographic_fields_ptree = config.get_child("project_setup_crystalographic_fields_ptree"); project_setup_crystalographic_fields_ptree_result = project_setup_crystalographic_fields_model->load_data_from_property_tree( project_setup_crystalographic_fields_ptree ); result &= project_setup_crystalographic_fields_ptree_result; ui->qtree_view_project_setup_crystallography->update(); } catch(const boost::property_tree::ptree_error &e) { _flag_project_setted = false; result = false; if( _flag_im2model_logger ){ std::stringstream message; message << "Caught an ptree_error : " << e.what(); ApplicationLog::severity_level _log_type = ApplicationLog::error; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } try{ boost::property_tree::ptree tdmap_simulation_setup_ptree = config.get_child("tdmap_simulation_setup_ptree"); tdmap_simulation_setup_ptree_result = tdmap_simulation_setup_model->load_data_from_property_tree( tdmap_simulation_setup_ptree ); result &= tdmap_simulation_setup_ptree_result; ui->qtree_view_tdmap_simulation_setup->update(); } catch(const boost::property_tree::ptree_error &e) { _flag_project_setted = false; result = false; if( _flag_im2model_logger ){ std::stringstream message; message << "Caught an ptree_error : " << e.what(); ApplicationLog::severity_level _log_type = ApplicationLog::error; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } try{ boost::property_tree::ptree tdmap_running_configuration_ptree = config.get_child("tdmap_running_configuration_ptree"); tdmap_running_configuration_ptree_result = tdmap_running_configuration_model->load_data_from_property_tree( tdmap_running_configuration_ptree ); result &= tdmap_running_configuration_ptree_result; ui->qtree_view_tdmap_running_configuration->update(); } catch(const boost::property_tree::ptree_error &e) { _flag_project_setted = false; result = false; if( _flag_im2model_logger ){ std::stringstream message; message << "Caught an ptree_error : " << e.what(); ApplicationLog::severity_level _log_type = ApplicationLog::error; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } try{ boost::property_tree::ptree super_cell_setup_model_ptree = config.get_child("super_cell_setup_model_ptree"); super_cell_setup_ptree_result = super_cell_setup_model->load_data_from_property_tree( super_cell_setup_model_ptree ); result &= super_cell_setup_ptree_result; ui->qtree_view_supercell_model_edge_detection_setup->update(); } catch(const boost::property_tree::ptree_error &e) { _flag_project_setted = false; result = false; if( _flag_im2model_logger ){ std::stringstream message; message << "Caught an ptree_error : " << e.what(); ApplicationLog::severity_level _log_type = ApplicationLog::error; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } try{ atom_info_fields_model = ui->qwidget_qt_scene_view_roi_tdmap_super_cell->get_atom_info_fields_model( ); boost::property_tree::ptree atom_info_fields_model_ptree = config.get_child("atom_info_fields_model_ptree"); atom_info_fields_model_ptree_result = atom_info_fields_model->load_data_from_property_tree( atom_info_fields_model_ptree ); //result &= atom_info_fields_model_ptree_result; ui->qwidget_qt_scene_view_roi_tdmap_super_cell->update(); } catch(const boost::property_tree::ptree_error &e) { _flag_project_setted = false; result = false; if( _flag_im2model_logger ){ std::stringstream message; message << "Caught an ptree_error : " << e.what(); ApplicationLog::severity_level _log_type = ApplicationLog::error; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } } #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif if( result ){ _flag_project_setted = true; this->setCurrentFile(fileName); std::stringstream message; message << "Project loaded."; ui->statusBar->showMessage( QString::fromStdString(message.str()), 2000 ); if( _flag_im2model_logger ){ ApplicationLog::severity_level _log_type = ApplicationLog::normal; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } _reset_document_modified_flags(); } else{ _flag_project_setted = false; std::stringstream message; message << "Error loading Project. Some variables might not be loaded."; ui->statusBar->showMessage( QString::fromStdString(message.str()) ); message << "Per ptree: \n"; message << "\tproject_setup_image_fields_ptree_result: " << std::boolalpha << project_setup_image_fields_ptree_result; message << "\tproject_setup_crystalographic_fields_ptree_result: " << std::boolalpha << project_setup_crystalographic_fields_ptree_result; message << "\ttdmap_simulation_setup_ptree_result: " << std::boolalpha << tdmap_simulation_setup_ptree_result; message << "\ttdmap_running_configuration_ptree_result: " << std::boolalpha << tdmap_running_configuration_ptree_result; message << "\tsuper_cell_setup_ptree_result: " << std::boolalpha << super_cell_setup_ptree_result; if( _flag_im2model_logger ){ ApplicationLog::severity_level _log_type = ApplicationLog::error; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } } } } bool MainWindow::saveFile(const QString &fileName ){ #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::WaitCursor); #endif // The first parameter in the constructor is the character used for indentation, whilst the second is the indentation length. boost::filesystem::path filename_path ( fileName.toStdString() ); //_load_file_delegate->set_base_dir_path( filename_path.parent_path().string(), false ); if ( _flag_im2model_logger ){ im2model_logger->add_sync( filename_path.parent_path() ); } atom_info_fields_model = ui->qwidget_qt_scene_view_roi_tdmap_super_cell->get_atom_info_fields_model( ); // The first parameter in the constructor is the character used for indentation, whilst the second is the indentation length. boost::property_tree::xml_writer_settings<std::string> pt_settings(' ', 4); boost::property_tree::ptree *project_setup_image_fields_ptree = project_setup_image_fields_model->save_data_into_property_tree(); boost::property_tree::ptree *project_setup_crystalographic_fields_ptree = project_setup_crystalographic_fields_model->save_data_into_property_tree(); boost::property_tree::ptree *tdmap_simulation_setup_ptree = tdmap_simulation_setup_model->save_data_into_property_tree(); boost::property_tree::ptree *tdmap_running_configuration_ptree = tdmap_running_configuration_model->save_data_into_property_tree(); boost::property_tree::ptree *super_cell_setup_model_ptree = super_cell_setup_model->save_data_into_property_tree(); boost::property_tree::ptree *intensity_peaks_model_ptree = intensity_peaks_model->save_data_into_property_tree(); boost::property_tree::ptree *atom_info_fields_model_ptree = atom_info_fields_model->save_data_into_property_tree(); //boost::property_tree::ptree *chem_database_model_ptree = chem_database_model->save_data_into_property_tree(); boost::property_tree::ptree *config = new boost::property_tree::ptree(); config->put( "version", application_version ); config->add_child( "atom_info_fields_model_ptree", *atom_info_fields_model_ptree); config->add_child( "project_setup_image_fields_ptree", *project_setup_image_fields_ptree); config->add_child( "project_setup_crystalographic_fields_ptree", *project_setup_crystalographic_fields_ptree); config->add_child( "tdmap_simulation_setup_ptree", *tdmap_simulation_setup_ptree); config->add_child( "tdmap_running_configuration_ptree", *tdmap_running_configuration_ptree); config->add_child( "super_cell_setup_model_ptree", *super_cell_setup_model_ptree); config->add_child( "intensity_peaks_model_ptree", *intensity_peaks_model_ptree); //config->add_child( "chem_database_model_ptree", *chem_database_model_ptree); // Write the property tree to the XML file. boost::property_tree::write_xml( fileName.toStdString(), *config, std::locale(), pt_settings ); #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif _flag_project_setted = true; setCurrentFile(fileName); std::stringstream message; message << "Project saved."; ui->statusBar->showMessage( QString::fromStdString(message.str()), 2000 ); if( _flag_im2model_logger ){ ApplicationLog::severity_level _log_type = ApplicationLog::normal; BOOST_LOG_FUNCTION(); im2model_logger->logEvent( _log_type , message.str() ); } _reset_document_modified_flags(); return true; } void MainWindow::setCurrentFile(const QString &fileName){ curFile = fileName; setWindowModified(false); QString shownName = curFile; if ( !_flag_project_setted ){ shownName = "*untitled.im2model"; } this->setWindowFilePath(shownName); this->setWindowTitle( shownName ); } QString MainWindow::strippedName(const QString &fullFileName){ return QFileInfo(fullFileName).fileName(); } void MainWindow::update_exp_image_roi_from_rectangle_selection( QRect rectangle_selection ){ const int dim_px_x = rectangle_selection.width(); const int center_x = dim_px_x / 2.0f + rectangle_selection.x(); const int dim_px_y = rectangle_selection.height(); const int center_y = dim_px_y / 2.0f + rectangle_selection.y(); std::cout << " center x " << center_x << " center y" << center_y << std::endl; std::cout << " dim_px_x " << dim_px_x << " dim_px_y" << dim_px_y << std::endl; project_setup_image_fields_model->setData( experimental_roi_center_x, 1 , QVariant( center_x ), Qt::EditRole ); project_setup_image_fields_model->setData( experimental_roi_center_y, 1 , QVariant( center_y ), Qt::EditRole ); project_setup_image_fields_model->setData( experimental_roi_dimensions_width_px, 1 , QVariant( dim_px_x ), Qt::EditRole ); project_setup_image_fields_model->setData( experimental_roi_dimensions_height_px, 1 , QVariant( dim_px_y ), Qt::EditRole ); } void MainWindow::update_tab3_exp_image_bounds_from_rectangle_selection( QRect rectangle_selection ){ std::cout << " update_tab3_exp_image_bounds_from_rectangle_selection " << std::endl; cv::Rect cv_rect ( rectangle_selection.x(), rectangle_selection.y(), rectangle_selection.width(), rectangle_selection.height() ); const bool result = _core_td_map->set_exp_image_bounds_roi_boundary_rect( cv_rect ); if( result ){ emit super_cell_target_region_changed(); } } void MainWindow::update_exp_image_properties_roi_rectangle_statistical_from_rectangle_selection( QRect rectangle_selection ){ cv::Rect cv_rect ( rectangle_selection.x(), rectangle_selection.y(), rectangle_selection.width(), rectangle_selection.height() ); const bool result = _core_td_map->set_exp_image_properties_roi_rectangle_statistical( cv_rect ); if( result ){ //emit super_cell_target_region_changed(); } } void MainWindow::create_box_options_tab1_exp_image(){ QVector<QVariant> common_header = {"Field","Value"}; /************************* * EXPERIMENTAL IMAGE *************************/ experimental_image_root = new TreeItem ( common_header ); experimental_image_root->set_variable_name("experimental_image_root"); project_setup_image_fields_model = new TreeModel( experimental_image_root ); //////////////// // Sampling rate //////////////// QVector<QVariant> box1_option_2 = {"Pixel size (nm/pixel)",""}; experimental_sampling_rate = new TreeItem ( box1_option_2 ); experimental_sampling_rate->set_variable_name( "experimental_sampling_rate" ); experimental_image_root->insertChildren( experimental_sampling_rate ); QVector<QVariant> box1_option_2_1 = {"x",""}; QVector<bool> box1_option_2_1_edit = {false,true}; boost::function<bool(std::string)> box1_function_2_1 ( boost::bind( &TDMap::set_exp_image_properties_sampling_rate_x_nm_per_pixel,_core_td_map, _1 ) ); boost::function<double(void)> box1_function_2_1_getter ( boost::bind( &TDMap::get_exp_image_properties_sampling_rate_x_nm_per_pixel,_core_td_map ) ); experimental_sampling_rate_x = new TreeItem ( box1_option_2_1 , box1_function_2_1, box1_option_2_1_edit ); experimental_sampling_rate_x->set_fp_data_getter_double_vec( 1, box1_function_2_1_getter ); connect( _core_td_map, SIGNAL(exp_image_properties_sampling_rate_x_nm_per_pixel_changed( )), experimental_sampling_rate_x, SLOT( load_data_from_getter_double() ) ); experimental_sampling_rate_x->set_variable_name( "experimental_sampling_rate_x" ); experimental_sampling_rate->insertChildren( experimental_sampling_rate_x ); /*group options*/ celslc_step_group_options->add_option( project_setup_image_fields_model, experimental_sampling_rate_x , 1, true); simgrid_step_group_options->add_option( project_setup_image_fields_model, experimental_sampling_rate_x , 1, true); /* validators */ experimental_sampling_rate_x->set_flag_validatable_double(1,true); boost::function<double(void)> box1_function_2_1_validator_bot ( boost::bind( &TDMap::get_exp_image_properties_sampling_rate_nm_per_pixel_bottom_limit, _core_td_map ) ); boost::function<double(void)> box1_function_2_1_validator_top ( boost::bind( &TDMap::get_exp_image_properties_sampling_rate_nm_per_pixel_top_limit, _core_td_map ) ); experimental_sampling_rate_x->set_validator_double_bottom(1, box1_function_2_1_validator_bot ); experimental_sampling_rate_x->set_validator_double_top(1, box1_function_2_1_validator_top ); //////////////// // Image Path //////////////// QVector<QVariant> box1_option_1 = {"Image path",""}; QVector<bool> box1_option_1_edit = {false,true}; boost::function<bool(std::string)> box1_function_1( boost::bind( &MainWindow::update_qline_image_path, this, _1 ) ); image_path = new TreeItem ( box1_option_1 , box1_function_1, box1_option_1_edit ); image_path->set_variable_name( "image_path" ); image_path->set_item_delegate_type( TreeItem::_delegate_FILE ); boost::function<std::string(void)> box1_function_1_getter ( boost::bind( &TDMap::get_exp_image_properties_image_path_string, _core_td_map ) ); image_path->set_fp_data_getter_string_vec( 1, box1_function_1_getter ); /*group options*/ image_path->set_variable_description( "Experimental image path" ); simgrid_step_group_options->add_option( project_setup_image_fields_model, image_path , 1, true); experimental_image_root->insertChildren( image_path ); //////////////// // ROI //////////////// QVector<QVariant> box1_option_3 = {"ROI",""}; experimental_roi = new TreeItem ( box1_option_3 ); experimental_roi->set_variable_name( "experimental_roi" ); experimental_image_root->insertChildren( experimental_roi ); //////////////// // ROI Center //////////////// QVector<QVariant> box1_option_3_1 = {"Center",""}; QVector<QVariant> box1_option_3_1_1 = {"x",""}; QVector<bool> box1_option_3_1_1_edit = {false,true}; boost::function<bool(std::string)> box1_function_3_1_1 ( boost::bind( &TDMap::set_exp_image_properties_roi_center_x,_core_td_map, _1 ) ); QVector<QVariant> box1_option_3_1_2 = {"y",""}; QVector<bool> box1_option_3_1_2_edit = {false,true}; boost::function<bool(std::string)> box1_function_3_1_2 ( boost::bind( &TDMap::set_exp_image_properties_roi_center_y,_core_td_map, _1 ) ); experimental_roi_center = new TreeItem ( box1_option_3_1 ); experimental_roi_center->set_variable_name( "experimental_roi_center" ); experimental_roi_center_x = new TreeItem ( box1_option_3_1_1 , box1_function_3_1_1, box1_option_3_1_1_edit ); experimental_roi_center_x->set_variable_name( "experimental_roi_center_x" ); connect( experimental_roi_center_x, SIGNAL(dataChanged( int )), this, SLOT( update_roi_experimental_image_frame() ) ); connect( experimental_roi_center_x, SIGNAL(dataChanged( int )), this, SLOT( update_roi_full_experimental_image_frame() ) ); experimental_roi_center_y = new TreeItem ( box1_option_3_1_2 , box1_function_3_1_2, box1_option_3_1_2_edit ); experimental_roi_center_y->set_variable_name( "experimental_roi_center_y" ); connect( experimental_roi_center_y, SIGNAL(dataChanged( int )), this, SLOT( update_roi_experimental_image_frame() ) ); connect( experimental_roi_center_y, SIGNAL(dataChanged( int )), this, SLOT( update_roi_full_experimental_image_frame() ) ); experimental_roi->insertChildren( experimental_roi_center ); experimental_roi_center->insertChildren( experimental_roi_center_x ); experimental_roi_center->insertChildren( experimental_roi_center_y ); /*group options*/ simgrid_step_group_options->add_option( project_setup_image_fields_model, experimental_roi_center_x , 1, true); simgrid_step_group_options->add_option( project_setup_image_fields_model, experimental_roi_center_y , 1, true); /* validators */ experimental_roi_center_x->set_flag_validatable_int(1,true); boost::function<int(void)> box1_function_3_1_1_validator_bot ( boost::bind( &TDMap::get_experimental_roi_center_x_bottom_limit,_core_td_map ) ); boost::function<int(void)> box1_function_3_1_1_validator_top ( boost::bind( &TDMap::get_experimental_roi_center_x_top_limit,_core_td_map ) ); experimental_roi_center_x->set_validator_int_bottom(1, box1_function_3_1_1_validator_bot ); experimental_roi_center_x->set_validator_int_top(1, box1_function_3_1_1_validator_top ); experimental_roi_center_y->set_flag_validatable_int(1,true); boost::function<int(void)> box1_function_3_1_2_validator_bot ( boost::bind( &TDMap::get_experimental_roi_center_y_bottom_limit,_core_td_map ) ); boost::function<int(void)> box1_function_3_1_2_validator_top ( boost::bind( &TDMap::get_experimental_roi_center_y_top_limit,_core_td_map ) ); experimental_roi_center_y->set_validator_int_top(1, box1_function_3_1_2_validator_top ); experimental_roi_center_y->set_validator_int_bottom(1, box1_function_3_1_2_validator_bot ); //////////////// // ROI Dimensions //////////////// QVector<QVariant> box1_option_3_2 = {"Dimensions",""}; experimental_roi_dimensions = new TreeItem ( box1_option_3_2 ); experimental_roi_dimensions->set_variable_name( "experimental_roi_dimensions" ); experimental_roi->insertChildren( experimental_roi_dimensions ); //////////////// // Width //////////////// QVector<QVariant> box1_option_3_2_1 = {"Width",""}; experimental_roi_dimensions_width = new TreeItem ( box1_option_3_2_1 ); experimental_roi_dimensions_width->set_variable_name( "experimental_roi_dimensions_width" ); experimental_roi_dimensions->insertChildren( experimental_roi_dimensions_width ); QVector<QVariant> box1_option_3_2_1_1 = {"Pixels",""}; QVector<bool> box1_option_3_2_1_1_edit = {false,true}; boost::function<bool(std::string)> box1_function_3_2_1_1 ( boost::bind( &TDMap::set_nx_size_width,_core_td_map, _1 ) ); experimental_roi_dimensions_width_px = new TreeItem ( box1_option_3_2_1_1 , box1_function_3_2_1_1 , box1_option_3_2_1_1_edit ); experimental_roi_dimensions_width_px->set_variable_name( "experimental_roi_dimensions_width_px" ); connect( experimental_roi_dimensions_width_px, SIGNAL(dataChanged( int )), this, SLOT( update_roi_experimental_image_frame() ) ); connect( experimental_roi_dimensions_width_px, SIGNAL(dataChanged( int )), this, SLOT( update_roi_full_experimental_image_frame() ) ); experimental_roi_dimensions_width->insertChildren( experimental_roi_dimensions_width_px ); QVector<QVariant> box1_option_3_2_1_2 = {"nm",""}; QVector<bool> box1_option_3_2_1_2_edit = {false,false}; boost::function<double(void)> box1_function_3_2_1_2 ( boost::bind( &TDMap::get_exp_image_properties_roi_nx_size_width_nm,_core_td_map ) ); experimental_roi_dimensions_width_nm = new TreeItem ( box1_option_3_2_1_2 ); experimental_roi_dimensions_width_nm->set_variable_name( "experimental_roi_dimensions_width_nm" ); experimental_roi_dimensions_width_nm->set_fp_data_getter_double_vec( 1, box1_function_3_2_1_2 ); experimental_roi_dimensions_width->insertChildren( experimental_roi_dimensions_width_nm ); connect( experimental_roi_dimensions_width_px, SIGNAL(dataChanged( int )), experimental_roi_dimensions_width_nm, SLOT( load_data_from_getter( int ) ) ); //////////////// // Heigth //////////////// QVector<QVariant> box1_option_3_2_2 = {"Height",""}; experimental_roi_dimensions_height = new TreeItem ( box1_option_3_2_2 ); experimental_roi_dimensions_height->set_variable_name( "experimental_roi_dimensions_height" ); experimental_roi_dimensions->insertChildren( experimental_roi_dimensions_height ); QVector<QVariant> box1_option_3_2_2_1 = {"Pixels",""}; QVector<bool> box1_option_3_2_2_1_edit = {false,true}; boost::function<bool(std::string)> box1_function_3_2_2_1 ( boost::bind( &TDMap::set_ny_size_height,_core_td_map, _1 ) ); experimental_roi_dimensions_height_px = new TreeItem ( box1_option_3_2_2_1 , box1_function_3_2_2_1, box1_option_3_2_2_1_edit ); experimental_roi_dimensions_height_px->set_variable_name( "experimental_roi_dimensions_height_px" ); connect( experimental_roi_dimensions_height_px, SIGNAL(dataChanged( int )), this, SLOT( update_roi_experimental_image_frame() ) ); connect( experimental_roi_dimensions_height_px, SIGNAL(dataChanged( int )), this, SLOT( update_roi_full_experimental_image_frame() ) ); experimental_roi_dimensions_height->insertChildren( experimental_roi_dimensions_height_px ); QVector<QVariant> box1_option_3_2_2_2 = {"nm",""}; QVector<bool> box1_option_3_2_2_2_edit = {false,false}; boost::function<double(void)> box1_function_3_2_2_2 ( boost::bind( &TDMap::get_exp_image_properties_roi_ny_size_height_nm,_core_td_map ) ); experimental_roi_dimensions_height_nm = new TreeItem ( box1_option_3_2_2_2 ); experimental_roi_dimensions_height_nm->set_variable_name( "experimental_roi_dimensions_height_nm" ); experimental_roi_dimensions_height_nm->set_fp_data_getter_double_vec( 1, box1_function_3_2_2_2 ); experimental_roi_dimensions_height->insertChildren( experimental_roi_dimensions_height_nm ); connect( experimental_roi_dimensions_height_px, SIGNAL(dataChanged( int )), experimental_roi_dimensions_height_nm, SLOT( load_data_from_getter( int ) ) ); /*group options*/ simgrid_step_group_options->add_option( project_setup_image_fields_model, experimental_roi_dimensions_width_px , 1, true); simgrid_step_group_options->add_option( project_setup_image_fields_model, experimental_roi_dimensions_height_px , 1, true); /* validators */ experimental_roi_dimensions_width_px->set_flag_validatable_int(1,true); experimental_roi_dimensions_height_px->set_flag_validatable_int(1,true); boost::function<int(void)> box1_function_3_2_1_validator_bot ( boost::bind( &TDMap::get_experimental_roi_dimensions_width_bottom_limit,_core_td_map ) ); boost::function<int(void)> box1_function_3_2_1_validator_top ( boost::bind( &TDMap::get_experimental_roi_dimensions_width_top_limit,_core_td_map ) ); boost::function<int(void)> box1_function_3_2_2_validator_bot ( boost::bind( &TDMap::get_experimental_roi_dimensions_height_bottom_limit,_core_td_map ) ); boost::function<int(void)> box1_function_3_2_2_validator_top ( boost::bind( &TDMap::get_experimental_roi_dimensions_height_top_limit,_core_td_map ) ); experimental_roi_dimensions_width_px->set_validator_int_bottom(1, box1_function_3_2_1_validator_bot ); experimental_roi_dimensions_height_px->set_validator_int_bottom(1, box1_function_3_2_2_validator_bot ); experimental_roi_dimensions_width_px->set_validator_int_top(1, box1_function_3_2_1_validator_top ); experimental_roi_dimensions_height_px->set_validator_int_top(1, box1_function_3_2_2_validator_top ); ui->qtree_view_project_setup_image->setModel(project_setup_image_fields_model); ui->qtree_view_project_setup_image->setItemDelegate( _load_file_delegate ); //start editing after one click ui->qtree_view_project_setup_image->setEditTriggers(QAbstractItemView::AllEditTriggers); ui->qtree_view_project_setup_image->expandAll(); for (int column = 0; column < project_setup_image_fields_model->columnCount(); ++column){ ui->qtree_view_project_setup_image->resizeColumnToContents(column); } } void MainWindow::create_box_options_tab1_crystallography(){ QVector<QVariant> common_header = {"Field","Value"}; /************************* * CRYSTALLOGRAPLY *************************/ crystallography_root = new TreeItem ( common_header ); crystallography_root->set_variable_name( "crystallography_root" ); project_setup_crystalographic_fields_model = new TreeModel( crystallography_root ); //////////////// // Unit-cell file //////////////// QVector<QVariant> box2_option_1 = {"Unit-cell",""}; unit_cell_file = new TreeItem ( box2_option_1 ); unit_cell_file->set_variable_name( "unit_cell_file" ); crystallography_root->insertChildren( unit_cell_file ); //////////////// // Unit-cell file CIF //////////////// QVector<QVariant> box2_option_1_1 = {"Unit-Cell",""}; QVector<bool> box2_option_1_1_edit = {false,true}; boost::function<bool(std::string)> box2_function_1_1 ( boost::bind( &MainWindow::update_qline_cif_path,this, _1 ) ); unit_cell_file_cif = new TreeItem ( box2_option_1_1 , box2_function_1_1, box2_option_1_1_edit ); unit_cell_file_cif->set_variable_name( "unit_cell_file_cif" ); boost::function<std::string(void)> box2_function_1_1_getter ( boost::bind( &TDMap::get_unit_cell_cif_path, _core_td_map ) ); unit_cell_file_cif->set_fp_data_getter_string_vec( 1, box2_function_1_1_getter ); connect( _core_td_map, SIGNAL( unit_cell_changed( )), unit_cell_file_cif, SLOT( load_data_from_getter_string() ) ); unit_cell_file_cif->set_item_delegate_type( TreeItem::_delegate_FILE ); unit_cell_file->insertChildren( unit_cell_file_cif ); /*group options*/ celslc_step_group_options->add_option( project_setup_crystalographic_fields_model, unit_cell_file_cif , 1, true ); QVector<QVariant> box2_option_1_2 = {"Display",""}; unit_cell_display = new TreeItem ( box2_option_1_2 ); unit_cell_display->set_variable_name( "unit_cell_display" ); unit_cell_file->insertChildren( unit_cell_display ); //////////////// //Unit cell display -- Expand factor //////////////// QVector<QVariant> box2_option_1_2_1 = {"Expand factor",""}; unit_cell_display_expand_factor = new TreeItem ( box2_option_1_2_1 ); unit_cell_display_expand_factor->set_variable_name( "unit_cell_display_expand_factor" ); unit_cell_display->insertChildren( unit_cell_display_expand_factor ); //////////////// //Unit cell display -- Expand factor a //////////////// QVector<QVariant> box2_option_1_2_1_1 = {"a",""}; QVector<bool> box2_option_1_2_1_1_edit = {false,true}; boost::function<bool(std::string)> box2_function_1_2_1_1_setter ( boost::bind( &TDMap::set_unit_cell_display_expand_factor_a, _core_td_map, _1 ) ); boost::function<int(void)> box2_function_1_2_1_1_getter ( boost::bind( &TDMap::get_unit_cell_display_expand_factor_a, _core_td_map ) ); unit_cell_display_expand_factor_a = new TreeItem ( box2_option_1_2_1_1 , box2_function_1_2_1_1_setter, box2_option_1_2_1_1_edit ); unit_cell_display_expand_factor_a->set_fp_data_getter_int_vec( 1, box2_function_1_2_1_1_getter ); // load the preset data from core constuctor unit_cell_display_expand_factor_a->load_data_from_getter( 1 ); unit_cell_display_expand_factor_a->set_variable_name( "unit_cell_display_expand_factor_a" ); unit_cell_display_expand_factor->insertChildren( unit_cell_display_expand_factor_a ); /* validators */ unit_cell_display_expand_factor_a->set_flag_validatable_int(1,true); boost::function<int(void)> box2_function_1_2_1_1_validator_bot ( boost::bind( &TDMap::get_unit_cell_display_expand_factor_bottom_limit, _core_td_map ) ); unit_cell_display_expand_factor_a->set_validator_int_bottom(1, box2_function_1_2_1_1_validator_bot ); //////////////// //Unit cell display -- Expand factor b //////////////// QVector<QVariant> box2_option_1_2_1_2 = {"b",""}; QVector<bool> box2_option_1_2_1_2_edit = {false,true}; boost::function<bool(std::string)> box2_function_1_2_1_2_setter ( boost::bind( &TDMap::set_unit_cell_display_expand_factor_b, _core_td_map, _1 ) ); boost::function<int(void)> box2_function_1_2_1_2_getter ( boost::bind( &TDMap::get_unit_cell_display_expand_factor_b, _core_td_map ) ); unit_cell_display_expand_factor_b = new TreeItem ( box2_option_1_2_1_2 , box2_function_1_2_1_2_setter, box2_option_1_2_1_2_edit ); unit_cell_display_expand_factor_b->set_fp_data_getter_int_vec( 1, box2_function_1_2_1_2_getter ); // load the preset data from core constuctor unit_cell_display_expand_factor_b->load_data_from_getter( 1 ); unit_cell_display_expand_factor_b->set_variable_name( "unit_cell_display_expand_factor_b" ); unit_cell_display_expand_factor->insertChildren( unit_cell_display_expand_factor_b ); /* validators */ unit_cell_display_expand_factor_b->set_flag_validatable_int(1,true); boost::function<int(void)> box2_function_1_2_1_2_validator_bot ( boost::bind( &TDMap::get_unit_cell_display_expand_factor_bottom_limit, _core_td_map ) ); unit_cell_display_expand_factor_b->set_validator_int_bottom(1, box2_function_1_2_1_2_validator_bot ); //////////////// //Unit cell display -- Expand factor c //////////////// QVector<QVariant> box2_option_1_2_1_3 = {"c",""}; QVector<bool> box2_option_1_2_1_3_edit = {false,true}; boost::function<bool(std::string)> box2_function_1_2_1_3_setter ( boost::bind( &TDMap::set_unit_cell_display_expand_factor_c, _core_td_map, _1 ) ); boost::function<int(void)> box2_function_1_2_1_3_getter ( boost::bind( &TDMap::get_unit_cell_display_expand_factor_c, _core_td_map ) ); unit_cell_display_expand_factor_c = new TreeItem ( box2_option_1_2_1_3 , box2_function_1_2_1_3_setter, box2_option_1_2_1_3_edit ); unit_cell_display_expand_factor_c->set_fp_data_getter_int_vec( 1, box2_function_1_2_1_3_getter ); // load the preset data from core constuctor unit_cell_display_expand_factor_c->load_data_from_getter( 1 ); unit_cell_display_expand_factor_c->set_variable_name( "unit_cell_display_expand_factor_c" ); unit_cell_display_expand_factor->insertChildren( unit_cell_display_expand_factor_c ); /* validators */ unit_cell_display_expand_factor_c->set_flag_validatable_int(1,true); boost::function<int(void)> box2_function_1_2_1_3_validator_bot ( boost::bind( &TDMap::get_unit_cell_display_expand_factor_bottom_limit, _core_td_map ) ); unit_cell_display_expand_factor_c->set_validator_int_bottom(1, box2_function_1_2_1_3_validator_bot ); //////////////// // Projection direction //////////////// QVector<QVariant> box2_option_3 = {"Zone axis",""}; zone_axis = new TreeItem ( box2_option_3 ); zone_axis->set_variable_name( "zone_axis" ); crystallography_root->insertChildren( zone_axis ); //////////////// // Projection direction h //////////////// QVector<QVariant> box2_option_3_1 = {"u",""}; QVector<bool> box2_option_3_1_edit = {false,true}; boost::function<bool(std::string)> box2_function_3_1 ( boost::bind( &TDMap::set_zone_axis_u,_core_td_map, _1 ) ); zone_axis_u = new TreeItem ( box2_option_3_1 , box2_function_3_1, box2_option_3_1_edit ); zone_axis_u->set_variable_name( "zone_axis_u" ); boost::function<double(void)> box2_function_3_1_getter ( boost::bind( &TDMap::get_zone_axis_u, _core_td_map ) ); zone_axis_u->set_fp_data_getter_int_vec( 1, box2_function_3_1_getter ); zone_axis->insertChildren( zone_axis_u ); /*group options*/ celslc_step_group_options->add_option( project_setup_crystalographic_fields_model, zone_axis_u , 1, true); /* validators */ zone_axis_u->set_flag_validatable_double(1,true); // load the preset data from core constuctor zone_axis_u->load_data_from_getter( 1 ); //////////////// // Projection direction k //////////////// QVector<QVariant> box2_option_3_2 = {"v",""}; QVector<bool> box2_option_3_2_edit = {false,true}; boost::function<bool(std::string)> box2_function_3_2 ( boost::bind( &TDMap::set_zone_axis_v,_core_td_map, _1 ) ); zone_axis_v = new TreeItem ( box2_option_3_2 , box2_function_3_2, box2_option_3_2_edit ); zone_axis_v->set_variable_name( "zone_axis_v" ); boost::function<double(void)> box2_function_3_2_getter ( boost::bind( &TDMap::get_zone_axis_v, _core_td_map ) ); zone_axis_v->set_fp_data_getter_int_vec( 1, box2_function_3_2_getter ); zone_axis->insertChildren( zone_axis_v ); /*group options*/ celslc_step_group_options->add_option( project_setup_crystalographic_fields_model, zone_axis_v , 1, true); /* validators */ zone_axis_v->set_flag_validatable_double(1,true); // load the preset data from core constuctor zone_axis_v->load_data_from_getter( 1 ); //////////////// // Projection direction l //////////////// QVector<QVariant> box2_option_3_3 = {"w",""}; QVector<bool> box2_option_3_3_edit = {false,true}; boost::function<bool(std::string)> box2_function_3_3 ( boost::bind( &TDMap::set_zone_axis_w,_core_td_map, _1 ) ); zone_axis_w = new TreeItem ( box2_option_3_3 , box2_function_3_3, box2_option_3_3_edit ); zone_axis_w->set_variable_name( "zone_axis_w" ); boost::function<double(void)> box2_function_3_3_getter ( boost::bind( &TDMap::get_zone_axis_w, _core_td_map ) ); zone_axis_w->set_fp_data_getter_int_vec( 1, box2_function_3_3_getter ); zone_axis->insertChildren( zone_axis_w ); /*group options*/ celslc_step_group_options->add_option( project_setup_crystalographic_fields_model, zone_axis_w , 1, true); /* validators */ zone_axis_w->set_flag_validatable_double(1,true); // load the preset data from core constuctor zone_axis_w->load_data_from_getter( 1 ); //////////////// // Projected y axis //////////////// QVector<QVariant> box2_option_2 = {"Upward vector",""}; upward_vector = new TreeItem ( box2_option_2 ); upward_vector->set_variable_name( "upward_vector" ); crystallography_root->insertChildren( upward_vector ); //////////////// //Projected y axis u //////////////// QVector<QVariant> box2_option_2_1 = {"u",""}; QVector<bool> box2_option_2_1_edit = {false,true}; boost::function<bool(std::string)> box2_function_2_1 ( boost::bind( &TDMap::set_upward_vector_u,_core_td_map, _1 ) ); upward_vector_u = new TreeItem ( box2_option_2_1 , box2_function_2_1, box2_option_2_1_edit ); upward_vector_u->set_variable_name( "upward_vector_u" ); boost::function<double(void)> box2_function_2_1_getter ( boost::bind( &TDMap::get_upward_vector_u, _core_td_map ) ); upward_vector_u->set_fp_data_getter_int_vec( 1, box2_function_2_1_getter ); upward_vector->insertChildren( upward_vector_u ); /*group options*/ celslc_step_group_options->add_option( project_setup_crystalographic_fields_model, upward_vector_u , 1, true); /* validators */ upward_vector_u->set_flag_validatable_double(1,true); // load the preset data from core constuctor upward_vector_u->load_data_from_getter( 1 ); //////////////// //Projected y axis v //////////////// QVector<QVariant> box2_option_2_2 = {"v",""}; QVector<bool> box2_option_2_2_edit = {false,true}; boost::function<bool(std::string)> box2_function_2_2 ( boost::bind( &TDMap::set_upward_vector_v,_core_td_map, _1 ) ); upward_vector_v = new TreeItem ( box2_option_2_2 , box2_function_2_2, box2_option_2_2_edit ); upward_vector_v->set_variable_name( "upward_vector_v" ); boost::function<double(void)> box2_function_2_2_getter ( boost::bind( &TDMap::get_upward_vector_v, _core_td_map ) ); upward_vector_v->set_fp_data_getter_int_vec( 1, box2_function_2_2_getter ); upward_vector->insertChildren( upward_vector_v ); /*group options*/ celslc_step_group_options->add_option( project_setup_crystalographic_fields_model, upward_vector_v , 1, true); /* validators */ upward_vector_v->set_flag_validatable_double(1,true); // load the preset data from core constuctor upward_vector_v->load_data_from_getter( 1 ); //////////////// //Projected y axis w //////////////// QVector<QVariant> box2_option_2_3 = {"w",""}; QVector<bool> box2_option_2_3_edit = {false,true}; boost::function<bool(std::string)> box2_function_2_3 ( boost::bind( &TDMap::set_upward_vector_w,_core_td_map, _1 ) ); upward_vector_w = new TreeItem ( box2_option_2_3 , box2_function_2_3, box2_option_2_3_edit ); upward_vector_w->set_variable_name( "upward_vector_w" ); boost::function<double(void)> box2_function_2_3_getter ( boost::bind( &TDMap::get_upward_vector_w, _core_td_map ) ); upward_vector_w->set_fp_data_getter_int_vec( 1, box2_function_2_3_getter ); upward_vector->insertChildren( upward_vector_w ); /*group options*/ celslc_step_group_options->add_option( project_setup_crystalographic_fields_model, upward_vector_w , 1, true); /* validators */ upward_vector_w->set_flag_validatable_double(1,true); // load the preset data from core constuctor upward_vector_w->load_data_from_getter( 1 ); //////////////// // Orientation //////////////// QVector<QVariant> box2_option_4 = {"Orientation matrix",""}; QVector<bool> box2_option_4_edit = {false,true}; boost::function<bool(std::string)> box2_function_4 ( boost::bind( &TDMap::set_orientation_matrix_string,_core_td_map, _1 ) ); orientation_matrix = new TreeItem ( box2_option_4, box2_function_4, box2_option_4_edit ); orientation_matrix->set_variable_name( "orientation_matrix" ); crystallography_root->insertChildren( orientation_matrix ); boost::function<std::string(void)> box2_function_4_getter ( boost::bind( &TDMap::get_orientation_matrix_string, _core_td_map ) ); orientation_matrix->set_fp_data_getter_string_vec( 1, box2_function_4_getter ); // load the preset data from core constuctor orientation_matrix->load_data_from_getter( 1 ); SuperCell* tdmap_roi_sim_super_cell = _core_td_map->get_tdmap_roi_sim_super_cell(); connect( tdmap_roi_sim_super_cell, SIGNAL( orientation_matrix_changed()), orientation_matrix, SLOT( load_data_from_getter_string() ) ); ui->qtree_view_project_setup_crystallography->setModel(project_setup_crystalographic_fields_model); ui->qtree_view_project_setup_crystallography->setItemDelegate( _load_file_delegate ); //start editing after one click ui->qtree_view_project_setup_crystallography->setEditTriggers(QAbstractItemView::AllEditTriggers); ui->qtree_view_project_setup_crystallography->expandAll(); for (int column = 0; column < project_setup_crystalographic_fields_model->columnCount(); ++column){ ui->qtree_view_project_setup_crystallography->resizeColumnToContents(column); } } void MainWindow::create_box_options_tab2_sim_config(){ QVector<QVariant> common_header = {"Field","Value"}; /************************* * TD MAP *************************/ tdmap_root = new TreeItem ( common_header ); tdmap_root->set_variable_name( "tdmap_root" ); tdmap_simulation_setup_model = new TreeModel( tdmap_root ); //////////////// // Cell Dimensions //////////////// QVector<QVariant> box3_option_4 = {"Cell Dimensions",""}; tdmap_cell_dimensions = new TreeItem ( box3_option_4 ); tdmap_cell_dimensions->set_variable_name( "tdmap_cell_dimensions" ); tdmap_root->insertChildren( tdmap_cell_dimensions ); //////////////// // Cell Dimensions -- a //////////////// QVector<QVariant> box3_option_4_1 = {"a (nm)",""}; QVector<bool> box3_option_4_1_edit = {false,true}; boost::function<bool(std::string)> box3_function_4_1 ( boost::bind( &TDMap::set_super_cell_size_a, _core_td_map, _1 ) ); tdmap_cell_dimensions_a = new TreeItem ( box3_option_4_1 , box3_function_4_1, box3_option_4_1_edit ); tdmap_cell_dimensions_a->set_variable_name( "tdmap_cell_dimensions_a" ); tdmap_cell_dimensions->insertChildren( tdmap_cell_dimensions_a ); /*group options*/ celslc_step_group_options->add_option( tdmap_simulation_setup_model, tdmap_cell_dimensions_a , 1, true); /* validators */ tdmap_cell_dimensions_a->set_flag_validatable_double(1,true); boost::function<double(void)> box3_function_4_1_validator_bot ( boost::bind( &TDMap::get_tdmap_cell_dimensions_a_bottom_limit, _core_td_map ) ); boost::function<double(void)> box3_function_4_1_validator_top ( boost::bind( &TDMap::get_tdmap_cell_dimensions_a_top_limit, _core_td_map ) ); tdmap_cell_dimensions_a->set_validator_double_bottom(1, box3_function_4_1_validator_bot ); tdmap_cell_dimensions_a->set_validator_double_top(1, box3_function_4_1_validator_top ); //////////////// // Cell Dimensions -- b //////////////// QVector<QVariant> box3_option_4_2 = {"b (nm)",""}; QVector<bool> box3_option_4_2_edit = {false,true}; boost::function<bool(std::string)> box3_function_4_2 ( boost::bind( &TDMap::set_super_cell_size_b, _core_td_map, _1 ) ); tdmap_cell_dimensions_b = new TreeItem ( box3_option_4_2 , box3_function_4_2, box3_option_4_2_edit ); tdmap_cell_dimensions_b->set_variable_name( "tdmap_cell_dimensions_b" ); tdmap_cell_dimensions->insertChildren( tdmap_cell_dimensions_b ); /*group options*/ celslc_step_group_options->add_option( tdmap_simulation_setup_model, tdmap_cell_dimensions_b , 1, true); /* validators */ tdmap_cell_dimensions_b->set_flag_validatable_double(1,true); boost::function<double(void)> box3_function_4_2_validator_bot ( boost::bind( &TDMap::get_tdmap_cell_dimensions_b_bottom_limit, _core_td_map ) ); boost::function<double(void)> box3_function_4_2_validator_top ( boost::bind( &TDMap::get_tdmap_cell_dimensions_b_top_limit, _core_td_map ) ); tdmap_cell_dimensions_b->set_validator_double_bottom(1, box3_function_4_2_validator_bot ); tdmap_cell_dimensions_b->set_validator_double_top(1, box3_function_4_2_validator_top ); //////////////// // 2D variation map //////////////// QVector<QVariant> box3_option_0 = {"Parameter variation map",""}; _parameter_variation_map = new TreeItem ( box3_option_0 ); _parameter_variation_map->set_variable_name( "_parameter_variation_map" ); tdmap_root->insertChildren( _parameter_variation_map ); //////////////// // 2D variation map - thickness //////////////// QVector<QVariant> box3_option_0_1 = {"Thickness",""}; _parameter_variation_map_thickness = new TreeItem ( box3_option_0_1 ); _parameter_variation_map_thickness->set_variable_name( "_parameter_variation_map_thickness" ); _parameter_variation_map->insertChildren( _parameter_variation_map_thickness ); //////////////// // Thickness range //////////////// QVector<QVariant> box3_option_1 = {"Thickness range",""}; thickness_range = new TreeItem ( box3_option_1 ); thickness_range->set_variable_name( "thickness_range" ); _parameter_variation_map_thickness->insertChildren( thickness_range ); //////////////// //Thickness range -- lower bound //////////////// QVector<QVariant> box3_option_1_1 = {"Lower bound",""}; QVector<bool> box3_option_1_1_edit = {false,true}; boost::function<bool(std::string)> box3_function_1_1 ( boost::bind( &TDMap::set_nm_lower_bound, _core_td_map, _1 ) ); thickness_range_lower_bound = new TreeItem ( box3_option_1_1 , box3_function_1_1, box3_option_1_1_edit ); thickness_range_lower_bound->set_variable_name( "thickness_range_lower_bound" ); thickness_range->insertChildren( thickness_range_lower_bound ); /* validators */ thickness_range_lower_bound->set_flag_validatable_double(1,true); boost::function<double(void)> box3_function_1_1_validator_bot ( boost::bind( &TDMap::get_nm_lower_bound_bottom_limit, _core_td_map ) ); boost::function<double(void)> box3_function_1_1_validator_top ( boost::bind( &TDMap::get_nm_lower_bound_top_limit, _core_td_map ) ); thickness_range_lower_bound->set_validator_double_bottom(1, box3_function_1_1_validator_bot ); thickness_range_lower_bound->set_validator_double_top(1, box3_function_1_1_validator_top ); //////////////// //Thickness range -- upper bound //////////////// QVector<QVariant> box3_option_1_2 = {"Upper bound",""}; QVector<bool> box3_option_1_2_edit = {false,true}; boost::function<bool(std::string)> box3_function_1_2 ( boost::bind( &TDMap::set_nm_upper_bound, _core_td_map, _1 ) ); thickness_range_upper_bound = new TreeItem ( box3_option_1_2 , box3_function_1_2, box3_option_1_2_edit ); thickness_range_upper_bound->set_variable_name( "thickness_range_upper_bound" ); thickness_range->insertChildren( thickness_range_upper_bound ); /* validators */ thickness_range_upper_bound->set_flag_validatable_double(1,true); boost::function<double(void)> box3_function_1_2_validator_bot ( boost::bind( &TDMap::get_nm_upper_bound_bottom_limit, _core_td_map ) ); boost::function<double(void)> box3_function_1_2_validator_top ( boost::bind( &TDMap::get_nm_upper_bound_top_limit, _core_td_map ) ); thickness_range_upper_bound->set_validator_double_bottom(1, box3_function_1_2_validator_bot ); thickness_range_upper_bound->set_validator_double_top(1, box3_function_1_2_validator_top ); //////////////// //Thickness range -- Samples //////////////// QVector<QVariant> box3_option_1_3 = {"Samples",""}; QVector<bool> box3_option_1_3_edit = {false,true}; boost::function<bool(std::string)> box3_function_1_3 ( boost::bind( &TDMap::set_slice_samples, _core_td_map, _1 ) ); thickness_range_number_samples = new TreeItem ( box3_option_1_3 , box3_function_1_3, box3_option_1_3_edit ); thickness_range_number_samples->set_variable_name( "thickness_range_number_samples" ); _parameter_variation_map_thickness->insertChildren( thickness_range_number_samples ); /* validators */ thickness_range_number_samples->set_flag_validatable_int(1,true); boost::function<int(void)> box3_function_1_3_validator_bot ( boost::bind( &TDMap::get_slice_samples_bottom_limit, _core_td_map ) ); boost::function<int(void)> box3_function_1_3_validator_top ( boost::bind( &TDMap::get_slice_samples_top_limit, _core_td_map ) ); thickness_range_number_samples->set_validator_int_bottom(1, box3_function_1_3_validator_bot ); thickness_range_number_samples->set_validator_int_top(1, box3_function_1_3_validator_top ); //////////////// // 2D variation map - defocus //////////////// QVector<QVariant> box3_option_0_2 = {"Defocus",""}; _parameter_variation_map_defocous = new TreeItem ( box3_option_0_2 ); _parameter_variation_map_defocous->set_variable_name( "_parameter_variation_map_defocous" ); _parameter_variation_map->insertChildren( _parameter_variation_map_defocous ); //////////////// // Defocus range //////////////// QVector<QVariant> box3_option_2 = {"Defocus range",""}; defocus_range = new TreeItem ( box3_option_2 ); defocus_range->set_variable_name( "defocus_range" ); _parameter_variation_map_defocous->insertChildren( defocus_range ); //////////////// //Defocus range -- lower bound //////////////// QVector<QVariant> box3_option_2_1 = {"Lower bound",""}; QVector<bool> box3_option_2_1_edit = {false,true}; boost::function<bool(std::string)> box3_function_2_1 ( boost::bind( &TDMap::set_defocus_lower_bound, _core_td_map, _1 ) ); defocus_range_lower_bound = new TreeItem ( box3_option_2_1 , box3_function_2_1, box3_option_2_1_edit ); defocus_range_lower_bound->set_variable_name( "defocus_range_lower_bound" ); defocus_range->insertChildren( defocus_range_lower_bound ); /* validators */ defocus_range_lower_bound->set_flag_validatable_double(1,true); boost::function<double(void)> box3_function_2_1_validator_bot ( boost::bind( &TDMap::get_defocus_lower_bound_bottom_limit, _core_td_map ) ); boost::function<double(void)> box3_function_2_1_validator_top ( boost::bind( &TDMap::get_defocus_lower_bound_top_limit, _core_td_map ) ); defocus_range_lower_bound->set_validator_double_bottom(1, box3_function_2_1_validator_bot ); defocus_range_lower_bound->set_validator_double_top(1, box3_function_2_1_validator_top ); //////////////// //Defocus range -- upper bound //////////////// QVector<QVariant> box3_option_2_2 = {"Upper bound",""}; QVector<bool> box3_option_2_2_edit = {false,true}; boost::function<bool(std::string)> box3_function_2_2 ( boost::bind( &TDMap::set_defocus_upper_bound, _core_td_map, _1 ) ); defocus_range_upper_bound = new TreeItem ( box3_option_2_2 , box3_function_2_2, box3_option_2_2_edit ); defocus_range_upper_bound->set_variable_name( "defocus_range_upper_bound" ); defocus_range->insertChildren( defocus_range_upper_bound ); /* validators */ defocus_range_upper_bound->set_flag_validatable_double(1,true); boost::function<double(void)> box3_function_2_2_validator_bot ( boost::bind( &TDMap::get_defocus_upper_bound_bottom_limit, _core_td_map ) ); boost::function<double(void)> box3_function_2_2_validator_top ( boost::bind( &TDMap::get_defocus_upper_bound_top_limit, _core_td_map ) ); defocus_range_upper_bound->set_validator_double_bottom(1, box3_function_2_2_validator_bot ); defocus_range_upper_bound->set_validator_double_top(1, box3_function_2_2_validator_top ); //////////////// //Defocus range -- Samples //////////////// QVector<QVariant> box3_option_2_3 = {"Samples",""}; QVector<bool> box3_option_2_3_edit = {false,true}; boost::function<bool(std::string)> box3_function_2_3 ( boost::bind( &TDMap::set_defocus_samples, _core_td_map, _1 ) ); defocus_range_number_samples = new TreeItem ( box3_option_2_3 , box3_function_2_3, box3_option_2_3_edit ); defocus_range_number_samples->set_variable_name( "defocus_range_number_samples" ); _parameter_variation_map_defocous->insertChildren( defocus_range_number_samples ); /* validators */ defocus_range_number_samples->set_flag_validatable_int(1,true); boost::function<int(void)> box3_function_2_3_validator_bot ( boost::bind( &TDMap::get_defocus_samples_bottom_limit, _core_td_map ) ); boost::function<int(void)> box3_function_2_3_validator_top ( boost::bind( &TDMap::get_defocus_samples_top_limit, _core_td_map ) ); defocus_range_number_samples->set_validator_int_bottom(1, box3_function_2_3_validator_bot ); defocus_range_number_samples->set_validator_int_top(1, box3_function_2_3_validator_top ); //////////////// // Incident electron beam //////////////// QVector<QVariant> box3_option_3 = {"Optics",""}; incident_electron_beam = new TreeItem ( box3_option_3 ); incident_electron_beam->set_variable_name( "incident_electron_beam" ); _parameter_variation_map->insertChildren( incident_electron_beam ); //////////////// // Incident electron beam -- Accelaration voltage (kV) //////////////// QVector<QVariant> box3_option_3_1 = {"Acceleration voltage (kV)",""}; QVector<bool> box3_option_3_1_edit = {false,true}; boost::function<bool(std::string)> box3_function_3_1 ( boost::bind( &TDMap::set_accelaration_voltage_kv, _core_td_map, _1 ) ); boost::function<double(void)> box3_function_3_1_getter ( boost::bind( &TDMap::get_accelaration_voltage_kv,_core_td_map ) ); accelaration_voltage_kv = new TreeItem ( box3_option_3_1 , box3_function_3_1, box3_option_3_1_edit ); accelaration_voltage_kv->set_fp_data_getter_double_vec( 1, box3_function_3_1_getter ); connect( _core_td_map, SIGNAL( accelaration_voltage_kv_changed( )), accelaration_voltage_kv, SLOT( load_data_from_getter_double() ) ); accelaration_voltage_kv->set_variable_name( "accelaration_voltage_kv" ); incident_electron_beam->insertChildren( accelaration_voltage_kv ); /*group options*/ celslc_step_group_options->add_option( tdmap_simulation_setup_model, accelaration_voltage_kv , 1, true); msa_step_group_options->add_option( tdmap_simulation_setup_model, accelaration_voltage_kv , 1, true); /* validators */ accelaration_voltage_kv->set_flag_validatable_double(1,true); boost::function<double(void)> box3_function_3_1_validator_bot ( boost::bind( &TDMap::get_accelaration_voltage_kv_bottom_limit, _core_td_map ) ); boost::function<double(void)> box3_function_3_1_validator_top ( boost::bind( &TDMap::get_accelaration_voltage_kv_top_limit, _core_td_map ) ); accelaration_voltage_kv->set_validator_double_bottom(1, box3_function_3_1_validator_bot ); accelaration_voltage_kv->set_validator_double_top(1, box3_function_3_1_validator_top ); //////////////// // Simulation Refinement //////////////// QVector<QVariant> box3_option_5 = {"Refinement",""}; QVector<bool> box3_option_5_edit = {false,true}; boost::function<int(void)> box3_function_5_getter ( boost::bind( &TDMap::get_refinement_definition_method, _core_td_map ) ); boost::function<bool(int)> box3_function_5_setter ( boost::bind( &TDMap::set_refinement_definition_method, _core_td_map, _1 ) ); _simulation_refinement = new TreeItem ( box3_option_5, box3_function_5_setter, box3_option_5_edit ); _simulation_refinement->set_fp_data_getter_int_vec( 1, box3_function_5_getter ); _simulation_refinement->set_variable_name( "_simulation_refinement" ); // load the preset data from core constuctor _simulation_refinement->load_data_from_getter( 1 ); QVector<QVariant> box3_option_5_drop = {"No refinement","Corrected","Non-Corrected", "User defined"}; QVector<QVariant> box3_option_5_drop_enum( { TDMap::RefinementPreset::NO_REFINEMENT, TDMap::RefinementPreset::MICROSCOPE_CORRECTED, TDMap::RefinementPreset::MICROSCOPE_NON_CORRECTED, TDMap::RefinementPreset::USER_DEFINED_PRESET } ); _simulation_refinement->set_item_delegate_type( TreeItem::_delegate_DROP ); _simulation_refinement->set_dropdown_options( 1, box3_option_5_drop, box3_option_5_drop_enum ); tdmap_root->insertChildren( _simulation_refinement ); //////////////// //Simulation Refinement -- Aberration parameters //////////////// QVector<QVariant> box3_option_5_1 = {"Aberration parameters",""}; _aberration_parameters = new TreeItem ( box3_option_5_1 ); _aberration_parameters->set_variable_name( "_aberration_parameters" ); _simulation_refinement->insertChildren( _aberration_parameters ); //////////////// // Aberration parameters -- Spherical aberration (a40, C3,0, C3) //////////////// QVector<QVariant> box3_option_5_1_1 = {"Spherical aberration (nm)",""}; QVector<bool> box3_option_5_1_1_edit = {false,true}; boost::function<bool(std::string)> box3_function_5_1_1_setter ( boost::bind( &TDMap::set_spherical_aberration, _core_td_map, _1 ) ); boost::function<double(void)> box3_function_5_1_1_getter ( boost::bind( &TDMap::get_spherical_aberration, _core_td_map ) ); boost::function<bool(void)> box3_option_5_1_1_check_getter ( boost::bind( &TDMap::get_spherical_aberration_switch, _core_td_map ) ); boost::function<bool(bool)> box3_option_5_1_1_check_setter ( boost::bind( &TDMap::set_spherical_aberration_switch, _core_td_map, _1 ) ); spherical_aberration_nm = new TreeItem ( box3_option_5_1_1 , box3_function_5_1_1_setter, box3_option_5_1_1_edit ); spherical_aberration_nm->set_fp_data_getter_double_vec( 1, box3_function_5_1_1_getter ); spherical_aberration_nm->set_variable_name( "spherical_aberration_nm" ); _aberration_parameters->insertChildren( spherical_aberration_nm ); /*group options*/ spherical_aberration_nm->set_fp_check_setter( 0, box3_option_5_1_1_check_setter ); spherical_aberration_nm->set_fp_check_getter( 0, box3_option_5_1_1_check_getter ); spherical_aberration_nm->load_check_status_from_getter( 0 ); /* validators */ spherical_aberration_nm->set_flag_validatable_double(1,true); //////////////// //Simulation Refinement -- envelope parameters //////////////// QVector<QVariant> box3_option_5_2 = {"Envelope parameters",""}; _envelope_parameters = new TreeItem ( box3_option_5_2 ); _envelope_parameters->set_variable_name( "_envelope_parameters" ); _simulation_refinement->insertChildren( _envelope_parameters ); QVector<QVariant> box3_option_5_2_1 = {"Image spread",""}; QVector<bool> box3_option_5_2_1_edit = {false,true}; boost::function<int(void)> box3_function_5_2_1_getter ( boost::bind( &TDMap::get_envelop_parameters_vibrational_damping_method, _core_td_map ) ); boost::function<bool(int)> box3_function_5_2_1_setter ( boost::bind( &TDMap::set_envelop_parameters_vibrational_damping_method, _core_td_map, _1 ) ); _envelope_parameters_vibrational_damping = new TreeItem ( box3_option_5_2_1, box3_function_5_2_1_setter, box3_option_5_edit ); _envelope_parameters_vibrational_damping->set_fp_data_getter_int_vec( 1, box3_function_5_2_1_getter ); _envelope_parameters_vibrational_damping->set_variable_name( "_envelope_parameters_vibrational_damping" ); // load the preset data from core constuctor _envelope_parameters_vibrational_damping->load_data_from_getter( 1 ); QVector<QVariant> box3_option_5_2_1_drop = {"Deactivated","Isotropic","Anisotropic"}; QVector<QVariant> box3_option_5_2_1_drop_enum( { WAVIMG_prm::EnvelopeVibrationalDamping::Deactivated, WAVIMG_prm::EnvelopeVibrationalDamping::Isotropic, WAVIMG_prm::EnvelopeVibrationalDamping::Anisotropic } ); _envelope_parameters_vibrational_damping->set_item_delegate_type( TreeItem::_delegate_DROP ); _envelope_parameters_vibrational_damping->set_dropdown_options( 1, box3_option_5_2_1_drop, box3_option_5_2_1_drop_enum ); _envelope_parameters->insertChildren( _envelope_parameters_vibrational_damping ); // bool set_envelop_parameters_vibrational_damping_anisotropic_second_rms_amplitude( double amplitude ); // bool set_envelop_parameters_vibrational_damping_azimuth_orientation_angle( double angle ); //////////////// // Image spread -- first rms (nm) //////////////// QVector<QVariant> box3_option_5_2_1_1 = {"Vibrational damping",""}; QVector<bool> box3_option_5_2_1_1_edit = {false,true}; boost::function<bool(double)> box3_function_5_2_1_1 ( boost::bind( &TDMap::set_envelop_parameters_vibrational_damping_isotropic_one_rms_amplitude, _core_td_map, _1 ) ); envelop_parameters_vibrational_damping_isotropic_first_rms_amplitude = new TreeItem ( box3_option_5_2_1_1 , box3_function_5_2_1_1, box3_option_5_2_1_1_edit ); envelop_parameters_vibrational_damping_isotropic_first_rms_amplitude->set_variable_name( "envelop_parameters_vibrational_damping_isotropic_first_rms_amplitude" ); _envelope_parameters_vibrational_damping->insertChildren( envelop_parameters_vibrational_damping_isotropic_first_rms_amplitude ); /* validators */ envelop_parameters_vibrational_damping_isotropic_first_rms_amplitude->set_flag_validatable_double(1,true); //////////////// // Envelop parameters - temporal coherence //////////////// QVector<QVariant> box3_option_5_2_2 = {"Temporal coherence - focus-spread",""}; QVector<bool> box3_option_5_2_2_edit = {false,true}; boost::function<bool(std::string)> box3_function_5_2_2_setter ( boost::bind( &TDMap::set_partial_temporal_coherence_focus_spread, _core_td_map, _1 ) ); boost::function<bool(void)> box3_option_5_2_2_check_getter ( boost::bind( &TDMap::get_partial_temporal_coherence_switch, _core_td_map ) ); boost::function<bool(bool)> box3_option_5_2_2_check_setter ( boost::bind( &TDMap::set_partial_temporal_coherence_switch, _core_td_map, _1 ) ); partial_temporal_coherence_focus_spread = new TreeItem ( box3_option_5_2_2 , box3_function_5_2_2_setter, box3_option_5_2_2_edit ); partial_temporal_coherence_focus_spread->set_variable_name( "partial_temporal_coherence_focus_spread" ); _envelope_parameters->insertChildren( partial_temporal_coherence_focus_spread ); /* validators */ partial_temporal_coherence_focus_spread->set_flag_validatable_double(1,true); /*group options*/ partial_temporal_coherence_focus_spread->set_variable_name( "partial_temporal_coherence_focus_spread" ); partial_temporal_coherence_focus_spread->set_fp_check_setter( 0, box3_option_5_2_2_check_setter ); partial_temporal_coherence_focus_spread->set_fp_check_getter( 0, box3_option_5_2_2_check_getter ); partial_temporal_coherence_focus_spread->load_check_status_from_getter( 0 ); //////////////// // Envelop parameters - spatial coherence //////////////// QVector<QVariant> box3_option_5_2_3 = {"Spatial coherence - semi-convergence angle",""}; QVector<bool> box3_option_5_2_3_edit = {false,true}; boost::function<bool(std::string)> box3_function_5_2_3_setter ( boost::bind( &TDMap::set_partial_spatial_coherence_semi_convergence_angle, _core_td_map, _1 ) ); boost::function<bool(void)> box3_option_5_2_3_check_getter ( boost::bind( &TDMap::get_partial_spatial_coherence_switch, _core_td_map ) ); boost::function<bool(bool)> box3_option_5_2_3_check_setter ( boost::bind( &TDMap::set_partial_spatial_coherence_switch, _core_td_map, _1 ) ); partial_spatial_coherence_semi_convergence_angle = new TreeItem ( box3_option_5_2_3 , box3_function_5_2_3_setter, box3_option_5_2_3_edit ); partial_spatial_coherence_semi_convergence_angle->set_variable_name( "partial_spatial_coherence_semi_convergence_angle" ); _envelope_parameters->insertChildren( partial_spatial_coherence_semi_convergence_angle ); /* validators */ partial_spatial_coherence_semi_convergence_angle->set_flag_validatable_double(1,true); /*group options*/ partial_spatial_coherence_semi_convergence_angle->set_fp_check_setter( 0, box3_option_5_2_3_check_setter ); partial_spatial_coherence_semi_convergence_angle->set_fp_check_getter( 0, box3_option_5_2_3_check_getter ); partial_spatial_coherence_semi_convergence_angle->load_check_status_from_getter( 0 ); //////////////// //Simulation Refinement -- MTF //////////////// QVector<QVariant> box3_option_5_3 = {"MTF",""}; QVector<bool> box3_option_5_3_edit = {false,true}; boost::function<bool(std::string)> box3_function_5_3 ( boost::bind( &MainWindow::update_qline_mtf_path,this, _1 ) ); _mtf_parameters = new TreeItem ( box3_option_5_3 , box3_function_5_3, box3_option_5_3_edit ); _mtf_parameters->set_variable_name( "_mtf_parameters" ); boost::function<std::string(void)> box3_function_5_3_getter ( boost::bind( &TDMap::get_mtf_filename, _core_td_map ) ); _mtf_parameters->set_fp_data_getter_string_vec( 1, box3_function_5_3_getter ); _mtf_parameters->set_item_delegate_type( TreeItem::_delegate_FILE ); _simulation_refinement->insertChildren( _mtf_parameters ); boost::function<bool(void)> box3_option_5_3_1_check_getter ( boost::bind( &TDMap::get_mtf_switch, _core_td_map ) ); boost::function<bool(bool)> box3_option_5_3_1_check_setter ( boost::bind( &TDMap::set_mtf_switch, _core_td_map, _1 ) ); _mtf_parameters->set_fp_check_setter( 0, box3_option_5_3_1_check_setter ); _mtf_parameters->set_fp_check_getter( 0, box3_option_5_3_1_check_getter ); _mtf_parameters->load_check_status_from_getter( 0 ); //////////////// // Image Correlation //////////////// QVector<QVariant> box3_option_6 = {"Image correlation",""}; image_correlation = new TreeItem ( box3_option_6 ); image_correlation->set_variable_name( "image_correlation" ); tdmap_root->insertChildren( image_correlation ); //////////////// // Image Correlation -- Hysteresis Thresholding //////////////// //: , non-normalized correlation and sum-absolute-difference QVector<QVariant> box3_option_6_1 = {"Match method",""}; QVector<bool> box3_option_6_1_edit = {false,true}; boost::function<int(void)> box3_function_6_1_getter ( boost::bind( &TDMap::get_image_correlation_matching_method, _core_td_map ) ); boost::function<bool(int)> box3_function_6_1_setter ( boost::bind( &TDMap::set_image_correlation_matching_method, _core_td_map, _1 ) ); image_correlation_matching_method = new TreeItem ( box3_option_6_1 , box3_function_6_1_setter, box3_option_6_1_edit ); image_correlation_matching_method->set_variable_name( "image_correlation_matching_method" ); image_correlation_matching_method->set_fp_data_getter_int_vec( 1, box3_function_6_1_getter ); // load the preset data from core constuctor image_correlation_matching_method->load_data_from_getter( 1 ); QVector<QVariant> box3_option_6_1_drop = {"Normalized squared difference","Normalized cross correlation","Normalized correlation coefficient"}; QVector<QVariant> box3_option_6_1_drop_enum( { CV_TM_SQDIFF_NORMED, CV_TM_CCORR_NORMED, CV_TM_CCOEFF_NORMED} ); image_correlation_matching_method->set_item_delegate_type( TreeItem::_delegate_DROP ); image_correlation_matching_method->set_dropdown_options( 1, box3_option_6_1_drop, box3_option_6_1_drop_enum ); image_correlation->insertChildren( image_correlation_matching_method ); QVector<QVariant> box3_option_6_2 = {"Normalization method",""}; QVector<bool> box3_option_6_2_edit = {false,true}; boost::function<int(void)> box3_function_6_2_getter ( boost::bind( &TDMap::get_image_normalization_method, _core_td_map ) ); boost::function<bool(int)> box3_function_6_2_setter ( boost::bind( &TDMap::set_image_normalization_method, _core_td_map, _1 ) ); image_normalization_method = new TreeItem ( box3_option_6_2 , box3_function_6_2_setter, box3_option_6_2_edit ); image_normalization_method->set_variable_name( "image_normalization_method" ); image_normalization_method->set_fp_data_getter_int_vec( 1, box3_function_6_2_getter ); // load the preset data from core constuctor image_normalization_method->load_data_from_getter( 1 ); QVector<QVariant> box3_option_6_2_drop = {"Local normalization","Global normalization"}; QVector<QVariant> box3_option_6_2_drop_enum( { SimGrid::InmageNormalizationMode::LOCAL_NORMALIZATION, SimGrid::InmageNormalizationMode::GLOBAL_NORMALIZATION} ); image_normalization_method->set_item_delegate_type( TreeItem::_delegate_DROP ); image_normalization_method->set_dropdown_options( 1, box3_option_6_2_drop, box3_option_6_2_drop_enum ); image_correlation->insertChildren( image_normalization_method ); ui->qtree_view_tdmap_simulation_setup->setModel( tdmap_simulation_setup_model ); ui->qtree_view_tdmap_simulation_setup->setItemDelegate( _load_file_delegate ); //start editing after one click ui->qtree_view_tdmap_simulation_setup->setEditTriggers(QAbstractItemView::AllEditTriggers); ui->qtree_view_tdmap_simulation_setup->expandAll(); for (int column = 0; column < tdmap_simulation_setup_model->columnCount(); ++column){ ui->qtree_view_tdmap_simulation_setup->resizeColumnToContents(column); } ui->tdmap_table->set_tdmap( _core_td_map ); // any change on the following fields causes the grid to be reset: //# thick samples, thick lower bound, thick upper bound //# defocus samples, lower bound, upper bound, // more work here ui->tdmap_table->connect_item_changes_to_invalidate_grid( tdmap_cell_dimensions_a, 1 ); ui->tdmap_table->connect_item_changes_to_invalidate_grid( tdmap_cell_dimensions_b, 1 ); ui->tdmap_table->connect_item_changes_to_invalidate_grid( accelaration_voltage_kv, 1 ); ui->tdmap_table->connect_item_changes_to_invalidate_grid( experimental_sampling_rate, 1 ); ui->tdmap_table->connect_item_changes_to_invalidate_grid( thickness_range_number_samples, 1 ); ui->tdmap_table->connect_item_changes_to_invalidate_grid( thickness_range_lower_bound, 1 ); ui->tdmap_table->connect_item_changes_to_invalidate_grid( thickness_range_upper_bound, 1 ); ui->tdmap_table->connect_item_changes_to_invalidate_grid( defocus_range_number_samples, 1 ); ui->tdmap_table->connect_item_changes_to_invalidate_grid( defocus_range_upper_bound, 1 ); ui->tdmap_table->connect_item_changes_to_invalidate_grid( defocus_range_lower_bound, 1 ); ui->tdmap_table->connect_thickness_range_number_samples_changes( thickness_range_lower_bound, 1 ); ui->tdmap_table->connect_thickness_range_number_samples_changes( thickness_range_upper_bound, 1 ); ui->tdmap_table->connect_thickness_range_number_samples_changes( thickness_range_number_samples, 1 ); ui->tdmap_table->connect_defocus_range_number_samples_changes( defocus_range_upper_bound, 1 ); ui->tdmap_table->connect_defocus_range_number_samples_changes( defocus_range_lower_bound, 1 ); ui->tdmap_table->connect_defocus_range_number_samples_changes( defocus_range_number_samples, 1 ); } void MainWindow::create_box_options_tab2_run_config(){ /************************* * Running configuration *************************/ QVector<QVariant> running_header = {"Status","Step"}; TreeItem* running_configuration_root = new TreeItem ( running_header ); running_configuration_root->set_variable_name( "running_configuration_root" ); tdmap_running_configuration_model = new TreeModel( running_configuration_root ); //////////////// // api tdmap configuration //////////////// QVector<QVariant> box4_option_0_1 = {"tdmap url",""}; QVector<bool> box4_option_0_1_edit = {false,true}; boost::function<bool(std::string)> box4_function_0_1_setter ( boost::bind( &TDMap::set_tdmap_url, _core_td_map, _1 ) ); boost::function<std::string(void)> box4_function_0_1_getter ( boost::bind( &TDMap::get_tdmap_url, _core_td_map ) ); boost::function<bool(void)> box4_option_0_1_check_getter ( boost::bind( &TDMap::get_tdmap_url_switch, _core_td_map ) ); boost::function<bool(bool)> box4_option_0_1_check_setter ( boost::bind( &TDMap::set_tdmap_url_switch, _core_td_map, _1 ) ); tdmap_url = new TreeItem ( box4_option_0_1 , box4_function_0_1_setter, box4_option_0_1_edit ); tdmap_url->set_variable_name( "tdmap_url" ); tdmap_url->set_fp_data_getter_string_vec( 1, box4_function_0_1_getter ); tdmap_url->load_data_from_getter( 1 ); connect( _core_td_map, SIGNAL( api_tdmap_url_changed( )), tdmap_url, SLOT( load_data_from_getter_string() ) ); /*group options*/ tdmap_url->set_fp_check_setter( 0, box4_option_0_1_check_setter ); tdmap_url->set_fp_check_getter( 0, box4_option_0_1_check_getter ); tdmap_url->load_check_status_from_getter( 0 ); running_configuration_root->insertChildren( tdmap_url ); //////////////// // api tdmap id configuration //////////////// QVector<QVariant> box4_option_0_2 = {"tdmap api id",""}; QVector<bool> box4_option_0_2_edit = {false,true}; boost::function<bool(std::string)> box4_function_0_2_setter ( boost::bind( &TDMap::set_tdmap_id, _core_td_map, _1 ) ); boost::function<std::string(void)> box4_function_0_2_getter ( boost::bind( &TDMap::get_tdmap_id, _core_td_map ) ); tdmap_id = new TreeItem ( box4_option_0_2 , box4_function_0_2_setter, box4_option_0_2_edit ); tdmap_id->set_variable_name( "tdmap_id" ); tdmap_id->set_fp_data_getter_string_vec( 1, box4_function_0_2_getter ); tdmap_id->load_data_from_getter( 1 ); connect( _core_td_map, SIGNAL( api_tdmap_url_changed( )), tdmap_id, SLOT( load_data_from_getter_string() ) ); /*group options*/ tdmap_id->set_fp_check_setter( 0, box4_option_0_1_check_setter ); tdmap_id->set_fp_check_getter( 0, box4_option_0_1_check_getter ); tdmap_id->load_check_status_from_getter( 0 ); running_configuration_root->insertChildren( tdmap_id ); //////////////// // Log level //////////////// QVector<QVariant> box4_option_0 = {"", "Log level"}; TreeItem* _log_level = new TreeItem ( box4_option_0 ); _log_level->set_variable_name( "_log_level" ); running_configuration_root->insertChildren( _log_level ); QVector<QVariant> box4_option_1 = {"", ""}; QVector<bool> box4_option_1_edit = {false,true}; boost::function<int(void)> box4_function_1_getter ( boost::bind( &TDMap::get_exec_log_level, _core_td_map ) ); boost::function<bool(int)> box4_function_1_setter ( boost::bind( &TDMap::set_exec_log_level, _core_td_map, _1 ) ); TreeItem* _log_level_setter = new TreeItem ( box4_option_1, box4_function_1_setter, box4_option_1_edit ); _log_level_setter->set_fp_data_getter_int_vec( 1, box4_function_1_getter ); _log_level_setter->set_variable_name( "_log_level_setter" ); // load the preset data from core constuctor _log_level_setter->load_data_from_getter( 1 ); QVector<QVariant> box4_option_1_drop = {"Full log","Debug mode","Silent mode", "User defined"}; QVector<QVariant> box4_option_1_drop_enum( { TDMap::ExecLogMode::FULL_LOG, TDMap::ExecLogMode::DEBUG_MODE, TDMap::ExecLogMode::SILENT_MODE, TDMap::ExecLogMode::USER_DEFINED_LOG_MODE } ); _log_level_setter->set_item_delegate_type( TreeItem::_delegate_DROP ); _log_level_setter->set_dropdown_options( 1, box4_option_1_drop, box4_option_1_drop_enum ); _log_level->insertChildren( _log_level_setter ); /* * CELSLC * */ QVector<QVariant> box4_data_2 = {"","Multislice phase granting"}; boost::function<bool(void)> box4_option_2_check_getter ( boost::bind( &TDMap::get_run_celslc_switch, _core_td_map ) ); boost::function<bool(bool)> box4_option_2_check_setter ( boost::bind( &TDMap::set_run_celslc_switch, _core_td_map, _1 ) ); QVector<bool> box4_option_2_edit = {false,false}; TreeItem* _multislice_phase_granting = new TreeItem ( box4_data_2 , box4_option_2_edit ); _multislice_phase_granting->set_variable_name( "_multislice_phase_granting" ); //_multislice_phase_granting->setStatusOption( 0, TreeItem::ActionStatusType::_status_NOT_READY ); // load the preset data from core constuctor _multislice_phase_granting->set_fp_check_setter( 1, box4_option_2_check_setter ); _multislice_phase_granting->set_fp_check_getter( 1, box4_option_2_check_getter ); _multislice_phase_granting->load_check_status_from_getter( 1 ); running_configuration_root->insertChildren( _multislice_phase_granting ); QVector<QVariant> box4_option_2_0 = {"", "Output"}; TreeItem* _multislice_phase_granting_output_legend = new TreeItem ( box4_option_2_0 ); _multislice_phase_granting_output_legend->set_variable_name( "_multislice_phase_granting_output_legend" ); _multislice_phase_granting->insertChildren( _multislice_phase_granting_output_legend ); QVector<QVariant> box4_option_2_1 = {"", ""}; QVector<bool> box4_option_2_1_edit = {false,true}; _multislice_phase_granting_output = new TreeItem ( box4_option_2_1, box4_option_2_1_edit ); _multislice_phase_granting_output->set_variable_name( "_multislice_phase_granting_output" ); _multislice_phase_granting_output->set_fp_data_data_appender_col_pos( 1 ); _multislice_phase_granting_output->set_flag_fp_data_appender_string( true ); _multislice_phase_granting_output->set_item_delegate_type( TreeItem::_delegate_TEXT_BROWSER ); _multislice_phase_granting_output_legend->insertChildren( _multislice_phase_granting_output ); QVector<QVariant> box4_option_2_2 = {"","Temporary files"}; TreeItem* _multislice_phase_granting_temporary_files = new TreeItem ( box4_option_2_2 ); _multislice_phase_granting_temporary_files->set_variable_name( "_multislice_phase_granting_temporary_files" ); _multislice_phase_granting->insertChildren( _multislice_phase_granting_temporary_files ); /* * MSA * */ QVector<QVariant> box4_data_3 = {"","Electron diffraction patterns"}; boost::function<bool(void)> box4_option_3_check_getter ( boost::bind( &TDMap::get_run_msa_switch, _core_td_map ) ); boost::function<bool(bool)> box4_option_3_check_setter ( boost::bind( &TDMap::set_run_msa_switch, _core_td_map, _1 ) ); QVector<bool> box4_option_3_edit = {false,false}; TreeItem* _electron_diffraction_patterns = new TreeItem ( box4_data_3 , box4_option_3_edit ); _electron_diffraction_patterns->set_variable_name( "_electron_diffraction_patterns" ); _multislice_phase_granting->setStatusOption( 0, TreeItem::ActionStatusType::_status_NOT_READY ); // load the preset data from core constuctor _electron_diffraction_patterns->set_fp_check_setter( 1, box4_option_3_check_setter ); _electron_diffraction_patterns->set_fp_check_getter( 1, box4_option_3_check_getter ); _electron_diffraction_patterns->load_check_status_from_getter( 1 ); running_configuration_root->insertChildren( _electron_diffraction_patterns ); QVector<QVariant> box4_option_3_0 = {"", "Output"}; TreeItem* _electron_diffraction_patterns_output_legend = new TreeItem ( box4_option_3_0 ); _electron_diffraction_patterns_output_legend->set_variable_name( "_electron_diffraction_patterns_output_legend" ); _electron_diffraction_patterns->insertChildren( _electron_diffraction_patterns_output_legend ); QVector<QVariant> box4_option_3_1 = {"", ""}; QVector<bool> box4_option_3_1_edit = {false,true}; _electron_diffraction_patterns_output = new TreeItem ( box4_option_3_1, box4_option_3_1_edit ); _electron_diffraction_patterns_output->set_variable_name( "_electron_diffraction_patterns_output" ); _electron_diffraction_patterns_output->set_fp_data_data_appender_col_pos( 1 ); _electron_diffraction_patterns_output->set_flag_fp_data_appender_string( true ); _electron_diffraction_patterns_output->set_item_delegate_type( TreeItem::_delegate_TEXT_BROWSER ); _electron_diffraction_patterns_output_legend->insertChildren( _electron_diffraction_patterns_output ); QVector<QVariant> box4_option_3_2 = {"","Temporary files"}; TreeItem* _electron_diffraction_patterns_temporary_files = new TreeItem ( box4_option_3_2 ); _electron_diffraction_patterns_temporary_files->set_variable_name( "_electron_diffraction_patterns_temporary_files" ); _electron_diffraction_patterns->insertChildren( _electron_diffraction_patterns_temporary_files ); /* * WAVIMG * */ QVector<QVariant> box4_data_4 = {"","Image intensity distribuitions"}; boost::function<bool(void)> box4_option_4_check_getter ( boost::bind( &TDMap::get_run_wavimg_switch, _core_td_map ) ); boost::function<bool(bool)> box4_option_4_check_setter ( boost::bind( &TDMap::set_run_wavimg_switch, _core_td_map, _1 ) ); QVector<bool> box4_option_4_edit = {false,false}; TreeItem* _image_intensity_distribuitions = new TreeItem ( box4_data_4 , box4_option_4_edit ); _image_intensity_distribuitions->set_variable_name( "_image_intensity_distribuitions" ); _image_intensity_distribuitions->setStatusOption( 0, TreeItem::ActionStatusType::_status_NOT_READY ); // load the preset data from core constuctor _image_intensity_distribuitions->set_fp_check_setter( 1, box4_option_4_check_setter ); _image_intensity_distribuitions->set_fp_check_getter( 1, box4_option_4_check_getter ); _image_intensity_distribuitions->load_check_status_from_getter( 1 ); running_configuration_root->insertChildren( _image_intensity_distribuitions ); QVector<QVariant> box4_option_4_0 = {"","Output"}; TreeItem* _image_intensity_distribuitions_output_legend = new TreeItem ( box4_option_4_0 ); _image_intensity_distribuitions_output_legend->set_variable_name( "_image_intensity_distribuitions_output_legend" ); _image_intensity_distribuitions->insertChildren( _image_intensity_distribuitions_output_legend ); QVector<QVariant> box4_option_4_1 = {"", ""}; QVector<bool> box4_option_4_1_edit = {false,true}; _image_intensity_distribuitions_output = new TreeItem ( box4_option_4_1, box4_option_4_1_edit ); _image_intensity_distribuitions_output->set_variable_name( "_image_intensity_distribuitions_output" ); _image_intensity_distribuitions_output->set_fp_data_data_appender_col_pos( 1 ); _image_intensity_distribuitions_output->set_flag_fp_data_appender_string( true ); _image_intensity_distribuitions_output->set_item_delegate_type( TreeItem::_delegate_TEXT_BROWSER ); _image_intensity_distribuitions_output_legend->insertChildren( _image_intensity_distribuitions_output ); QVector<QVariant> box4_option_4_2 = {"","Temporary files"}; TreeItem* _image_intensity_distribuitions_temporary_files = new TreeItem ( box4_option_4_2 ); _image_intensity_distribuitions_temporary_files->set_variable_name( "_image_intensity_distribuitions_temporary_files" ); _image_intensity_distribuitions->insertChildren( _image_intensity_distribuitions_temporary_files ); /* * SIMGRID * */ QVector<QVariant> box4_data_5 = {"","Image correlation"}; boost::function<bool(void)> box4_option_5_check_getter ( boost::bind( &TDMap::get_run_simgrid_switch, _core_td_map ) ); boost::function<bool(bool)> box4_option_5_check_setter ( boost::bind( &TDMap::set_run_simgrid_switch, _core_td_map, _1 ) ); QVector<bool> box4_option_5_edit = {false,false}; TreeItem* _image_correlation = new TreeItem ( box4_data_5 , box4_option_5_edit ); _image_correlation->set_variable_name( "_image_correlation" ); _image_correlation->setStatusOption( 0, TreeItem::ActionStatusType::_status_NOT_READY ); // load the preset data from core constuctor _image_correlation->set_fp_check_setter( 1, box4_option_5_check_setter ); _image_correlation->set_fp_check_getter( 1, box4_option_5_check_getter ); _image_correlation->load_check_status_from_getter( 1 ); running_configuration_root->insertChildren( _image_correlation ); QVector<QVariant> box4_option_5_0 = {"","Output"}; TreeItem* _image_correlation_output_legend = new TreeItem ( box4_option_5_0 ); _image_correlation_output_legend->set_variable_name( "_image_correlation_output_legend" ); _image_correlation->insertChildren( _image_correlation_output_legend ); QVector<QVariant> box4_option_5_1 = {"", ""}; QVector<bool> box4_option_5_1_edit = {false,true}; _image_correlation_output = new TreeItem ( box4_option_5_1, box4_option_5_1_edit ); _image_correlation_output->set_variable_name( "_image_correlation_output" ); _image_correlation_output->set_fp_data_data_appender_col_pos( 1 ); _image_correlation_output->set_flag_fp_data_appender_string( true ); _image_correlation_output->set_item_delegate_type( TreeItem::_delegate_TEXT_BROWSER ); _image_correlation_output_legend->insertChildren( _image_correlation_output ); ui->qtree_view_tdmap_running_configuration->setModel( tdmap_running_configuration_model ); ui->qtree_view_tdmap_running_configuration->setItemDelegate( _load_file_delegate ); //start editing after one click ui->qtree_view_tdmap_running_configuration->setEditTriggers(QAbstractItemView::AllEditTriggers); for (int column = 0; column < tdmap_simulation_setup_model->columnCount(); ++column){ ui->qtree_view_tdmap_running_configuration->resizeColumnToContents(column); } } void MainWindow::create_box_options_tab3_supercell(){ QVector<QVariant> common_header = {"Field","Value"}; /************************* * SUPER-CELL *************************/ super_cell_setup_root = new TreeItem ( common_header ); super_cell_setup_root->set_variable_name( "super_cell_setup_root" ); super_cell_setup_model = new TreeModel( super_cell_setup_root ); //////////////// // Edge detection //////////////// QVector<QVariant> box5_option_1 = {"Edge detection",""}; super_cell_edge_detection = new TreeItem ( box5_option_1 ); super_cell_edge_detection->set_variable_name( "super_cell_edge_detection" ); super_cell_setup_root->insertChildren( super_cell_edge_detection ); QVector<QVariant> box5_option_1_data_1 = {"Hysteresis thresholding",""}; boost::function<int(void)> box5_option_1_getter ( boost::bind( &TDMap::get_exp_image_bounds_hysteresis_threshold, _core_td_map ) ); boost::function<bool(int)> box5_option_1_setter ( boost::bind( &TDMap::set_exp_image_bounds_hysteresis_threshold, _core_td_map, _1 ) ); QVector<bool> box5_option_1_edit = {false,true}; edge_detection_hysteris_thresholding = new TreeItem ( box5_option_1_data_1 ,box5_option_1_setter, box5_option_1_edit ); edge_detection_hysteris_thresholding->set_fp_data_getter_int_vec( 1, box5_option_1_getter ); // load the preset data from core constuctor edge_detection_hysteris_thresholding->load_data_from_getter( 1 ); edge_detection_hysteris_thresholding->set_variable_name( "edge_detection_hysteris_thresholding" ); edge_detection_hysteris_thresholding->set_item_delegate_type( TreeItem::_delegate_SLIDER_INT ); // set the bottom and top limits of the interval int hysteresis_threshold_bottom_limit = _core_td_map->get_exp_image_bounds_hysteresis_threshold_range_bottom_limit( ); int hysteresis_threshold_top_limit = _core_td_map->get_exp_image_bounds_hysteresis_threshold_range_top_limit( ); edge_detection_hysteris_thresholding->set_slider_int_range_min( hysteresis_threshold_bottom_limit ); edge_detection_hysteris_thresholding->set_slider_int_range_max( hysteresis_threshold_top_limit ); super_cell_edge_detection->insertChildren( edge_detection_hysteris_thresholding ); QVector<QVariant> box5_option_1_data_2 = {"Max. contour distance",""}; boost::function<int(void)> box5_option_1_2_getter ( boost::bind( &TDMap::get_exp_image_bounds_max_contour_distance_px, _core_td_map ) ); boost::function<bool(int)> box5_option_1_2_setter ( boost::bind( &TDMap::set_exp_image_bounds_max_contour_distance_px, _core_td_map, _1 ) ); QVector<bool> box5_option_1_2_edit = {false,true}; edge_detection_max_contour_distance = new TreeItem ( box5_option_1_data_2 ,box5_option_1_2_setter, box5_option_1_2_edit ); edge_detection_max_contour_distance->set_fp_data_getter_int_vec( 1, box5_option_1_2_getter ); edge_detection_max_contour_distance->set_variable_name( "edge_detection_max_contour_distance" ); edge_detection_max_contour_distance->set_item_delegate_type( TreeItem::_delegate_SLIDER_INT ); // load the preset data from core constuctor edge_detection_max_contour_distance->load_data_from_getter( 1 ); // set the bottom and top limits of the interval int max_contour_distance_bottom_limit = _core_td_map->get_exp_image_bounds_max_contour_distance_px_range_bottom_limit( ); int max_contour_distance_top_limit = _core_td_map->get_exp_image_bounds_max_contour_distance_px_range_top_limit( ); edge_detection_max_contour_distance->set_slider_int_range_min( max_contour_distance_bottom_limit ); edge_detection_max_contour_distance->set_slider_int_range_max( max_contour_distance_top_limit ); super_cell_edge_detection->insertChildren( edge_detection_max_contour_distance ); //connect( _max_contour_distance, SIGNAL(dataChanged( int )), this, SLOT( update_supercell_model_edge_detection_setup() ) ); //////////////// // Super-Cell margin -nm //////////////// QVector<QVariant> box5_option_1_data_3 = {"Super-cell margin (nm)",""}; QVector<bool> box5_option_1_3_edit = {false,true}; boost::function<bool(std::string)> box5_option_1_3_setter ( boost::bind( &TDMap::set_full_boundary_polygon_margin_nm, _core_td_map, _1 ) ); boost::function<double(void)> box5_option_1_3_getter ( boost::bind( &TDMap::get_full_boundary_polygon_margin_nm, _core_td_map ) ); TreeItem* super_cell_margin_nm = new TreeItem ( box5_option_1_data_3 , box5_option_1_3_setter, box5_option_1_3_edit ); super_cell_margin_nm->set_fp_data_getter_double_vec( 1, box5_option_1_3_getter ); super_cell_margin_nm->set_variable_name( "super_cell_margin_nm" ); super_cell_edge_detection->insertChildren( super_cell_margin_nm ); /*group options*/ super_cell_margin_nm->load_data_from_getter( 1 ); /* validators */ super_cell_margin_nm->set_flag_validatable_double(1,true); boost::function<double(void)> box5_function_1_3_validator_bot ( boost::bind( &TDMap::get_full_boundary_polygon_margin_nm_bottom_limit, _core_td_map ) ); boost::function<double(void)> box5_function_1_3_validator_top ( boost::bind( &TDMap::get_full_boundary_polygon_margin_nm_top_limit, _core_td_map ) ); super_cell_margin_nm->set_validator_double_bottom(1, box5_function_1_3_validator_bot ); super_cell_margin_nm->set_validator_double_top(1, box5_function_1_3_validator_top ); //////////////// // Super-Cell Dimensions //////////////// QVector<QVariant> box5_option_2 = {"Super-Cell Dimensions",""}; super_cell_dimensions = new TreeItem ( box5_option_2 ); super_cell_dimensions->set_variable_name( "super_cell_dimensions" ); super_cell_setup_root->insertChildren( super_cell_dimensions ); //////////////// // Super-Cell Dimensions -- a //////////////// QVector<QVariant> box5_option_2_1_data = {"a (nm)",""}; boost::function<bool(double)> box5_option_2_1_setter ( boost::bind( &TDMap::set_full_sim_super_cell_length_a_nm, _core_td_map, _1 ) ); QVector<bool> box5_option_2_1_edit = {false,false}; boost::function<double(void)> box5_option_2_1_getter ( boost::bind( &TDMap::get_super_cell_dimensions_a,_core_td_map ) ); super_cell_dimensions_a = new TreeItem ( box5_option_2_1_data, box5_option_2_1_setter, box5_option_2_1_edit); super_cell_dimensions_a->set_variable_name( "super_cell_dimensions_a" ); super_cell_dimensions_a->set_fp_data_getter_double_vec( 1, box5_option_2_1_getter ); connect( _core_td_map, SIGNAL( super_cell_dimensions_a_changed( )), super_cell_dimensions_a, SLOT( load_data_from_getter_double() ) ); super_cell_dimensions->insertChildren( super_cell_dimensions_a ); //////////////// // Super-Cell Dimensions -- b //////////////// QVector<QVariant> box5_option_2_2_data = {"b (nm)",""}; boost::function<bool(double)> box5_option_2_2_setter ( boost::bind( &TDMap::set_full_sim_super_cell_length_b_nm, _core_td_map, _1 ) ); QVector<bool> box5_option_2_2_edit = {false,false}; boost::function<double(void)> box5_option_2_2_getter ( boost::bind( &TDMap::get_super_cell_dimensions_b,_core_td_map ) ); super_cell_dimensions_b = new TreeItem ( box5_option_2_2_data , box5_option_2_2_setter, box5_option_2_2_edit ); super_cell_dimensions_b->set_variable_name( "super_cell_dimensions_b" ); super_cell_dimensions_b->set_fp_data_getter_double_vec( 1, box5_option_2_2_getter ); connect( _core_td_map, SIGNAL( super_cell_dimensions_b_changed( )), super_cell_dimensions_b, SLOT( load_data_from_getter_double() ) ); super_cell_dimensions->insertChildren( super_cell_dimensions_b ); //////////////// // Super-Cell Dimensions -- c //////////////// QVector<QVariant> box5_option_2_3_data = {"c (nm)",""}; boost::function<bool(double)> box5_option_2_3_setter ( boost::bind( &TDMap::set_full_sim_super_cell_length_c_nm, _core_td_map, _1 ) ); QVector<bool> box5_option_2_3_edit = {false,false}; boost::function<double(void)> box5_option_2_3_getter ( boost::bind( &TDMap::get_super_cell_dimensions_c,_core_td_map ) ); super_cell_dimensions_c = new TreeItem ( box5_option_2_3_data , box5_option_2_3_setter, box5_option_2_3_edit ); super_cell_dimensions_c->set_variable_name( "super_cell_dimensions_c" ); super_cell_dimensions_c->set_fp_data_getter_double_vec( 1, box5_option_2_3_getter ); connect( _core_td_map, SIGNAL( super_cell_dimensions_c_changed( )), super_cell_dimensions_c, SLOT( load_data_from_getter_double() ) ); super_cell_dimensions->insertChildren( super_cell_dimensions_c ); //////////////// // Super-Cell Dimensions -- Rect //////////////// QVector<QVariant> box5_option_2_4_data = {"Selection Rect",""}; boost::function<void(QRect)> box5_option_2_4_setter ( boost::bind( &MainWindow::update_tab3_exp_image_bounds_from_rectangle_selection, this, _1 ) ); QVector<bool> box5_option_2_4_edit = {false,false}; super_cell_rectangle_selection = new TreeItem ( box5_option_2_4_data , box5_option_2_4_setter, box5_option_2_4_edit ); super_cell_rectangle_selection->set_variable_name( "super_cell_rectangle_selection" ); connect(ui->qgraphics_super_cell_edge_detection, SIGNAL(selectionRectangleChanged(QRect)), super_cell_rectangle_selection, SLOT( load_data_from_rect(QRect)) ); super_cell_dimensions->insertChildren( super_cell_rectangle_selection ); //////////////// // Noise/Carbon ROI Statistical analysis //////////////// QVector<QVariant> box5_option_3 = {"Noise/Carbon ROI Statistical analysis",""}; noise_carbon_roi_statistical_analysis = new TreeItem ( box5_option_3 ); noise_carbon_roi_statistical_analysis->set_variable_name( "noise_carbon_roi_statistical_analysis" ); super_cell_setup_root->insertChildren( noise_carbon_roi_statistical_analysis ); //////////////// // Noise/Carbon ROI Statistical analysis -- Mean //////////////// QVector<QVariant> box5_option_3_1_data = {"Mean",""}; QVector<bool> box5_option_3_1_edit = {false,false}; boost::function<bool(int)> box5_option_3_1_setter ( boost::bind( &TDMap::set_exp_image_properties_roi_rectangle_statistical_mean, _core_td_map, _1 ) ); boost::function<int(void)> box5_option_3_1_getter ( boost::bind( &TDMap::get_exp_image_properties_roi_rectangle_statistical_mean,_core_td_map ) ); exp_image_properties_noise_carbon_statistical_mean = new TreeItem ( box5_option_3_1_data, box5_option_3_1_setter, box5_option_3_1_edit); exp_image_properties_noise_carbon_statistical_mean->set_variable_name( "exp_image_properties_noise_carbon_statistical_mean" ); exp_image_properties_noise_carbon_statistical_mean->set_fp_data_getter_int_vec( 1, box5_option_3_1_getter ); connect( _core_td_map, SIGNAL( exp_image_properties_noise_carbon_statistical_mean_changed( )), exp_image_properties_noise_carbon_statistical_mean, SLOT( load_data_from_getter_int() ) ); noise_carbon_roi_statistical_analysis->insertChildren( exp_image_properties_noise_carbon_statistical_mean ); //////////////// // Noise/Carbon ROI Statistical analysis -- Std dev //////////////// QVector<QVariant> box5_option_3_2_data = {"Std deviation",""}; QVector<bool> box5_option_3_2_edit = {false,false}; boost::function<bool(int)> box5_option_3_2_setter ( boost::bind( &TDMap::set_exp_image_properties_roi_rectangle_statistical_stddev, _core_td_map, _1 ) ); boost::function<int(void)> box5_option_3_2_getter ( boost::bind( &TDMap::get_exp_image_properties_roi_rectangle_statistical_stddev,_core_td_map ) ); exp_image_properties_noise_carbon_statistical_stddev = new TreeItem ( box5_option_3_2_data, box5_option_3_2_setter, box5_option_3_2_edit); exp_image_properties_noise_carbon_statistical_stddev->set_variable_name( "exp_image_properties_noise_carbon_statistical_stddev" ); exp_image_properties_noise_carbon_statistical_stddev->set_fp_data_getter_int_vec( 1, box5_option_3_2_getter ); connect( _core_td_map, SIGNAL( exp_image_properties_noise_carbon_statistical_stddev_changed( )), exp_image_properties_noise_carbon_statistical_stddev, SLOT( load_data_from_getter_int() ) ); noise_carbon_roi_statistical_analysis->insertChildren( exp_image_properties_noise_carbon_statistical_stddev ); ui->qtree_view_supercell_model_edge_detection_setup->setModel( super_cell_setup_model ); ui->qtree_view_supercell_model_edge_detection_setup->setItemDelegate( _load_file_delegate ); //start editing after one click ui->qtree_view_supercell_model_edge_detection_setup->setEditTriggers( QAbstractItemView::AllEditTriggers ); ui->qtree_view_supercell_model_edge_detection_setup->expandAll(); for (int column = 0; column < super_cell_setup_model->columnCount(); ++column){ ui->qtree_view_supercell_model_edge_detection_setup->resizeColumnToContents(column); } } void MainWindow::create_box_options_tab4_intensity_peaks(){ QVector<QVariant> common_header = {"Field","Value"}; /************************* * INTENSITY PEAKS *************************/ intensity_peaks_root = new TreeItem ( common_header ); intensity_peaks_root->set_variable_name( "intensity_peaks_root" ); intensity_peaks_model = new TreeModel( intensity_peaks_root ); //////////////// // Edge detection //////////////// int alpha_bottom_limit = 0; int alpha_top_limit = 255; QVector<QVariant> box6_option_1 = {"Intensity peaks",""}; intensity_peaks_analysis = new TreeItem ( box6_option_1 ); intensity_peaks_analysis->set_variable_name( "intensity_peaks_analysis" ); intensity_peaks_root->insertChildren( intensity_peaks_analysis ); QVector<QVariant> box6_option_2 = {"Display",""}; intensity_peaks_display = new TreeItem ( box6_option_2 ); intensity_peaks_display->set_variable_name( "intensity_peaks_display" ); intensity_peaks_root->insertChildren( intensity_peaks_display ); QVector<QVariant> box6_option_2_1 = {"Simulated image",""}; intensity_peaks_display_simulated_img = new TreeItem ( box6_option_2_1 ); intensity_peaks_display_simulated_img->set_variable_name( "intensity_peaks_display_simulated_img" ); intensity_peaks_display->insertChildren( intensity_peaks_display_simulated_img ); QVector<QVariant> box6_option_2_1_1 = {"Alpha channel",""}; boost::function<int(void)> box6_option_2_1_1_getter ( boost::bind( &CvImageFrameWidget::get_image_layer_alpha_channel, ui->qgraphics_super_cell_refinement , 0 ) ); boost::function<bool(int)> box6_option_2_1_1_setter ( boost::bind( &CvImageFrameWidget::set_image_layer_alpha_channel, ui->qgraphics_super_cell_refinement, 0, _1 ) ); QVector<bool> box6_option_2_1_1_edit = {false,true}; intensity_peaks_display_simulated_img_alpha = new TreeItem ( box6_option_2_1_1 , box6_option_2_1_1_setter, box6_option_2_1_1_edit ); intensity_peaks_display_simulated_img_alpha->set_fp_data_getter_int_vec( 1, box6_option_2_1_1_getter ); // load the preset data from core constuctor intensity_peaks_display_simulated_img_alpha->load_data_from_getter( 1 ); intensity_peaks_display_simulated_img_alpha->set_variable_name( "intensity_peaks_display_simulated_img_alpha" ); intensity_peaks_display_simulated_img_alpha->set_item_delegate_type( TreeItem::_delegate_SLIDER_INT ); intensity_peaks_display_simulated_img->insertChildren( intensity_peaks_display_simulated_img_alpha ); intensity_peaks_display_simulated_img_alpha->set_slider_int_range_min( alpha_bottom_limit ); intensity_peaks_display_simulated_img_alpha->set_slider_int_range_max( alpha_top_limit ); connect( intensity_peaks_display_simulated_img_alpha, SIGNAL(dataChanged(int)), ui->qgraphics_super_cell_refinement->image_widget, SLOT(repaint()) ); QVector<QVariant> box6_option_2_1_2 = {"Distance transform algorithm alpha channel",""}; intensity_peaks_display_simulated_img_distance_transform_alpha = new TreeItem ( box6_option_2_1_2 ); intensity_peaks_display_simulated_img_distance_transform_alpha->set_variable_name( "intensity_peaks_display_simulated_img_distance_transform_alpha" ); intensity_peaks_display_simulated_img->insertChildren( intensity_peaks_display_simulated_img_distance_transform_alpha ); connect( intensity_peaks_display_simulated_img_distance_transform_alpha, SIGNAL(dataChanged(int)), ui->qgraphics_super_cell_refinement->image_widget, SLOT(repaint()) ); QVector<QVariant> box6_option_2_1_3 = {"Intensity peaks alpha channel",""}; boost::function<int(void)> box6_option_2_1_3_getter ( boost::bind( &CvImageFrameWidget::get_renderPoints_alpha_channels_map, ui->qgraphics_super_cell_refinement , tr("Simulated image intensity columns") ) ); boost::function<bool(int)> box6_option_2_1_3_setter ( boost::bind( &CvImageFrameWidget::set_renderPoints_alpha_channels_map_group, ui->qgraphics_super_cell_refinement, tr("Simulated image intensity columns"), _1 ) ); QVector<bool> box6_option_2_1_3_edit = {false,true}; intensity_peaks_display_simulated_img_alpha_channel = new TreeItem ( box6_option_2_1_3 , box6_option_2_1_3_setter , box6_option_2_1_3_edit ); intensity_peaks_display_simulated_img_alpha_channel->set_fp_data_getter_int_vec( 1, box6_option_2_1_3_getter ); intensity_peaks_display_simulated_img_alpha_channel->load_data_from_getter( 1 ); intensity_peaks_display_simulated_img_alpha_channel->set_variable_name( "intensity_peaks_display_simulated_img_alpha_channel" ); intensity_peaks_display_simulated_img_alpha_channel->set_item_delegate_type( TreeItem::_delegate_SLIDER_INT ); intensity_peaks_display_simulated_img->insertChildren( intensity_peaks_display_simulated_img_alpha_channel ); intensity_peaks_display_simulated_img_alpha_channel->set_slider_int_range_min( alpha_bottom_limit ); intensity_peaks_display_simulated_img_alpha_channel->set_slider_int_range_max( alpha_top_limit ); connect( intensity_peaks_display_simulated_img_alpha_channel, SIGNAL(dataChanged(int)), ui->qgraphics_super_cell_refinement->image_widget, SLOT(repaint()) ); QVector<QVariant> box6_option_2_2 = {"Experimental image",""}; intensity_peaks_display_experimental_img = new TreeItem ( box6_option_2_2 ); intensity_peaks_display_experimental_img->set_variable_name( "intensity_peaks_display_experimental_img" ); intensity_peaks_display->insertChildren( intensity_peaks_display_experimental_img ); QVector<QVariant> box6_option_2_2_1 = {"Alpha channel",""}; boost::function<int(void)> box6_option_2_2_1_getter ( boost::bind( &CvImageFrameWidget::get_image_layer_alpha_channel, ui->qgraphics_super_cell_refinement , 1 ) ); boost::function<bool(int)> box6_option_2_2_1_setter ( boost::bind( &CvImageFrameWidget::set_image_layer_alpha_channel, ui->qgraphics_super_cell_refinement, 1, _1 ) ); QVector<bool> box6_option_2_2_1_edit = {false,true}; intensity_peaks_display_experimental_img_alpha = new TreeItem ( box6_option_2_2_1 , box6_option_2_2_1_setter, box6_option_2_2_1_edit ); intensity_peaks_display_experimental_img_alpha->set_fp_data_getter_int_vec( 1, box6_option_2_2_1_getter ); connect( intensity_peaks_display_experimental_img_alpha, SIGNAL(dataChanged(int)), ui->qgraphics_super_cell_refinement->image_widget, SLOT(repaint()) ); // load the preset data from core constuctor intensity_peaks_display_experimental_img_alpha->load_data_from_getter( 1 ); intensity_peaks_display_experimental_img_alpha->set_variable_name( "intensity_peaks_display_experimental_img_alpha" ); intensity_peaks_display_experimental_img_alpha->set_item_delegate_type( TreeItem::_delegate_SLIDER_INT ); intensity_peaks_display_experimental_img->insertChildren( intensity_peaks_display_experimental_img_alpha ); intensity_peaks_display_experimental_img_alpha->set_slider_int_range_min( alpha_bottom_limit ); intensity_peaks_display_experimental_img_alpha->set_slider_int_range_max( alpha_top_limit ); connect( intensity_peaks_display_experimental_img_alpha, SIGNAL(dataChanged(int)), ui->qgraphics_super_cell_refinement->image_widget, SLOT(repaint()) ); QVector<QVariant> box6_option_2_2_2 = {"Distance transform algorithm alpha channel",""}; intensity_peaks_display_experimental_img_distance_transform_alpha = new TreeItem ( box6_option_2_2_2 ); intensity_peaks_display_experimental_img_distance_transform_alpha->set_variable_name( "intensity_peaks_display_experimental_img_distance_transform_alpha" ); intensity_peaks_display_experimental_img->insertChildren( intensity_peaks_display_experimental_img_distance_transform_alpha ); ui->qtree_view_refinement_full_simulation->setModel( intensity_peaks_model ); ui->qtree_view_refinement_full_simulation->setItemDelegate( _load_file_delegate ); //start editing after one click ui->qtree_view_refinement_full_simulation->setEditTriggers( QAbstractItemView::AllEditTriggers ); ui->qtree_view_refinement_full_simulation->expandAll(); for (int column = 0; column < super_cell_setup_model->columnCount(); ++column){ ui->qtree_view_refinement_full_simulation->resizeColumnToContents(column); } } void MainWindow::create_box_options_tab4_intensity_columns_listing(){ QVector<QVariant> common_header = {"Intensity column #","SIM x pos", "SIM y pos", "SIM x delta", "SIM y delta", "Status", "SIM Integ. Intensity", "EXP Integ. Intensity", "SIM Column Mean" , "EXP Column Mean" , "Column Threshold Value" , "SIM Column Std. Dev.", "EXP Column Std. Dev." }; /************************* * INTENSITY PEAKS *************************/ intensity_columns_listing_root = new TreeItem ( common_header ); intensity_columns_listing_root->set_variable_name( "intensity_columns_listing_root" ); intensity_columns_listing_model = new TreeModel( intensity_columns_listing_root ); //update_super_cell_simulated_image_intensity_columns(); ui->qtree_view_refinement_full_simulation_intensity_columns->setModel( intensity_columns_listing_model ); ui->qtree_view_refinement_full_simulation_intensity_columns->setItemDelegate( _load_file_delegate ); //start editing after one click ui->qtree_view_refinement_full_simulation_intensity_columns->setEditTriggers( QAbstractItemView::AllEditTriggers ); ui->qtree_view_refinement_full_simulation_intensity_columns->expandAll(); ui->qtree_view_refinement_full_simulation_intensity_columns->setSelectionMode( QAbstractItemView::ExtendedSelection ); for (int column = 0; column < intensity_columns_listing_model->columnCount(); ++column){ ui->qtree_view_refinement_full_simulation_intensity_columns->resizeColumnToContents(column); } connect( ui->qtree_view_refinement_full_simulation_intensity_columns->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(full_simulation_intensity_columns_SelectionChanged(const QItemSelection &, const QItemSelection &)), Qt::DirectConnection ); } void MainWindow::full_simulation_intensity_columns_SelectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { QList<QModelIndex> indices = selected.indexes(); for( QModelIndex index : indices ) { TreeItem* data = intensity_columns_listing_model->getItem(index); std::string varname = data->get_variable_name(); std::cout << "selecting var: " << varname << std::endl; ui->qgraphics_super_cell_refinement->set_render_point_selected_state( QString::fromStdString(varname), true ); } QList<QModelIndex> des_indices = deselected.indexes(); for( QModelIndex index : des_indices ) { TreeItem* data = intensity_columns_listing_model->getItem(index); std::string varname = data->get_variable_name(); std::cout << "deselecting var: " << varname << std::endl; ui->qgraphics_super_cell_refinement->set_render_point_selected_state( QString::fromStdString(varname), false ); } ui->qgraphics_super_cell_refinement->repaint(); //ui->qgraphics_super_cell_refinement->force_layout_change(); } void MainWindow::create_box_options(){ // tab1 create_box_options_tab1_exp_image(); create_box_options_tab1_crystallography(); // tab2 create_box_options_tab2_sim_config(); create_box_options_tab2_run_config(); // tab3 create_box_options_tab3_supercell(); // tab4 create_box_options_tab4_intensity_peaks(); create_box_options_tab4_intensity_columns_listing(); } bool MainWindow::set_dr_probe_path( QString path ){ _dr_probe_bin_path = path; return true; } void MainWindow::on_qpush_apply_edge_detection_clicked(){ bool status = false; ui->statusBar->showMessage(tr("Running edge detection"), 2000); sim_super_cell_worker->requestSuperCellEdge(); } void MainWindow::on_qpush_test_tdmap_clicked(){ const bool project_ok = maybeSetProject(); if ( project_ok ){ ui->statusBar->showMessage(tr("Testing if TD Map has a clean run environment"), 2000); const bool _warnings_clean = _core_td_map->test_clean_run_env(); if( _warnings_clean == false ){ std::vector <std::string> warnings = _core_td_map->get_test_clean_run_env_warnings(); std::ostringstream os; for( int pos = 0; pos < warnings.size(); pos++ ){ os << warnings.at(pos) << "\n"; } QMessageBox messageBox; QFont font; font.setBold(false); messageBox.setFont(font); messageBox.warning(0,"Warning",QString::fromStdString( os.str() )); } ui->statusBar->showMessage(tr("Testing TD Map variable configuration"), 2000); const bool _errors_clean = _core_td_map->test_run_config(); if( _errors_clean == false ){ std::vector <std::string> errors = _core_td_map->get_test_run_config_errors(); std::ostringstream os; for( int pos = 0; pos < errors.size(); pos++ ){ os << errors.at(pos) << "\n"; } QMessageBox messageBox; QFont font; font.setBold(false); messageBox.setFont(font); messageBox.critical(0,"Error",QString::fromStdString( os.str() )); } else{ QMessageBox messageBox; messageBox.information(0,"TD Map ready to run.","The TD Map required variables are setted up. You can run the simulation."); } } else{ ui->statusBar->showMessage(tr("Error while checking project configurations."), 2000); } } void MainWindow::on_qpush_run_tdmap_clicked(){ const bool project_ok = maybeSetProject(); if ( project_ok ){ _core_td_map->validate_tdmap_url(); bool status = false; updateProgressBar(0,0,100); ui->statusBar->showMessage(tr("Requesting a TD-Map worker thread."), 2000); clear_tdmap_sim_ostream_containers(); sim_tdmap_worker->requestTDMap(); } else{ ui->statusBar->showMessage(tr("Error while checking project configurations."), 2000); } } void MainWindow::on_qbutton_tdmap_accept_clicked(){ bool result = false; if(_core_td_map->get_flag_simulated_images_grid()){ cv::Point2i best_match_pos; const bool _calculated_best_match = _core_td_map->get_flag_simgrid_best_match_position(); bool accept = true; if( _calculated_best_match ){ best_match_pos = _core_td_map->get_simgrid_best_match_position(); if( best_match_pos != tdmap_current_selection_pos ){ const QMessageBox::StandardButton ret = QMessageBox::warning(this, tr("Application"), tr("The selected cell differs from the automatic best match position.\n" "Do you want to use the current selected thickness value?"), QMessageBox::Yes | QMessageBox::No); switch (ret) { case QMessageBox::No: accept = false; break; default: break; } } } // if the user still wants to accept position if( accept ){ result = _core_td_map->accept_tdmap_best_match_position( tdmap_current_selection_pos.x ,tdmap_current_selection_pos.y ); } } if( result ){ ui->statusBar->showMessage(tr("Accepted TD Map best match position."), 2000); } else{ ui->statusBar->showMessage(tr("Error while accepting TD Map best match position.") ); } } void MainWindow::on_qpush_compute_full_super_cell_clicked(){ ui->statusBar->showMessage(tr("Requesting a Full-Super-Cell worker thread."), 2000); full_sim_super_cell_worker->requestFullSuperCell(); } void MainWindow::on_qpush_run_compute_intensity_columns_clicked(){ ui->statusBar->showMessage(tr("Requesting a Full-Super-Cell worker thread to compute intensity columns."), 2000); full_sim_super_cell_intensity_cols_worker->requestFullSuperCellComputeIntensityCols(); }
51.938948
645
0.765821
filipecosta90
f4b07deac6aa6af3f7ee54cbe5bdee6fcaa83860
247
hpp
C++
src/components/component_job_list.hpp
Nodmgatall/ytba
19de0ac40236e0c8cf5f1f7eb77efe764bc51b1f
[ "MIT" ]
null
null
null
src/components/component_job_list.hpp
Nodmgatall/ytba
19de0ac40236e0c8cf5f1f7eb77efe764bc51b1f
[ "MIT" ]
null
null
null
src/components/component_job_list.hpp
Nodmgatall/ytba
19de0ac40236e0c8cf5f1f7eb77efe764bc51b1f
[ "MIT" ]
null
null
null
#ifndef COMPONENT_JOB_LIST_HPP #define COMPONENT_JOB_LIST_HPP #include "../sub_types/terrain_types.hpp" #include "entityx/entityx.h" struct job_list : entityx::Component<job_list> { job_list() { std::vector<Job*> job_list; } #endif
19
48
0.732794
Nodmgatall
f4b38a8da4e8b2add36e4d77eda66b1c226df21b
1,764
hpp
C++
libfma/include/fma/types/Class.hpp
BenjaminSchulte/fma
df2aa5b0644c75dd34a92defeff9beaa4a32ffea
[ "MIT" ]
14
2018-01-25T10:31:05.000Z
2022-02-19T13:08:11.000Z
libfma/include/fma/types/Class.hpp
BenjaminSchulte/fma
df2aa5b0644c75dd34a92defeff9beaa4a32ffea
[ "MIT" ]
1
2020-12-24T10:10:28.000Z
2020-12-24T10:10:28.000Z
libfma/include/fma/types/Class.hpp
BenjaminSchulte/fma
df2aa5b0644c75dd34a92defeff9beaa4a32ffea
[ "MIT" ]
null
null
null
#ifndef __FMA_TYPES_CLASS_H__ #define __FMA_TYPES_CLASS_H__ #include <vector> #include "Base.hpp" namespace FMA { namespace interpret { class BaseContext; typedef std::shared_ptr<BaseContext> ContextPtr; struct Parameter; struct GroupedParameterList; } namespace types { class ClassPrototype; class Class : public Base { public: Class(const std::string &name, const std::string &fullName); virtual bool isClass() const { return true; } virtual ClassPtr asClass() { return std::dynamic_pointer_cast<Class>(getPointer()); } ObjectPtr createInstance(const interpret::ContextPtr &context, const interpret::GroupedParameterList &parameters); void extends(const ClassPtr &other); virtual std::string asString() const; virtual void dump(const std::string &); const std::string &getName() const { return name; } const std::string &getFullName() const { return fullName; } const ClassPrototypePtr &getPrototype(); virtual bool hasMember(const std::string &name) const; virtual TypePtr getMember(const std::string &name) const; bool hasOwnMember(const std::string &name) const; TypePtr getOwnMember(const std::string &name) const; virtual bool hasPrototypeMember(const std::string &name); virtual TypePtr getPrototypeMember(const std::string &name); bool isInstanceOf(const ClassPtr &other) const; bool isInstanceOf(const std::string &other) const; virtual interpret::ResultPtr callWithoutDecoratorTest(const interpret::ContextPtr &context, const interpret::GroupedParameterList &parameter); inline const std::vector<ClassPtr> &getParents() const { return parents; }; protected: std::string name; std::string fullName; mutable ClassPrototypePtr prototype; std::vector<ClassPtr> parents; }; } } #endif
28.918033
145
0.757937
BenjaminSchulte
f4b544cdc193383e9a84f4bf6eb813c8bedcb66e
395,724
cpp
C++
message/generation/swift-mt-generation/repository/SR2018/parsers/SwiftMtParser_MT537Parser.cpp
Yanick-Salzmann/message-converter-c
6dfdf56e12f19e0f0b63ee0354fda16968f36415
[ "MIT" ]
null
null
null
message/generation/swift-mt-generation/repository/SR2018/parsers/SwiftMtParser_MT537Parser.cpp
Yanick-Salzmann/message-converter-c
6dfdf56e12f19e0f0b63ee0354fda16968f36415
[ "MIT" ]
null
null
null
message/generation/swift-mt-generation/repository/SR2018/parsers/SwiftMtParser_MT537Parser.cpp
Yanick-Salzmann/message-converter-c
6dfdf56e12f19e0f0b63ee0354fda16968f36415
[ "MIT" ]
null
null
null
#include "repository/ISwiftMtParser.h" #include "SwiftMtMessage.pb.h" #include <vector> #include <string> #include "BaseErrorListener.h" #include "SwiftMtParser_MT537Lexer.h" // Generated from C:/programming/message-converter-c/message/generation/swift-mt-generation/repository/SR2018/grammars/SwiftMtParser_MT537.g4 by ANTLR 4.7.2 #include "SwiftMtParser_MT537Listener.h" #include "SwiftMtParser_MT537Parser.h" using namespace antlrcpp; using namespace message::definition::swift::mt::parsers::sr2018; using namespace antlr4; SwiftMtParser_MT537Parser::SwiftMtParser_MT537Parser(TokenStream *input) : Parser(input) { _interpreter = new atn::ParserATNSimulator(this, _atn, _decisionToDFA, _sharedContextCache); } SwiftMtParser_MT537Parser::~SwiftMtParser_MT537Parser() { delete _interpreter; } std::string SwiftMtParser_MT537Parser::getGrammarFileName() const { return "SwiftMtParser_MT537.g4"; } const std::vector<std::string>& SwiftMtParser_MT537Parser::getRuleNames() const { return _ruleNames; } dfa::Vocabulary& SwiftMtParser_MT537Parser::getVocabulary() const { return _vocabulary; } //----------------- MessageContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::MessageContext::MessageContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::BhContext* SwiftMtParser_MT537Parser::MessageContext::bh() { return getRuleContext<SwiftMtParser_MT537Parser::BhContext>(0); } SwiftMtParser_MT537Parser::AhContext* SwiftMtParser_MT537Parser::MessageContext::ah() { return getRuleContext<SwiftMtParser_MT537Parser::AhContext>(0); } SwiftMtParser_MT537Parser::MtContext* SwiftMtParser_MT537Parser::MessageContext::mt() { return getRuleContext<SwiftMtParser_MT537Parser::MtContext>(0); } tree::TerminalNode* SwiftMtParser_MT537Parser::MessageContext::EOF() { return getToken(SwiftMtParser_MT537Parser::EOF, 0); } SwiftMtParser_MT537Parser::UhContext* SwiftMtParser_MT537Parser::MessageContext::uh() { return getRuleContext<SwiftMtParser_MT537Parser::UhContext>(0); } SwiftMtParser_MT537Parser::TrContext* SwiftMtParser_MT537Parser::MessageContext::tr() { return getRuleContext<SwiftMtParser_MT537Parser::TrContext>(0); } size_t SwiftMtParser_MT537Parser::MessageContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleMessage; } void SwiftMtParser_MT537Parser::MessageContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterMessage(this); } void SwiftMtParser_MT537Parser::MessageContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitMessage(this); } SwiftMtParser_MT537Parser::MessageContext* SwiftMtParser_MT537Parser::message() { MessageContext *_localctx = _tracker.createInstance<MessageContext>(_ctx, getState()); enterRule(_localctx, 0, SwiftMtParser_MT537Parser::RuleMessage); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(184); bh(); setState(185); ah(); setState(187); _errHandler->sync(this); _la = _input->LA(1); if (_la == SwiftMtParser_MT537Parser::TAG_UH) { setState(186); uh(); } setState(189); mt(); setState(191); _errHandler->sync(this); _la = _input->LA(1); if (_la == SwiftMtParser_MT537Parser::TAG_TR) { setState(190); tr(); } setState(193); match(SwiftMtParser_MT537Parser::EOF); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- BhContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::BhContext::BhContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } tree::TerminalNode* SwiftMtParser_MT537Parser::BhContext::TAG_BH() { return getToken(SwiftMtParser_MT537Parser::TAG_BH, 0); } SwiftMtParser_MT537Parser::Bh_contentContext* SwiftMtParser_MT537Parser::BhContext::bh_content() { return getRuleContext<SwiftMtParser_MT537Parser::Bh_contentContext>(0); } tree::TerminalNode* SwiftMtParser_MT537Parser::BhContext::RBRACE() { return getToken(SwiftMtParser_MT537Parser::RBRACE, 0); } size_t SwiftMtParser_MT537Parser::BhContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleBh; } void SwiftMtParser_MT537Parser::BhContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterBh(this); } void SwiftMtParser_MT537Parser::BhContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitBh(this); } SwiftMtParser_MT537Parser::BhContext* SwiftMtParser_MT537Parser::bh() { BhContext *_localctx = _tracker.createInstance<BhContext>(_ctx, getState()); enterRule(_localctx, 2, SwiftMtParser_MT537Parser::RuleBh); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(195); match(SwiftMtParser_MT537Parser::TAG_BH); setState(196); bh_content(); setState(197); match(SwiftMtParser_MT537Parser::RBRACE); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Bh_contentContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Bh_contentContext::Bh_contentContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Bh_contentContext::RBRACE() { return getTokens(SwiftMtParser_MT537Parser::RBRACE); } tree::TerminalNode* SwiftMtParser_MT537Parser::Bh_contentContext::RBRACE(size_t i) { return getToken(SwiftMtParser_MT537Parser::RBRACE, i); } size_t SwiftMtParser_MT537Parser::Bh_contentContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleBh_content; } void SwiftMtParser_MT537Parser::Bh_contentContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterBh_content(this); } void SwiftMtParser_MT537Parser::Bh_contentContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitBh_content(this); } SwiftMtParser_MT537Parser::Bh_contentContext* SwiftMtParser_MT537Parser::bh_content() { Bh_contentContext *_localctx = _tracker.createInstance<Bh_contentContext>(_ctx, getState()); enterRule(_localctx, 4, SwiftMtParser_MT537Parser::RuleBh_content); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(200); _errHandler->sync(this); _la = _input->LA(1); do { setState(199); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::RBRACE)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(202); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::START_OF_FIELD) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- AhContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::AhContext::AhContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } tree::TerminalNode* SwiftMtParser_MT537Parser::AhContext::TAG_AH() { return getToken(SwiftMtParser_MT537Parser::TAG_AH, 0); } SwiftMtParser_MT537Parser::Ah_contentContext* SwiftMtParser_MT537Parser::AhContext::ah_content() { return getRuleContext<SwiftMtParser_MT537Parser::Ah_contentContext>(0); } tree::TerminalNode* SwiftMtParser_MT537Parser::AhContext::RBRACE() { return getToken(SwiftMtParser_MT537Parser::RBRACE, 0); } size_t SwiftMtParser_MT537Parser::AhContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleAh; } void SwiftMtParser_MT537Parser::AhContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterAh(this); } void SwiftMtParser_MT537Parser::AhContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitAh(this); } SwiftMtParser_MT537Parser::AhContext* SwiftMtParser_MT537Parser::ah() { AhContext *_localctx = _tracker.createInstance<AhContext>(_ctx, getState()); enterRule(_localctx, 6, SwiftMtParser_MT537Parser::RuleAh); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(204); match(SwiftMtParser_MT537Parser::TAG_AH); setState(205); ah_content(); setState(206); match(SwiftMtParser_MT537Parser::RBRACE); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Ah_contentContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Ah_contentContext::Ah_contentContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Ah_contentContext::RBRACE() { return getTokens(SwiftMtParser_MT537Parser::RBRACE); } tree::TerminalNode* SwiftMtParser_MT537Parser::Ah_contentContext::RBRACE(size_t i) { return getToken(SwiftMtParser_MT537Parser::RBRACE, i); } size_t SwiftMtParser_MT537Parser::Ah_contentContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleAh_content; } void SwiftMtParser_MT537Parser::Ah_contentContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterAh_content(this); } void SwiftMtParser_MT537Parser::Ah_contentContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitAh_content(this); } SwiftMtParser_MT537Parser::Ah_contentContext* SwiftMtParser_MT537Parser::ah_content() { Ah_contentContext *_localctx = _tracker.createInstance<Ah_contentContext>(_ctx, getState()); enterRule(_localctx, 8, SwiftMtParser_MT537Parser::RuleAh_content); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(209); _errHandler->sync(this); _la = _input->LA(1); do { setState(208); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::RBRACE)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(211); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::START_OF_FIELD) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- UhContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::UhContext::UhContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } tree::TerminalNode* SwiftMtParser_MT537Parser::UhContext::TAG_UH() { return getToken(SwiftMtParser_MT537Parser::TAG_UH, 0); } SwiftMtParser_MT537Parser::Sys_blockContext* SwiftMtParser_MT537Parser::UhContext::sys_block() { return getRuleContext<SwiftMtParser_MT537Parser::Sys_blockContext>(0); } tree::TerminalNode* SwiftMtParser_MT537Parser::UhContext::RBRACE() { return getToken(SwiftMtParser_MT537Parser::RBRACE, 0); } size_t SwiftMtParser_MT537Parser::UhContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleUh; } void SwiftMtParser_MT537Parser::UhContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterUh(this); } void SwiftMtParser_MT537Parser::UhContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitUh(this); } SwiftMtParser_MT537Parser::UhContext* SwiftMtParser_MT537Parser::uh() { UhContext *_localctx = _tracker.createInstance<UhContext>(_ctx, getState()); enterRule(_localctx, 10, SwiftMtParser_MT537Parser::RuleUh); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(213); match(SwiftMtParser_MT537Parser::TAG_UH); setState(214); sys_block(); setState(215); match(SwiftMtParser_MT537Parser::RBRACE); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- TrContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::TrContext::TrContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } tree::TerminalNode* SwiftMtParser_MT537Parser::TrContext::TAG_TR() { return getToken(SwiftMtParser_MT537Parser::TAG_TR, 0); } SwiftMtParser_MT537Parser::Sys_blockContext* SwiftMtParser_MT537Parser::TrContext::sys_block() { return getRuleContext<SwiftMtParser_MT537Parser::Sys_blockContext>(0); } tree::TerminalNode* SwiftMtParser_MT537Parser::TrContext::RBRACE() { return getToken(SwiftMtParser_MT537Parser::RBRACE, 0); } size_t SwiftMtParser_MT537Parser::TrContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleTr; } void SwiftMtParser_MT537Parser::TrContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterTr(this); } void SwiftMtParser_MT537Parser::TrContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitTr(this); } SwiftMtParser_MT537Parser::TrContext* SwiftMtParser_MT537Parser::tr() { TrContext *_localctx = _tracker.createInstance<TrContext>(_ctx, getState()); enterRule(_localctx, 12, SwiftMtParser_MT537Parser::RuleTr); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(217); match(SwiftMtParser_MT537Parser::TAG_TR); setState(218); sys_block(); setState(219); match(SwiftMtParser_MT537Parser::RBRACE); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Sys_blockContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Sys_blockContext::Sys_blockContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<SwiftMtParser_MT537Parser::Sys_elementContext *> SwiftMtParser_MT537Parser::Sys_blockContext::sys_element() { return getRuleContexts<SwiftMtParser_MT537Parser::Sys_elementContext>(); } SwiftMtParser_MT537Parser::Sys_elementContext* SwiftMtParser_MT537Parser::Sys_blockContext::sys_element(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Sys_elementContext>(i); } size_t SwiftMtParser_MT537Parser::Sys_blockContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSys_block; } void SwiftMtParser_MT537Parser::Sys_blockContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSys_block(this); } void SwiftMtParser_MT537Parser::Sys_blockContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSys_block(this); } SwiftMtParser_MT537Parser::Sys_blockContext* SwiftMtParser_MT537Parser::sys_block() { Sys_blockContext *_localctx = _tracker.createInstance<Sys_blockContext>(_ctx, getState()); enterRule(_localctx, 14, SwiftMtParser_MT537Parser::RuleSys_block); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(222); _errHandler->sync(this); _la = _input->LA(1); do { setState(221); sys_element(); setState(224); _errHandler->sync(this); _la = _input->LA(1); } while (_la == SwiftMtParser_MT537Parser::LBRACE); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Sys_elementContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Sys_elementContext::Sys_elementContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } tree::TerminalNode* SwiftMtParser_MT537Parser::Sys_elementContext::LBRACE() { return getToken(SwiftMtParser_MT537Parser::LBRACE, 0); } SwiftMtParser_MT537Parser::Sys_element_keyContext* SwiftMtParser_MT537Parser::Sys_elementContext::sys_element_key() { return getRuleContext<SwiftMtParser_MT537Parser::Sys_element_keyContext>(0); } tree::TerminalNode* SwiftMtParser_MT537Parser::Sys_elementContext::COLON() { return getToken(SwiftMtParser_MT537Parser::COLON, 0); } SwiftMtParser_MT537Parser::Sys_element_contentContext* SwiftMtParser_MT537Parser::Sys_elementContext::sys_element_content() { return getRuleContext<SwiftMtParser_MT537Parser::Sys_element_contentContext>(0); } tree::TerminalNode* SwiftMtParser_MT537Parser::Sys_elementContext::RBRACE() { return getToken(SwiftMtParser_MT537Parser::RBRACE, 0); } size_t SwiftMtParser_MT537Parser::Sys_elementContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSys_element; } void SwiftMtParser_MT537Parser::Sys_elementContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSys_element(this); } void SwiftMtParser_MT537Parser::Sys_elementContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSys_element(this); } SwiftMtParser_MT537Parser::Sys_elementContext* SwiftMtParser_MT537Parser::sys_element() { Sys_elementContext *_localctx = _tracker.createInstance<Sys_elementContext>(_ctx, getState()); enterRule(_localctx, 16, SwiftMtParser_MT537Parser::RuleSys_element); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(226); match(SwiftMtParser_MT537Parser::LBRACE); setState(227); sys_element_key(); setState(228); match(SwiftMtParser_MT537Parser::COLON); setState(229); sys_element_content(); setState(230); match(SwiftMtParser_MT537Parser::RBRACE); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Sys_element_keyContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Sys_element_keyContext::Sys_element_keyContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Sys_element_keyContext::COLON() { return getTokens(SwiftMtParser_MT537Parser::COLON); } tree::TerminalNode* SwiftMtParser_MT537Parser::Sys_element_keyContext::COLON(size_t i) { return getToken(SwiftMtParser_MT537Parser::COLON, i); } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Sys_element_keyContext::RBRACE() { return getTokens(SwiftMtParser_MT537Parser::RBRACE); } tree::TerminalNode* SwiftMtParser_MT537Parser::Sys_element_keyContext::RBRACE(size_t i) { return getToken(SwiftMtParser_MT537Parser::RBRACE, i); } size_t SwiftMtParser_MT537Parser::Sys_element_keyContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSys_element_key; } void SwiftMtParser_MT537Parser::Sys_element_keyContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSys_element_key(this); } void SwiftMtParser_MT537Parser::Sys_element_keyContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSys_element_key(this); } SwiftMtParser_MT537Parser::Sys_element_keyContext* SwiftMtParser_MT537Parser::sys_element_key() { Sys_element_keyContext *_localctx = _tracker.createInstance<Sys_element_keyContext>(_ctx, getState()); enterRule(_localctx, 18, SwiftMtParser_MT537Parser::RuleSys_element_key); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(233); _errHandler->sync(this); _la = _input->LA(1); do { setState(232); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::RBRACE || _la == SwiftMtParser_MT537Parser::COLON)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(235); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::START_OF_FIELD) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Sys_element_contentContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Sys_element_contentContext::Sys_element_contentContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Sys_element_contentContext::RBRACE() { return getTokens(SwiftMtParser_MT537Parser::RBRACE); } tree::TerminalNode* SwiftMtParser_MT537Parser::Sys_element_contentContext::RBRACE(size_t i) { return getToken(SwiftMtParser_MT537Parser::RBRACE, i); } size_t SwiftMtParser_MT537Parser::Sys_element_contentContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSys_element_content; } void SwiftMtParser_MT537Parser::Sys_element_contentContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSys_element_content(this); } void SwiftMtParser_MT537Parser::Sys_element_contentContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSys_element_content(this); } SwiftMtParser_MT537Parser::Sys_element_contentContext* SwiftMtParser_MT537Parser::sys_element_content() { Sys_element_contentContext *_localctx = _tracker.createInstance<Sys_element_contentContext>(_ctx, getState()); enterRule(_localctx, 20, SwiftMtParser_MT537Parser::RuleSys_element_content); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(238); _errHandler->sync(this); _la = _input->LA(1); do { setState(237); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::RBRACE)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(240); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::START_OF_FIELD) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- MtContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::MtContext::MtContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } tree::TerminalNode* SwiftMtParser_MT537Parser::MtContext::TAG_MT() { return getToken(SwiftMtParser_MT537Parser::TAG_MT, 0); } SwiftMtParser_MT537Parser::Seq_AContext* SwiftMtParser_MT537Parser::MtContext::seq_A() { return getRuleContext<SwiftMtParser_MT537Parser::Seq_AContext>(0); } tree::TerminalNode* SwiftMtParser_MT537Parser::MtContext::MT_END() { return getToken(SwiftMtParser_MT537Parser::MT_END, 0); } std::vector<SwiftMtParser_MT537Parser::Seq_BContext *> SwiftMtParser_MT537Parser::MtContext::seq_B() { return getRuleContexts<SwiftMtParser_MT537Parser::Seq_BContext>(); } SwiftMtParser_MT537Parser::Seq_BContext* SwiftMtParser_MT537Parser::MtContext::seq_B(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Seq_BContext>(i); } size_t SwiftMtParser_MT537Parser::MtContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleMt; } void SwiftMtParser_MT537Parser::MtContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterMt(this); } void SwiftMtParser_MT537Parser::MtContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitMt(this); } SwiftMtParser_MT537Parser::MtContext* SwiftMtParser_MT537Parser::mt() { MtContext *_localctx = _tracker.createInstance<MtContext>(_ctx, getState()); enterRule(_localctx, 22, SwiftMtParser_MT537Parser::RuleMt); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(242); match(SwiftMtParser_MT537Parser::TAG_MT); setState(243); seq_A(); setState(247); _errHandler->sync(this); _la = _input->LA(1); while (_la == SwiftMtParser_MT537Parser::START_OF_FIELD) { setState(244); seq_B(); setState(249); _errHandler->sync(this); _la = _input->LA(1); } setState(250); match(SwiftMtParser_MT537Parser::MT_END); _ctx->stop = _input->LT(-1); _message_builder.mutable_msg_text()->MergeFrom(_localctx->elem); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Seq_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Seq_AContext::Seq_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_16R_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_16R_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16R_AContext>(0); } SwiftMtParser_MT537Parser::Fld_28E_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_28E_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_28E_AContext>(0); } SwiftMtParser_MT537Parser::Fld_20C_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_20C_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_20C_AContext>(0); } SwiftMtParser_MT537Parser::Fld_23G_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_23G_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_23G_AContext>(0); } SwiftMtParser_MT537Parser::Fld_97a_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_97a_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_97a_AContext>(0); } SwiftMtParser_MT537Parser::Fld_17B_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_17B_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_17B_AContext>(0); } SwiftMtParser_MT537Parser::Fld_16S_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_16S_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16S_AContext>(0); } SwiftMtParser_MT537Parser::Fld_13a_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_13a_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_13a_AContext>(0); } std::vector<SwiftMtParser_MT537Parser::Fld_98a_AContext *> SwiftMtParser_MT537Parser::Seq_AContext::fld_98a_A() { return getRuleContexts<SwiftMtParser_MT537Parser::Fld_98a_AContext>(); } SwiftMtParser_MT537Parser::Fld_98a_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_98a_A(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Fld_98a_AContext>(i); } std::vector<SwiftMtParser_MT537Parser::Fld_22a_AContext *> SwiftMtParser_MT537Parser::Seq_AContext::fld_22a_A() { return getRuleContexts<SwiftMtParser_MT537Parser::Fld_22a_AContext>(); } SwiftMtParser_MT537Parser::Fld_22a_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_22a_A(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Fld_22a_AContext>(i); } std::vector<SwiftMtParser_MT537Parser::Seq_A1Context *> SwiftMtParser_MT537Parser::Seq_AContext::seq_A1() { return getRuleContexts<SwiftMtParser_MT537Parser::Seq_A1Context>(); } SwiftMtParser_MT537Parser::Seq_A1Context* SwiftMtParser_MT537Parser::Seq_AContext::seq_A1(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Seq_A1Context>(i); } std::vector<SwiftMtParser_MT537Parser::Fld_95a_AContext *> SwiftMtParser_MT537Parser::Seq_AContext::fld_95a_A() { return getRuleContexts<SwiftMtParser_MT537Parser::Fld_95a_AContext>(); } SwiftMtParser_MT537Parser::Fld_95a_AContext* SwiftMtParser_MT537Parser::Seq_AContext::fld_95a_A(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Fld_95a_AContext>(i); } size_t SwiftMtParser_MT537Parser::Seq_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSeq_A; } void SwiftMtParser_MT537Parser::Seq_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSeq_A(this); } void SwiftMtParser_MT537Parser::Seq_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSeq_A(this); } SwiftMtParser_MT537Parser::Seq_AContext* SwiftMtParser_MT537Parser::seq_A() { Seq_AContext *_localctx = _tracker.createInstance<Seq_AContext>(_ctx, getState()); enterRule(_localctx, 24, SwiftMtParser_MT537Parser::RuleSeq_A); _localctx->elem.set_tag("A"); auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(252); dynamic_cast<Seq_AContext *>(_localctx)->fld_16R_AContext = fld_16R_A(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_16R_AContext->fld); setState(254); dynamic_cast<Seq_AContext *>(_localctx)->fld_28E_AContext = fld_28E_A(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_28E_AContext->fld); setState(257); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 8, _ctx)) { case 1: { setState(256); dynamic_cast<Seq_AContext *>(_localctx)->fld_13a_AContext = fld_13a_A(); break; } } _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_13a_AContext->fld); setState(260); dynamic_cast<Seq_AContext *>(_localctx)->fld_20C_AContext = fld_20C_A(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_20C_AContext->fld); setState(262); dynamic_cast<Seq_AContext *>(_localctx)->fld_23G_AContext = fld_23G_A(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_23G_AContext->fld); setState(265); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(264); dynamic_cast<Seq_AContext *>(_localctx)->fld_98a_AContext = fld_98a_A(); break; } default: throw NoViableAltException(this); } setState(267); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 9, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_98a_AContext->fld); setState(271); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(270); dynamic_cast<Seq_AContext *>(_localctx)->fld_22a_AContext = fld_22a_A(); break; } default: throw NoViableAltException(this); } setState(273); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 10, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_22a_AContext->fld); setState(279); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 11, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { if (alt == 1) { setState(276); dynamic_cast<Seq_AContext *>(_localctx)->seq_A1Context = seq_A1(); } setState(281); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 11, _ctx); } _localctx->elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->seq_A1Context->elem); setState(286); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 12, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { if (alt == 1) { setState(283); dynamic_cast<Seq_AContext *>(_localctx)->fld_95a_AContext = fld_95a_A(); } setState(288); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 12, _ctx); } _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_95a_AContext->fld); setState(290); dynamic_cast<Seq_AContext *>(_localctx)->fld_97a_AContext = fld_97a_A(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_97a_AContext->fld); setState(292); dynamic_cast<Seq_AContext *>(_localctx)->fld_17B_AContext = fld_17B_A(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_17B_AContext->fld); setState(294); dynamic_cast<Seq_AContext *>(_localctx)->fld_16S_AContext = fld_16S_A(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_AContext *>(_localctx)->fld_16S_AContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Seq_A1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Seq_A1Context::Seq_A1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_16R_A1Context* SwiftMtParser_MT537Parser::Seq_A1Context::fld_16R_A1() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16R_A1Context>(0); } SwiftMtParser_MT537Parser::Fld_20C_A1Context* SwiftMtParser_MT537Parser::Seq_A1Context::fld_20C_A1() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_20C_A1Context>(0); } SwiftMtParser_MT537Parser::Fld_16S_A1Context* SwiftMtParser_MT537Parser::Seq_A1Context::fld_16S_A1() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16S_A1Context>(0); } SwiftMtParser_MT537Parser::Fld_13a_A1Context* SwiftMtParser_MT537Parser::Seq_A1Context::fld_13a_A1() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_13a_A1Context>(0); } size_t SwiftMtParser_MT537Parser::Seq_A1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSeq_A1; } void SwiftMtParser_MT537Parser::Seq_A1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSeq_A1(this); } void SwiftMtParser_MT537Parser::Seq_A1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSeq_A1(this); } SwiftMtParser_MT537Parser::Seq_A1Context* SwiftMtParser_MT537Parser::seq_A1() { Seq_A1Context *_localctx = _tracker.createInstance<Seq_A1Context>(_ctx, getState()); enterRule(_localctx, 26, SwiftMtParser_MT537Parser::RuleSeq_A1); _localctx->elem.set_tag("A1"); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(297); dynamic_cast<Seq_A1Context *>(_localctx)->fld_16R_A1Context = fld_16R_A1(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_A1Context *>(_localctx)->fld_16R_A1Context->fld); setState(300); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 13, _ctx)) { case 1: { setState(299); dynamic_cast<Seq_A1Context *>(_localctx)->fld_13a_A1Context = fld_13a_A1(); break; } } _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_A1Context *>(_localctx)->fld_13a_A1Context->fld); setState(303); dynamic_cast<Seq_A1Context *>(_localctx)->fld_20C_A1Context = fld_20C_A1(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_A1Context *>(_localctx)->fld_20C_A1Context->fld); setState(305); dynamic_cast<Seq_A1Context *>(_localctx)->fld_16S_A1Context = fld_16S_A1(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_A1Context *>(_localctx)->fld_16S_A1Context->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Seq_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Seq_BContext::Seq_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_16R_BContext* SwiftMtParser_MT537Parser::Seq_BContext::fld_16R_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16R_BContext>(0); } SwiftMtParser_MT537Parser::Fld_25D_BContext* SwiftMtParser_MT537Parser::Seq_BContext::fld_25D_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_25D_BContext>(0); } std::vector<SwiftMtParser_MT537Parser::Seq_B1Context *> SwiftMtParser_MT537Parser::Seq_BContext::seq_B1() { return getRuleContexts<SwiftMtParser_MT537Parser::Seq_B1Context>(); } SwiftMtParser_MT537Parser::Seq_B1Context* SwiftMtParser_MT537Parser::Seq_BContext::seq_B1(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Seq_B1Context>(i); } std::vector<SwiftMtParser_MT537Parser::Seq_B2Context *> SwiftMtParser_MT537Parser::Seq_BContext::seq_B2() { return getRuleContexts<SwiftMtParser_MT537Parser::Seq_B2Context>(); } SwiftMtParser_MT537Parser::Seq_B2Context* SwiftMtParser_MT537Parser::Seq_BContext::seq_B2(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Seq_B2Context>(i); } size_t SwiftMtParser_MT537Parser::Seq_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSeq_B; } void SwiftMtParser_MT537Parser::Seq_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSeq_B(this); } void SwiftMtParser_MT537Parser::Seq_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSeq_B(this); } SwiftMtParser_MT537Parser::Seq_BContext* SwiftMtParser_MT537Parser::seq_B() { Seq_BContext *_localctx = _tracker.createInstance<Seq_BContext>(_ctx, getState()); enterRule(_localctx, 28, SwiftMtParser_MT537Parser::RuleSeq_B); _localctx->elem.set_tag("B"); auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(308); dynamic_cast<Seq_BContext *>(_localctx)->fld_16R_BContext = fld_16R_B(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_BContext *>(_localctx)->fld_16R_BContext->fld); setState(310); dynamic_cast<Seq_BContext *>(_localctx)->fld_25D_BContext = fld_25D_B(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_BContext *>(_localctx)->fld_25D_BContext->fld); setState(315); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 14, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { if (alt == 1) { setState(312); dynamic_cast<Seq_BContext *>(_localctx)->seq_B1Context = seq_B1(); } setState(317); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 14, _ctx); } _localctx->elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom(dynamic_cast<Seq_BContext *>(_localctx)->seq_B1Context->elem); setState(320); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(319); dynamic_cast<Seq_BContext *>(_localctx)->seq_B2Context = seq_B2(); break; } default: throw NoViableAltException(this); } setState(322); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 15, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); _localctx->elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom(dynamic_cast<Seq_BContext *>(_localctx)->seq_B2Context->elem); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Seq_B1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Seq_B1Context::Seq_B1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_16R_B1Context* SwiftMtParser_MT537Parser::Seq_B1Context::fld_16R_B1() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16R_B1Context>(0); } SwiftMtParser_MT537Parser::Fld_24B_B1Context* SwiftMtParser_MT537Parser::Seq_B1Context::fld_24B_B1() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_24B_B1Context>(0); } SwiftMtParser_MT537Parser::Fld_16S_B1Context* SwiftMtParser_MT537Parser::Seq_B1Context::fld_16S_B1() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16S_B1Context>(0); } SwiftMtParser_MT537Parser::Fld_70D_B1Context* SwiftMtParser_MT537Parser::Seq_B1Context::fld_70D_B1() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_70D_B1Context>(0); } size_t SwiftMtParser_MT537Parser::Seq_B1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSeq_B1; } void SwiftMtParser_MT537Parser::Seq_B1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSeq_B1(this); } void SwiftMtParser_MT537Parser::Seq_B1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSeq_B1(this); } SwiftMtParser_MT537Parser::Seq_B1Context* SwiftMtParser_MT537Parser::seq_B1() { Seq_B1Context *_localctx = _tracker.createInstance<Seq_B1Context>(_ctx, getState()); enterRule(_localctx, 30, SwiftMtParser_MT537Parser::RuleSeq_B1); _localctx->elem.set_tag("B1"); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(326); dynamic_cast<Seq_B1Context *>(_localctx)->fld_16R_B1Context = fld_16R_B1(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B1Context *>(_localctx)->fld_16R_B1Context->fld); setState(328); dynamic_cast<Seq_B1Context *>(_localctx)->fld_24B_B1Context = fld_24B_B1(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B1Context *>(_localctx)->fld_24B_B1Context->fld); setState(331); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 16, _ctx)) { case 1: { setState(330); dynamic_cast<Seq_B1Context *>(_localctx)->fld_70D_B1Context = fld_70D_B1(); break; } } _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B1Context *>(_localctx)->fld_70D_B1Context->fld); setState(334); dynamic_cast<Seq_B1Context *>(_localctx)->fld_16S_B1Context = fld_16S_B1(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B1Context *>(_localctx)->fld_16S_B1Context->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Seq_B2Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Seq_B2Context::Seq_B2Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_16R_B2Context* SwiftMtParser_MT537Parser::Seq_B2Context::fld_16R_B2() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16R_B2Context>(0); } std::vector<SwiftMtParser_MT537Parser::Seq_B2aContext *> SwiftMtParser_MT537Parser::Seq_B2Context::seq_B2a() { return getRuleContexts<SwiftMtParser_MT537Parser::Seq_B2aContext>(); } SwiftMtParser_MT537Parser::Seq_B2aContext* SwiftMtParser_MT537Parser::Seq_B2Context::seq_B2a(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Seq_B2aContext>(i); } SwiftMtParser_MT537Parser::Seq_B2bContext* SwiftMtParser_MT537Parser::Seq_B2Context::seq_B2b() { return getRuleContext<SwiftMtParser_MT537Parser::Seq_B2bContext>(0); } size_t SwiftMtParser_MT537Parser::Seq_B2Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSeq_B2; } void SwiftMtParser_MT537Parser::Seq_B2Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSeq_B2(this); } void SwiftMtParser_MT537Parser::Seq_B2Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSeq_B2(this); } SwiftMtParser_MT537Parser::Seq_B2Context* SwiftMtParser_MT537Parser::seq_B2() { Seq_B2Context *_localctx = _tracker.createInstance<Seq_B2Context>(_ctx, getState()); enterRule(_localctx, 32, SwiftMtParser_MT537Parser::RuleSeq_B2); _localctx->elem.set_tag("B2"); auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(337); dynamic_cast<Seq_B2Context *>(_localctx)->fld_16R_B2Context = fld_16R_B2(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2Context *>(_localctx)->fld_16R_B2Context->fld); setState(340); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(339); dynamic_cast<Seq_B2Context *>(_localctx)->seq_B2aContext = seq_B2a(); break; } default: throw NoViableAltException(this); } setState(342); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 17, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); _localctx->elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom(dynamic_cast<Seq_B2Context *>(_localctx)->seq_B2aContext->elem); setState(346); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 18, _ctx)) { case 1: { setState(345); dynamic_cast<Seq_B2Context *>(_localctx)->seq_B2bContext = seq_B2b(); break; } } _localctx->elem.mutable_objects()->Add()->mutable_sequence()->MergeFrom(dynamic_cast<Seq_B2Context *>(_localctx)->seq_B2bContext->elem); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Seq_B2aContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Seq_B2aContext::Seq_B2aContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_16R_B2aContext* SwiftMtParser_MT537Parser::Seq_B2aContext::fld_16R_B2a() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16R_B2aContext>(0); } SwiftMtParser_MT537Parser::Fld_20C_B2aContext* SwiftMtParser_MT537Parser::Seq_B2aContext::fld_20C_B2a() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_20C_B2aContext>(0); } SwiftMtParser_MT537Parser::Fld_16S_B2aContext* SwiftMtParser_MT537Parser::Seq_B2aContext::fld_16S_B2a() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16S_B2aContext>(0); } SwiftMtParser_MT537Parser::Fld_13a_B2aContext* SwiftMtParser_MT537Parser::Seq_B2aContext::fld_13a_B2a() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_13a_B2aContext>(0); } size_t SwiftMtParser_MT537Parser::Seq_B2aContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSeq_B2a; } void SwiftMtParser_MT537Parser::Seq_B2aContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSeq_B2a(this); } void SwiftMtParser_MT537Parser::Seq_B2aContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSeq_B2a(this); } SwiftMtParser_MT537Parser::Seq_B2aContext* SwiftMtParser_MT537Parser::seq_B2a() { Seq_B2aContext *_localctx = _tracker.createInstance<Seq_B2aContext>(_ctx, getState()); enterRule(_localctx, 34, SwiftMtParser_MT537Parser::RuleSeq_B2a); _localctx->elem.set_tag("B2a"); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(350); dynamic_cast<Seq_B2aContext *>(_localctx)->fld_16R_B2aContext = fld_16R_B2a(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2aContext *>(_localctx)->fld_16R_B2aContext->fld); setState(353); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 19, _ctx)) { case 1: { setState(352); dynamic_cast<Seq_B2aContext *>(_localctx)->fld_13a_B2aContext = fld_13a_B2a(); break; } } _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2aContext *>(_localctx)->fld_13a_B2aContext->fld); setState(356); dynamic_cast<Seq_B2aContext *>(_localctx)->fld_20C_B2aContext = fld_20C_B2a(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2aContext *>(_localctx)->fld_20C_B2aContext->fld); setState(358); dynamic_cast<Seq_B2aContext *>(_localctx)->fld_16S_B2aContext = fld_16S_B2a(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2aContext *>(_localctx)->fld_16S_B2aContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Seq_B2bContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Seq_B2bContext::Seq_B2bContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_16R_B2bContext* SwiftMtParser_MT537Parser::Seq_B2bContext::fld_16R_B2b() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_16R_B2bContext>(0); } SwiftMtParser_MT537Parser::Fld_35B_B2bContext* SwiftMtParser_MT537Parser::Seq_B2bContext::fld_35B_B2b() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_35B_B2bContext>(0); } std::vector<SwiftMtParser_MT537Parser::Fld_94a_B2bContext *> SwiftMtParser_MT537Parser::Seq_B2bContext::fld_94a_B2b() { return getRuleContexts<SwiftMtParser_MT537Parser::Fld_94a_B2bContext>(); } SwiftMtParser_MT537Parser::Fld_94a_B2bContext* SwiftMtParser_MT537Parser::Seq_B2bContext::fld_94a_B2b(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Fld_94a_B2bContext>(i); } std::vector<SwiftMtParser_MT537Parser::Fld_36B_B2bContext *> SwiftMtParser_MT537Parser::Seq_B2bContext::fld_36B_B2b() { return getRuleContexts<SwiftMtParser_MT537Parser::Fld_36B_B2bContext>(); } SwiftMtParser_MT537Parser::Fld_36B_B2bContext* SwiftMtParser_MT537Parser::Seq_B2bContext::fld_36B_B2b(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Fld_36B_B2bContext>(i); } std::vector<SwiftMtParser_MT537Parser::Fld_19A_B2bContext *> SwiftMtParser_MT537Parser::Seq_B2bContext::fld_19A_B2b() { return getRuleContexts<SwiftMtParser_MT537Parser::Fld_19A_B2bContext>(); } SwiftMtParser_MT537Parser::Fld_19A_B2bContext* SwiftMtParser_MT537Parser::Seq_B2bContext::fld_19A_B2b(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Fld_19A_B2bContext>(i); } std::vector<SwiftMtParser_MT537Parser::Fld_22a_B2bContext *> SwiftMtParser_MT537Parser::Seq_B2bContext::fld_22a_B2b() { return getRuleContexts<SwiftMtParser_MT537Parser::Fld_22a_B2bContext>(); } SwiftMtParser_MT537Parser::Fld_22a_B2bContext* SwiftMtParser_MT537Parser::Seq_B2bContext::fld_22a_B2b(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Fld_22a_B2bContext>(i); } std::vector<SwiftMtParser_MT537Parser::Fld_98a_B2bContext *> SwiftMtParser_MT537Parser::Seq_B2bContext::fld_98a_B2b() { return getRuleContexts<SwiftMtParser_MT537Parser::Fld_98a_B2bContext>(); } SwiftMtParser_MT537Parser::Fld_98a_B2bContext* SwiftMtParser_MT537Parser::Seq_B2bContext::fld_98a_B2b(size_t i) { return getRuleContext<SwiftMtParser_MT537Parser::Fld_98a_B2bContext>(i); } SwiftMtParser_MT537Parser::Fld_70E_B2bContext* SwiftMtParser_MT537Parser::Seq_B2bContext::fld_70E_B2b() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_70E_B2bContext>(0); } size_t SwiftMtParser_MT537Parser::Seq_B2bContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleSeq_B2b; } void SwiftMtParser_MT537Parser::Seq_B2bContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterSeq_B2b(this); } void SwiftMtParser_MT537Parser::Seq_B2bContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitSeq_B2b(this); } SwiftMtParser_MT537Parser::Seq_B2bContext* SwiftMtParser_MT537Parser::seq_B2b() { Seq_B2bContext *_localctx = _tracker.createInstance<Seq_B2bContext>(_ctx, getState()); enterRule(_localctx, 36, SwiftMtParser_MT537Parser::RuleSeq_B2b); _localctx->elem.set_tag("B2b"); auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(361); dynamic_cast<Seq_B2bContext *>(_localctx)->fld_16R_B2bContext = fld_16R_B2b(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2bContext *>(_localctx)->fld_16R_B2bContext->fld); setState(366); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 20, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { if (alt == 1) { setState(363); dynamic_cast<Seq_B2bContext *>(_localctx)->fld_94a_B2bContext = fld_94a_B2b(); } setState(368); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 20, _ctx); } _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2bContext *>(_localctx)->fld_94a_B2bContext->fld); setState(370); dynamic_cast<Seq_B2bContext *>(_localctx)->fld_35B_B2bContext = fld_35B_B2b(); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2bContext *>(_localctx)->fld_35B_B2bContext->fld); setState(373); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(372); dynamic_cast<Seq_B2bContext *>(_localctx)->fld_36B_B2bContext = fld_36B_B2b(); break; } default: throw NoViableAltException(this); } setState(375); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 21, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2bContext *>(_localctx)->fld_36B_B2bContext->fld); setState(381); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 22, _ctx); while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER) { if (alt == 1) { setState(378); dynamic_cast<Seq_B2bContext *>(_localctx)->fld_19A_B2bContext = fld_19A_B2b(); } setState(383); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 22, _ctx); } _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2bContext *>(_localctx)->fld_19A_B2bContext->fld); setState(386); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(385); dynamic_cast<Seq_B2bContext *>(_localctx)->fld_22a_B2bContext = fld_22a_B2b(); break; } default: throw NoViableAltException(this); } setState(388); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 23, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2bContext *>(_localctx)->fld_22a_B2bContext->fld); setState(392); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(391); dynamic_cast<Seq_B2bContext *>(_localctx)->fld_98a_B2bContext = fld_98a_B2b(); break; } default: throw NoViableAltException(this); } setState(394); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 24, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2bContext *>(_localctx)->fld_98a_B2bContext->fld); setState(398); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 25, _ctx)) { case 1: { setState(397); dynamic_cast<Seq_B2bContext *>(_localctx)->fld_70E_B2bContext = fld_70E_B2b(); break; } } _localctx->elem.mutable_objects()->Add()->mutable_field()->MergeFrom(dynamic_cast<Seq_B2bContext *>(_localctx)->fld_70E_B2bContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16R_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16R_AContext::Fld_16R_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16R_AContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16R_AContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16R_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16R_A; } void SwiftMtParser_MT537Parser::Fld_16R_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16R_A(this); } void SwiftMtParser_MT537Parser::Fld_16R_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16R_A(this); } SwiftMtParser_MT537Parser::Fld_16R_AContext* SwiftMtParser_MT537Parser::fld_16R_A() { Fld_16R_AContext *_localctx = _tracker.createInstance<Fld_16R_AContext>(_ctx, getState()); enterRule(_localctx, 38, SwiftMtParser_MT537Parser::RuleFld_16R_A); _localctx->fld.set_tag("16R"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(402); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(403); match(SwiftMtParser_MT537Parser::T__0); setState(405); _errHandler->sync(this); _la = _input->LA(1); do { setState(404); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(407); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_28E_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_28E_AContext::Fld_28E_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_28E_A_EContext* SwiftMtParser_MT537Parser::Fld_28E_AContext::fld_28E_A_E() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_28E_A_EContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_28E_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_28E_A; } void SwiftMtParser_MT537Parser::Fld_28E_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_28E_A(this); } void SwiftMtParser_MT537Parser::Fld_28E_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_28E_A(this); } SwiftMtParser_MT537Parser::Fld_28E_AContext* SwiftMtParser_MT537Parser::fld_28E_A() { Fld_28E_AContext *_localctx = _tracker.createInstance<Fld_28E_AContext>(_ctx, getState()); enterRule(_localctx, 40, SwiftMtParser_MT537Parser::RuleFld_28E_A); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(409); dynamic_cast<Fld_28E_AContext *>(_localctx)->fld_28E_A_EContext = fld_28E_A_E(); _localctx->fld.MergeFrom(dynamic_cast<Fld_28E_AContext *>(_localctx)->fld_28E_A_EContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_13a_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_13a_AContext::Fld_13a_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_13a_A_AContext* SwiftMtParser_MT537Parser::Fld_13a_AContext::fld_13a_A_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_13a_A_AContext>(0); } SwiftMtParser_MT537Parser::Fld_13a_A_JContext* SwiftMtParser_MT537Parser::Fld_13a_AContext::fld_13a_A_J() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_13a_A_JContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_13a_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_13a_A; } void SwiftMtParser_MT537Parser::Fld_13a_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_13a_A(this); } void SwiftMtParser_MT537Parser::Fld_13a_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_13a_A(this); } SwiftMtParser_MT537Parser::Fld_13a_AContext* SwiftMtParser_MT537Parser::fld_13a_A() { Fld_13a_AContext *_localctx = _tracker.createInstance<Fld_13a_AContext>(_ctx, getState()); enterRule(_localctx, 42, SwiftMtParser_MT537Parser::RuleFld_13a_A); auto onExit = finally([=] { exitRule(); }); try { setState(418); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 27, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(412); dynamic_cast<Fld_13a_AContext *>(_localctx)->fld_13a_A_AContext = fld_13a_A_A(); _localctx->fld.MergeFrom(dynamic_cast<Fld_13a_AContext *>(_localctx)->fld_13a_A_AContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(415); dynamic_cast<Fld_13a_AContext *>(_localctx)->fld_13a_A_JContext = fld_13a_A_J(); _localctx->fld.MergeFrom(dynamic_cast<Fld_13a_AContext *>(_localctx)->fld_13a_A_JContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_20C_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_20C_AContext::Fld_20C_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_20C_A_CContext* SwiftMtParser_MT537Parser::Fld_20C_AContext::fld_20C_A_C() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_20C_A_CContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_20C_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_20C_A; } void SwiftMtParser_MT537Parser::Fld_20C_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_20C_A(this); } void SwiftMtParser_MT537Parser::Fld_20C_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_20C_A(this); } SwiftMtParser_MT537Parser::Fld_20C_AContext* SwiftMtParser_MT537Parser::fld_20C_A() { Fld_20C_AContext *_localctx = _tracker.createInstance<Fld_20C_AContext>(_ctx, getState()); enterRule(_localctx, 44, SwiftMtParser_MT537Parser::RuleFld_20C_A); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(420); dynamic_cast<Fld_20C_AContext *>(_localctx)->fld_20C_A_CContext = fld_20C_A_C(); _localctx->fld.MergeFrom(dynamic_cast<Fld_20C_AContext *>(_localctx)->fld_20C_A_CContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_23G_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_23G_AContext::Fld_23G_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_23G_A_GContext* SwiftMtParser_MT537Parser::Fld_23G_AContext::fld_23G_A_G() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_23G_A_GContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_23G_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_23G_A; } void SwiftMtParser_MT537Parser::Fld_23G_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_23G_A(this); } void SwiftMtParser_MT537Parser::Fld_23G_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_23G_A(this); } SwiftMtParser_MT537Parser::Fld_23G_AContext* SwiftMtParser_MT537Parser::fld_23G_A() { Fld_23G_AContext *_localctx = _tracker.createInstance<Fld_23G_AContext>(_ctx, getState()); enterRule(_localctx, 46, SwiftMtParser_MT537Parser::RuleFld_23G_A); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(423); dynamic_cast<Fld_23G_AContext *>(_localctx)->fld_23G_A_GContext = fld_23G_A_G(); _localctx->fld.MergeFrom(dynamic_cast<Fld_23G_AContext *>(_localctx)->fld_23G_A_GContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_98a_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_98a_AContext::Fld_98a_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_98a_A_AContext* SwiftMtParser_MT537Parser::Fld_98a_AContext::fld_98a_A_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_98a_A_AContext>(0); } SwiftMtParser_MT537Parser::Fld_98a_A_CContext* SwiftMtParser_MT537Parser::Fld_98a_AContext::fld_98a_A_C() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_98a_A_CContext>(0); } SwiftMtParser_MT537Parser::Fld_98a_A_EContext* SwiftMtParser_MT537Parser::Fld_98a_AContext::fld_98a_A_E() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_98a_A_EContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_98a_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_98a_A; } void SwiftMtParser_MT537Parser::Fld_98a_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_98a_A(this); } void SwiftMtParser_MT537Parser::Fld_98a_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_98a_A(this); } SwiftMtParser_MT537Parser::Fld_98a_AContext* SwiftMtParser_MT537Parser::fld_98a_A() { Fld_98a_AContext *_localctx = _tracker.createInstance<Fld_98a_AContext>(_ctx, getState()); enterRule(_localctx, 48, SwiftMtParser_MT537Parser::RuleFld_98a_A); auto onExit = finally([=] { exitRule(); }); try { setState(435); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 28, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(426); dynamic_cast<Fld_98a_AContext *>(_localctx)->fld_98a_A_AContext = fld_98a_A_A(); _localctx->fld.MergeFrom(dynamic_cast<Fld_98a_AContext *>(_localctx)->fld_98a_A_AContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(429); dynamic_cast<Fld_98a_AContext *>(_localctx)->fld_98a_A_CContext = fld_98a_A_C(); _localctx->fld.MergeFrom(dynamic_cast<Fld_98a_AContext *>(_localctx)->fld_98a_A_CContext->fld); break; } case 3: { enterOuterAlt(_localctx, 3); setState(432); dynamic_cast<Fld_98a_AContext *>(_localctx)->fld_98a_A_EContext = fld_98a_A_E(); _localctx->fld.MergeFrom(dynamic_cast<Fld_98a_AContext *>(_localctx)->fld_98a_A_EContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_22a_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_22a_AContext::Fld_22a_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_22a_A_FContext* SwiftMtParser_MT537Parser::Fld_22a_AContext::fld_22a_A_F() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_22a_A_FContext>(0); } SwiftMtParser_MT537Parser::Fld_22a_A_HContext* SwiftMtParser_MT537Parser::Fld_22a_AContext::fld_22a_A_H() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_22a_A_HContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_22a_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_22a_A; } void SwiftMtParser_MT537Parser::Fld_22a_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_22a_A(this); } void SwiftMtParser_MT537Parser::Fld_22a_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_22a_A(this); } SwiftMtParser_MT537Parser::Fld_22a_AContext* SwiftMtParser_MT537Parser::fld_22a_A() { Fld_22a_AContext *_localctx = _tracker.createInstance<Fld_22a_AContext>(_ctx, getState()); enterRule(_localctx, 50, SwiftMtParser_MT537Parser::RuleFld_22a_A); auto onExit = finally([=] { exitRule(); }); try { setState(443); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 29, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(437); dynamic_cast<Fld_22a_AContext *>(_localctx)->fld_22a_A_FContext = fld_22a_A_F(); _localctx->fld.MergeFrom(dynamic_cast<Fld_22a_AContext *>(_localctx)->fld_22a_A_FContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(440); dynamic_cast<Fld_22a_AContext *>(_localctx)->fld_22a_A_HContext = fld_22a_A_H(); _localctx->fld.MergeFrom(dynamic_cast<Fld_22a_AContext *>(_localctx)->fld_22a_A_HContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16R_A1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16R_A1Context::Fld_16R_A1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16R_A1Context::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16R_A1Context::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16R_A1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16R_A1; } void SwiftMtParser_MT537Parser::Fld_16R_A1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16R_A1(this); } void SwiftMtParser_MT537Parser::Fld_16R_A1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16R_A1(this); } SwiftMtParser_MT537Parser::Fld_16R_A1Context* SwiftMtParser_MT537Parser::fld_16R_A1() { Fld_16R_A1Context *_localctx = _tracker.createInstance<Fld_16R_A1Context>(_ctx, getState()); enterRule(_localctx, 52, SwiftMtParser_MT537Parser::RuleFld_16R_A1); _localctx->fld.set_tag("16R"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(445); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(446); match(SwiftMtParser_MT537Parser::T__0); setState(448); _errHandler->sync(this); _la = _input->LA(1); do { setState(447); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(450); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_13a_A1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_13a_A1Context::Fld_13a_A1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_13a_A1_AContext* SwiftMtParser_MT537Parser::Fld_13a_A1Context::fld_13a_A1_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_13a_A1_AContext>(0); } SwiftMtParser_MT537Parser::Fld_13a_A1_BContext* SwiftMtParser_MT537Parser::Fld_13a_A1Context::fld_13a_A1_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_13a_A1_BContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_13a_A1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_13a_A1; } void SwiftMtParser_MT537Parser::Fld_13a_A1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_13a_A1(this); } void SwiftMtParser_MT537Parser::Fld_13a_A1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_13a_A1(this); } SwiftMtParser_MT537Parser::Fld_13a_A1Context* SwiftMtParser_MT537Parser::fld_13a_A1() { Fld_13a_A1Context *_localctx = _tracker.createInstance<Fld_13a_A1Context>(_ctx, getState()); enterRule(_localctx, 54, SwiftMtParser_MT537Parser::RuleFld_13a_A1); auto onExit = finally([=] { exitRule(); }); try { setState(458); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 31, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(452); dynamic_cast<Fld_13a_A1Context *>(_localctx)->fld_13a_A1_AContext = fld_13a_A1_A(); _localctx->fld.MergeFrom(dynamic_cast<Fld_13a_A1Context *>(_localctx)->fld_13a_A1_AContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(455); dynamic_cast<Fld_13a_A1Context *>(_localctx)->fld_13a_A1_BContext = fld_13a_A1_B(); _localctx->fld.MergeFrom(dynamic_cast<Fld_13a_A1Context *>(_localctx)->fld_13a_A1_BContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_20C_A1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_20C_A1Context::Fld_20C_A1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_20C_A1_CContext* SwiftMtParser_MT537Parser::Fld_20C_A1Context::fld_20C_A1_C() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_20C_A1_CContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_20C_A1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_20C_A1; } void SwiftMtParser_MT537Parser::Fld_20C_A1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_20C_A1(this); } void SwiftMtParser_MT537Parser::Fld_20C_A1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_20C_A1(this); } SwiftMtParser_MT537Parser::Fld_20C_A1Context* SwiftMtParser_MT537Parser::fld_20C_A1() { Fld_20C_A1Context *_localctx = _tracker.createInstance<Fld_20C_A1Context>(_ctx, getState()); enterRule(_localctx, 56, SwiftMtParser_MT537Parser::RuleFld_20C_A1); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(460); dynamic_cast<Fld_20C_A1Context *>(_localctx)->fld_20C_A1_CContext = fld_20C_A1_C(); _localctx->fld.MergeFrom(dynamic_cast<Fld_20C_A1Context *>(_localctx)->fld_20C_A1_CContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16S_A1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16S_A1Context::Fld_16S_A1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16S_A1Context::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16S_A1Context::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16S_A1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16S_A1; } void SwiftMtParser_MT537Parser::Fld_16S_A1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16S_A1(this); } void SwiftMtParser_MT537Parser::Fld_16S_A1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16S_A1(this); } SwiftMtParser_MT537Parser::Fld_16S_A1Context* SwiftMtParser_MT537Parser::fld_16S_A1() { Fld_16S_A1Context *_localctx = _tracker.createInstance<Fld_16S_A1Context>(_ctx, getState()); enterRule(_localctx, 58, SwiftMtParser_MT537Parser::RuleFld_16S_A1); _localctx->fld.set_tag("16S"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(463); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(464); match(SwiftMtParser_MT537Parser::T__1); setState(466); _errHandler->sync(this); _la = _input->LA(1); do { setState(465); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(468); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_95a_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_95a_AContext::Fld_95a_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_95a_A_LContext* SwiftMtParser_MT537Parser::Fld_95a_AContext::fld_95a_A_L() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_95a_A_LContext>(0); } SwiftMtParser_MT537Parser::Fld_95a_A_PContext* SwiftMtParser_MT537Parser::Fld_95a_AContext::fld_95a_A_P() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_95a_A_PContext>(0); } SwiftMtParser_MT537Parser::Fld_95a_A_RContext* SwiftMtParser_MT537Parser::Fld_95a_AContext::fld_95a_A_R() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_95a_A_RContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_95a_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_95a_A; } void SwiftMtParser_MT537Parser::Fld_95a_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_95a_A(this); } void SwiftMtParser_MT537Parser::Fld_95a_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_95a_A(this); } SwiftMtParser_MT537Parser::Fld_95a_AContext* SwiftMtParser_MT537Parser::fld_95a_A() { Fld_95a_AContext *_localctx = _tracker.createInstance<Fld_95a_AContext>(_ctx, getState()); enterRule(_localctx, 60, SwiftMtParser_MT537Parser::RuleFld_95a_A); auto onExit = finally([=] { exitRule(); }); try { setState(479); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 33, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(470); dynamic_cast<Fld_95a_AContext *>(_localctx)->fld_95a_A_LContext = fld_95a_A_L(); _localctx->fld.MergeFrom(dynamic_cast<Fld_95a_AContext *>(_localctx)->fld_95a_A_LContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(473); dynamic_cast<Fld_95a_AContext *>(_localctx)->fld_95a_A_PContext = fld_95a_A_P(); _localctx->fld.MergeFrom(dynamic_cast<Fld_95a_AContext *>(_localctx)->fld_95a_A_PContext->fld); break; } case 3: { enterOuterAlt(_localctx, 3); setState(476); dynamic_cast<Fld_95a_AContext *>(_localctx)->fld_95a_A_RContext = fld_95a_A_R(); _localctx->fld.MergeFrom(dynamic_cast<Fld_95a_AContext *>(_localctx)->fld_95a_A_RContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_97a_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_97a_AContext::Fld_97a_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_97a_A_AContext* SwiftMtParser_MT537Parser::Fld_97a_AContext::fld_97a_A_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_97a_A_AContext>(0); } SwiftMtParser_MT537Parser::Fld_97a_A_BContext* SwiftMtParser_MT537Parser::Fld_97a_AContext::fld_97a_A_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_97a_A_BContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_97a_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_97a_A; } void SwiftMtParser_MT537Parser::Fld_97a_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_97a_A(this); } void SwiftMtParser_MT537Parser::Fld_97a_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_97a_A(this); } SwiftMtParser_MT537Parser::Fld_97a_AContext* SwiftMtParser_MT537Parser::fld_97a_A() { Fld_97a_AContext *_localctx = _tracker.createInstance<Fld_97a_AContext>(_ctx, getState()); enterRule(_localctx, 62, SwiftMtParser_MT537Parser::RuleFld_97a_A); auto onExit = finally([=] { exitRule(); }); try { setState(487); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 34, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(481); dynamic_cast<Fld_97a_AContext *>(_localctx)->fld_97a_A_AContext = fld_97a_A_A(); _localctx->fld.MergeFrom(dynamic_cast<Fld_97a_AContext *>(_localctx)->fld_97a_A_AContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(484); dynamic_cast<Fld_97a_AContext *>(_localctx)->fld_97a_A_BContext = fld_97a_A_B(); _localctx->fld.MergeFrom(dynamic_cast<Fld_97a_AContext *>(_localctx)->fld_97a_A_BContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_17B_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_17B_AContext::Fld_17B_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_17B_A_BContext* SwiftMtParser_MT537Parser::Fld_17B_AContext::fld_17B_A_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_17B_A_BContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_17B_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_17B_A; } void SwiftMtParser_MT537Parser::Fld_17B_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_17B_A(this); } void SwiftMtParser_MT537Parser::Fld_17B_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_17B_A(this); } SwiftMtParser_MT537Parser::Fld_17B_AContext* SwiftMtParser_MT537Parser::fld_17B_A() { Fld_17B_AContext *_localctx = _tracker.createInstance<Fld_17B_AContext>(_ctx, getState()); enterRule(_localctx, 64, SwiftMtParser_MT537Parser::RuleFld_17B_A); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(489); dynamic_cast<Fld_17B_AContext *>(_localctx)->fld_17B_A_BContext = fld_17B_A_B(); _localctx->fld.MergeFrom(dynamic_cast<Fld_17B_AContext *>(_localctx)->fld_17B_A_BContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16S_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16S_AContext::Fld_16S_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16S_AContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16S_AContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16S_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16S_A; } void SwiftMtParser_MT537Parser::Fld_16S_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16S_A(this); } void SwiftMtParser_MT537Parser::Fld_16S_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16S_A(this); } SwiftMtParser_MT537Parser::Fld_16S_AContext* SwiftMtParser_MT537Parser::fld_16S_A() { Fld_16S_AContext *_localctx = _tracker.createInstance<Fld_16S_AContext>(_ctx, getState()); enterRule(_localctx, 66, SwiftMtParser_MT537Parser::RuleFld_16S_A); _localctx->fld.set_tag("16S"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(492); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(493); match(SwiftMtParser_MT537Parser::T__1); setState(495); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(494); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } break; } default: throw NoViableAltException(this); } setState(497); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 35, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16R_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16R_BContext::Fld_16R_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16R_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16R_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16R_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16R_B; } void SwiftMtParser_MT537Parser::Fld_16R_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16R_B(this); } void SwiftMtParser_MT537Parser::Fld_16R_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16R_B(this); } SwiftMtParser_MT537Parser::Fld_16R_BContext* SwiftMtParser_MT537Parser::fld_16R_B() { Fld_16R_BContext *_localctx = _tracker.createInstance<Fld_16R_BContext>(_ctx, getState()); enterRule(_localctx, 68, SwiftMtParser_MT537Parser::RuleFld_16R_B); _localctx->fld.set_tag("16R"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(499); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(500); match(SwiftMtParser_MT537Parser::T__0); setState(502); _errHandler->sync(this); _la = _input->LA(1); do { setState(501); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(504); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_25D_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_25D_BContext::Fld_25D_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_25D_B_DContext* SwiftMtParser_MT537Parser::Fld_25D_BContext::fld_25D_B_D() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_25D_B_DContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_25D_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_25D_B; } void SwiftMtParser_MT537Parser::Fld_25D_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_25D_B(this); } void SwiftMtParser_MT537Parser::Fld_25D_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_25D_B(this); } SwiftMtParser_MT537Parser::Fld_25D_BContext* SwiftMtParser_MT537Parser::fld_25D_B() { Fld_25D_BContext *_localctx = _tracker.createInstance<Fld_25D_BContext>(_ctx, getState()); enterRule(_localctx, 70, SwiftMtParser_MT537Parser::RuleFld_25D_B); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(506); dynamic_cast<Fld_25D_BContext *>(_localctx)->fld_25D_B_DContext = fld_25D_B_D(); _localctx->fld.MergeFrom(dynamic_cast<Fld_25D_BContext *>(_localctx)->fld_25D_B_DContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16R_B1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16R_B1Context::Fld_16R_B1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16R_B1Context::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16R_B1Context::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16R_B1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16R_B1; } void SwiftMtParser_MT537Parser::Fld_16R_B1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16R_B1(this); } void SwiftMtParser_MT537Parser::Fld_16R_B1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16R_B1(this); } SwiftMtParser_MT537Parser::Fld_16R_B1Context* SwiftMtParser_MT537Parser::fld_16R_B1() { Fld_16R_B1Context *_localctx = _tracker.createInstance<Fld_16R_B1Context>(_ctx, getState()); enterRule(_localctx, 72, SwiftMtParser_MT537Parser::RuleFld_16R_B1); _localctx->fld.set_tag("16R"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(509); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(510); match(SwiftMtParser_MT537Parser::T__0); setState(512); _errHandler->sync(this); _la = _input->LA(1); do { setState(511); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(514); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_24B_B1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_24B_B1Context::Fld_24B_B1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_24B_B1_BContext* SwiftMtParser_MT537Parser::Fld_24B_B1Context::fld_24B_B1_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_24B_B1_BContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_24B_B1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_24B_B1; } void SwiftMtParser_MT537Parser::Fld_24B_B1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_24B_B1(this); } void SwiftMtParser_MT537Parser::Fld_24B_B1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_24B_B1(this); } SwiftMtParser_MT537Parser::Fld_24B_B1Context* SwiftMtParser_MT537Parser::fld_24B_B1() { Fld_24B_B1Context *_localctx = _tracker.createInstance<Fld_24B_B1Context>(_ctx, getState()); enterRule(_localctx, 74, SwiftMtParser_MT537Parser::RuleFld_24B_B1); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(516); dynamic_cast<Fld_24B_B1Context *>(_localctx)->fld_24B_B1_BContext = fld_24B_B1_B(); _localctx->fld.MergeFrom(dynamic_cast<Fld_24B_B1Context *>(_localctx)->fld_24B_B1_BContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_70D_B1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_70D_B1Context::Fld_70D_B1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_70D_B1_DContext* SwiftMtParser_MT537Parser::Fld_70D_B1Context::fld_70D_B1_D() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_70D_B1_DContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_70D_B1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_70D_B1; } void SwiftMtParser_MT537Parser::Fld_70D_B1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_70D_B1(this); } void SwiftMtParser_MT537Parser::Fld_70D_B1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_70D_B1(this); } SwiftMtParser_MT537Parser::Fld_70D_B1Context* SwiftMtParser_MT537Parser::fld_70D_B1() { Fld_70D_B1Context *_localctx = _tracker.createInstance<Fld_70D_B1Context>(_ctx, getState()); enterRule(_localctx, 76, SwiftMtParser_MT537Parser::RuleFld_70D_B1); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(519); dynamic_cast<Fld_70D_B1Context *>(_localctx)->fld_70D_B1_DContext = fld_70D_B1_D(); _localctx->fld.MergeFrom(dynamic_cast<Fld_70D_B1Context *>(_localctx)->fld_70D_B1_DContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16S_B1Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16S_B1Context::Fld_16S_B1Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16S_B1Context::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16S_B1Context::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16S_B1Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16S_B1; } void SwiftMtParser_MT537Parser::Fld_16S_B1Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16S_B1(this); } void SwiftMtParser_MT537Parser::Fld_16S_B1Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16S_B1(this); } SwiftMtParser_MT537Parser::Fld_16S_B1Context* SwiftMtParser_MT537Parser::fld_16S_B1() { Fld_16S_B1Context *_localctx = _tracker.createInstance<Fld_16S_B1Context>(_ctx, getState()); enterRule(_localctx, 78, SwiftMtParser_MT537Parser::RuleFld_16S_B1); _localctx->fld.set_tag("16S"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(522); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(523); match(SwiftMtParser_MT537Parser::T__1); setState(525); _errHandler->sync(this); _la = _input->LA(1); do { setState(524); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(527); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16R_B2Context ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16R_B2Context::Fld_16R_B2Context(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16R_B2Context::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16R_B2Context::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16R_B2Context::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16R_B2; } void SwiftMtParser_MT537Parser::Fld_16R_B2Context::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16R_B2(this); } void SwiftMtParser_MT537Parser::Fld_16R_B2Context::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16R_B2(this); } SwiftMtParser_MT537Parser::Fld_16R_B2Context* SwiftMtParser_MT537Parser::fld_16R_B2() { Fld_16R_B2Context *_localctx = _tracker.createInstance<Fld_16R_B2Context>(_ctx, getState()); enterRule(_localctx, 80, SwiftMtParser_MT537Parser::RuleFld_16R_B2); _localctx->fld.set_tag("16R"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(529); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(530); match(SwiftMtParser_MT537Parser::T__0); setState(532); _errHandler->sync(this); _la = _input->LA(1); do { setState(531); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(534); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16R_B2aContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16R_B2aContext::Fld_16R_B2aContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16R_B2aContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16R_B2aContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16R_B2aContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16R_B2a; } void SwiftMtParser_MT537Parser::Fld_16R_B2aContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16R_B2a(this); } void SwiftMtParser_MT537Parser::Fld_16R_B2aContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16R_B2a(this); } SwiftMtParser_MT537Parser::Fld_16R_B2aContext* SwiftMtParser_MT537Parser::fld_16R_B2a() { Fld_16R_B2aContext *_localctx = _tracker.createInstance<Fld_16R_B2aContext>(_ctx, getState()); enterRule(_localctx, 82, SwiftMtParser_MT537Parser::RuleFld_16R_B2a); _localctx->fld.set_tag("16R"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(536); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(537); match(SwiftMtParser_MT537Parser::T__0); setState(539); _errHandler->sync(this); _la = _input->LA(1); do { setState(538); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(541); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_13a_B2aContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_13a_B2aContext::Fld_13a_B2aContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_13a_B2a_AContext* SwiftMtParser_MT537Parser::Fld_13a_B2aContext::fld_13a_B2a_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_13a_B2a_AContext>(0); } SwiftMtParser_MT537Parser::Fld_13a_B2a_BContext* SwiftMtParser_MT537Parser::Fld_13a_B2aContext::fld_13a_B2a_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_13a_B2a_BContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_13a_B2aContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_13a_B2a; } void SwiftMtParser_MT537Parser::Fld_13a_B2aContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_13a_B2a(this); } void SwiftMtParser_MT537Parser::Fld_13a_B2aContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_13a_B2a(this); } SwiftMtParser_MT537Parser::Fld_13a_B2aContext* SwiftMtParser_MT537Parser::fld_13a_B2a() { Fld_13a_B2aContext *_localctx = _tracker.createInstance<Fld_13a_B2aContext>(_ctx, getState()); enterRule(_localctx, 84, SwiftMtParser_MT537Parser::RuleFld_13a_B2a); auto onExit = finally([=] { exitRule(); }); try { setState(549); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 41, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(543); dynamic_cast<Fld_13a_B2aContext *>(_localctx)->fld_13a_B2a_AContext = fld_13a_B2a_A(); _localctx->fld.MergeFrom(dynamic_cast<Fld_13a_B2aContext *>(_localctx)->fld_13a_B2a_AContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(546); dynamic_cast<Fld_13a_B2aContext *>(_localctx)->fld_13a_B2a_BContext = fld_13a_B2a_B(); _localctx->fld.MergeFrom(dynamic_cast<Fld_13a_B2aContext *>(_localctx)->fld_13a_B2a_BContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_20C_B2aContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_20C_B2aContext::Fld_20C_B2aContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_20C_B2a_CContext* SwiftMtParser_MT537Parser::Fld_20C_B2aContext::fld_20C_B2a_C() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_20C_B2a_CContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_20C_B2aContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_20C_B2a; } void SwiftMtParser_MT537Parser::Fld_20C_B2aContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_20C_B2a(this); } void SwiftMtParser_MT537Parser::Fld_20C_B2aContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_20C_B2a(this); } SwiftMtParser_MT537Parser::Fld_20C_B2aContext* SwiftMtParser_MT537Parser::fld_20C_B2a() { Fld_20C_B2aContext *_localctx = _tracker.createInstance<Fld_20C_B2aContext>(_ctx, getState()); enterRule(_localctx, 86, SwiftMtParser_MT537Parser::RuleFld_20C_B2a); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(551); dynamic_cast<Fld_20C_B2aContext *>(_localctx)->fld_20C_B2a_CContext = fld_20C_B2a_C(); _localctx->fld.MergeFrom(dynamic_cast<Fld_20C_B2aContext *>(_localctx)->fld_20C_B2a_CContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16S_B2aContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16S_B2aContext::Fld_16S_B2aContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16S_B2aContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16S_B2aContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16S_B2aContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16S_B2a; } void SwiftMtParser_MT537Parser::Fld_16S_B2aContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16S_B2a(this); } void SwiftMtParser_MT537Parser::Fld_16S_B2aContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16S_B2a(this); } SwiftMtParser_MT537Parser::Fld_16S_B2aContext* SwiftMtParser_MT537Parser::fld_16S_B2a() { Fld_16S_B2aContext *_localctx = _tracker.createInstance<Fld_16S_B2aContext>(_ctx, getState()); enterRule(_localctx, 88, SwiftMtParser_MT537Parser::RuleFld_16S_B2a); _localctx->fld.set_tag("16S"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(554); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(555); match(SwiftMtParser_MT537Parser::T__1); setState(557); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(556); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } break; } default: throw NoViableAltException(this); } setState(559); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 42, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_16R_B2bContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_16R_B2bContext::Fld_16R_B2bContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_16R_B2bContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_16R_B2bContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_16R_B2bContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_16R_B2b; } void SwiftMtParser_MT537Parser::Fld_16R_B2bContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_16R_B2b(this); } void SwiftMtParser_MT537Parser::Fld_16R_B2bContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_16R_B2b(this); } SwiftMtParser_MT537Parser::Fld_16R_B2bContext* SwiftMtParser_MT537Parser::fld_16R_B2b() { Fld_16R_B2bContext *_localctx = _tracker.createInstance<Fld_16R_B2bContext>(_ctx, getState()); enterRule(_localctx, 90, SwiftMtParser_MT537Parser::RuleFld_16R_B2b); _localctx->fld.set_tag("16R"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(561); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(562); match(SwiftMtParser_MT537Parser::T__0); setState(564); _errHandler->sync(this); _la = _input->LA(1); do { setState(563); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(566); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_94a_B2bContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_94a_B2bContext::Fld_94a_B2bContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_94a_B2b_BContext* SwiftMtParser_MT537Parser::Fld_94a_B2bContext::fld_94a_B2b_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_94a_B2b_BContext>(0); } SwiftMtParser_MT537Parser::Fld_94a_B2b_CContext* SwiftMtParser_MT537Parser::Fld_94a_B2bContext::fld_94a_B2b_C() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_94a_B2b_CContext>(0); } SwiftMtParser_MT537Parser::Fld_94a_B2b_FContext* SwiftMtParser_MT537Parser::Fld_94a_B2bContext::fld_94a_B2b_F() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_94a_B2b_FContext>(0); } SwiftMtParser_MT537Parser::Fld_94a_B2b_HContext* SwiftMtParser_MT537Parser::Fld_94a_B2bContext::fld_94a_B2b_H() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_94a_B2b_HContext>(0); } SwiftMtParser_MT537Parser::Fld_94a_B2b_LContext* SwiftMtParser_MT537Parser::Fld_94a_B2bContext::fld_94a_B2b_L() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_94a_B2b_LContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_94a_B2bContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_94a_B2b; } void SwiftMtParser_MT537Parser::Fld_94a_B2bContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_94a_B2b(this); } void SwiftMtParser_MT537Parser::Fld_94a_B2bContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_94a_B2b(this); } SwiftMtParser_MT537Parser::Fld_94a_B2bContext* SwiftMtParser_MT537Parser::fld_94a_B2b() { Fld_94a_B2bContext *_localctx = _tracker.createInstance<Fld_94a_B2bContext>(_ctx, getState()); enterRule(_localctx, 92, SwiftMtParser_MT537Parser::RuleFld_94a_B2b); auto onExit = finally([=] { exitRule(); }); try { setState(583); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 44, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(568); dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_BContext = fld_94a_B2b_B(); _localctx->fld.MergeFrom(dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_BContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(571); dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_CContext = fld_94a_B2b_C(); _localctx->fld.MergeFrom(dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_CContext->fld); break; } case 3: { enterOuterAlt(_localctx, 3); setState(574); dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_FContext = fld_94a_B2b_F(); _localctx->fld.MergeFrom(dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_FContext->fld); break; } case 4: { enterOuterAlt(_localctx, 4); setState(577); dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_HContext = fld_94a_B2b_H(); _localctx->fld.MergeFrom(dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_HContext->fld); break; } case 5: { enterOuterAlt(_localctx, 5); setState(580); dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_LContext = fld_94a_B2b_L(); _localctx->fld.MergeFrom(dynamic_cast<Fld_94a_B2bContext *>(_localctx)->fld_94a_B2b_LContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_35B_B2bContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_35B_B2bContext::Fld_35B_B2bContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_35B_B2b_BContext* SwiftMtParser_MT537Parser::Fld_35B_B2bContext::fld_35B_B2b_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_35B_B2b_BContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_35B_B2bContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_35B_B2b; } void SwiftMtParser_MT537Parser::Fld_35B_B2bContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_35B_B2b(this); } void SwiftMtParser_MT537Parser::Fld_35B_B2bContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_35B_B2b(this); } SwiftMtParser_MT537Parser::Fld_35B_B2bContext* SwiftMtParser_MT537Parser::fld_35B_B2b() { Fld_35B_B2bContext *_localctx = _tracker.createInstance<Fld_35B_B2bContext>(_ctx, getState()); enterRule(_localctx, 94, SwiftMtParser_MT537Parser::RuleFld_35B_B2b); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(585); dynamic_cast<Fld_35B_B2bContext *>(_localctx)->fld_35B_B2b_BContext = fld_35B_B2b_B(); _localctx->fld.MergeFrom(dynamic_cast<Fld_35B_B2bContext *>(_localctx)->fld_35B_B2b_BContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_36B_B2bContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_36B_B2bContext::Fld_36B_B2bContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_36B_B2b_BContext* SwiftMtParser_MT537Parser::Fld_36B_B2bContext::fld_36B_B2b_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_36B_B2b_BContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_36B_B2bContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_36B_B2b; } void SwiftMtParser_MT537Parser::Fld_36B_B2bContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_36B_B2b(this); } void SwiftMtParser_MT537Parser::Fld_36B_B2bContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_36B_B2b(this); } SwiftMtParser_MT537Parser::Fld_36B_B2bContext* SwiftMtParser_MT537Parser::fld_36B_B2b() { Fld_36B_B2bContext *_localctx = _tracker.createInstance<Fld_36B_B2bContext>(_ctx, getState()); enterRule(_localctx, 96, SwiftMtParser_MT537Parser::RuleFld_36B_B2b); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(588); dynamic_cast<Fld_36B_B2bContext *>(_localctx)->fld_36B_B2b_BContext = fld_36B_B2b_B(); _localctx->fld.MergeFrom(dynamic_cast<Fld_36B_B2bContext *>(_localctx)->fld_36B_B2b_BContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_19A_B2bContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_19A_B2bContext::Fld_19A_B2bContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_19A_B2b_AContext* SwiftMtParser_MT537Parser::Fld_19A_B2bContext::fld_19A_B2b_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_19A_B2b_AContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_19A_B2bContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_19A_B2b; } void SwiftMtParser_MT537Parser::Fld_19A_B2bContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_19A_B2b(this); } void SwiftMtParser_MT537Parser::Fld_19A_B2bContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_19A_B2b(this); } SwiftMtParser_MT537Parser::Fld_19A_B2bContext* SwiftMtParser_MT537Parser::fld_19A_B2b() { Fld_19A_B2bContext *_localctx = _tracker.createInstance<Fld_19A_B2bContext>(_ctx, getState()); enterRule(_localctx, 98, SwiftMtParser_MT537Parser::RuleFld_19A_B2b); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(591); dynamic_cast<Fld_19A_B2bContext *>(_localctx)->fld_19A_B2b_AContext = fld_19A_B2b_A(); _localctx->fld.MergeFrom(dynamic_cast<Fld_19A_B2bContext *>(_localctx)->fld_19A_B2b_AContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_22a_B2bContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_22a_B2bContext::Fld_22a_B2bContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_22a_B2b_FContext* SwiftMtParser_MT537Parser::Fld_22a_B2bContext::fld_22a_B2b_F() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_22a_B2b_FContext>(0); } SwiftMtParser_MT537Parser::Fld_22a_B2b_HContext* SwiftMtParser_MT537Parser::Fld_22a_B2bContext::fld_22a_B2b_H() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_22a_B2b_HContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_22a_B2bContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_22a_B2b; } void SwiftMtParser_MT537Parser::Fld_22a_B2bContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_22a_B2b(this); } void SwiftMtParser_MT537Parser::Fld_22a_B2bContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_22a_B2b(this); } SwiftMtParser_MT537Parser::Fld_22a_B2bContext* SwiftMtParser_MT537Parser::fld_22a_B2b() { Fld_22a_B2bContext *_localctx = _tracker.createInstance<Fld_22a_B2bContext>(_ctx, getState()); enterRule(_localctx, 100, SwiftMtParser_MT537Parser::RuleFld_22a_B2b); auto onExit = finally([=] { exitRule(); }); try { setState(600); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 45, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(594); dynamic_cast<Fld_22a_B2bContext *>(_localctx)->fld_22a_B2b_FContext = fld_22a_B2b_F(); _localctx->fld.MergeFrom(dynamic_cast<Fld_22a_B2bContext *>(_localctx)->fld_22a_B2b_FContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(597); dynamic_cast<Fld_22a_B2bContext *>(_localctx)->fld_22a_B2b_HContext = fld_22a_B2b_H(); _localctx->fld.MergeFrom(dynamic_cast<Fld_22a_B2bContext *>(_localctx)->fld_22a_B2b_HContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_98a_B2bContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_98a_B2bContext::Fld_98a_B2bContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_98a_B2b_AContext* SwiftMtParser_MT537Parser::Fld_98a_B2bContext::fld_98a_B2b_A() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_98a_B2b_AContext>(0); } SwiftMtParser_MT537Parser::Fld_98a_B2b_BContext* SwiftMtParser_MT537Parser::Fld_98a_B2bContext::fld_98a_B2b_B() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_98a_B2b_BContext>(0); } SwiftMtParser_MT537Parser::Fld_98a_B2b_CContext* SwiftMtParser_MT537Parser::Fld_98a_B2bContext::fld_98a_B2b_C() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_98a_B2b_CContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_98a_B2bContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_98a_B2b; } void SwiftMtParser_MT537Parser::Fld_98a_B2bContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_98a_B2b(this); } void SwiftMtParser_MT537Parser::Fld_98a_B2bContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_98a_B2b(this); } SwiftMtParser_MT537Parser::Fld_98a_B2bContext* SwiftMtParser_MT537Parser::fld_98a_B2b() { Fld_98a_B2bContext *_localctx = _tracker.createInstance<Fld_98a_B2bContext>(_ctx, getState()); enterRule(_localctx, 102, SwiftMtParser_MT537Parser::RuleFld_98a_B2b); auto onExit = finally([=] { exitRule(); }); try { setState(611); _errHandler->sync(this); switch (getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 46, _ctx)) { case 1: { enterOuterAlt(_localctx, 1); setState(602); dynamic_cast<Fld_98a_B2bContext *>(_localctx)->fld_98a_B2b_AContext = fld_98a_B2b_A(); _localctx->fld.MergeFrom(dynamic_cast<Fld_98a_B2bContext *>(_localctx)->fld_98a_B2b_AContext->fld); break; } case 2: { enterOuterAlt(_localctx, 2); setState(605); dynamic_cast<Fld_98a_B2bContext *>(_localctx)->fld_98a_B2b_BContext = fld_98a_B2b_B(); _localctx->fld.MergeFrom(dynamic_cast<Fld_98a_B2bContext *>(_localctx)->fld_98a_B2b_BContext->fld); break; } case 3: { enterOuterAlt(_localctx, 3); setState(608); dynamic_cast<Fld_98a_B2bContext *>(_localctx)->fld_98a_B2b_CContext = fld_98a_B2b_C(); _localctx->fld.MergeFrom(dynamic_cast<Fld_98a_B2bContext *>(_localctx)->fld_98a_B2b_CContext->fld); break; } } } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_70E_B2bContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_70E_B2bContext::Fld_70E_B2bContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } SwiftMtParser_MT537Parser::Fld_70E_B2b_EContext* SwiftMtParser_MT537Parser::Fld_70E_B2bContext::fld_70E_B2b_E() { return getRuleContext<SwiftMtParser_MT537Parser::Fld_70E_B2b_EContext>(0); } size_t SwiftMtParser_MT537Parser::Fld_70E_B2bContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_70E_B2b; } void SwiftMtParser_MT537Parser::Fld_70E_B2bContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_70E_B2b(this); } void SwiftMtParser_MT537Parser::Fld_70E_B2bContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_70E_B2b(this); } SwiftMtParser_MT537Parser::Fld_70E_B2bContext* SwiftMtParser_MT537Parser::fld_70E_B2b() { Fld_70E_B2bContext *_localctx = _tracker.createInstance<Fld_70E_B2bContext>(_ctx, getState()); enterRule(_localctx, 104, SwiftMtParser_MT537Parser::RuleFld_70E_B2b); auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(613); dynamic_cast<Fld_70E_B2bContext *>(_localctx)->fld_70E_B2b_EContext = fld_70E_B2b_E(); _localctx->fld.MergeFrom(dynamic_cast<Fld_70E_B2bContext *>(_localctx)->fld_70E_B2b_EContext->fld); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_28E_A_EContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_28E_A_EContext::Fld_28E_A_EContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_28E_A_EContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_28E_A_EContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_28E_A_EContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_28E_A_E; } void SwiftMtParser_MT537Parser::Fld_28E_A_EContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_28E_A_E(this); } void SwiftMtParser_MT537Parser::Fld_28E_A_EContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_28E_A_E(this); } SwiftMtParser_MT537Parser::Fld_28E_A_EContext* SwiftMtParser_MT537Parser::fld_28E_A_E() { Fld_28E_A_EContext *_localctx = _tracker.createInstance<Fld_28E_A_EContext>(_ctx, getState()); enterRule(_localctx, 106, SwiftMtParser_MT537Parser::RuleFld_28E_A_E); _localctx->fld.set_tag("28E"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(616); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(617); match(SwiftMtParser_MT537Parser::T__2); setState(619); _errHandler->sync(this); _la = _input->LA(1); do { setState(618); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(621); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_13a_A_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_13a_A_AContext::Fld_13a_A_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_13a_A_AContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_13a_A_AContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_13a_A_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_13a_A_A; } void SwiftMtParser_MT537Parser::Fld_13a_A_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_13a_A_A(this); } void SwiftMtParser_MT537Parser::Fld_13a_A_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_13a_A_A(this); } SwiftMtParser_MT537Parser::Fld_13a_A_AContext* SwiftMtParser_MT537Parser::fld_13a_A_A() { Fld_13a_A_AContext *_localctx = _tracker.createInstance<Fld_13a_A_AContext>(_ctx, getState()); enterRule(_localctx, 108, SwiftMtParser_MT537Parser::RuleFld_13a_A_A); _localctx->fld.set_tag("13A"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(623); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(624); match(SwiftMtParser_MT537Parser::T__3); setState(626); _errHandler->sync(this); _la = _input->LA(1); do { setState(625); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(628); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_13a_A_JContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_13a_A_JContext::Fld_13a_A_JContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_13a_A_JContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_13a_A_JContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_13a_A_JContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_13a_A_J; } void SwiftMtParser_MT537Parser::Fld_13a_A_JContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_13a_A_J(this); } void SwiftMtParser_MT537Parser::Fld_13a_A_JContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_13a_A_J(this); } SwiftMtParser_MT537Parser::Fld_13a_A_JContext* SwiftMtParser_MT537Parser::fld_13a_A_J() { Fld_13a_A_JContext *_localctx = _tracker.createInstance<Fld_13a_A_JContext>(_ctx, getState()); enterRule(_localctx, 110, SwiftMtParser_MT537Parser::RuleFld_13a_A_J); _localctx->fld.set_tag("13J"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(630); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(631); match(SwiftMtParser_MT537Parser::T__4); setState(633); _errHandler->sync(this); _la = _input->LA(1); do { setState(632); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(635); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_20C_A_CContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_20C_A_CContext::Fld_20C_A_CContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_20C_A_CContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_20C_A_CContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_20C_A_CContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_20C_A_C; } void SwiftMtParser_MT537Parser::Fld_20C_A_CContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_20C_A_C(this); } void SwiftMtParser_MT537Parser::Fld_20C_A_CContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_20C_A_C(this); } SwiftMtParser_MT537Parser::Fld_20C_A_CContext* SwiftMtParser_MT537Parser::fld_20C_A_C() { Fld_20C_A_CContext *_localctx = _tracker.createInstance<Fld_20C_A_CContext>(_ctx, getState()); enterRule(_localctx, 112, SwiftMtParser_MT537Parser::RuleFld_20C_A_C); _localctx->fld.set_tag("20C"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(637); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(638); match(SwiftMtParser_MT537Parser::T__5); setState(640); _errHandler->sync(this); _la = _input->LA(1); do { setState(639); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(642); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_23G_A_GContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_23G_A_GContext::Fld_23G_A_GContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_23G_A_GContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_23G_A_GContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_23G_A_GContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_23G_A_G; } void SwiftMtParser_MT537Parser::Fld_23G_A_GContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_23G_A_G(this); } void SwiftMtParser_MT537Parser::Fld_23G_A_GContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_23G_A_G(this); } SwiftMtParser_MT537Parser::Fld_23G_A_GContext* SwiftMtParser_MT537Parser::fld_23G_A_G() { Fld_23G_A_GContext *_localctx = _tracker.createInstance<Fld_23G_A_GContext>(_ctx, getState()); enterRule(_localctx, 114, SwiftMtParser_MT537Parser::RuleFld_23G_A_G); _localctx->fld.set_tag("23G"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(644); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(645); match(SwiftMtParser_MT537Parser::T__6); setState(647); _errHandler->sync(this); _la = _input->LA(1); do { setState(646); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(649); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_98a_A_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_98a_A_AContext::Fld_98a_A_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_98a_A_AContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_98a_A_AContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_98a_A_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_98a_A_A; } void SwiftMtParser_MT537Parser::Fld_98a_A_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_98a_A_A(this); } void SwiftMtParser_MT537Parser::Fld_98a_A_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_98a_A_A(this); } SwiftMtParser_MT537Parser::Fld_98a_A_AContext* SwiftMtParser_MT537Parser::fld_98a_A_A() { Fld_98a_A_AContext *_localctx = _tracker.createInstance<Fld_98a_A_AContext>(_ctx, getState()); enterRule(_localctx, 116, SwiftMtParser_MT537Parser::RuleFld_98a_A_A); _localctx->fld.set_tag("98A"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(651); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(652); match(SwiftMtParser_MT537Parser::T__7); setState(654); _errHandler->sync(this); _la = _input->LA(1); do { setState(653); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(656); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_98a_A_CContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_98a_A_CContext::Fld_98a_A_CContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_98a_A_CContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_98a_A_CContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_98a_A_CContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_98a_A_C; } void SwiftMtParser_MT537Parser::Fld_98a_A_CContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_98a_A_C(this); } void SwiftMtParser_MT537Parser::Fld_98a_A_CContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_98a_A_C(this); } SwiftMtParser_MT537Parser::Fld_98a_A_CContext* SwiftMtParser_MT537Parser::fld_98a_A_C() { Fld_98a_A_CContext *_localctx = _tracker.createInstance<Fld_98a_A_CContext>(_ctx, getState()); enterRule(_localctx, 118, SwiftMtParser_MT537Parser::RuleFld_98a_A_C); _localctx->fld.set_tag("98C"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(658); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(659); match(SwiftMtParser_MT537Parser::T__8); setState(661); _errHandler->sync(this); _la = _input->LA(1); do { setState(660); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(663); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_98a_A_EContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_98a_A_EContext::Fld_98a_A_EContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_98a_A_EContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_98a_A_EContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_98a_A_EContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_98a_A_E; } void SwiftMtParser_MT537Parser::Fld_98a_A_EContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_98a_A_E(this); } void SwiftMtParser_MT537Parser::Fld_98a_A_EContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_98a_A_E(this); } SwiftMtParser_MT537Parser::Fld_98a_A_EContext* SwiftMtParser_MT537Parser::fld_98a_A_E() { Fld_98a_A_EContext *_localctx = _tracker.createInstance<Fld_98a_A_EContext>(_ctx, getState()); enterRule(_localctx, 120, SwiftMtParser_MT537Parser::RuleFld_98a_A_E); _localctx->fld.set_tag("98E"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(665); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(666); match(SwiftMtParser_MT537Parser::T__9); setState(668); _errHandler->sync(this); _la = _input->LA(1); do { setState(667); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(670); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_22a_A_FContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_22a_A_FContext::Fld_22a_A_FContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_22a_A_FContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_22a_A_FContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_22a_A_FContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_22a_A_F; } void SwiftMtParser_MT537Parser::Fld_22a_A_FContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_22a_A_F(this); } void SwiftMtParser_MT537Parser::Fld_22a_A_FContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_22a_A_F(this); } SwiftMtParser_MT537Parser::Fld_22a_A_FContext* SwiftMtParser_MT537Parser::fld_22a_A_F() { Fld_22a_A_FContext *_localctx = _tracker.createInstance<Fld_22a_A_FContext>(_ctx, getState()); enterRule(_localctx, 122, SwiftMtParser_MT537Parser::RuleFld_22a_A_F); _localctx->fld.set_tag("22F"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(672); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(673); match(SwiftMtParser_MT537Parser::T__10); setState(675); _errHandler->sync(this); _la = _input->LA(1); do { setState(674); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(677); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_22a_A_HContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_22a_A_HContext::Fld_22a_A_HContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_22a_A_HContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_22a_A_HContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_22a_A_HContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_22a_A_H; } void SwiftMtParser_MT537Parser::Fld_22a_A_HContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_22a_A_H(this); } void SwiftMtParser_MT537Parser::Fld_22a_A_HContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_22a_A_H(this); } SwiftMtParser_MT537Parser::Fld_22a_A_HContext* SwiftMtParser_MT537Parser::fld_22a_A_H() { Fld_22a_A_HContext *_localctx = _tracker.createInstance<Fld_22a_A_HContext>(_ctx, getState()); enterRule(_localctx, 124, SwiftMtParser_MT537Parser::RuleFld_22a_A_H); _localctx->fld.set_tag("22H"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(679); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(680); match(SwiftMtParser_MT537Parser::T__11); setState(682); _errHandler->sync(this); _la = _input->LA(1); do { setState(681); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(684); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_13a_A1_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_13a_A1_AContext::Fld_13a_A1_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_13a_A1_AContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_13a_A1_AContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_13a_A1_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_13a_A1_A; } void SwiftMtParser_MT537Parser::Fld_13a_A1_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_13a_A1_A(this); } void SwiftMtParser_MT537Parser::Fld_13a_A1_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_13a_A1_A(this); } SwiftMtParser_MT537Parser::Fld_13a_A1_AContext* SwiftMtParser_MT537Parser::fld_13a_A1_A() { Fld_13a_A1_AContext *_localctx = _tracker.createInstance<Fld_13a_A1_AContext>(_ctx, getState()); enterRule(_localctx, 126, SwiftMtParser_MT537Parser::RuleFld_13a_A1_A); _localctx->fld.set_tag("13A"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(686); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(687); match(SwiftMtParser_MT537Parser::T__3); setState(689); _errHandler->sync(this); _la = _input->LA(1); do { setState(688); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(691); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_13a_A1_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_13a_A1_BContext::Fld_13a_A1_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_13a_A1_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_13a_A1_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_13a_A1_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_13a_A1_B; } void SwiftMtParser_MT537Parser::Fld_13a_A1_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_13a_A1_B(this); } void SwiftMtParser_MT537Parser::Fld_13a_A1_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_13a_A1_B(this); } SwiftMtParser_MT537Parser::Fld_13a_A1_BContext* SwiftMtParser_MT537Parser::fld_13a_A1_B() { Fld_13a_A1_BContext *_localctx = _tracker.createInstance<Fld_13a_A1_BContext>(_ctx, getState()); enterRule(_localctx, 128, SwiftMtParser_MT537Parser::RuleFld_13a_A1_B); _localctx->fld.set_tag("13B"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(693); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(694); match(SwiftMtParser_MT537Parser::T__12); setState(696); _errHandler->sync(this); _la = _input->LA(1); do { setState(695); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(698); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_20C_A1_CContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_20C_A1_CContext::Fld_20C_A1_CContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_20C_A1_CContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_20C_A1_CContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_20C_A1_CContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_20C_A1_C; } void SwiftMtParser_MT537Parser::Fld_20C_A1_CContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_20C_A1_C(this); } void SwiftMtParser_MT537Parser::Fld_20C_A1_CContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_20C_A1_C(this); } SwiftMtParser_MT537Parser::Fld_20C_A1_CContext* SwiftMtParser_MT537Parser::fld_20C_A1_C() { Fld_20C_A1_CContext *_localctx = _tracker.createInstance<Fld_20C_A1_CContext>(_ctx, getState()); enterRule(_localctx, 130, SwiftMtParser_MT537Parser::RuleFld_20C_A1_C); _localctx->fld.set_tag("20C"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(700); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(701); match(SwiftMtParser_MT537Parser::T__5); setState(703); _errHandler->sync(this); _la = _input->LA(1); do { setState(702); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(705); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_95a_A_LContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_95a_A_LContext::Fld_95a_A_LContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_95a_A_LContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_95a_A_LContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_95a_A_LContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_95a_A_L; } void SwiftMtParser_MT537Parser::Fld_95a_A_LContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_95a_A_L(this); } void SwiftMtParser_MT537Parser::Fld_95a_A_LContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_95a_A_L(this); } SwiftMtParser_MT537Parser::Fld_95a_A_LContext* SwiftMtParser_MT537Parser::fld_95a_A_L() { Fld_95a_A_LContext *_localctx = _tracker.createInstance<Fld_95a_A_LContext>(_ctx, getState()); enterRule(_localctx, 132, SwiftMtParser_MT537Parser::RuleFld_95a_A_L); _localctx->fld.set_tag("95L"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(707); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(708); match(SwiftMtParser_MT537Parser::T__13); setState(710); _errHandler->sync(this); _la = _input->LA(1); do { setState(709); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(712); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_95a_A_PContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_95a_A_PContext::Fld_95a_A_PContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_95a_A_PContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_95a_A_PContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_95a_A_PContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_95a_A_P; } void SwiftMtParser_MT537Parser::Fld_95a_A_PContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_95a_A_P(this); } void SwiftMtParser_MT537Parser::Fld_95a_A_PContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_95a_A_P(this); } SwiftMtParser_MT537Parser::Fld_95a_A_PContext* SwiftMtParser_MT537Parser::fld_95a_A_P() { Fld_95a_A_PContext *_localctx = _tracker.createInstance<Fld_95a_A_PContext>(_ctx, getState()); enterRule(_localctx, 134, SwiftMtParser_MT537Parser::RuleFld_95a_A_P); _localctx->fld.set_tag("95P"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(714); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(715); match(SwiftMtParser_MT537Parser::T__14); setState(717); _errHandler->sync(this); _la = _input->LA(1); do { setState(716); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(719); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_95a_A_RContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_95a_A_RContext::Fld_95a_A_RContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_95a_A_RContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_95a_A_RContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_95a_A_RContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_95a_A_R; } void SwiftMtParser_MT537Parser::Fld_95a_A_RContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_95a_A_R(this); } void SwiftMtParser_MT537Parser::Fld_95a_A_RContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_95a_A_R(this); } SwiftMtParser_MT537Parser::Fld_95a_A_RContext* SwiftMtParser_MT537Parser::fld_95a_A_R() { Fld_95a_A_RContext *_localctx = _tracker.createInstance<Fld_95a_A_RContext>(_ctx, getState()); enterRule(_localctx, 136, SwiftMtParser_MT537Parser::RuleFld_95a_A_R); _localctx->fld.set_tag("95R"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(721); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(722); match(SwiftMtParser_MT537Parser::T__15); setState(724); _errHandler->sync(this); _la = _input->LA(1); do { setState(723); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(726); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_97a_A_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_97a_A_AContext::Fld_97a_A_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_97a_A_AContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_97a_A_AContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_97a_A_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_97a_A_A; } void SwiftMtParser_MT537Parser::Fld_97a_A_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_97a_A_A(this); } void SwiftMtParser_MT537Parser::Fld_97a_A_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_97a_A_A(this); } SwiftMtParser_MT537Parser::Fld_97a_A_AContext* SwiftMtParser_MT537Parser::fld_97a_A_A() { Fld_97a_A_AContext *_localctx = _tracker.createInstance<Fld_97a_A_AContext>(_ctx, getState()); enterRule(_localctx, 138, SwiftMtParser_MT537Parser::RuleFld_97a_A_A); _localctx->fld.set_tag("97A"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(728); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(729); match(SwiftMtParser_MT537Parser::T__16); setState(731); _errHandler->sync(this); _la = _input->LA(1); do { setState(730); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(733); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_97a_A_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_97a_A_BContext::Fld_97a_A_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_97a_A_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_97a_A_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_97a_A_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_97a_A_B; } void SwiftMtParser_MT537Parser::Fld_97a_A_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_97a_A_B(this); } void SwiftMtParser_MT537Parser::Fld_97a_A_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_97a_A_B(this); } SwiftMtParser_MT537Parser::Fld_97a_A_BContext* SwiftMtParser_MT537Parser::fld_97a_A_B() { Fld_97a_A_BContext *_localctx = _tracker.createInstance<Fld_97a_A_BContext>(_ctx, getState()); enterRule(_localctx, 140, SwiftMtParser_MT537Parser::RuleFld_97a_A_B); _localctx->fld.set_tag("97B"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(735); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(736); match(SwiftMtParser_MT537Parser::T__17); setState(738); _errHandler->sync(this); _la = _input->LA(1); do { setState(737); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(740); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_17B_A_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_17B_A_BContext::Fld_17B_A_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_17B_A_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_17B_A_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_17B_A_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_17B_A_B; } void SwiftMtParser_MT537Parser::Fld_17B_A_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_17B_A_B(this); } void SwiftMtParser_MT537Parser::Fld_17B_A_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_17B_A_B(this); } SwiftMtParser_MT537Parser::Fld_17B_A_BContext* SwiftMtParser_MT537Parser::fld_17B_A_B() { Fld_17B_A_BContext *_localctx = _tracker.createInstance<Fld_17B_A_BContext>(_ctx, getState()); enterRule(_localctx, 142, SwiftMtParser_MT537Parser::RuleFld_17B_A_B); _localctx->fld.set_tag("17B"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(742); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(743); match(SwiftMtParser_MT537Parser::T__18); setState(745); _errHandler->sync(this); _la = _input->LA(1); do { setState(744); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(747); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_25D_B_DContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_25D_B_DContext::Fld_25D_B_DContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_25D_B_DContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_25D_B_DContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_25D_B_DContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_25D_B_D; } void SwiftMtParser_MT537Parser::Fld_25D_B_DContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_25D_B_D(this); } void SwiftMtParser_MT537Parser::Fld_25D_B_DContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_25D_B_D(this); } SwiftMtParser_MT537Parser::Fld_25D_B_DContext* SwiftMtParser_MT537Parser::fld_25D_B_D() { Fld_25D_B_DContext *_localctx = _tracker.createInstance<Fld_25D_B_DContext>(_ctx, getState()); enterRule(_localctx, 144, SwiftMtParser_MT537Parser::RuleFld_25D_B_D); _localctx->fld.set_tag("25D"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(749); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(750); match(SwiftMtParser_MT537Parser::T__19); setState(752); _errHandler->sync(this); _la = _input->LA(1); do { setState(751); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(754); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_24B_B1_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_24B_B1_BContext::Fld_24B_B1_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_24B_B1_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_24B_B1_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_24B_B1_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_24B_B1_B; } void SwiftMtParser_MT537Parser::Fld_24B_B1_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_24B_B1_B(this); } void SwiftMtParser_MT537Parser::Fld_24B_B1_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_24B_B1_B(this); } SwiftMtParser_MT537Parser::Fld_24B_B1_BContext* SwiftMtParser_MT537Parser::fld_24B_B1_B() { Fld_24B_B1_BContext *_localctx = _tracker.createInstance<Fld_24B_B1_BContext>(_ctx, getState()); enterRule(_localctx, 146, SwiftMtParser_MT537Parser::RuleFld_24B_B1_B); _localctx->fld.set_tag("24B"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(756); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(757); match(SwiftMtParser_MT537Parser::T__20); setState(759); _errHandler->sync(this); _la = _input->LA(1); do { setState(758); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(761); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_70D_B1_DContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_70D_B1_DContext::Fld_70D_B1_DContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_70D_B1_DContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_70D_B1_DContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_70D_B1_DContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_70D_B1_D; } void SwiftMtParser_MT537Parser::Fld_70D_B1_DContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_70D_B1_D(this); } void SwiftMtParser_MT537Parser::Fld_70D_B1_DContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_70D_B1_D(this); } SwiftMtParser_MT537Parser::Fld_70D_B1_DContext* SwiftMtParser_MT537Parser::fld_70D_B1_D() { Fld_70D_B1_DContext *_localctx = _tracker.createInstance<Fld_70D_B1_DContext>(_ctx, getState()); enterRule(_localctx, 148, SwiftMtParser_MT537Parser::RuleFld_70D_B1_D); _localctx->fld.set_tag("70D"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(763); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(764); match(SwiftMtParser_MT537Parser::T__21); setState(766); _errHandler->sync(this); _la = _input->LA(1); do { setState(765); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(768); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_13a_B2a_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_13a_B2a_AContext::Fld_13a_B2a_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_13a_B2a_AContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_13a_B2a_AContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_13a_B2a_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_13a_B2a_A; } void SwiftMtParser_MT537Parser::Fld_13a_B2a_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_13a_B2a_A(this); } void SwiftMtParser_MT537Parser::Fld_13a_B2a_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_13a_B2a_A(this); } SwiftMtParser_MT537Parser::Fld_13a_B2a_AContext* SwiftMtParser_MT537Parser::fld_13a_B2a_A() { Fld_13a_B2a_AContext *_localctx = _tracker.createInstance<Fld_13a_B2a_AContext>(_ctx, getState()); enterRule(_localctx, 150, SwiftMtParser_MT537Parser::RuleFld_13a_B2a_A); _localctx->fld.set_tag("13A"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(770); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(771); match(SwiftMtParser_MT537Parser::T__3); setState(773); _errHandler->sync(this); _la = _input->LA(1); do { setState(772); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(775); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_13a_B2a_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_13a_B2a_BContext::Fld_13a_B2a_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_13a_B2a_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_13a_B2a_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_13a_B2a_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_13a_B2a_B; } void SwiftMtParser_MT537Parser::Fld_13a_B2a_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_13a_B2a_B(this); } void SwiftMtParser_MT537Parser::Fld_13a_B2a_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_13a_B2a_B(this); } SwiftMtParser_MT537Parser::Fld_13a_B2a_BContext* SwiftMtParser_MT537Parser::fld_13a_B2a_B() { Fld_13a_B2a_BContext *_localctx = _tracker.createInstance<Fld_13a_B2a_BContext>(_ctx, getState()); enterRule(_localctx, 152, SwiftMtParser_MT537Parser::RuleFld_13a_B2a_B); _localctx->fld.set_tag("13B"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(777); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(778); match(SwiftMtParser_MT537Parser::T__12); setState(780); _errHandler->sync(this); _la = _input->LA(1); do { setState(779); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(782); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_20C_B2a_CContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_20C_B2a_CContext::Fld_20C_B2a_CContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_20C_B2a_CContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_20C_B2a_CContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_20C_B2a_CContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_20C_B2a_C; } void SwiftMtParser_MT537Parser::Fld_20C_B2a_CContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_20C_B2a_C(this); } void SwiftMtParser_MT537Parser::Fld_20C_B2a_CContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_20C_B2a_C(this); } SwiftMtParser_MT537Parser::Fld_20C_B2a_CContext* SwiftMtParser_MT537Parser::fld_20C_B2a_C() { Fld_20C_B2a_CContext *_localctx = _tracker.createInstance<Fld_20C_B2a_CContext>(_ctx, getState()); enterRule(_localctx, 154, SwiftMtParser_MT537Parser::RuleFld_20C_B2a_C); _localctx->fld.set_tag("20C"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(784); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(785); match(SwiftMtParser_MT537Parser::T__5); setState(787); _errHandler->sync(this); _la = _input->LA(1); do { setState(786); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(789); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_94a_B2b_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_94a_B2b_BContext::Fld_94a_B2b_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_94a_B2b_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_94a_B2b_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_94a_B2b_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_94a_B2b_B; } void SwiftMtParser_MT537Parser::Fld_94a_B2b_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_94a_B2b_B(this); } void SwiftMtParser_MT537Parser::Fld_94a_B2b_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_94a_B2b_B(this); } SwiftMtParser_MT537Parser::Fld_94a_B2b_BContext* SwiftMtParser_MT537Parser::fld_94a_B2b_B() { Fld_94a_B2b_BContext *_localctx = _tracker.createInstance<Fld_94a_B2b_BContext>(_ctx, getState()); enterRule(_localctx, 156, SwiftMtParser_MT537Parser::RuleFld_94a_B2b_B); _localctx->fld.set_tag("94B"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(791); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(792); match(SwiftMtParser_MT537Parser::T__22); setState(794); _errHandler->sync(this); _la = _input->LA(1); do { setState(793); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(796); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_94a_B2b_CContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_94a_B2b_CContext::Fld_94a_B2b_CContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_94a_B2b_CContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_94a_B2b_CContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_94a_B2b_CContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_94a_B2b_C; } void SwiftMtParser_MT537Parser::Fld_94a_B2b_CContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_94a_B2b_C(this); } void SwiftMtParser_MT537Parser::Fld_94a_B2b_CContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_94a_B2b_C(this); } SwiftMtParser_MT537Parser::Fld_94a_B2b_CContext* SwiftMtParser_MT537Parser::fld_94a_B2b_C() { Fld_94a_B2b_CContext *_localctx = _tracker.createInstance<Fld_94a_B2b_CContext>(_ctx, getState()); enterRule(_localctx, 158, SwiftMtParser_MT537Parser::RuleFld_94a_B2b_C); _localctx->fld.set_tag("94C"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(798); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(799); match(SwiftMtParser_MT537Parser::T__23); setState(801); _errHandler->sync(this); _la = _input->LA(1); do { setState(800); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(803); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_94a_B2b_FContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_94a_B2b_FContext::Fld_94a_B2b_FContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_94a_B2b_FContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_94a_B2b_FContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_94a_B2b_FContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_94a_B2b_F; } void SwiftMtParser_MT537Parser::Fld_94a_B2b_FContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_94a_B2b_F(this); } void SwiftMtParser_MT537Parser::Fld_94a_B2b_FContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_94a_B2b_F(this); } SwiftMtParser_MT537Parser::Fld_94a_B2b_FContext* SwiftMtParser_MT537Parser::fld_94a_B2b_F() { Fld_94a_B2b_FContext *_localctx = _tracker.createInstance<Fld_94a_B2b_FContext>(_ctx, getState()); enterRule(_localctx, 160, SwiftMtParser_MT537Parser::RuleFld_94a_B2b_F); _localctx->fld.set_tag("94F"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(805); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(806); match(SwiftMtParser_MT537Parser::T__24); setState(808); _errHandler->sync(this); _la = _input->LA(1); do { setState(807); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(810); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_94a_B2b_HContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_94a_B2b_HContext::Fld_94a_B2b_HContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_94a_B2b_HContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_94a_B2b_HContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_94a_B2b_HContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_94a_B2b_H; } void SwiftMtParser_MT537Parser::Fld_94a_B2b_HContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_94a_B2b_H(this); } void SwiftMtParser_MT537Parser::Fld_94a_B2b_HContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_94a_B2b_H(this); } SwiftMtParser_MT537Parser::Fld_94a_B2b_HContext* SwiftMtParser_MT537Parser::fld_94a_B2b_H() { Fld_94a_B2b_HContext *_localctx = _tracker.createInstance<Fld_94a_B2b_HContext>(_ctx, getState()); enterRule(_localctx, 162, SwiftMtParser_MT537Parser::RuleFld_94a_B2b_H); _localctx->fld.set_tag("94H"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(812); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(813); match(SwiftMtParser_MT537Parser::T__25); setState(815); _errHandler->sync(this); _la = _input->LA(1); do { setState(814); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(817); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_94a_B2b_LContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_94a_B2b_LContext::Fld_94a_B2b_LContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_94a_B2b_LContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_94a_B2b_LContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_94a_B2b_LContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_94a_B2b_L; } void SwiftMtParser_MT537Parser::Fld_94a_B2b_LContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_94a_B2b_L(this); } void SwiftMtParser_MT537Parser::Fld_94a_B2b_LContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_94a_B2b_L(this); } SwiftMtParser_MT537Parser::Fld_94a_B2b_LContext* SwiftMtParser_MT537Parser::fld_94a_B2b_L() { Fld_94a_B2b_LContext *_localctx = _tracker.createInstance<Fld_94a_B2b_LContext>(_ctx, getState()); enterRule(_localctx, 164, SwiftMtParser_MT537Parser::RuleFld_94a_B2b_L); _localctx->fld.set_tag("94L"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(819); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(820); match(SwiftMtParser_MT537Parser::T__26); setState(822); _errHandler->sync(this); _la = _input->LA(1); do { setState(821); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(824); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_35B_B2b_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_35B_B2b_BContext::Fld_35B_B2b_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_35B_B2b_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_35B_B2b_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_35B_B2b_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_35B_B2b_B; } void SwiftMtParser_MT537Parser::Fld_35B_B2b_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_35B_B2b_B(this); } void SwiftMtParser_MT537Parser::Fld_35B_B2b_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_35B_B2b_B(this); } SwiftMtParser_MT537Parser::Fld_35B_B2b_BContext* SwiftMtParser_MT537Parser::fld_35B_B2b_B() { Fld_35B_B2b_BContext *_localctx = _tracker.createInstance<Fld_35B_B2b_BContext>(_ctx, getState()); enterRule(_localctx, 166, SwiftMtParser_MT537Parser::RuleFld_35B_B2b_B); _localctx->fld.set_tag("35B"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(826); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(827); match(SwiftMtParser_MT537Parser::T__27); setState(829); _errHandler->sync(this); _la = _input->LA(1); do { setState(828); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(831); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_36B_B2b_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_36B_B2b_BContext::Fld_36B_B2b_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_36B_B2b_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_36B_B2b_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_36B_B2b_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_36B_B2b_B; } void SwiftMtParser_MT537Parser::Fld_36B_B2b_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_36B_B2b_B(this); } void SwiftMtParser_MT537Parser::Fld_36B_B2b_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_36B_B2b_B(this); } SwiftMtParser_MT537Parser::Fld_36B_B2b_BContext* SwiftMtParser_MT537Parser::fld_36B_B2b_B() { Fld_36B_B2b_BContext *_localctx = _tracker.createInstance<Fld_36B_B2b_BContext>(_ctx, getState()); enterRule(_localctx, 168, SwiftMtParser_MT537Parser::RuleFld_36B_B2b_B); _localctx->fld.set_tag("36B"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(833); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(834); match(SwiftMtParser_MT537Parser::T__28); setState(836); _errHandler->sync(this); _la = _input->LA(1); do { setState(835); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(838); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_19A_B2b_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_19A_B2b_AContext::Fld_19A_B2b_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_19A_B2b_AContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_19A_B2b_AContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_19A_B2b_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_19A_B2b_A; } void SwiftMtParser_MT537Parser::Fld_19A_B2b_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_19A_B2b_A(this); } void SwiftMtParser_MT537Parser::Fld_19A_B2b_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_19A_B2b_A(this); } SwiftMtParser_MT537Parser::Fld_19A_B2b_AContext* SwiftMtParser_MT537Parser::fld_19A_B2b_A() { Fld_19A_B2b_AContext *_localctx = _tracker.createInstance<Fld_19A_B2b_AContext>(_ctx, getState()); enterRule(_localctx, 170, SwiftMtParser_MT537Parser::RuleFld_19A_B2b_A); _localctx->fld.set_tag("19A"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(840); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(841); match(SwiftMtParser_MT537Parser::T__29); setState(843); _errHandler->sync(this); _la = _input->LA(1); do { setState(842); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(845); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_22a_B2b_FContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_22a_B2b_FContext::Fld_22a_B2b_FContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_22a_B2b_FContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_22a_B2b_FContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_22a_B2b_FContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_22a_B2b_F; } void SwiftMtParser_MT537Parser::Fld_22a_B2b_FContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_22a_B2b_F(this); } void SwiftMtParser_MT537Parser::Fld_22a_B2b_FContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_22a_B2b_F(this); } SwiftMtParser_MT537Parser::Fld_22a_B2b_FContext* SwiftMtParser_MT537Parser::fld_22a_B2b_F() { Fld_22a_B2b_FContext *_localctx = _tracker.createInstance<Fld_22a_B2b_FContext>(_ctx, getState()); enterRule(_localctx, 172, SwiftMtParser_MT537Parser::RuleFld_22a_B2b_F); _localctx->fld.set_tag("22F"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(847); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(848); match(SwiftMtParser_MT537Parser::T__10); setState(850); _errHandler->sync(this); _la = _input->LA(1); do { setState(849); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(852); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_22a_B2b_HContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_22a_B2b_HContext::Fld_22a_B2b_HContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_22a_B2b_HContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_22a_B2b_HContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_22a_B2b_HContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_22a_B2b_H; } void SwiftMtParser_MT537Parser::Fld_22a_B2b_HContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_22a_B2b_H(this); } void SwiftMtParser_MT537Parser::Fld_22a_B2b_HContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_22a_B2b_H(this); } SwiftMtParser_MT537Parser::Fld_22a_B2b_HContext* SwiftMtParser_MT537Parser::fld_22a_B2b_H() { Fld_22a_B2b_HContext *_localctx = _tracker.createInstance<Fld_22a_B2b_HContext>(_ctx, getState()); enterRule(_localctx, 174, SwiftMtParser_MT537Parser::RuleFld_22a_B2b_H); _localctx->fld.set_tag("22H"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { enterOuterAlt(_localctx, 1); setState(854); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(855); match(SwiftMtParser_MT537Parser::T__11); setState(857); _errHandler->sync(this); _la = _input->LA(1); do { setState(856); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } setState(859); _errHandler->sync(this); _la = _input->LA(1); } while ((((_la & ~ 0x3fULL) == 0) && ((1ULL << _la) & ((1ULL << SwiftMtParser_MT537Parser::T__0) | (1ULL << SwiftMtParser_MT537Parser::T__1) | (1ULL << SwiftMtParser_MT537Parser::T__2) | (1ULL << SwiftMtParser_MT537Parser::T__3) | (1ULL << SwiftMtParser_MT537Parser::T__4) | (1ULL << SwiftMtParser_MT537Parser::T__5) | (1ULL << SwiftMtParser_MT537Parser::T__6) | (1ULL << SwiftMtParser_MT537Parser::T__7) | (1ULL << SwiftMtParser_MT537Parser::T__8) | (1ULL << SwiftMtParser_MT537Parser::T__9) | (1ULL << SwiftMtParser_MT537Parser::T__10) | (1ULL << SwiftMtParser_MT537Parser::T__11) | (1ULL << SwiftMtParser_MT537Parser::T__12) | (1ULL << SwiftMtParser_MT537Parser::T__13) | (1ULL << SwiftMtParser_MT537Parser::T__14) | (1ULL << SwiftMtParser_MT537Parser::T__15) | (1ULL << SwiftMtParser_MT537Parser::T__16) | (1ULL << SwiftMtParser_MT537Parser::T__17) | (1ULL << SwiftMtParser_MT537Parser::T__18) | (1ULL << SwiftMtParser_MT537Parser::T__19) | (1ULL << SwiftMtParser_MT537Parser::T__20) | (1ULL << SwiftMtParser_MT537Parser::T__21) | (1ULL << SwiftMtParser_MT537Parser::T__22) | (1ULL << SwiftMtParser_MT537Parser::T__23) | (1ULL << SwiftMtParser_MT537Parser::T__24) | (1ULL << SwiftMtParser_MT537Parser::T__25) | (1ULL << SwiftMtParser_MT537Parser::T__26) | (1ULL << SwiftMtParser_MT537Parser::T__27) | (1ULL << SwiftMtParser_MT537Parser::T__28) | (1ULL << SwiftMtParser_MT537Parser::T__29) | (1ULL << SwiftMtParser_MT537Parser::T__30) | (1ULL << SwiftMtParser_MT537Parser::T__31) | (1ULL << SwiftMtParser_MT537Parser::TAG_BH) | (1ULL << SwiftMtParser_MT537Parser::TAG_AH) | (1ULL << SwiftMtParser_MT537Parser::TAG_UH) | (1ULL << SwiftMtParser_MT537Parser::TAG_MT) | (1ULL << SwiftMtParser_MT537Parser::TAG_TR) | (1ULL << SwiftMtParser_MT537Parser::MT_END) | (1ULL << SwiftMtParser_MT537Parser::LBRACE) | (1ULL << SwiftMtParser_MT537Parser::RBRACE) | (1ULL << SwiftMtParser_MT537Parser::COLON) | (1ULL << SwiftMtParser_MT537Parser::ANY))) != 0)); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_98a_B2b_AContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_98a_B2b_AContext::Fld_98a_B2b_AContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_98a_B2b_AContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_98a_B2b_AContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_98a_B2b_AContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_98a_B2b_A; } void SwiftMtParser_MT537Parser::Fld_98a_B2b_AContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_98a_B2b_A(this); } void SwiftMtParser_MT537Parser::Fld_98a_B2b_AContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_98a_B2b_A(this); } SwiftMtParser_MT537Parser::Fld_98a_B2b_AContext* SwiftMtParser_MT537Parser::fld_98a_B2b_A() { Fld_98a_B2b_AContext *_localctx = _tracker.createInstance<Fld_98a_B2b_AContext>(_ctx, getState()); enterRule(_localctx, 176, SwiftMtParser_MT537Parser::RuleFld_98a_B2b_A); _localctx->fld.set_tag("98A"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(861); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(862); match(SwiftMtParser_MT537Parser::T__7); setState(864); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(863); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } break; } default: throw NoViableAltException(this); } setState(866); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 82, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_98a_B2b_BContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_98a_B2b_BContext::Fld_98a_B2b_BContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_98a_B2b_BContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_98a_B2b_BContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_98a_B2b_BContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_98a_B2b_B; } void SwiftMtParser_MT537Parser::Fld_98a_B2b_BContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_98a_B2b_B(this); } void SwiftMtParser_MT537Parser::Fld_98a_B2b_BContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_98a_B2b_B(this); } SwiftMtParser_MT537Parser::Fld_98a_B2b_BContext* SwiftMtParser_MT537Parser::fld_98a_B2b_B() { Fld_98a_B2b_BContext *_localctx = _tracker.createInstance<Fld_98a_B2b_BContext>(_ctx, getState()); enterRule(_localctx, 178, SwiftMtParser_MT537Parser::RuleFld_98a_B2b_B); _localctx->fld.set_tag("98B"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(868); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(869); match(SwiftMtParser_MT537Parser::T__30); setState(871); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(870); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } break; } default: throw NoViableAltException(this); } setState(873); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 83, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_98a_B2b_CContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_98a_B2b_CContext::Fld_98a_B2b_CContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_98a_B2b_CContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_98a_B2b_CContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_98a_B2b_CContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_98a_B2b_C; } void SwiftMtParser_MT537Parser::Fld_98a_B2b_CContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_98a_B2b_C(this); } void SwiftMtParser_MT537Parser::Fld_98a_B2b_CContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_98a_B2b_C(this); } SwiftMtParser_MT537Parser::Fld_98a_B2b_CContext* SwiftMtParser_MT537Parser::fld_98a_B2b_C() { Fld_98a_B2b_CContext *_localctx = _tracker.createInstance<Fld_98a_B2b_CContext>(_ctx, getState()); enterRule(_localctx, 180, SwiftMtParser_MT537Parser::RuleFld_98a_B2b_C); _localctx->fld.set_tag("98C"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(875); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(876); match(SwiftMtParser_MT537Parser::T__8); setState(878); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(877); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } break; } default: throw NoViableAltException(this); } setState(880); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 84, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } //----------------- Fld_70E_B2b_EContext ------------------------------------------------------------------ SwiftMtParser_MT537Parser::Fld_70E_B2b_EContext::Fld_70E_B2b_EContext(ParserRuleContext *parent, size_t invokingState) : ParserRuleContext(parent, invokingState) { } std::vector<tree::TerminalNode *> SwiftMtParser_MT537Parser::Fld_70E_B2b_EContext::START_OF_FIELD() { return getTokens(SwiftMtParser_MT537Parser::START_OF_FIELD); } tree::TerminalNode* SwiftMtParser_MT537Parser::Fld_70E_B2b_EContext::START_OF_FIELD(size_t i) { return getToken(SwiftMtParser_MT537Parser::START_OF_FIELD, i); } size_t SwiftMtParser_MT537Parser::Fld_70E_B2b_EContext::getRuleIndex() const { return SwiftMtParser_MT537Parser::RuleFld_70E_B2b_E; } void SwiftMtParser_MT537Parser::Fld_70E_B2b_EContext::enterRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->enterFld_70E_B2b_E(this); } void SwiftMtParser_MT537Parser::Fld_70E_B2b_EContext::exitRule(tree::ParseTreeListener *listener) { auto parserListener = dynamic_cast<SwiftMtParser_MT537Listener *>(listener); if (parserListener != nullptr) parserListener->exitFld_70E_B2b_E(this); } SwiftMtParser_MT537Parser::Fld_70E_B2b_EContext* SwiftMtParser_MT537Parser::fld_70E_B2b_E() { Fld_70E_B2b_EContext *_localctx = _tracker.createInstance<Fld_70E_B2b_EContext>(_ctx, getState()); enterRule(_localctx, 182, SwiftMtParser_MT537Parser::RuleFld_70E_B2b_E); _localctx->fld.set_tag("70E"); size_t _la = 0; auto onExit = finally([=] { exitRule(); }); try { size_t alt; enterOuterAlt(_localctx, 1); setState(882); match(SwiftMtParser_MT537Parser::START_OF_FIELD); setState(883); match(SwiftMtParser_MT537Parser::T__31); setState(885); _errHandler->sync(this); alt = 1; do { switch (alt) { case 1: { setState(884); _la = _input->LA(1); if (_la == 0 || _la == Token::EOF || (_la == SwiftMtParser_MT537Parser::START_OF_FIELD)) { _errHandler->recoverInline(this); } else { _errHandler->reportMatch(this); consume(); } break; } default: throw NoViableAltException(this); } setState(887); _errHandler->sync(this); alt = getInterpreter<atn::ParserATNSimulator>()->adaptivePredict(_input, 85, _ctx); } while (alt != 2 && alt != atn::ATN::INVALID_ALT_NUMBER); } catch (RecognitionException &e) { _errHandler->reportError(this, e); _localctx->exception = std::current_exception(); _errHandler->recover(this, _localctx->exception); } return _localctx; } // Static vars and initialization. std::vector<dfa::DFA> SwiftMtParser_MT537Parser::_decisionToDFA; atn::PredictionContextCache SwiftMtParser_MT537Parser::_sharedContextCache; // We own the ATN which in turn owns the ATN states. atn::ATN SwiftMtParser_MT537Parser::_atn; std::vector<uint16_t> SwiftMtParser_MT537Parser::_serializedATN; std::vector<std::string> SwiftMtParser_MT537Parser::_ruleNames = { "message", "bh", "bh_content", "ah", "ah_content", "uh", "tr", "sys_block", "sys_element", "sys_element_key", "sys_element_content", "mt", "seq_A", "seq_A1", "seq_B", "seq_B1", "seq_B2", "seq_B2a", "seq_B2b", "fld_16R_A", "fld_28E_A", "fld_13a_A", "fld_20C_A", "fld_23G_A", "fld_98a_A", "fld_22a_A", "fld_16R_A1", "fld_13a_A1", "fld_20C_A1", "fld_16S_A1", "fld_95a_A", "fld_97a_A", "fld_17B_A", "fld_16S_A", "fld_16R_B", "fld_25D_B", "fld_16R_B1", "fld_24B_B1", "fld_70D_B1", "fld_16S_B1", "fld_16R_B2", "fld_16R_B2a", "fld_13a_B2a", "fld_20C_B2a", "fld_16S_B2a", "fld_16R_B2b", "fld_94a_B2b", "fld_35B_B2b", "fld_36B_B2b", "fld_19A_B2b", "fld_22a_B2b", "fld_98a_B2b", "fld_70E_B2b", "fld_28E_A_E", "fld_13a_A_A", "fld_13a_A_J", "fld_20C_A_C", "fld_23G_A_G", "fld_98a_A_A", "fld_98a_A_C", "fld_98a_A_E", "fld_22a_A_F", "fld_22a_A_H", "fld_13a_A1_A", "fld_13a_A1_B", "fld_20C_A1_C", "fld_95a_A_L", "fld_95a_A_P", "fld_95a_A_R", "fld_97a_A_A", "fld_97a_A_B", "fld_17B_A_B", "fld_25D_B_D", "fld_24B_B1_B", "fld_70D_B1_D", "fld_13a_B2a_A", "fld_13a_B2a_B", "fld_20C_B2a_C", "fld_94a_B2b_B", "fld_94a_B2b_C", "fld_94a_B2b_F", "fld_94a_B2b_H", "fld_94a_B2b_L", "fld_35B_B2b_B", "fld_36B_B2b_B", "fld_19A_B2b_A", "fld_22a_B2b_F", "fld_22a_B2b_H", "fld_98a_B2b_A", "fld_98a_B2b_B", "fld_98a_B2b_C", "fld_70E_B2b_E" }; std::vector<std::string> SwiftMtParser_MT537Parser::_literalNames = { "", "'16R:'", "'16S:'", "'28E:'", "'13A:'", "'13J:'", "'20C:'", "'23G:'", "'98A:'", "'98C:'", "'98E:'", "'22F:'", "'22H:'", "'13B:'", "'95L:'", "'95P:'", "'95R:'", "'97A:'", "'97B:'", "'17B:'", "'25D:'", "'24B:'", "'70D:'", "'94B:'", "'94C:'", "'94F:'", "'94H:'", "'94L:'", "'35B:'", "'36B:'", "'19A:'", "'98B:'", "'70E:'", "'{1:'", "'{2:'", "'{3:'", "'{4:'", "'{5:'", "'-}'", "'{'", "'}'", "':'" }; std::vector<std::string> SwiftMtParser_MT537Parser::_symbolicNames = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "TAG_BH", "TAG_AH", "TAG_UH", "TAG_MT", "TAG_TR", "MT_END", "LBRACE", "RBRACE", "COLON", "START_OF_FIELD", "ANY" }; dfa::Vocabulary SwiftMtParser_MT537Parser::_vocabulary(_literalNames, _symbolicNames); std::vector<std::string> SwiftMtParser_MT537Parser::_tokenNames; SwiftMtParser_MT537Parser::Initializer::Initializer() { for (size_t i = 0; i < _symbolicNames.size(); ++i) { std::string name = _vocabulary.getLiteralName(i); if (name.empty()) { name = _vocabulary.getSymbolicName(i); } if (name.empty()) { _tokenNames.push_back("<INVALID>"); } else { _tokenNames.push_back(name); } } _serializedATN = { 0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964, 0x3, 0x2d, 0x37c, 0x4, 0x2, 0x9, 0x2, 0x4, 0x3, 0x9, 0x3, 0x4, 0x4, 0x9, 0x4, 0x4, 0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7, 0x9, 0x7, 0x4, 0x8, 0x9, 0x8, 0x4, 0x9, 0x9, 0x9, 0x4, 0xa, 0x9, 0xa, 0x4, 0xb, 0x9, 0xb, 0x4, 0xc, 0x9, 0xc, 0x4, 0xd, 0x9, 0xd, 0x4, 0xe, 0x9, 0xe, 0x4, 0xf, 0x9, 0xf, 0x4, 0x10, 0x9, 0x10, 0x4, 0x11, 0x9, 0x11, 0x4, 0x12, 0x9, 0x12, 0x4, 0x13, 0x9, 0x13, 0x4, 0x14, 0x9, 0x14, 0x4, 0x15, 0x9, 0x15, 0x4, 0x16, 0x9, 0x16, 0x4, 0x17, 0x9, 0x17, 0x4, 0x18, 0x9, 0x18, 0x4, 0x19, 0x9, 0x19, 0x4, 0x1a, 0x9, 0x1a, 0x4, 0x1b, 0x9, 0x1b, 0x4, 0x1c, 0x9, 0x1c, 0x4, 0x1d, 0x9, 0x1d, 0x4, 0x1e, 0x9, 0x1e, 0x4, 0x1f, 0x9, 0x1f, 0x4, 0x20, 0x9, 0x20, 0x4, 0x21, 0x9, 0x21, 0x4, 0x22, 0x9, 0x22, 0x4, 0x23, 0x9, 0x23, 0x4, 0x24, 0x9, 0x24, 0x4, 0x25, 0x9, 0x25, 0x4, 0x26, 0x9, 0x26, 0x4, 0x27, 0x9, 0x27, 0x4, 0x28, 0x9, 0x28, 0x4, 0x29, 0x9, 0x29, 0x4, 0x2a, 0x9, 0x2a, 0x4, 0x2b, 0x9, 0x2b, 0x4, 0x2c, 0x9, 0x2c, 0x4, 0x2d, 0x9, 0x2d, 0x4, 0x2e, 0x9, 0x2e, 0x4, 0x2f, 0x9, 0x2f, 0x4, 0x30, 0x9, 0x30, 0x4, 0x31, 0x9, 0x31, 0x4, 0x32, 0x9, 0x32, 0x4, 0x33, 0x9, 0x33, 0x4, 0x34, 0x9, 0x34, 0x4, 0x35, 0x9, 0x35, 0x4, 0x36, 0x9, 0x36, 0x4, 0x37, 0x9, 0x37, 0x4, 0x38, 0x9, 0x38, 0x4, 0x39, 0x9, 0x39, 0x4, 0x3a, 0x9, 0x3a, 0x4, 0x3b, 0x9, 0x3b, 0x4, 0x3c, 0x9, 0x3c, 0x4, 0x3d, 0x9, 0x3d, 0x4, 0x3e, 0x9, 0x3e, 0x4, 0x3f, 0x9, 0x3f, 0x4, 0x40, 0x9, 0x40, 0x4, 0x41, 0x9, 0x41, 0x4, 0x42, 0x9, 0x42, 0x4, 0x43, 0x9, 0x43, 0x4, 0x44, 0x9, 0x44, 0x4, 0x45, 0x9, 0x45, 0x4, 0x46, 0x9, 0x46, 0x4, 0x47, 0x9, 0x47, 0x4, 0x48, 0x9, 0x48, 0x4, 0x49, 0x9, 0x49, 0x4, 0x4a, 0x9, 0x4a, 0x4, 0x4b, 0x9, 0x4b, 0x4, 0x4c, 0x9, 0x4c, 0x4, 0x4d, 0x9, 0x4d, 0x4, 0x4e, 0x9, 0x4e, 0x4, 0x4f, 0x9, 0x4f, 0x4, 0x50, 0x9, 0x50, 0x4, 0x51, 0x9, 0x51, 0x4, 0x52, 0x9, 0x52, 0x4, 0x53, 0x9, 0x53, 0x4, 0x54, 0x9, 0x54, 0x4, 0x55, 0x9, 0x55, 0x4, 0x56, 0x9, 0x56, 0x4, 0x57, 0x9, 0x57, 0x4, 0x58, 0x9, 0x58, 0x4, 0x59, 0x9, 0x59, 0x4, 0x5a, 0x9, 0x5a, 0x4, 0x5b, 0x9, 0x5b, 0x4, 0x5c, 0x9, 0x5c, 0x4, 0x5d, 0x9, 0x5d, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2, 0x5, 0x2, 0xbe, 0xa, 0x2, 0x3, 0x2, 0x3, 0x2, 0x5, 0x2, 0xc2, 0xa, 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x6, 0x4, 0xcb, 0xa, 0x4, 0xd, 0x4, 0xe, 0x4, 0xcc, 0x3, 0x5, 0x3, 0x5, 0x3, 0x5, 0x3, 0x5, 0x3, 0x6, 0x6, 0x6, 0xd4, 0xa, 0x6, 0xd, 0x6, 0xe, 0x6, 0xd5, 0x3, 0x7, 0x3, 0x7, 0x3, 0x7, 0x3, 0x7, 0x3, 0x8, 0x3, 0x8, 0x3, 0x8, 0x3, 0x8, 0x3, 0x9, 0x6, 0x9, 0xe1, 0xa, 0x9, 0xd, 0x9, 0xe, 0x9, 0xe2, 0x3, 0xa, 0x3, 0xa, 0x3, 0xa, 0x3, 0xa, 0x3, 0xa, 0x3, 0xa, 0x3, 0xb, 0x6, 0xb, 0xec, 0xa, 0xb, 0xd, 0xb, 0xe, 0xb, 0xed, 0x3, 0xc, 0x6, 0xc, 0xf1, 0xa, 0xc, 0xd, 0xc, 0xe, 0xc, 0xf2, 0x3, 0xd, 0x3, 0xd, 0x3, 0xd, 0x7, 0xd, 0xf8, 0xa, 0xd, 0xc, 0xd, 0xe, 0xd, 0xfb, 0xb, 0xd, 0x3, 0xd, 0x3, 0xd, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x5, 0xe, 0x104, 0xa, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x6, 0xe, 0x10c, 0xa, 0xe, 0xd, 0xe, 0xe, 0xe, 0x10d, 0x3, 0xe, 0x3, 0xe, 0x6, 0xe, 0x112, 0xa, 0xe, 0xd, 0xe, 0xe, 0xe, 0x113, 0x3, 0xe, 0x3, 0xe, 0x7, 0xe, 0x118, 0xa, 0xe, 0xc, 0xe, 0xe, 0xe, 0x11b, 0xb, 0xe, 0x3, 0xe, 0x3, 0xe, 0x7, 0xe, 0x11f, 0xa, 0xe, 0xc, 0xe, 0xe, 0xe, 0x122, 0xb, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xe, 0x3, 0xf, 0x3, 0xf, 0x3, 0xf, 0x5, 0xf, 0x12f, 0xa, 0xf, 0x3, 0xf, 0x3, 0xf, 0x3, 0xf, 0x3, 0xf, 0x3, 0xf, 0x3, 0xf, 0x3, 0x10, 0x3, 0x10, 0x3, 0x10, 0x3, 0x10, 0x3, 0x10, 0x7, 0x10, 0x13c, 0xa, 0x10, 0xc, 0x10, 0xe, 0x10, 0x13f, 0xb, 0x10, 0x3, 0x10, 0x3, 0x10, 0x6, 0x10, 0x143, 0xa, 0x10, 0xd, 0x10, 0xe, 0x10, 0x144, 0x3, 0x10, 0x3, 0x10, 0x3, 0x11, 0x3, 0x11, 0x3, 0x11, 0x3, 0x11, 0x3, 0x11, 0x5, 0x11, 0x14e, 0xa, 0x11, 0x3, 0x11, 0x3, 0x11, 0x3, 0x11, 0x3, 0x11, 0x3, 0x12, 0x3, 0x12, 0x3, 0x12, 0x6, 0x12, 0x157, 0xa, 0x12, 0xd, 0x12, 0xe, 0x12, 0x158, 0x3, 0x12, 0x3, 0x12, 0x5, 0x12, 0x15d, 0xa, 0x12, 0x3, 0x12, 0x3, 0x12, 0x3, 0x13, 0x3, 0x13, 0x3, 0x13, 0x5, 0x13, 0x164, 0xa, 0x13, 0x3, 0x13, 0x3, 0x13, 0x3, 0x13, 0x3, 0x13, 0x3, 0x13, 0x3, 0x13, 0x3, 0x14, 0x3, 0x14, 0x3, 0x14, 0x7, 0x14, 0x16f, 0xa, 0x14, 0xc, 0x14, 0xe, 0x14, 0x172, 0xb, 0x14, 0x3, 0x14, 0x3, 0x14, 0x3, 0x14, 0x3, 0x14, 0x6, 0x14, 0x178, 0xa, 0x14, 0xd, 0x14, 0xe, 0x14, 0x179, 0x3, 0x14, 0x3, 0x14, 0x7, 0x14, 0x17e, 0xa, 0x14, 0xc, 0x14, 0xe, 0x14, 0x181, 0xb, 0x14, 0x3, 0x14, 0x3, 0x14, 0x6, 0x14, 0x185, 0xa, 0x14, 0xd, 0x14, 0xe, 0x14, 0x186, 0x3, 0x14, 0x3, 0x14, 0x6, 0x14, 0x18b, 0xa, 0x14, 0xd, 0x14, 0xe, 0x14, 0x18c, 0x3, 0x14, 0x3, 0x14, 0x5, 0x14, 0x191, 0xa, 0x14, 0x3, 0x14, 0x3, 0x14, 0x3, 0x15, 0x3, 0x15, 0x3, 0x15, 0x6, 0x15, 0x198, 0xa, 0x15, 0xd, 0x15, 0xe, 0x15, 0x199, 0x3, 0x16, 0x3, 0x16, 0x3, 0x16, 0x3, 0x17, 0x3, 0x17, 0x3, 0x17, 0x3, 0x17, 0x3, 0x17, 0x3, 0x17, 0x5, 0x17, 0x1a5, 0xa, 0x17, 0x3, 0x18, 0x3, 0x18, 0x3, 0x18, 0x3, 0x19, 0x3, 0x19, 0x3, 0x19, 0x3, 0x1a, 0x3, 0x1a, 0x3, 0x1a, 0x3, 0x1a, 0x3, 0x1a, 0x3, 0x1a, 0x3, 0x1a, 0x3, 0x1a, 0x3, 0x1a, 0x5, 0x1a, 0x1b6, 0xa, 0x1a, 0x3, 0x1b, 0x3, 0x1b, 0x3, 0x1b, 0x3, 0x1b, 0x3, 0x1b, 0x3, 0x1b, 0x5, 0x1b, 0x1be, 0xa, 0x1b, 0x3, 0x1c, 0x3, 0x1c, 0x3, 0x1c, 0x6, 0x1c, 0x1c3, 0xa, 0x1c, 0xd, 0x1c, 0xe, 0x1c, 0x1c4, 0x3, 0x1d, 0x3, 0x1d, 0x3, 0x1d, 0x3, 0x1d, 0x3, 0x1d, 0x3, 0x1d, 0x5, 0x1d, 0x1cd, 0xa, 0x1d, 0x3, 0x1e, 0x3, 0x1e, 0x3, 0x1e, 0x3, 0x1f, 0x3, 0x1f, 0x3, 0x1f, 0x6, 0x1f, 0x1d5, 0xa, 0x1f, 0xd, 0x1f, 0xe, 0x1f, 0x1d6, 0x3, 0x20, 0x3, 0x20, 0x3, 0x20, 0x3, 0x20, 0x3, 0x20, 0x3, 0x20, 0x3, 0x20, 0x3, 0x20, 0x3, 0x20, 0x5, 0x20, 0x1e2, 0xa, 0x20, 0x3, 0x21, 0x3, 0x21, 0x3, 0x21, 0x3, 0x21, 0x3, 0x21, 0x3, 0x21, 0x5, 0x21, 0x1ea, 0xa, 0x21, 0x3, 0x22, 0x3, 0x22, 0x3, 0x22, 0x3, 0x23, 0x3, 0x23, 0x3, 0x23, 0x6, 0x23, 0x1f2, 0xa, 0x23, 0xd, 0x23, 0xe, 0x23, 0x1f3, 0x3, 0x24, 0x3, 0x24, 0x3, 0x24, 0x6, 0x24, 0x1f9, 0xa, 0x24, 0xd, 0x24, 0xe, 0x24, 0x1fa, 0x3, 0x25, 0x3, 0x25, 0x3, 0x25, 0x3, 0x26, 0x3, 0x26, 0x3, 0x26, 0x6, 0x26, 0x203, 0xa, 0x26, 0xd, 0x26, 0xe, 0x26, 0x204, 0x3, 0x27, 0x3, 0x27, 0x3, 0x27, 0x3, 0x28, 0x3, 0x28, 0x3, 0x28, 0x3, 0x29, 0x3, 0x29, 0x3, 0x29, 0x6, 0x29, 0x210, 0xa, 0x29, 0xd, 0x29, 0xe, 0x29, 0x211, 0x3, 0x2a, 0x3, 0x2a, 0x3, 0x2a, 0x6, 0x2a, 0x217, 0xa, 0x2a, 0xd, 0x2a, 0xe, 0x2a, 0x218, 0x3, 0x2b, 0x3, 0x2b, 0x3, 0x2b, 0x6, 0x2b, 0x21e, 0xa, 0x2b, 0xd, 0x2b, 0xe, 0x2b, 0x21f, 0x3, 0x2c, 0x3, 0x2c, 0x3, 0x2c, 0x3, 0x2c, 0x3, 0x2c, 0x3, 0x2c, 0x5, 0x2c, 0x228, 0xa, 0x2c, 0x3, 0x2d, 0x3, 0x2d, 0x3, 0x2d, 0x3, 0x2e, 0x3, 0x2e, 0x3, 0x2e, 0x6, 0x2e, 0x230, 0xa, 0x2e, 0xd, 0x2e, 0xe, 0x2e, 0x231, 0x3, 0x2f, 0x3, 0x2f, 0x3, 0x2f, 0x6, 0x2f, 0x237, 0xa, 0x2f, 0xd, 0x2f, 0xe, 0x2f, 0x238, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x3, 0x30, 0x5, 0x30, 0x24a, 0xa, 0x30, 0x3, 0x31, 0x3, 0x31, 0x3, 0x31, 0x3, 0x32, 0x3, 0x32, 0x3, 0x32, 0x3, 0x33, 0x3, 0x33, 0x3, 0x33, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x5, 0x34, 0x25b, 0xa, 0x34, 0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x5, 0x35, 0x266, 0xa, 0x35, 0x3, 0x36, 0x3, 0x36, 0x3, 0x36, 0x3, 0x37, 0x3, 0x37, 0x3, 0x37, 0x6, 0x37, 0x26e, 0xa, 0x37, 0xd, 0x37, 0xe, 0x37, 0x26f, 0x3, 0x38, 0x3, 0x38, 0x3, 0x38, 0x6, 0x38, 0x275, 0xa, 0x38, 0xd, 0x38, 0xe, 0x38, 0x276, 0x3, 0x39, 0x3, 0x39, 0x3, 0x39, 0x6, 0x39, 0x27c, 0xa, 0x39, 0xd, 0x39, 0xe, 0x39, 0x27d, 0x3, 0x3a, 0x3, 0x3a, 0x3, 0x3a, 0x6, 0x3a, 0x283, 0xa, 0x3a, 0xd, 0x3a, 0xe, 0x3a, 0x284, 0x3, 0x3b, 0x3, 0x3b, 0x3, 0x3b, 0x6, 0x3b, 0x28a, 0xa, 0x3b, 0xd, 0x3b, 0xe, 0x3b, 0x28b, 0x3, 0x3c, 0x3, 0x3c, 0x3, 0x3c, 0x6, 0x3c, 0x291, 0xa, 0x3c, 0xd, 0x3c, 0xe, 0x3c, 0x292, 0x3, 0x3d, 0x3, 0x3d, 0x3, 0x3d, 0x6, 0x3d, 0x298, 0xa, 0x3d, 0xd, 0x3d, 0xe, 0x3d, 0x299, 0x3, 0x3e, 0x3, 0x3e, 0x3, 0x3e, 0x6, 0x3e, 0x29f, 0xa, 0x3e, 0xd, 0x3e, 0xe, 0x3e, 0x2a0, 0x3, 0x3f, 0x3, 0x3f, 0x3, 0x3f, 0x6, 0x3f, 0x2a6, 0xa, 0x3f, 0xd, 0x3f, 0xe, 0x3f, 0x2a7, 0x3, 0x40, 0x3, 0x40, 0x3, 0x40, 0x6, 0x40, 0x2ad, 0xa, 0x40, 0xd, 0x40, 0xe, 0x40, 0x2ae, 0x3, 0x41, 0x3, 0x41, 0x3, 0x41, 0x6, 0x41, 0x2b4, 0xa, 0x41, 0xd, 0x41, 0xe, 0x41, 0x2b5, 0x3, 0x42, 0x3, 0x42, 0x3, 0x42, 0x6, 0x42, 0x2bb, 0xa, 0x42, 0xd, 0x42, 0xe, 0x42, 0x2bc, 0x3, 0x43, 0x3, 0x43, 0x3, 0x43, 0x6, 0x43, 0x2c2, 0xa, 0x43, 0xd, 0x43, 0xe, 0x43, 0x2c3, 0x3, 0x44, 0x3, 0x44, 0x3, 0x44, 0x6, 0x44, 0x2c9, 0xa, 0x44, 0xd, 0x44, 0xe, 0x44, 0x2ca, 0x3, 0x45, 0x3, 0x45, 0x3, 0x45, 0x6, 0x45, 0x2d0, 0xa, 0x45, 0xd, 0x45, 0xe, 0x45, 0x2d1, 0x3, 0x46, 0x3, 0x46, 0x3, 0x46, 0x6, 0x46, 0x2d7, 0xa, 0x46, 0xd, 0x46, 0xe, 0x46, 0x2d8, 0x3, 0x47, 0x3, 0x47, 0x3, 0x47, 0x6, 0x47, 0x2de, 0xa, 0x47, 0xd, 0x47, 0xe, 0x47, 0x2df, 0x3, 0x48, 0x3, 0x48, 0x3, 0x48, 0x6, 0x48, 0x2e5, 0xa, 0x48, 0xd, 0x48, 0xe, 0x48, 0x2e6, 0x3, 0x49, 0x3, 0x49, 0x3, 0x49, 0x6, 0x49, 0x2ec, 0xa, 0x49, 0xd, 0x49, 0xe, 0x49, 0x2ed, 0x3, 0x4a, 0x3, 0x4a, 0x3, 0x4a, 0x6, 0x4a, 0x2f3, 0xa, 0x4a, 0xd, 0x4a, 0xe, 0x4a, 0x2f4, 0x3, 0x4b, 0x3, 0x4b, 0x3, 0x4b, 0x6, 0x4b, 0x2fa, 0xa, 0x4b, 0xd, 0x4b, 0xe, 0x4b, 0x2fb, 0x3, 0x4c, 0x3, 0x4c, 0x3, 0x4c, 0x6, 0x4c, 0x301, 0xa, 0x4c, 0xd, 0x4c, 0xe, 0x4c, 0x302, 0x3, 0x4d, 0x3, 0x4d, 0x3, 0x4d, 0x6, 0x4d, 0x308, 0xa, 0x4d, 0xd, 0x4d, 0xe, 0x4d, 0x309, 0x3, 0x4e, 0x3, 0x4e, 0x3, 0x4e, 0x6, 0x4e, 0x30f, 0xa, 0x4e, 0xd, 0x4e, 0xe, 0x4e, 0x310, 0x3, 0x4f, 0x3, 0x4f, 0x3, 0x4f, 0x6, 0x4f, 0x316, 0xa, 0x4f, 0xd, 0x4f, 0xe, 0x4f, 0x317, 0x3, 0x50, 0x3, 0x50, 0x3, 0x50, 0x6, 0x50, 0x31d, 0xa, 0x50, 0xd, 0x50, 0xe, 0x50, 0x31e, 0x3, 0x51, 0x3, 0x51, 0x3, 0x51, 0x6, 0x51, 0x324, 0xa, 0x51, 0xd, 0x51, 0xe, 0x51, 0x325, 0x3, 0x52, 0x3, 0x52, 0x3, 0x52, 0x6, 0x52, 0x32b, 0xa, 0x52, 0xd, 0x52, 0xe, 0x52, 0x32c, 0x3, 0x53, 0x3, 0x53, 0x3, 0x53, 0x6, 0x53, 0x332, 0xa, 0x53, 0xd, 0x53, 0xe, 0x53, 0x333, 0x3, 0x54, 0x3, 0x54, 0x3, 0x54, 0x6, 0x54, 0x339, 0xa, 0x54, 0xd, 0x54, 0xe, 0x54, 0x33a, 0x3, 0x55, 0x3, 0x55, 0x3, 0x55, 0x6, 0x55, 0x340, 0xa, 0x55, 0xd, 0x55, 0xe, 0x55, 0x341, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x6, 0x56, 0x347, 0xa, 0x56, 0xd, 0x56, 0xe, 0x56, 0x348, 0x3, 0x57, 0x3, 0x57, 0x3, 0x57, 0x6, 0x57, 0x34e, 0xa, 0x57, 0xd, 0x57, 0xe, 0x57, 0x34f, 0x3, 0x58, 0x3, 0x58, 0x3, 0x58, 0x6, 0x58, 0x355, 0xa, 0x58, 0xd, 0x58, 0xe, 0x58, 0x356, 0x3, 0x59, 0x3, 0x59, 0x3, 0x59, 0x6, 0x59, 0x35c, 0xa, 0x59, 0xd, 0x59, 0xe, 0x59, 0x35d, 0x3, 0x5a, 0x3, 0x5a, 0x3, 0x5a, 0x6, 0x5a, 0x363, 0xa, 0x5a, 0xd, 0x5a, 0xe, 0x5a, 0x364, 0x3, 0x5b, 0x3, 0x5b, 0x3, 0x5b, 0x6, 0x5b, 0x36a, 0xa, 0x5b, 0xd, 0x5b, 0xe, 0x5b, 0x36b, 0x3, 0x5c, 0x3, 0x5c, 0x3, 0x5c, 0x6, 0x5c, 0x371, 0xa, 0x5c, 0xd, 0x5c, 0xe, 0x5c, 0x372, 0x3, 0x5d, 0x3, 0x5d, 0x3, 0x5d, 0x6, 0x5d, 0x378, 0xa, 0x5d, 0xd, 0x5d, 0xe, 0x5d, 0x379, 0x3, 0x5d, 0x2, 0x2, 0x5e, 0x2, 0x4, 0x6, 0x8, 0xa, 0xc, 0xe, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, 0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e, 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e, 0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0x2, 0x5, 0x3, 0x2, 0x2a, 0x2a, 0x3, 0x2, 0x2a, 0x2b, 0x3, 0x2, 0x2c, 0x2c, 0x2, 0x37b, 0x2, 0xba, 0x3, 0x2, 0x2, 0x2, 0x4, 0xc5, 0x3, 0x2, 0x2, 0x2, 0x6, 0xca, 0x3, 0x2, 0x2, 0x2, 0x8, 0xce, 0x3, 0x2, 0x2, 0x2, 0xa, 0xd3, 0x3, 0x2, 0x2, 0x2, 0xc, 0xd7, 0x3, 0x2, 0x2, 0x2, 0xe, 0xdb, 0x3, 0x2, 0x2, 0x2, 0x10, 0xe0, 0x3, 0x2, 0x2, 0x2, 0x12, 0xe4, 0x3, 0x2, 0x2, 0x2, 0x14, 0xeb, 0x3, 0x2, 0x2, 0x2, 0x16, 0xf0, 0x3, 0x2, 0x2, 0x2, 0x18, 0xf4, 0x3, 0x2, 0x2, 0x2, 0x1a, 0xfe, 0x3, 0x2, 0x2, 0x2, 0x1c, 0x12b, 0x3, 0x2, 0x2, 0x2, 0x1e, 0x136, 0x3, 0x2, 0x2, 0x2, 0x20, 0x148, 0x3, 0x2, 0x2, 0x2, 0x22, 0x153, 0x3, 0x2, 0x2, 0x2, 0x24, 0x160, 0x3, 0x2, 0x2, 0x2, 0x26, 0x16b, 0x3, 0x2, 0x2, 0x2, 0x28, 0x194, 0x3, 0x2, 0x2, 0x2, 0x2a, 0x19b, 0x3, 0x2, 0x2, 0x2, 0x2c, 0x1a4, 0x3, 0x2, 0x2, 0x2, 0x2e, 0x1a6, 0x3, 0x2, 0x2, 0x2, 0x30, 0x1a9, 0x3, 0x2, 0x2, 0x2, 0x32, 0x1b5, 0x3, 0x2, 0x2, 0x2, 0x34, 0x1bd, 0x3, 0x2, 0x2, 0x2, 0x36, 0x1bf, 0x3, 0x2, 0x2, 0x2, 0x38, 0x1cc, 0x3, 0x2, 0x2, 0x2, 0x3a, 0x1ce, 0x3, 0x2, 0x2, 0x2, 0x3c, 0x1d1, 0x3, 0x2, 0x2, 0x2, 0x3e, 0x1e1, 0x3, 0x2, 0x2, 0x2, 0x40, 0x1e9, 0x3, 0x2, 0x2, 0x2, 0x42, 0x1eb, 0x3, 0x2, 0x2, 0x2, 0x44, 0x1ee, 0x3, 0x2, 0x2, 0x2, 0x46, 0x1f5, 0x3, 0x2, 0x2, 0x2, 0x48, 0x1fc, 0x3, 0x2, 0x2, 0x2, 0x4a, 0x1ff, 0x3, 0x2, 0x2, 0x2, 0x4c, 0x206, 0x3, 0x2, 0x2, 0x2, 0x4e, 0x209, 0x3, 0x2, 0x2, 0x2, 0x50, 0x20c, 0x3, 0x2, 0x2, 0x2, 0x52, 0x213, 0x3, 0x2, 0x2, 0x2, 0x54, 0x21a, 0x3, 0x2, 0x2, 0x2, 0x56, 0x227, 0x3, 0x2, 0x2, 0x2, 0x58, 0x229, 0x3, 0x2, 0x2, 0x2, 0x5a, 0x22c, 0x3, 0x2, 0x2, 0x2, 0x5c, 0x233, 0x3, 0x2, 0x2, 0x2, 0x5e, 0x249, 0x3, 0x2, 0x2, 0x2, 0x60, 0x24b, 0x3, 0x2, 0x2, 0x2, 0x62, 0x24e, 0x3, 0x2, 0x2, 0x2, 0x64, 0x251, 0x3, 0x2, 0x2, 0x2, 0x66, 0x25a, 0x3, 0x2, 0x2, 0x2, 0x68, 0x265, 0x3, 0x2, 0x2, 0x2, 0x6a, 0x267, 0x3, 0x2, 0x2, 0x2, 0x6c, 0x26a, 0x3, 0x2, 0x2, 0x2, 0x6e, 0x271, 0x3, 0x2, 0x2, 0x2, 0x70, 0x278, 0x3, 0x2, 0x2, 0x2, 0x72, 0x27f, 0x3, 0x2, 0x2, 0x2, 0x74, 0x286, 0x3, 0x2, 0x2, 0x2, 0x76, 0x28d, 0x3, 0x2, 0x2, 0x2, 0x78, 0x294, 0x3, 0x2, 0x2, 0x2, 0x7a, 0x29b, 0x3, 0x2, 0x2, 0x2, 0x7c, 0x2a2, 0x3, 0x2, 0x2, 0x2, 0x7e, 0x2a9, 0x3, 0x2, 0x2, 0x2, 0x80, 0x2b0, 0x3, 0x2, 0x2, 0x2, 0x82, 0x2b7, 0x3, 0x2, 0x2, 0x2, 0x84, 0x2be, 0x3, 0x2, 0x2, 0x2, 0x86, 0x2c5, 0x3, 0x2, 0x2, 0x2, 0x88, 0x2cc, 0x3, 0x2, 0x2, 0x2, 0x8a, 0x2d3, 0x3, 0x2, 0x2, 0x2, 0x8c, 0x2da, 0x3, 0x2, 0x2, 0x2, 0x8e, 0x2e1, 0x3, 0x2, 0x2, 0x2, 0x90, 0x2e8, 0x3, 0x2, 0x2, 0x2, 0x92, 0x2ef, 0x3, 0x2, 0x2, 0x2, 0x94, 0x2f6, 0x3, 0x2, 0x2, 0x2, 0x96, 0x2fd, 0x3, 0x2, 0x2, 0x2, 0x98, 0x304, 0x3, 0x2, 0x2, 0x2, 0x9a, 0x30b, 0x3, 0x2, 0x2, 0x2, 0x9c, 0x312, 0x3, 0x2, 0x2, 0x2, 0x9e, 0x319, 0x3, 0x2, 0x2, 0x2, 0xa0, 0x320, 0x3, 0x2, 0x2, 0x2, 0xa2, 0x327, 0x3, 0x2, 0x2, 0x2, 0xa4, 0x32e, 0x3, 0x2, 0x2, 0x2, 0xa6, 0x335, 0x3, 0x2, 0x2, 0x2, 0xa8, 0x33c, 0x3, 0x2, 0x2, 0x2, 0xaa, 0x343, 0x3, 0x2, 0x2, 0x2, 0xac, 0x34a, 0x3, 0x2, 0x2, 0x2, 0xae, 0x351, 0x3, 0x2, 0x2, 0x2, 0xb0, 0x358, 0x3, 0x2, 0x2, 0x2, 0xb2, 0x35f, 0x3, 0x2, 0x2, 0x2, 0xb4, 0x366, 0x3, 0x2, 0x2, 0x2, 0xb6, 0x36d, 0x3, 0x2, 0x2, 0x2, 0xb8, 0x374, 0x3, 0x2, 0x2, 0x2, 0xba, 0xbb, 0x5, 0x4, 0x3, 0x2, 0xbb, 0xbd, 0x5, 0x8, 0x5, 0x2, 0xbc, 0xbe, 0x5, 0xc, 0x7, 0x2, 0xbd, 0xbc, 0x3, 0x2, 0x2, 0x2, 0xbd, 0xbe, 0x3, 0x2, 0x2, 0x2, 0xbe, 0xbf, 0x3, 0x2, 0x2, 0x2, 0xbf, 0xc1, 0x5, 0x18, 0xd, 0x2, 0xc0, 0xc2, 0x5, 0xe, 0x8, 0x2, 0xc1, 0xc0, 0x3, 0x2, 0x2, 0x2, 0xc1, 0xc2, 0x3, 0x2, 0x2, 0x2, 0xc2, 0xc3, 0x3, 0x2, 0x2, 0x2, 0xc3, 0xc4, 0x7, 0x2, 0x2, 0x3, 0xc4, 0x3, 0x3, 0x2, 0x2, 0x2, 0xc5, 0xc6, 0x7, 0x23, 0x2, 0x2, 0xc6, 0xc7, 0x5, 0x6, 0x4, 0x2, 0xc7, 0xc8, 0x7, 0x2a, 0x2, 0x2, 0xc8, 0x5, 0x3, 0x2, 0x2, 0x2, 0xc9, 0xcb, 0xa, 0x2, 0x2, 0x2, 0xca, 0xc9, 0x3, 0x2, 0x2, 0x2, 0xcb, 0xcc, 0x3, 0x2, 0x2, 0x2, 0xcc, 0xca, 0x3, 0x2, 0x2, 0x2, 0xcc, 0xcd, 0x3, 0x2, 0x2, 0x2, 0xcd, 0x7, 0x3, 0x2, 0x2, 0x2, 0xce, 0xcf, 0x7, 0x24, 0x2, 0x2, 0xcf, 0xd0, 0x5, 0xa, 0x6, 0x2, 0xd0, 0xd1, 0x7, 0x2a, 0x2, 0x2, 0xd1, 0x9, 0x3, 0x2, 0x2, 0x2, 0xd2, 0xd4, 0xa, 0x2, 0x2, 0x2, 0xd3, 0xd2, 0x3, 0x2, 0x2, 0x2, 0xd4, 0xd5, 0x3, 0x2, 0x2, 0x2, 0xd5, 0xd3, 0x3, 0x2, 0x2, 0x2, 0xd5, 0xd6, 0x3, 0x2, 0x2, 0x2, 0xd6, 0xb, 0x3, 0x2, 0x2, 0x2, 0xd7, 0xd8, 0x7, 0x25, 0x2, 0x2, 0xd8, 0xd9, 0x5, 0x10, 0x9, 0x2, 0xd9, 0xda, 0x7, 0x2a, 0x2, 0x2, 0xda, 0xd, 0x3, 0x2, 0x2, 0x2, 0xdb, 0xdc, 0x7, 0x27, 0x2, 0x2, 0xdc, 0xdd, 0x5, 0x10, 0x9, 0x2, 0xdd, 0xde, 0x7, 0x2a, 0x2, 0x2, 0xde, 0xf, 0x3, 0x2, 0x2, 0x2, 0xdf, 0xe1, 0x5, 0x12, 0xa, 0x2, 0xe0, 0xdf, 0x3, 0x2, 0x2, 0x2, 0xe1, 0xe2, 0x3, 0x2, 0x2, 0x2, 0xe2, 0xe0, 0x3, 0x2, 0x2, 0x2, 0xe2, 0xe3, 0x3, 0x2, 0x2, 0x2, 0xe3, 0x11, 0x3, 0x2, 0x2, 0x2, 0xe4, 0xe5, 0x7, 0x29, 0x2, 0x2, 0xe5, 0xe6, 0x5, 0x14, 0xb, 0x2, 0xe6, 0xe7, 0x7, 0x2b, 0x2, 0x2, 0xe7, 0xe8, 0x5, 0x16, 0xc, 0x2, 0xe8, 0xe9, 0x7, 0x2a, 0x2, 0x2, 0xe9, 0x13, 0x3, 0x2, 0x2, 0x2, 0xea, 0xec, 0xa, 0x3, 0x2, 0x2, 0xeb, 0xea, 0x3, 0x2, 0x2, 0x2, 0xec, 0xed, 0x3, 0x2, 0x2, 0x2, 0xed, 0xeb, 0x3, 0x2, 0x2, 0x2, 0xed, 0xee, 0x3, 0x2, 0x2, 0x2, 0xee, 0x15, 0x3, 0x2, 0x2, 0x2, 0xef, 0xf1, 0xa, 0x2, 0x2, 0x2, 0xf0, 0xef, 0x3, 0x2, 0x2, 0x2, 0xf1, 0xf2, 0x3, 0x2, 0x2, 0x2, 0xf2, 0xf0, 0x3, 0x2, 0x2, 0x2, 0xf2, 0xf3, 0x3, 0x2, 0x2, 0x2, 0xf3, 0x17, 0x3, 0x2, 0x2, 0x2, 0xf4, 0xf5, 0x7, 0x26, 0x2, 0x2, 0xf5, 0xf9, 0x5, 0x1a, 0xe, 0x2, 0xf6, 0xf8, 0x5, 0x1e, 0x10, 0x2, 0xf7, 0xf6, 0x3, 0x2, 0x2, 0x2, 0xf8, 0xfb, 0x3, 0x2, 0x2, 0x2, 0xf9, 0xf7, 0x3, 0x2, 0x2, 0x2, 0xf9, 0xfa, 0x3, 0x2, 0x2, 0x2, 0xfa, 0xfc, 0x3, 0x2, 0x2, 0x2, 0xfb, 0xf9, 0x3, 0x2, 0x2, 0x2, 0xfc, 0xfd, 0x7, 0x28, 0x2, 0x2, 0xfd, 0x19, 0x3, 0x2, 0x2, 0x2, 0xfe, 0xff, 0x5, 0x28, 0x15, 0x2, 0xff, 0x100, 0x8, 0xe, 0x1, 0x2, 0x100, 0x101, 0x5, 0x2a, 0x16, 0x2, 0x101, 0x103, 0x8, 0xe, 0x1, 0x2, 0x102, 0x104, 0x5, 0x2c, 0x17, 0x2, 0x103, 0x102, 0x3, 0x2, 0x2, 0x2, 0x103, 0x104, 0x3, 0x2, 0x2, 0x2, 0x104, 0x105, 0x3, 0x2, 0x2, 0x2, 0x105, 0x106, 0x8, 0xe, 0x1, 0x2, 0x106, 0x107, 0x5, 0x2e, 0x18, 0x2, 0x107, 0x108, 0x8, 0xe, 0x1, 0x2, 0x108, 0x109, 0x5, 0x30, 0x19, 0x2, 0x109, 0x10b, 0x8, 0xe, 0x1, 0x2, 0x10a, 0x10c, 0x5, 0x32, 0x1a, 0x2, 0x10b, 0x10a, 0x3, 0x2, 0x2, 0x2, 0x10c, 0x10d, 0x3, 0x2, 0x2, 0x2, 0x10d, 0x10b, 0x3, 0x2, 0x2, 0x2, 0x10d, 0x10e, 0x3, 0x2, 0x2, 0x2, 0x10e, 0x10f, 0x3, 0x2, 0x2, 0x2, 0x10f, 0x111, 0x8, 0xe, 0x1, 0x2, 0x110, 0x112, 0x5, 0x34, 0x1b, 0x2, 0x111, 0x110, 0x3, 0x2, 0x2, 0x2, 0x112, 0x113, 0x3, 0x2, 0x2, 0x2, 0x113, 0x111, 0x3, 0x2, 0x2, 0x2, 0x113, 0x114, 0x3, 0x2, 0x2, 0x2, 0x114, 0x115, 0x3, 0x2, 0x2, 0x2, 0x115, 0x119, 0x8, 0xe, 0x1, 0x2, 0x116, 0x118, 0x5, 0x1c, 0xf, 0x2, 0x117, 0x116, 0x3, 0x2, 0x2, 0x2, 0x118, 0x11b, 0x3, 0x2, 0x2, 0x2, 0x119, 0x117, 0x3, 0x2, 0x2, 0x2, 0x119, 0x11a, 0x3, 0x2, 0x2, 0x2, 0x11a, 0x11c, 0x3, 0x2, 0x2, 0x2, 0x11b, 0x119, 0x3, 0x2, 0x2, 0x2, 0x11c, 0x120, 0x8, 0xe, 0x1, 0x2, 0x11d, 0x11f, 0x5, 0x3e, 0x20, 0x2, 0x11e, 0x11d, 0x3, 0x2, 0x2, 0x2, 0x11f, 0x122, 0x3, 0x2, 0x2, 0x2, 0x120, 0x11e, 0x3, 0x2, 0x2, 0x2, 0x120, 0x121, 0x3, 0x2, 0x2, 0x2, 0x121, 0x123, 0x3, 0x2, 0x2, 0x2, 0x122, 0x120, 0x3, 0x2, 0x2, 0x2, 0x123, 0x124, 0x8, 0xe, 0x1, 0x2, 0x124, 0x125, 0x5, 0x40, 0x21, 0x2, 0x125, 0x126, 0x8, 0xe, 0x1, 0x2, 0x126, 0x127, 0x5, 0x42, 0x22, 0x2, 0x127, 0x128, 0x8, 0xe, 0x1, 0x2, 0x128, 0x129, 0x5, 0x44, 0x23, 0x2, 0x129, 0x12a, 0x8, 0xe, 0x1, 0x2, 0x12a, 0x1b, 0x3, 0x2, 0x2, 0x2, 0x12b, 0x12c, 0x5, 0x36, 0x1c, 0x2, 0x12c, 0x12e, 0x8, 0xf, 0x1, 0x2, 0x12d, 0x12f, 0x5, 0x38, 0x1d, 0x2, 0x12e, 0x12d, 0x3, 0x2, 0x2, 0x2, 0x12e, 0x12f, 0x3, 0x2, 0x2, 0x2, 0x12f, 0x130, 0x3, 0x2, 0x2, 0x2, 0x130, 0x131, 0x8, 0xf, 0x1, 0x2, 0x131, 0x132, 0x5, 0x3a, 0x1e, 0x2, 0x132, 0x133, 0x8, 0xf, 0x1, 0x2, 0x133, 0x134, 0x5, 0x3c, 0x1f, 0x2, 0x134, 0x135, 0x8, 0xf, 0x1, 0x2, 0x135, 0x1d, 0x3, 0x2, 0x2, 0x2, 0x136, 0x137, 0x5, 0x46, 0x24, 0x2, 0x137, 0x138, 0x8, 0x10, 0x1, 0x2, 0x138, 0x139, 0x5, 0x48, 0x25, 0x2, 0x139, 0x13d, 0x8, 0x10, 0x1, 0x2, 0x13a, 0x13c, 0x5, 0x20, 0x11, 0x2, 0x13b, 0x13a, 0x3, 0x2, 0x2, 0x2, 0x13c, 0x13f, 0x3, 0x2, 0x2, 0x2, 0x13d, 0x13b, 0x3, 0x2, 0x2, 0x2, 0x13d, 0x13e, 0x3, 0x2, 0x2, 0x2, 0x13e, 0x140, 0x3, 0x2, 0x2, 0x2, 0x13f, 0x13d, 0x3, 0x2, 0x2, 0x2, 0x140, 0x142, 0x8, 0x10, 0x1, 0x2, 0x141, 0x143, 0x5, 0x22, 0x12, 0x2, 0x142, 0x141, 0x3, 0x2, 0x2, 0x2, 0x143, 0x144, 0x3, 0x2, 0x2, 0x2, 0x144, 0x142, 0x3, 0x2, 0x2, 0x2, 0x144, 0x145, 0x3, 0x2, 0x2, 0x2, 0x145, 0x146, 0x3, 0x2, 0x2, 0x2, 0x146, 0x147, 0x8, 0x10, 0x1, 0x2, 0x147, 0x1f, 0x3, 0x2, 0x2, 0x2, 0x148, 0x149, 0x5, 0x4a, 0x26, 0x2, 0x149, 0x14a, 0x8, 0x11, 0x1, 0x2, 0x14a, 0x14b, 0x5, 0x4c, 0x27, 0x2, 0x14b, 0x14d, 0x8, 0x11, 0x1, 0x2, 0x14c, 0x14e, 0x5, 0x4e, 0x28, 0x2, 0x14d, 0x14c, 0x3, 0x2, 0x2, 0x2, 0x14d, 0x14e, 0x3, 0x2, 0x2, 0x2, 0x14e, 0x14f, 0x3, 0x2, 0x2, 0x2, 0x14f, 0x150, 0x8, 0x11, 0x1, 0x2, 0x150, 0x151, 0x5, 0x50, 0x29, 0x2, 0x151, 0x152, 0x8, 0x11, 0x1, 0x2, 0x152, 0x21, 0x3, 0x2, 0x2, 0x2, 0x153, 0x154, 0x5, 0x52, 0x2a, 0x2, 0x154, 0x156, 0x8, 0x12, 0x1, 0x2, 0x155, 0x157, 0x5, 0x24, 0x13, 0x2, 0x156, 0x155, 0x3, 0x2, 0x2, 0x2, 0x157, 0x158, 0x3, 0x2, 0x2, 0x2, 0x158, 0x156, 0x3, 0x2, 0x2, 0x2, 0x158, 0x159, 0x3, 0x2, 0x2, 0x2, 0x159, 0x15a, 0x3, 0x2, 0x2, 0x2, 0x15a, 0x15c, 0x8, 0x12, 0x1, 0x2, 0x15b, 0x15d, 0x5, 0x26, 0x14, 0x2, 0x15c, 0x15b, 0x3, 0x2, 0x2, 0x2, 0x15c, 0x15d, 0x3, 0x2, 0x2, 0x2, 0x15d, 0x15e, 0x3, 0x2, 0x2, 0x2, 0x15e, 0x15f, 0x8, 0x12, 0x1, 0x2, 0x15f, 0x23, 0x3, 0x2, 0x2, 0x2, 0x160, 0x161, 0x5, 0x54, 0x2b, 0x2, 0x161, 0x163, 0x8, 0x13, 0x1, 0x2, 0x162, 0x164, 0x5, 0x56, 0x2c, 0x2, 0x163, 0x162, 0x3, 0x2, 0x2, 0x2, 0x163, 0x164, 0x3, 0x2, 0x2, 0x2, 0x164, 0x165, 0x3, 0x2, 0x2, 0x2, 0x165, 0x166, 0x8, 0x13, 0x1, 0x2, 0x166, 0x167, 0x5, 0x58, 0x2d, 0x2, 0x167, 0x168, 0x8, 0x13, 0x1, 0x2, 0x168, 0x169, 0x5, 0x5a, 0x2e, 0x2, 0x169, 0x16a, 0x8, 0x13, 0x1, 0x2, 0x16a, 0x25, 0x3, 0x2, 0x2, 0x2, 0x16b, 0x16c, 0x5, 0x5c, 0x2f, 0x2, 0x16c, 0x170, 0x8, 0x14, 0x1, 0x2, 0x16d, 0x16f, 0x5, 0x5e, 0x30, 0x2, 0x16e, 0x16d, 0x3, 0x2, 0x2, 0x2, 0x16f, 0x172, 0x3, 0x2, 0x2, 0x2, 0x170, 0x16e, 0x3, 0x2, 0x2, 0x2, 0x170, 0x171, 0x3, 0x2, 0x2, 0x2, 0x171, 0x173, 0x3, 0x2, 0x2, 0x2, 0x172, 0x170, 0x3, 0x2, 0x2, 0x2, 0x173, 0x174, 0x8, 0x14, 0x1, 0x2, 0x174, 0x175, 0x5, 0x60, 0x31, 0x2, 0x175, 0x177, 0x8, 0x14, 0x1, 0x2, 0x176, 0x178, 0x5, 0x62, 0x32, 0x2, 0x177, 0x176, 0x3, 0x2, 0x2, 0x2, 0x178, 0x179, 0x3, 0x2, 0x2, 0x2, 0x179, 0x177, 0x3, 0x2, 0x2, 0x2, 0x179, 0x17a, 0x3, 0x2, 0x2, 0x2, 0x17a, 0x17b, 0x3, 0x2, 0x2, 0x2, 0x17b, 0x17f, 0x8, 0x14, 0x1, 0x2, 0x17c, 0x17e, 0x5, 0x64, 0x33, 0x2, 0x17d, 0x17c, 0x3, 0x2, 0x2, 0x2, 0x17e, 0x181, 0x3, 0x2, 0x2, 0x2, 0x17f, 0x17d, 0x3, 0x2, 0x2, 0x2, 0x17f, 0x180, 0x3, 0x2, 0x2, 0x2, 0x180, 0x182, 0x3, 0x2, 0x2, 0x2, 0x181, 0x17f, 0x3, 0x2, 0x2, 0x2, 0x182, 0x184, 0x8, 0x14, 0x1, 0x2, 0x183, 0x185, 0x5, 0x66, 0x34, 0x2, 0x184, 0x183, 0x3, 0x2, 0x2, 0x2, 0x185, 0x186, 0x3, 0x2, 0x2, 0x2, 0x186, 0x184, 0x3, 0x2, 0x2, 0x2, 0x186, 0x187, 0x3, 0x2, 0x2, 0x2, 0x187, 0x188, 0x3, 0x2, 0x2, 0x2, 0x188, 0x18a, 0x8, 0x14, 0x1, 0x2, 0x189, 0x18b, 0x5, 0x68, 0x35, 0x2, 0x18a, 0x189, 0x3, 0x2, 0x2, 0x2, 0x18b, 0x18c, 0x3, 0x2, 0x2, 0x2, 0x18c, 0x18a, 0x3, 0x2, 0x2, 0x2, 0x18c, 0x18d, 0x3, 0x2, 0x2, 0x2, 0x18d, 0x18e, 0x3, 0x2, 0x2, 0x2, 0x18e, 0x190, 0x8, 0x14, 0x1, 0x2, 0x18f, 0x191, 0x5, 0x6a, 0x36, 0x2, 0x190, 0x18f, 0x3, 0x2, 0x2, 0x2, 0x190, 0x191, 0x3, 0x2, 0x2, 0x2, 0x191, 0x192, 0x3, 0x2, 0x2, 0x2, 0x192, 0x193, 0x8, 0x14, 0x1, 0x2, 0x193, 0x27, 0x3, 0x2, 0x2, 0x2, 0x194, 0x195, 0x7, 0x2c, 0x2, 0x2, 0x195, 0x197, 0x7, 0x3, 0x2, 0x2, 0x196, 0x198, 0xa, 0x4, 0x2, 0x2, 0x197, 0x196, 0x3, 0x2, 0x2, 0x2, 0x198, 0x199, 0x3, 0x2, 0x2, 0x2, 0x199, 0x197, 0x3, 0x2, 0x2, 0x2, 0x199, 0x19a, 0x3, 0x2, 0x2, 0x2, 0x19a, 0x29, 0x3, 0x2, 0x2, 0x2, 0x19b, 0x19c, 0x5, 0x6c, 0x37, 0x2, 0x19c, 0x19d, 0x8, 0x16, 0x1, 0x2, 0x19d, 0x2b, 0x3, 0x2, 0x2, 0x2, 0x19e, 0x19f, 0x5, 0x6e, 0x38, 0x2, 0x19f, 0x1a0, 0x8, 0x17, 0x1, 0x2, 0x1a0, 0x1a5, 0x3, 0x2, 0x2, 0x2, 0x1a1, 0x1a2, 0x5, 0x70, 0x39, 0x2, 0x1a2, 0x1a3, 0x8, 0x17, 0x1, 0x2, 0x1a3, 0x1a5, 0x3, 0x2, 0x2, 0x2, 0x1a4, 0x19e, 0x3, 0x2, 0x2, 0x2, 0x1a4, 0x1a1, 0x3, 0x2, 0x2, 0x2, 0x1a5, 0x2d, 0x3, 0x2, 0x2, 0x2, 0x1a6, 0x1a7, 0x5, 0x72, 0x3a, 0x2, 0x1a7, 0x1a8, 0x8, 0x18, 0x1, 0x2, 0x1a8, 0x2f, 0x3, 0x2, 0x2, 0x2, 0x1a9, 0x1aa, 0x5, 0x74, 0x3b, 0x2, 0x1aa, 0x1ab, 0x8, 0x19, 0x1, 0x2, 0x1ab, 0x31, 0x3, 0x2, 0x2, 0x2, 0x1ac, 0x1ad, 0x5, 0x76, 0x3c, 0x2, 0x1ad, 0x1ae, 0x8, 0x1a, 0x1, 0x2, 0x1ae, 0x1b6, 0x3, 0x2, 0x2, 0x2, 0x1af, 0x1b0, 0x5, 0x78, 0x3d, 0x2, 0x1b0, 0x1b1, 0x8, 0x1a, 0x1, 0x2, 0x1b1, 0x1b6, 0x3, 0x2, 0x2, 0x2, 0x1b2, 0x1b3, 0x5, 0x7a, 0x3e, 0x2, 0x1b3, 0x1b4, 0x8, 0x1a, 0x1, 0x2, 0x1b4, 0x1b6, 0x3, 0x2, 0x2, 0x2, 0x1b5, 0x1ac, 0x3, 0x2, 0x2, 0x2, 0x1b5, 0x1af, 0x3, 0x2, 0x2, 0x2, 0x1b5, 0x1b2, 0x3, 0x2, 0x2, 0x2, 0x1b6, 0x33, 0x3, 0x2, 0x2, 0x2, 0x1b7, 0x1b8, 0x5, 0x7c, 0x3f, 0x2, 0x1b8, 0x1b9, 0x8, 0x1b, 0x1, 0x2, 0x1b9, 0x1be, 0x3, 0x2, 0x2, 0x2, 0x1ba, 0x1bb, 0x5, 0x7e, 0x40, 0x2, 0x1bb, 0x1bc, 0x8, 0x1b, 0x1, 0x2, 0x1bc, 0x1be, 0x3, 0x2, 0x2, 0x2, 0x1bd, 0x1b7, 0x3, 0x2, 0x2, 0x2, 0x1bd, 0x1ba, 0x3, 0x2, 0x2, 0x2, 0x1be, 0x35, 0x3, 0x2, 0x2, 0x2, 0x1bf, 0x1c0, 0x7, 0x2c, 0x2, 0x2, 0x1c0, 0x1c2, 0x7, 0x3, 0x2, 0x2, 0x1c1, 0x1c3, 0xa, 0x4, 0x2, 0x2, 0x1c2, 0x1c1, 0x3, 0x2, 0x2, 0x2, 0x1c3, 0x1c4, 0x3, 0x2, 0x2, 0x2, 0x1c4, 0x1c2, 0x3, 0x2, 0x2, 0x2, 0x1c4, 0x1c5, 0x3, 0x2, 0x2, 0x2, 0x1c5, 0x37, 0x3, 0x2, 0x2, 0x2, 0x1c6, 0x1c7, 0x5, 0x80, 0x41, 0x2, 0x1c7, 0x1c8, 0x8, 0x1d, 0x1, 0x2, 0x1c8, 0x1cd, 0x3, 0x2, 0x2, 0x2, 0x1c9, 0x1ca, 0x5, 0x82, 0x42, 0x2, 0x1ca, 0x1cb, 0x8, 0x1d, 0x1, 0x2, 0x1cb, 0x1cd, 0x3, 0x2, 0x2, 0x2, 0x1cc, 0x1c6, 0x3, 0x2, 0x2, 0x2, 0x1cc, 0x1c9, 0x3, 0x2, 0x2, 0x2, 0x1cd, 0x39, 0x3, 0x2, 0x2, 0x2, 0x1ce, 0x1cf, 0x5, 0x84, 0x43, 0x2, 0x1cf, 0x1d0, 0x8, 0x1e, 0x1, 0x2, 0x1d0, 0x3b, 0x3, 0x2, 0x2, 0x2, 0x1d1, 0x1d2, 0x7, 0x2c, 0x2, 0x2, 0x1d2, 0x1d4, 0x7, 0x4, 0x2, 0x2, 0x1d3, 0x1d5, 0xa, 0x4, 0x2, 0x2, 0x1d4, 0x1d3, 0x3, 0x2, 0x2, 0x2, 0x1d5, 0x1d6, 0x3, 0x2, 0x2, 0x2, 0x1d6, 0x1d4, 0x3, 0x2, 0x2, 0x2, 0x1d6, 0x1d7, 0x3, 0x2, 0x2, 0x2, 0x1d7, 0x3d, 0x3, 0x2, 0x2, 0x2, 0x1d8, 0x1d9, 0x5, 0x86, 0x44, 0x2, 0x1d9, 0x1da, 0x8, 0x20, 0x1, 0x2, 0x1da, 0x1e2, 0x3, 0x2, 0x2, 0x2, 0x1db, 0x1dc, 0x5, 0x88, 0x45, 0x2, 0x1dc, 0x1dd, 0x8, 0x20, 0x1, 0x2, 0x1dd, 0x1e2, 0x3, 0x2, 0x2, 0x2, 0x1de, 0x1df, 0x5, 0x8a, 0x46, 0x2, 0x1df, 0x1e0, 0x8, 0x20, 0x1, 0x2, 0x1e0, 0x1e2, 0x3, 0x2, 0x2, 0x2, 0x1e1, 0x1d8, 0x3, 0x2, 0x2, 0x2, 0x1e1, 0x1db, 0x3, 0x2, 0x2, 0x2, 0x1e1, 0x1de, 0x3, 0x2, 0x2, 0x2, 0x1e2, 0x3f, 0x3, 0x2, 0x2, 0x2, 0x1e3, 0x1e4, 0x5, 0x8c, 0x47, 0x2, 0x1e4, 0x1e5, 0x8, 0x21, 0x1, 0x2, 0x1e5, 0x1ea, 0x3, 0x2, 0x2, 0x2, 0x1e6, 0x1e7, 0x5, 0x8e, 0x48, 0x2, 0x1e7, 0x1e8, 0x8, 0x21, 0x1, 0x2, 0x1e8, 0x1ea, 0x3, 0x2, 0x2, 0x2, 0x1e9, 0x1e3, 0x3, 0x2, 0x2, 0x2, 0x1e9, 0x1e6, 0x3, 0x2, 0x2, 0x2, 0x1ea, 0x41, 0x3, 0x2, 0x2, 0x2, 0x1eb, 0x1ec, 0x5, 0x90, 0x49, 0x2, 0x1ec, 0x1ed, 0x8, 0x22, 0x1, 0x2, 0x1ed, 0x43, 0x3, 0x2, 0x2, 0x2, 0x1ee, 0x1ef, 0x7, 0x2c, 0x2, 0x2, 0x1ef, 0x1f1, 0x7, 0x4, 0x2, 0x2, 0x1f0, 0x1f2, 0xa, 0x4, 0x2, 0x2, 0x1f1, 0x1f0, 0x3, 0x2, 0x2, 0x2, 0x1f2, 0x1f3, 0x3, 0x2, 0x2, 0x2, 0x1f3, 0x1f1, 0x3, 0x2, 0x2, 0x2, 0x1f3, 0x1f4, 0x3, 0x2, 0x2, 0x2, 0x1f4, 0x45, 0x3, 0x2, 0x2, 0x2, 0x1f5, 0x1f6, 0x7, 0x2c, 0x2, 0x2, 0x1f6, 0x1f8, 0x7, 0x3, 0x2, 0x2, 0x1f7, 0x1f9, 0xa, 0x4, 0x2, 0x2, 0x1f8, 0x1f7, 0x3, 0x2, 0x2, 0x2, 0x1f9, 0x1fa, 0x3, 0x2, 0x2, 0x2, 0x1fa, 0x1f8, 0x3, 0x2, 0x2, 0x2, 0x1fa, 0x1fb, 0x3, 0x2, 0x2, 0x2, 0x1fb, 0x47, 0x3, 0x2, 0x2, 0x2, 0x1fc, 0x1fd, 0x5, 0x92, 0x4a, 0x2, 0x1fd, 0x1fe, 0x8, 0x25, 0x1, 0x2, 0x1fe, 0x49, 0x3, 0x2, 0x2, 0x2, 0x1ff, 0x200, 0x7, 0x2c, 0x2, 0x2, 0x200, 0x202, 0x7, 0x3, 0x2, 0x2, 0x201, 0x203, 0xa, 0x4, 0x2, 0x2, 0x202, 0x201, 0x3, 0x2, 0x2, 0x2, 0x203, 0x204, 0x3, 0x2, 0x2, 0x2, 0x204, 0x202, 0x3, 0x2, 0x2, 0x2, 0x204, 0x205, 0x3, 0x2, 0x2, 0x2, 0x205, 0x4b, 0x3, 0x2, 0x2, 0x2, 0x206, 0x207, 0x5, 0x94, 0x4b, 0x2, 0x207, 0x208, 0x8, 0x27, 0x1, 0x2, 0x208, 0x4d, 0x3, 0x2, 0x2, 0x2, 0x209, 0x20a, 0x5, 0x96, 0x4c, 0x2, 0x20a, 0x20b, 0x8, 0x28, 0x1, 0x2, 0x20b, 0x4f, 0x3, 0x2, 0x2, 0x2, 0x20c, 0x20d, 0x7, 0x2c, 0x2, 0x2, 0x20d, 0x20f, 0x7, 0x4, 0x2, 0x2, 0x20e, 0x210, 0xa, 0x4, 0x2, 0x2, 0x20f, 0x20e, 0x3, 0x2, 0x2, 0x2, 0x210, 0x211, 0x3, 0x2, 0x2, 0x2, 0x211, 0x20f, 0x3, 0x2, 0x2, 0x2, 0x211, 0x212, 0x3, 0x2, 0x2, 0x2, 0x212, 0x51, 0x3, 0x2, 0x2, 0x2, 0x213, 0x214, 0x7, 0x2c, 0x2, 0x2, 0x214, 0x216, 0x7, 0x3, 0x2, 0x2, 0x215, 0x217, 0xa, 0x4, 0x2, 0x2, 0x216, 0x215, 0x3, 0x2, 0x2, 0x2, 0x217, 0x218, 0x3, 0x2, 0x2, 0x2, 0x218, 0x216, 0x3, 0x2, 0x2, 0x2, 0x218, 0x219, 0x3, 0x2, 0x2, 0x2, 0x219, 0x53, 0x3, 0x2, 0x2, 0x2, 0x21a, 0x21b, 0x7, 0x2c, 0x2, 0x2, 0x21b, 0x21d, 0x7, 0x3, 0x2, 0x2, 0x21c, 0x21e, 0xa, 0x4, 0x2, 0x2, 0x21d, 0x21c, 0x3, 0x2, 0x2, 0x2, 0x21e, 0x21f, 0x3, 0x2, 0x2, 0x2, 0x21f, 0x21d, 0x3, 0x2, 0x2, 0x2, 0x21f, 0x220, 0x3, 0x2, 0x2, 0x2, 0x220, 0x55, 0x3, 0x2, 0x2, 0x2, 0x221, 0x222, 0x5, 0x98, 0x4d, 0x2, 0x222, 0x223, 0x8, 0x2c, 0x1, 0x2, 0x223, 0x228, 0x3, 0x2, 0x2, 0x2, 0x224, 0x225, 0x5, 0x9a, 0x4e, 0x2, 0x225, 0x226, 0x8, 0x2c, 0x1, 0x2, 0x226, 0x228, 0x3, 0x2, 0x2, 0x2, 0x227, 0x221, 0x3, 0x2, 0x2, 0x2, 0x227, 0x224, 0x3, 0x2, 0x2, 0x2, 0x228, 0x57, 0x3, 0x2, 0x2, 0x2, 0x229, 0x22a, 0x5, 0x9c, 0x4f, 0x2, 0x22a, 0x22b, 0x8, 0x2d, 0x1, 0x2, 0x22b, 0x59, 0x3, 0x2, 0x2, 0x2, 0x22c, 0x22d, 0x7, 0x2c, 0x2, 0x2, 0x22d, 0x22f, 0x7, 0x4, 0x2, 0x2, 0x22e, 0x230, 0xa, 0x4, 0x2, 0x2, 0x22f, 0x22e, 0x3, 0x2, 0x2, 0x2, 0x230, 0x231, 0x3, 0x2, 0x2, 0x2, 0x231, 0x22f, 0x3, 0x2, 0x2, 0x2, 0x231, 0x232, 0x3, 0x2, 0x2, 0x2, 0x232, 0x5b, 0x3, 0x2, 0x2, 0x2, 0x233, 0x234, 0x7, 0x2c, 0x2, 0x2, 0x234, 0x236, 0x7, 0x3, 0x2, 0x2, 0x235, 0x237, 0xa, 0x4, 0x2, 0x2, 0x236, 0x235, 0x3, 0x2, 0x2, 0x2, 0x237, 0x238, 0x3, 0x2, 0x2, 0x2, 0x238, 0x236, 0x3, 0x2, 0x2, 0x2, 0x238, 0x239, 0x3, 0x2, 0x2, 0x2, 0x239, 0x5d, 0x3, 0x2, 0x2, 0x2, 0x23a, 0x23b, 0x5, 0x9e, 0x50, 0x2, 0x23b, 0x23c, 0x8, 0x30, 0x1, 0x2, 0x23c, 0x24a, 0x3, 0x2, 0x2, 0x2, 0x23d, 0x23e, 0x5, 0xa0, 0x51, 0x2, 0x23e, 0x23f, 0x8, 0x30, 0x1, 0x2, 0x23f, 0x24a, 0x3, 0x2, 0x2, 0x2, 0x240, 0x241, 0x5, 0xa2, 0x52, 0x2, 0x241, 0x242, 0x8, 0x30, 0x1, 0x2, 0x242, 0x24a, 0x3, 0x2, 0x2, 0x2, 0x243, 0x244, 0x5, 0xa4, 0x53, 0x2, 0x244, 0x245, 0x8, 0x30, 0x1, 0x2, 0x245, 0x24a, 0x3, 0x2, 0x2, 0x2, 0x246, 0x247, 0x5, 0xa6, 0x54, 0x2, 0x247, 0x248, 0x8, 0x30, 0x1, 0x2, 0x248, 0x24a, 0x3, 0x2, 0x2, 0x2, 0x249, 0x23a, 0x3, 0x2, 0x2, 0x2, 0x249, 0x23d, 0x3, 0x2, 0x2, 0x2, 0x249, 0x240, 0x3, 0x2, 0x2, 0x2, 0x249, 0x243, 0x3, 0x2, 0x2, 0x2, 0x249, 0x246, 0x3, 0x2, 0x2, 0x2, 0x24a, 0x5f, 0x3, 0x2, 0x2, 0x2, 0x24b, 0x24c, 0x5, 0xa8, 0x55, 0x2, 0x24c, 0x24d, 0x8, 0x31, 0x1, 0x2, 0x24d, 0x61, 0x3, 0x2, 0x2, 0x2, 0x24e, 0x24f, 0x5, 0xaa, 0x56, 0x2, 0x24f, 0x250, 0x8, 0x32, 0x1, 0x2, 0x250, 0x63, 0x3, 0x2, 0x2, 0x2, 0x251, 0x252, 0x5, 0xac, 0x57, 0x2, 0x252, 0x253, 0x8, 0x33, 0x1, 0x2, 0x253, 0x65, 0x3, 0x2, 0x2, 0x2, 0x254, 0x255, 0x5, 0xae, 0x58, 0x2, 0x255, 0x256, 0x8, 0x34, 0x1, 0x2, 0x256, 0x25b, 0x3, 0x2, 0x2, 0x2, 0x257, 0x258, 0x5, 0xb0, 0x59, 0x2, 0x258, 0x259, 0x8, 0x34, 0x1, 0x2, 0x259, 0x25b, 0x3, 0x2, 0x2, 0x2, 0x25a, 0x254, 0x3, 0x2, 0x2, 0x2, 0x25a, 0x257, 0x3, 0x2, 0x2, 0x2, 0x25b, 0x67, 0x3, 0x2, 0x2, 0x2, 0x25c, 0x25d, 0x5, 0xb2, 0x5a, 0x2, 0x25d, 0x25e, 0x8, 0x35, 0x1, 0x2, 0x25e, 0x266, 0x3, 0x2, 0x2, 0x2, 0x25f, 0x260, 0x5, 0xb4, 0x5b, 0x2, 0x260, 0x261, 0x8, 0x35, 0x1, 0x2, 0x261, 0x266, 0x3, 0x2, 0x2, 0x2, 0x262, 0x263, 0x5, 0xb6, 0x5c, 0x2, 0x263, 0x264, 0x8, 0x35, 0x1, 0x2, 0x264, 0x266, 0x3, 0x2, 0x2, 0x2, 0x265, 0x25c, 0x3, 0x2, 0x2, 0x2, 0x265, 0x25f, 0x3, 0x2, 0x2, 0x2, 0x265, 0x262, 0x3, 0x2, 0x2, 0x2, 0x266, 0x69, 0x3, 0x2, 0x2, 0x2, 0x267, 0x268, 0x5, 0xb8, 0x5d, 0x2, 0x268, 0x269, 0x8, 0x36, 0x1, 0x2, 0x269, 0x6b, 0x3, 0x2, 0x2, 0x2, 0x26a, 0x26b, 0x7, 0x2c, 0x2, 0x2, 0x26b, 0x26d, 0x7, 0x5, 0x2, 0x2, 0x26c, 0x26e, 0xa, 0x4, 0x2, 0x2, 0x26d, 0x26c, 0x3, 0x2, 0x2, 0x2, 0x26e, 0x26f, 0x3, 0x2, 0x2, 0x2, 0x26f, 0x26d, 0x3, 0x2, 0x2, 0x2, 0x26f, 0x270, 0x3, 0x2, 0x2, 0x2, 0x270, 0x6d, 0x3, 0x2, 0x2, 0x2, 0x271, 0x272, 0x7, 0x2c, 0x2, 0x2, 0x272, 0x274, 0x7, 0x6, 0x2, 0x2, 0x273, 0x275, 0xa, 0x4, 0x2, 0x2, 0x274, 0x273, 0x3, 0x2, 0x2, 0x2, 0x275, 0x276, 0x3, 0x2, 0x2, 0x2, 0x276, 0x274, 0x3, 0x2, 0x2, 0x2, 0x276, 0x277, 0x3, 0x2, 0x2, 0x2, 0x277, 0x6f, 0x3, 0x2, 0x2, 0x2, 0x278, 0x279, 0x7, 0x2c, 0x2, 0x2, 0x279, 0x27b, 0x7, 0x7, 0x2, 0x2, 0x27a, 0x27c, 0xa, 0x4, 0x2, 0x2, 0x27b, 0x27a, 0x3, 0x2, 0x2, 0x2, 0x27c, 0x27d, 0x3, 0x2, 0x2, 0x2, 0x27d, 0x27b, 0x3, 0x2, 0x2, 0x2, 0x27d, 0x27e, 0x3, 0x2, 0x2, 0x2, 0x27e, 0x71, 0x3, 0x2, 0x2, 0x2, 0x27f, 0x280, 0x7, 0x2c, 0x2, 0x2, 0x280, 0x282, 0x7, 0x8, 0x2, 0x2, 0x281, 0x283, 0xa, 0x4, 0x2, 0x2, 0x282, 0x281, 0x3, 0x2, 0x2, 0x2, 0x283, 0x284, 0x3, 0x2, 0x2, 0x2, 0x284, 0x282, 0x3, 0x2, 0x2, 0x2, 0x284, 0x285, 0x3, 0x2, 0x2, 0x2, 0x285, 0x73, 0x3, 0x2, 0x2, 0x2, 0x286, 0x287, 0x7, 0x2c, 0x2, 0x2, 0x287, 0x289, 0x7, 0x9, 0x2, 0x2, 0x288, 0x28a, 0xa, 0x4, 0x2, 0x2, 0x289, 0x288, 0x3, 0x2, 0x2, 0x2, 0x28a, 0x28b, 0x3, 0x2, 0x2, 0x2, 0x28b, 0x289, 0x3, 0x2, 0x2, 0x2, 0x28b, 0x28c, 0x3, 0x2, 0x2, 0x2, 0x28c, 0x75, 0x3, 0x2, 0x2, 0x2, 0x28d, 0x28e, 0x7, 0x2c, 0x2, 0x2, 0x28e, 0x290, 0x7, 0xa, 0x2, 0x2, 0x28f, 0x291, 0xa, 0x4, 0x2, 0x2, 0x290, 0x28f, 0x3, 0x2, 0x2, 0x2, 0x291, 0x292, 0x3, 0x2, 0x2, 0x2, 0x292, 0x290, 0x3, 0x2, 0x2, 0x2, 0x292, 0x293, 0x3, 0x2, 0x2, 0x2, 0x293, 0x77, 0x3, 0x2, 0x2, 0x2, 0x294, 0x295, 0x7, 0x2c, 0x2, 0x2, 0x295, 0x297, 0x7, 0xb, 0x2, 0x2, 0x296, 0x298, 0xa, 0x4, 0x2, 0x2, 0x297, 0x296, 0x3, 0x2, 0x2, 0x2, 0x298, 0x299, 0x3, 0x2, 0x2, 0x2, 0x299, 0x297, 0x3, 0x2, 0x2, 0x2, 0x299, 0x29a, 0x3, 0x2, 0x2, 0x2, 0x29a, 0x79, 0x3, 0x2, 0x2, 0x2, 0x29b, 0x29c, 0x7, 0x2c, 0x2, 0x2, 0x29c, 0x29e, 0x7, 0xc, 0x2, 0x2, 0x29d, 0x29f, 0xa, 0x4, 0x2, 0x2, 0x29e, 0x29d, 0x3, 0x2, 0x2, 0x2, 0x29f, 0x2a0, 0x3, 0x2, 0x2, 0x2, 0x2a0, 0x29e, 0x3, 0x2, 0x2, 0x2, 0x2a0, 0x2a1, 0x3, 0x2, 0x2, 0x2, 0x2a1, 0x7b, 0x3, 0x2, 0x2, 0x2, 0x2a2, 0x2a3, 0x7, 0x2c, 0x2, 0x2, 0x2a3, 0x2a5, 0x7, 0xd, 0x2, 0x2, 0x2a4, 0x2a6, 0xa, 0x4, 0x2, 0x2, 0x2a5, 0x2a4, 0x3, 0x2, 0x2, 0x2, 0x2a6, 0x2a7, 0x3, 0x2, 0x2, 0x2, 0x2a7, 0x2a5, 0x3, 0x2, 0x2, 0x2, 0x2a7, 0x2a8, 0x3, 0x2, 0x2, 0x2, 0x2a8, 0x7d, 0x3, 0x2, 0x2, 0x2, 0x2a9, 0x2aa, 0x7, 0x2c, 0x2, 0x2, 0x2aa, 0x2ac, 0x7, 0xe, 0x2, 0x2, 0x2ab, 0x2ad, 0xa, 0x4, 0x2, 0x2, 0x2ac, 0x2ab, 0x3, 0x2, 0x2, 0x2, 0x2ad, 0x2ae, 0x3, 0x2, 0x2, 0x2, 0x2ae, 0x2ac, 0x3, 0x2, 0x2, 0x2, 0x2ae, 0x2af, 0x3, 0x2, 0x2, 0x2, 0x2af, 0x7f, 0x3, 0x2, 0x2, 0x2, 0x2b0, 0x2b1, 0x7, 0x2c, 0x2, 0x2, 0x2b1, 0x2b3, 0x7, 0x6, 0x2, 0x2, 0x2b2, 0x2b4, 0xa, 0x4, 0x2, 0x2, 0x2b3, 0x2b2, 0x3, 0x2, 0x2, 0x2, 0x2b4, 0x2b5, 0x3, 0x2, 0x2, 0x2, 0x2b5, 0x2b3, 0x3, 0x2, 0x2, 0x2, 0x2b5, 0x2b6, 0x3, 0x2, 0x2, 0x2, 0x2b6, 0x81, 0x3, 0x2, 0x2, 0x2, 0x2b7, 0x2b8, 0x7, 0x2c, 0x2, 0x2, 0x2b8, 0x2ba, 0x7, 0xf, 0x2, 0x2, 0x2b9, 0x2bb, 0xa, 0x4, 0x2, 0x2, 0x2ba, 0x2b9, 0x3, 0x2, 0x2, 0x2, 0x2bb, 0x2bc, 0x3, 0x2, 0x2, 0x2, 0x2bc, 0x2ba, 0x3, 0x2, 0x2, 0x2, 0x2bc, 0x2bd, 0x3, 0x2, 0x2, 0x2, 0x2bd, 0x83, 0x3, 0x2, 0x2, 0x2, 0x2be, 0x2bf, 0x7, 0x2c, 0x2, 0x2, 0x2bf, 0x2c1, 0x7, 0x8, 0x2, 0x2, 0x2c0, 0x2c2, 0xa, 0x4, 0x2, 0x2, 0x2c1, 0x2c0, 0x3, 0x2, 0x2, 0x2, 0x2c2, 0x2c3, 0x3, 0x2, 0x2, 0x2, 0x2c3, 0x2c1, 0x3, 0x2, 0x2, 0x2, 0x2c3, 0x2c4, 0x3, 0x2, 0x2, 0x2, 0x2c4, 0x85, 0x3, 0x2, 0x2, 0x2, 0x2c5, 0x2c6, 0x7, 0x2c, 0x2, 0x2, 0x2c6, 0x2c8, 0x7, 0x10, 0x2, 0x2, 0x2c7, 0x2c9, 0xa, 0x4, 0x2, 0x2, 0x2c8, 0x2c7, 0x3, 0x2, 0x2, 0x2, 0x2c9, 0x2ca, 0x3, 0x2, 0x2, 0x2, 0x2ca, 0x2c8, 0x3, 0x2, 0x2, 0x2, 0x2ca, 0x2cb, 0x3, 0x2, 0x2, 0x2, 0x2cb, 0x87, 0x3, 0x2, 0x2, 0x2, 0x2cc, 0x2cd, 0x7, 0x2c, 0x2, 0x2, 0x2cd, 0x2cf, 0x7, 0x11, 0x2, 0x2, 0x2ce, 0x2d0, 0xa, 0x4, 0x2, 0x2, 0x2cf, 0x2ce, 0x3, 0x2, 0x2, 0x2, 0x2d0, 0x2d1, 0x3, 0x2, 0x2, 0x2, 0x2d1, 0x2cf, 0x3, 0x2, 0x2, 0x2, 0x2d1, 0x2d2, 0x3, 0x2, 0x2, 0x2, 0x2d2, 0x89, 0x3, 0x2, 0x2, 0x2, 0x2d3, 0x2d4, 0x7, 0x2c, 0x2, 0x2, 0x2d4, 0x2d6, 0x7, 0x12, 0x2, 0x2, 0x2d5, 0x2d7, 0xa, 0x4, 0x2, 0x2, 0x2d6, 0x2d5, 0x3, 0x2, 0x2, 0x2, 0x2d7, 0x2d8, 0x3, 0x2, 0x2, 0x2, 0x2d8, 0x2d6, 0x3, 0x2, 0x2, 0x2, 0x2d8, 0x2d9, 0x3, 0x2, 0x2, 0x2, 0x2d9, 0x8b, 0x3, 0x2, 0x2, 0x2, 0x2da, 0x2db, 0x7, 0x2c, 0x2, 0x2, 0x2db, 0x2dd, 0x7, 0x13, 0x2, 0x2, 0x2dc, 0x2de, 0xa, 0x4, 0x2, 0x2, 0x2dd, 0x2dc, 0x3, 0x2, 0x2, 0x2, 0x2de, 0x2df, 0x3, 0x2, 0x2, 0x2, 0x2df, 0x2dd, 0x3, 0x2, 0x2, 0x2, 0x2df, 0x2e0, 0x3, 0x2, 0x2, 0x2, 0x2e0, 0x8d, 0x3, 0x2, 0x2, 0x2, 0x2e1, 0x2e2, 0x7, 0x2c, 0x2, 0x2, 0x2e2, 0x2e4, 0x7, 0x14, 0x2, 0x2, 0x2e3, 0x2e5, 0xa, 0x4, 0x2, 0x2, 0x2e4, 0x2e3, 0x3, 0x2, 0x2, 0x2, 0x2e5, 0x2e6, 0x3, 0x2, 0x2, 0x2, 0x2e6, 0x2e4, 0x3, 0x2, 0x2, 0x2, 0x2e6, 0x2e7, 0x3, 0x2, 0x2, 0x2, 0x2e7, 0x8f, 0x3, 0x2, 0x2, 0x2, 0x2e8, 0x2e9, 0x7, 0x2c, 0x2, 0x2, 0x2e9, 0x2eb, 0x7, 0x15, 0x2, 0x2, 0x2ea, 0x2ec, 0xa, 0x4, 0x2, 0x2, 0x2eb, 0x2ea, 0x3, 0x2, 0x2, 0x2, 0x2ec, 0x2ed, 0x3, 0x2, 0x2, 0x2, 0x2ed, 0x2eb, 0x3, 0x2, 0x2, 0x2, 0x2ed, 0x2ee, 0x3, 0x2, 0x2, 0x2, 0x2ee, 0x91, 0x3, 0x2, 0x2, 0x2, 0x2ef, 0x2f0, 0x7, 0x2c, 0x2, 0x2, 0x2f0, 0x2f2, 0x7, 0x16, 0x2, 0x2, 0x2f1, 0x2f3, 0xa, 0x4, 0x2, 0x2, 0x2f2, 0x2f1, 0x3, 0x2, 0x2, 0x2, 0x2f3, 0x2f4, 0x3, 0x2, 0x2, 0x2, 0x2f4, 0x2f2, 0x3, 0x2, 0x2, 0x2, 0x2f4, 0x2f5, 0x3, 0x2, 0x2, 0x2, 0x2f5, 0x93, 0x3, 0x2, 0x2, 0x2, 0x2f6, 0x2f7, 0x7, 0x2c, 0x2, 0x2, 0x2f7, 0x2f9, 0x7, 0x17, 0x2, 0x2, 0x2f8, 0x2fa, 0xa, 0x4, 0x2, 0x2, 0x2f9, 0x2f8, 0x3, 0x2, 0x2, 0x2, 0x2fa, 0x2fb, 0x3, 0x2, 0x2, 0x2, 0x2fb, 0x2f9, 0x3, 0x2, 0x2, 0x2, 0x2fb, 0x2fc, 0x3, 0x2, 0x2, 0x2, 0x2fc, 0x95, 0x3, 0x2, 0x2, 0x2, 0x2fd, 0x2fe, 0x7, 0x2c, 0x2, 0x2, 0x2fe, 0x300, 0x7, 0x18, 0x2, 0x2, 0x2ff, 0x301, 0xa, 0x4, 0x2, 0x2, 0x300, 0x2ff, 0x3, 0x2, 0x2, 0x2, 0x301, 0x302, 0x3, 0x2, 0x2, 0x2, 0x302, 0x300, 0x3, 0x2, 0x2, 0x2, 0x302, 0x303, 0x3, 0x2, 0x2, 0x2, 0x303, 0x97, 0x3, 0x2, 0x2, 0x2, 0x304, 0x305, 0x7, 0x2c, 0x2, 0x2, 0x305, 0x307, 0x7, 0x6, 0x2, 0x2, 0x306, 0x308, 0xa, 0x4, 0x2, 0x2, 0x307, 0x306, 0x3, 0x2, 0x2, 0x2, 0x308, 0x309, 0x3, 0x2, 0x2, 0x2, 0x309, 0x307, 0x3, 0x2, 0x2, 0x2, 0x309, 0x30a, 0x3, 0x2, 0x2, 0x2, 0x30a, 0x99, 0x3, 0x2, 0x2, 0x2, 0x30b, 0x30c, 0x7, 0x2c, 0x2, 0x2, 0x30c, 0x30e, 0x7, 0xf, 0x2, 0x2, 0x30d, 0x30f, 0xa, 0x4, 0x2, 0x2, 0x30e, 0x30d, 0x3, 0x2, 0x2, 0x2, 0x30f, 0x310, 0x3, 0x2, 0x2, 0x2, 0x310, 0x30e, 0x3, 0x2, 0x2, 0x2, 0x310, 0x311, 0x3, 0x2, 0x2, 0x2, 0x311, 0x9b, 0x3, 0x2, 0x2, 0x2, 0x312, 0x313, 0x7, 0x2c, 0x2, 0x2, 0x313, 0x315, 0x7, 0x8, 0x2, 0x2, 0x314, 0x316, 0xa, 0x4, 0x2, 0x2, 0x315, 0x314, 0x3, 0x2, 0x2, 0x2, 0x316, 0x317, 0x3, 0x2, 0x2, 0x2, 0x317, 0x315, 0x3, 0x2, 0x2, 0x2, 0x317, 0x318, 0x3, 0x2, 0x2, 0x2, 0x318, 0x9d, 0x3, 0x2, 0x2, 0x2, 0x319, 0x31a, 0x7, 0x2c, 0x2, 0x2, 0x31a, 0x31c, 0x7, 0x19, 0x2, 0x2, 0x31b, 0x31d, 0xa, 0x4, 0x2, 0x2, 0x31c, 0x31b, 0x3, 0x2, 0x2, 0x2, 0x31d, 0x31e, 0x3, 0x2, 0x2, 0x2, 0x31e, 0x31c, 0x3, 0x2, 0x2, 0x2, 0x31e, 0x31f, 0x3, 0x2, 0x2, 0x2, 0x31f, 0x9f, 0x3, 0x2, 0x2, 0x2, 0x320, 0x321, 0x7, 0x2c, 0x2, 0x2, 0x321, 0x323, 0x7, 0x1a, 0x2, 0x2, 0x322, 0x324, 0xa, 0x4, 0x2, 0x2, 0x323, 0x322, 0x3, 0x2, 0x2, 0x2, 0x324, 0x325, 0x3, 0x2, 0x2, 0x2, 0x325, 0x323, 0x3, 0x2, 0x2, 0x2, 0x325, 0x326, 0x3, 0x2, 0x2, 0x2, 0x326, 0xa1, 0x3, 0x2, 0x2, 0x2, 0x327, 0x328, 0x7, 0x2c, 0x2, 0x2, 0x328, 0x32a, 0x7, 0x1b, 0x2, 0x2, 0x329, 0x32b, 0xa, 0x4, 0x2, 0x2, 0x32a, 0x329, 0x3, 0x2, 0x2, 0x2, 0x32b, 0x32c, 0x3, 0x2, 0x2, 0x2, 0x32c, 0x32a, 0x3, 0x2, 0x2, 0x2, 0x32c, 0x32d, 0x3, 0x2, 0x2, 0x2, 0x32d, 0xa3, 0x3, 0x2, 0x2, 0x2, 0x32e, 0x32f, 0x7, 0x2c, 0x2, 0x2, 0x32f, 0x331, 0x7, 0x1c, 0x2, 0x2, 0x330, 0x332, 0xa, 0x4, 0x2, 0x2, 0x331, 0x330, 0x3, 0x2, 0x2, 0x2, 0x332, 0x333, 0x3, 0x2, 0x2, 0x2, 0x333, 0x331, 0x3, 0x2, 0x2, 0x2, 0x333, 0x334, 0x3, 0x2, 0x2, 0x2, 0x334, 0xa5, 0x3, 0x2, 0x2, 0x2, 0x335, 0x336, 0x7, 0x2c, 0x2, 0x2, 0x336, 0x338, 0x7, 0x1d, 0x2, 0x2, 0x337, 0x339, 0xa, 0x4, 0x2, 0x2, 0x338, 0x337, 0x3, 0x2, 0x2, 0x2, 0x339, 0x33a, 0x3, 0x2, 0x2, 0x2, 0x33a, 0x338, 0x3, 0x2, 0x2, 0x2, 0x33a, 0x33b, 0x3, 0x2, 0x2, 0x2, 0x33b, 0xa7, 0x3, 0x2, 0x2, 0x2, 0x33c, 0x33d, 0x7, 0x2c, 0x2, 0x2, 0x33d, 0x33f, 0x7, 0x1e, 0x2, 0x2, 0x33e, 0x340, 0xa, 0x4, 0x2, 0x2, 0x33f, 0x33e, 0x3, 0x2, 0x2, 0x2, 0x340, 0x341, 0x3, 0x2, 0x2, 0x2, 0x341, 0x33f, 0x3, 0x2, 0x2, 0x2, 0x341, 0x342, 0x3, 0x2, 0x2, 0x2, 0x342, 0xa9, 0x3, 0x2, 0x2, 0x2, 0x343, 0x344, 0x7, 0x2c, 0x2, 0x2, 0x344, 0x346, 0x7, 0x1f, 0x2, 0x2, 0x345, 0x347, 0xa, 0x4, 0x2, 0x2, 0x346, 0x345, 0x3, 0x2, 0x2, 0x2, 0x347, 0x348, 0x3, 0x2, 0x2, 0x2, 0x348, 0x346, 0x3, 0x2, 0x2, 0x2, 0x348, 0x349, 0x3, 0x2, 0x2, 0x2, 0x349, 0xab, 0x3, 0x2, 0x2, 0x2, 0x34a, 0x34b, 0x7, 0x2c, 0x2, 0x2, 0x34b, 0x34d, 0x7, 0x20, 0x2, 0x2, 0x34c, 0x34e, 0xa, 0x4, 0x2, 0x2, 0x34d, 0x34c, 0x3, 0x2, 0x2, 0x2, 0x34e, 0x34f, 0x3, 0x2, 0x2, 0x2, 0x34f, 0x34d, 0x3, 0x2, 0x2, 0x2, 0x34f, 0x350, 0x3, 0x2, 0x2, 0x2, 0x350, 0xad, 0x3, 0x2, 0x2, 0x2, 0x351, 0x352, 0x7, 0x2c, 0x2, 0x2, 0x352, 0x354, 0x7, 0xd, 0x2, 0x2, 0x353, 0x355, 0xa, 0x4, 0x2, 0x2, 0x354, 0x353, 0x3, 0x2, 0x2, 0x2, 0x355, 0x356, 0x3, 0x2, 0x2, 0x2, 0x356, 0x354, 0x3, 0x2, 0x2, 0x2, 0x356, 0x357, 0x3, 0x2, 0x2, 0x2, 0x357, 0xaf, 0x3, 0x2, 0x2, 0x2, 0x358, 0x359, 0x7, 0x2c, 0x2, 0x2, 0x359, 0x35b, 0x7, 0xe, 0x2, 0x2, 0x35a, 0x35c, 0xa, 0x4, 0x2, 0x2, 0x35b, 0x35a, 0x3, 0x2, 0x2, 0x2, 0x35c, 0x35d, 0x3, 0x2, 0x2, 0x2, 0x35d, 0x35b, 0x3, 0x2, 0x2, 0x2, 0x35d, 0x35e, 0x3, 0x2, 0x2, 0x2, 0x35e, 0xb1, 0x3, 0x2, 0x2, 0x2, 0x35f, 0x360, 0x7, 0x2c, 0x2, 0x2, 0x360, 0x362, 0x7, 0xa, 0x2, 0x2, 0x361, 0x363, 0xa, 0x4, 0x2, 0x2, 0x362, 0x361, 0x3, 0x2, 0x2, 0x2, 0x363, 0x364, 0x3, 0x2, 0x2, 0x2, 0x364, 0x362, 0x3, 0x2, 0x2, 0x2, 0x364, 0x365, 0x3, 0x2, 0x2, 0x2, 0x365, 0xb3, 0x3, 0x2, 0x2, 0x2, 0x366, 0x367, 0x7, 0x2c, 0x2, 0x2, 0x367, 0x369, 0x7, 0x21, 0x2, 0x2, 0x368, 0x36a, 0xa, 0x4, 0x2, 0x2, 0x369, 0x368, 0x3, 0x2, 0x2, 0x2, 0x36a, 0x36b, 0x3, 0x2, 0x2, 0x2, 0x36b, 0x369, 0x3, 0x2, 0x2, 0x2, 0x36b, 0x36c, 0x3, 0x2, 0x2, 0x2, 0x36c, 0xb5, 0x3, 0x2, 0x2, 0x2, 0x36d, 0x36e, 0x7, 0x2c, 0x2, 0x2, 0x36e, 0x370, 0x7, 0xb, 0x2, 0x2, 0x36f, 0x371, 0xa, 0x4, 0x2, 0x2, 0x370, 0x36f, 0x3, 0x2, 0x2, 0x2, 0x371, 0x372, 0x3, 0x2, 0x2, 0x2, 0x372, 0x370, 0x3, 0x2, 0x2, 0x2, 0x372, 0x373, 0x3, 0x2, 0x2, 0x2, 0x373, 0xb7, 0x3, 0x2, 0x2, 0x2, 0x374, 0x375, 0x7, 0x2c, 0x2, 0x2, 0x375, 0x377, 0x7, 0x22, 0x2, 0x2, 0x376, 0x378, 0xa, 0x4, 0x2, 0x2, 0x377, 0x376, 0x3, 0x2, 0x2, 0x2, 0x378, 0x379, 0x3, 0x2, 0x2, 0x2, 0x379, 0x377, 0x3, 0x2, 0x2, 0x2, 0x379, 0x37a, 0x3, 0x2, 0x2, 0x2, 0x37a, 0xb9, 0x3, 0x2, 0x2, 0x2, 0x58, 0xbd, 0xc1, 0xcc, 0xd5, 0xe2, 0xed, 0xf2, 0xf9, 0x103, 0x10d, 0x113, 0x119, 0x120, 0x12e, 0x13d, 0x144, 0x14d, 0x158, 0x15c, 0x163, 0x170, 0x179, 0x17f, 0x186, 0x18c, 0x190, 0x199, 0x1a4, 0x1b5, 0x1bd, 0x1c4, 0x1cc, 0x1d6, 0x1e1, 0x1e9, 0x1f3, 0x1fa, 0x204, 0x211, 0x218, 0x21f, 0x227, 0x231, 0x238, 0x249, 0x25a, 0x265, 0x26f, 0x276, 0x27d, 0x284, 0x28b, 0x292, 0x299, 0x2a0, 0x2a7, 0x2ae, 0x2b5, 0x2bc, 0x2c3, 0x2ca, 0x2d1, 0x2d8, 0x2df, 0x2e6, 0x2ed, 0x2f4, 0x2fb, 0x302, 0x309, 0x310, 0x317, 0x31e, 0x325, 0x32c, 0x333, 0x33a, 0x341, 0x348, 0x34f, 0x356, 0x35d, 0x364, 0x36b, 0x372, 0x379, }; atn::ATNDeserializer deserializer; _atn = deserializer.deserialize(_serializedATN); size_t count = _atn.getNumberOfDecisions(); _decisionToDFA.reserve(count); for (size_t i = 0; i < count; i++) { _decisionToDFA.emplace_back(_atn.getDecisionState(i), i); } } SwiftMtParser_MT537Parser::Initializer SwiftMtParser_MT537Parser::_init;
41.204082
156
0.688467
Yanick-Salzmann
f4b5488371e33a3bab3d7f520adc51b3dda49001
1,296
cpp
C++
src/sport/enum/MarketSort.cpp
Sherlock92/greentop
aa278d08babe02326b3ab85a6eafb858d780dec5
[ "MIT" ]
5
2019-06-30T06:29:46.000Z
2021-12-17T12:41:23.000Z
src/sport/enum/MarketSort.cpp
Sherlock92/greentop
aa278d08babe02326b3ab85a6eafb858d780dec5
[ "MIT" ]
2
2018-01-09T17:14:45.000Z
2020-03-23T00:16:50.000Z
src/sport/enum/MarketSort.cpp
Sherlock92/greentop
aa278d08babe02326b3ab85a6eafb858d780dec5
[ "MIT" ]
7
2015-09-13T18:40:58.000Z
2020-01-24T10:57:56.000Z
/** * Copyright 2017 Colin Doig. Distributed under the MIT license. */ #include <stdexcept> #include "greentop/sport/enum/MarketSort.h" #include "greentop/Enum.h" namespace greentop { namespace sport { const std::string MarketSort::MINIMUM_TRADED = "MINIMUM_TRADED"; const std::string MarketSort::MAXIMUM_TRADED = "MAXIMUM_TRADED"; const std::string MarketSort::MINIMUM_AVAILABLE = "MINIMUM_AVAILABLE"; const std::string MarketSort::MAXIMUM_AVAILABLE = "MAXIMUM_AVAILABLE"; const std::string MarketSort::FIRST_TO_START = "FIRST_TO_START"; const std::string MarketSort::LAST_TO_START = "LAST_TO_START"; MarketSort::MarketSort() { valid = false; } MarketSort::MarketSort(const std::string& v) { if (v != MINIMUM_TRADED && v != MAXIMUM_TRADED && v != MINIMUM_AVAILABLE && v != MAXIMUM_AVAILABLE && v != FIRST_TO_START && v != LAST_TO_START) { throw std::invalid_argument("Invalid MarketSort: " + v); } value = v; valid = true; } bool MarketSort::operator<(const MarketSort& other) const { return value < other.value; } bool MarketSort::operator==(const MarketSort& other) const { return value == other.value; } bool MarketSort::operator!=(const MarketSort& other) const { return value != other.value; } } }
25.92
70
0.692901
Sherlock92
f4b57a65a8fd9bc91423240c1fec3adfcddf73a3
1,669
hpp
C++
include/CASM/codec/pcm.hpp
Liastre/CASM
4f978664ac4812e8cfcd76025ac2429a46543582
[ "MIT" ]
1
2021-08-06T07:55:21.000Z
2021-08-06T07:55:21.000Z
include/CASM/codec/pcm.hpp
Liastre/CASM
4f978664ac4812e8cfcd76025ac2429a46543582
[ "MIT" ]
1
2021-08-05T09:33:13.000Z
2021-08-05T09:33:13.000Z
include/CASM/codec/pcm.hpp
Liastre/CASM
4f978664ac4812e8cfcd76025ac2429a46543582
[ "MIT" ]
null
null
null
/** * PCM codec implementation * @author Liastre * @copyright MIT */ #pragma once #include <CASM/codec/codec.hpp> #include <array> namespace CASM { namespace Codec { using WavHeader = struct { std::array<char, 4> chunkID {'R','I','F','F'}; // RIFF chunk std::uint32_t chunkSize {0}; // chunk size in bytes std::array<char, 4> chunkFormat {'W','A','V','E'}; // file type std::array<char, 4> fmtID {'f','m','t',' '}; // FMT sub-chunk std::uint32_t fmtSize {0}; // size of fmt chunk 16 + extra format bytes std::uint16_t fmtAudioFormat {0}; // format (compression code) std::uint16_t fmtNumChannels {0}; std::uint32_t fmtSampleRate {0}; std::uint32_t fmtByteRate {0}; std::uint16_t fmtBlockAlign {0}; std::uint16_t fmtBitsPerSample {0}; std::uint16_t fmtExtraParamSize {0}; char *fmtExtraParams {nullptr}; std::array<char, 4> dataID {'d','a','t','a'}; // DATA sub-chunk std::uint32_t dataSize {0}; }; class Pcm : public CodecInterface { public: WaveProperties readHeader(DataStream& fileHandler) final; bool writeHeader(DataStream& fileHandler, WaveProperties const& waveProperties) final; BufferStatus readData(DataStream& fileHandler, Buffer& buffer) final; bool writeData(DataStream& dataStream, Buffer const& buffer) final; bool finalize(DataStream& fileHandler) final; private: WavHeader _wavHeader; std::size_t _posDataChunk = 0; std::size_t _posFileLength = 0; bool _isFinalized = false; }; } // namespace Codec } // namespace CASM
31.490566
100
0.624326
Liastre
f4b80a7d286e7523c85f8f2980657ae4ddb3cfcd
914
cpp
C++
Src/IO/CPipe_get.cpp
Gjoll/OpSys
ebba2d8856d21a1f6cefe59c781ce7b9ff1430cf
[ "Apache-2.0" ]
null
null
null
Src/IO/CPipe_get.cpp
Gjoll/OpSys
ebba2d8856d21a1f6cefe59c781ce7b9ff1430cf
[ "Apache-2.0" ]
null
null
null
Src/IO/CPipe_get.cpp
Gjoll/OpSys
ebba2d8856d21a1f6cefe59c781ce7b9ff1430cf
[ "Apache-2.0" ]
null
null
null
/* Copyright 1992 Kurt W. Allen. This is an unpublished work by Kurt W. Allen. All rights are reserved, and no part of this work may be distributed or released with out the express permission of Kurt W. Allen, 3540 43'rd Ave S., Mpls, Mn 55406. */ /* $Revision: 1.1 $ $Modtime: 01 May 1993 09:32:52 $ $Workfile: cpipe2.cpp $ */ #include <OsConfig.h> #include <OsAssert.h> #include <Base.h> #include <ptrBlock.h> #include <Task.h> #include <Block.h> #include <Semaphore.h> #include <Pipe.h> #include <IoBuf.h> #include <CPipe.h> /* CPipe::get Description: Class: CPipe. get one character from the CPipe. This routine will be called by the formatted I/O methods of IOBuf. Parameters: c is a pointer to a character to store the character from the pipe into. */ Bool CPipe::get(char* c) { return (Pipe::get(c) == OS_DONE) ? OSTrue : OSFalse; }
21.761905
65
0.657549
Gjoll
f4bda6abaa12d548ac6a2ea7cc0dcc531a5101c1
638
cpp
C++
src/main.cpp
sea-kg/v201703
d873ae71e4e9d7ae0386ea64513095a466fcba3a
[ "MIT" ]
null
null
null
src/main.cpp
sea-kg/v201703
d873ae71e4e9d7ae0386ea64513095a466fcba3a
[ "MIT" ]
null
null
null
src/main.cpp
sea-kg/v201703
d873ae71e4e9d7ae0386ea64513095a466fcba3a
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <signal.h> #include <iostream> #include <sys/stat.h> #include <sys/types.h> #include <sys/time.h> #include <unistd.h> #include <errno.h> #include <fcntl.h> #include <syslog.h> #include <QtCore> #include <QFile> #include <QString> #include "websocketserver.h" #include "sett.h" int main(int argc, char** argv) { QCoreApplication app(argc, argv); WebSocketServer *pServer = new WebSocketServer(); if(!pServer->isServerStarted()){ return -1; } QObject::connect(pServer, &WebSocketServer::closed, &app, &QCoreApplication::quit); return app.exec(); }
21.266667
87
0.69279
sea-kg
f4be843434b008e0d23cf1f055fb0b2f128eb85c
4,160
cpp
C++
irohad/multi_sig_transactions/state/impl/mst_state.cpp
truongnmt/iroha
e9b969df9a0eb6ce62eae3ab62c5c3f046a5e6e1
[ "Apache-2.0" ]
null
null
null
irohad/multi_sig_transactions/state/impl/mst_state.cpp
truongnmt/iroha
e9b969df9a0eb6ce62eae3ab62c5c3f046a5e6e1
[ "Apache-2.0" ]
2
2020-07-07T19:31:15.000Z
2021-06-01T22:29:48.000Z
irohad/multi_sig_transactions/state/impl/mst_state.cpp
truongnmt/iroha
e9b969df9a0eb6ce62eae3ab62c5c3f046a5e6e1
[ "Apache-2.0" ]
null
null
null
/** * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved. * http://soramitsu.co.jp * * 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 "multi_sig_transactions/state/mst_state.hpp" #include <boost/range/algorithm/find.hpp> #include <utility> #include "backend/protobuf/transaction.hpp" #include "common/set.hpp" namespace iroha { // ------------------------------| public api |------------------------------- MstState MstState::empty(const CompleterType &completer) { return MstState(completer); } MstState MstState::operator+=(const DataType &rhs) { auto result = MstState::empty(completer_); insertOne(result, rhs); return result; } MstState MstState::operator+=(const MstState &rhs) { auto result = MstState::empty(completer_); for (auto &&rhs_tx : rhs.internal_state_) { insertOne(result, rhs_tx); } return result; } MstState MstState::operator-(const MstState &rhs) const { return MstState(this->completer_, set_difference(this->internal_state_, rhs.internal_state_)); } bool MstState::operator==(const MstState &rhs) const { return std::is_permutation( internal_state_.begin(), internal_state_.end(), rhs.internal_state_.begin(), [](auto tx1, auto tx2) { if (*tx1 == *tx2) { return std::is_permutation( tx1->signatures().begin(), tx1->signatures().end(), tx2->signatures().begin(), [](const auto &sig1, const auto &sig2) { return sig1 == sig2; }); } return false; }); } bool MstState::isEmpty() const { return internal_state_.empty(); } std::vector<DataType> MstState::getTransactions() const { return std::vector<DataType>(internal_state_.begin(), internal_state_.end()); } MstState MstState::eraseByTime(const TimeType &time) { MstState out = MstState::empty(completer_); while (not index_.empty() and (*completer_)(index_.top(), time)) { auto iter = internal_state_.find(index_.top()); out += *iter; internal_state_.erase(iter); index_.pop(); } return out; } // ------------------------------| private api |------------------------------ MstState::MstState(const CompleterType &completer) : MstState(completer, InternalStateType{}) {} MstState::MstState(const CompleterType &completer, const InternalStateType &transactions) : completer_(completer), internal_state_(transactions.begin(), transactions.end()), index_(transactions.begin(), transactions.end()) { log_ = logger::log("MstState"); } void MstState::insertOne(MstState &out_state, const DataType &rhs_tx) { auto corresponding = internal_state_.find(rhs_tx); if (corresponding == internal_state_.end()) { // when state not contains transaction rawInsert(rhs_tx); return; } auto &found = *corresponding; // Append new signatures to the existing state for (auto &sig : rhs_tx->signatures()) { if (boost::find(found->signatures(), sig) == boost::end(found->signatures())) { found->addSignature(sig.signedData(), sig.publicKey()); } } if ((*completer_)(found)) { // state already has completed transaction, // remove from state and return it out_state += found; internal_state_.erase(internal_state_.find(found)); } } void MstState::rawInsert(const DataType &rhs_tx) { internal_state_.insert(rhs_tx); index_.push(rhs_tx); } } // namespace iroha
31.044776
85
0.626202
truongnmt
f4c6edcc6f260b9832e56a66eb2d1067e7445604
1,271
cpp
C++
libnuklei/io/PLYObservation.cpp
chungying/nuklei
23db2a55a1b3260cf913d0ac10b3b27c000ae1a6
[ "BSD-3-Clause" ]
null
null
null
libnuklei/io/PLYObservation.cpp
chungying/nuklei
23db2a55a1b3260cf913d0ac10b3b27c000ae1a6
[ "BSD-3-Clause" ]
null
null
null
libnuklei/io/PLYObservation.cpp
chungying/nuklei
23db2a55a1b3260cf913d0ac10b3b27c000ae1a6
[ "BSD-3-Clause" ]
null
null
null
// (C) Copyright Renaud Detry 2007-2015. // Distributed under the GNU General Public License and under the // BSD 3-Clause License (See accompanying file LICENSE.txt). /** @file */ #include <nuklei/PLYObservation.h> namespace nuklei { const double PLYObservation::TOL = 1e-5; PLYObservation::PLYObservation() { NUKLEI_TRACE_BEGIN(); ColorDescriptor d; k_.setDescriptor(d); NUKLEI_TRACE_END(); } PLYObservation::PLYObservation(const kernel::r3& k) : k_(k) {} void PLYObservation::setLoc(Vector3 loc) { NUKLEI_TRACE_BEGIN(); k_.loc_ = loc; NUKLEI_TRACE_END(); } Vector3 PLYObservation::getLoc() const { return k_.loc_; } void PLYObservation::setWeight(weight_t weight) { NUKLEI_TRACE_BEGIN(); k_.setWeight(weight); NUKLEI_TRACE_END(); } weight_t PLYObservation::getWeight() const { return k_.getWeight(); } const Color& PLYObservation::getColor() const { NUKLEI_TRACE_BEGIN(); return dynamic_cast<const ColorDescriptor&>(k_.getDescriptor()).getColor(); NUKLEI_TRACE_END(); } void PLYObservation::setColor(const Color& color) { NUKLEI_TRACE_BEGIN(); dynamic_cast<ColorDescriptor&>(k_.getDescriptor()).setColor(color); NUKLEI_TRACE_END(); } }
22.696429
79
0.686861
chungying
f4ca2bab53a38121df662d29c6d539d0399b8a3a
2,378
cpp
C++
test/example.cpp
peterbygrave/coulombgalore
ac7d13641212c53c126f9d48f8aa6e8f249f514e
[ "MIT" ]
7
2019-08-12T15:00:40.000Z
2022-03-23T06:46:40.000Z
test/example.cpp
peterbygrave/coulombgalore
ac7d13641212c53c126f9d48f8aa6e8f249f514e
[ "MIT" ]
7
2019-10-19T12:24:29.000Z
2021-05-12T05:58:03.000Z
test/example.cpp
peterbygrave/coulombgalore
ac7d13641212c53c126f9d48f8aa6e8f249f514e
[ "MIT" ]
3
2019-07-10T12:30:20.000Z
2020-11-27T11:10:07.000Z
#include <iostream> #include <nlohmann/json.hpp> #include "coulombgalore.h" using namespace CoulombGalore; typedef Eigen::Vector3d Point; //!< typedef for 3d vector int main() { double pi = 3.141592653589793, // Pi e0 = 8.85419e-12, // Permittivity of vacuum [C^2/(J*m)] e = 1.602177e-19, // Absolute electronic unit charge [C] T = 298.15, // Temperature [K] kB = 1.380658e-23; // Boltzmann's constant [J/K] double z1 = 1, z2 = 2; // two monopoles double cutoff = 18e-10; // cutoff distance, here in meters [m] vec3 r = {7.0e-10, 0, 0}; // a distance vector, use same using as cutoff, i.e. [m] // energies are returned in electrostatic units and we must multiply // with the Coulombic constant to get more familiar units: double bjerrum_length = e * e / (4 * pi * e0 * kB * T); // [m] // this is just the plain old Coulomb potential Plain pot_plain; double u12 = pot_plain.ion_ion_energy(z1, z2, r.norm()); std::cout << "plain ion-ion energy: " << bjerrum_length * u12 << " kT" << std::endl; // this is just the plain old Coulomb potential double debye_length = 23.01e-10; Plain pot_plainY(debye_length); u12 = pot_plainY.ion_ion_energy(z1, z2, r.norm()); std::cout << "plain ion-ion energy: " << bjerrum_length * u12 << " kT" << std::endl; // this is a truncated potential qPotential pot_qpot(cutoff, 3); u12 = pot_qpot.ion_ion_energy(z1, z2, r.norm()); std::cout << "qPotential ion-ion energy: " << bjerrum_length * u12 << " kT" << std::endl; qPotential pot_qpot3(cutoff, 3); qPotential pot_qpot4(cutoff, 4); Fanourgakis pot_kis(cutoff); Ewald pot_ewald(cutoff, 0.1e10, infinity); for (double q = 0; q <= 1; q += 0.01) std::cout << q << " " << pot_qpot3.short_range_function(q) << " " << pot_qpot4.short_range_function(q) << " " << " " << pot_kis.short_range_function(q) << " " << " " << pot_ewald.short_range_function(q) << "\n"; #ifdef NLOHMANN_JSON_HPP // this is a truncated potential initiated using JSON Wolf pot_wolf(nlohmann::json({{"cutoff", cutoff}, {"alpha", 0.5}})); // if available, json can be used to (de)serialize nlohmann::json j; pot_qpot.to_json(j); std::cout << j << std::endl; #endif }
38.983607
117
0.605551
peterbygrave
f4ca32bfc5cb9f28143a90f8d084eb1178cacdfb
826
cpp
C++
CodeChef/LTIME67B/AGECAL.cpp
codemute/cp-sol
e6ea2533adf9f590f5e9d6a6b50031db9d3dca4a
[ "MIT" ]
1
2019-10-06T14:39:34.000Z
2019-10-06T14:39:34.000Z
CodeChef/LTIME67B/AGECAL.cpp
codemute/cp-sol
e6ea2533adf9f590f5e9d6a6b50031db9d3dca4a
[ "MIT" ]
1
2019-07-12T08:08:50.000Z
2019-10-04T07:56:33.000Z
CodeChef/LTIME67B/AGECAL.cpp
codemute/cp-sol
e6ea2533adf9f590f5e9d6a6b50031db9d3dca4a
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int cei(int a, int b) { if(a % b == 0) return a / b; return (a / b) + 1; } int main() { int t; cin >> t; while(t--) { int n; cin >> n; int a[n], tot = 0; for(int i = 0; i < n; i++) { cin >> a[i]; tot += a[i]; } int yb, mb, db; cin >> yb >> mb >> db; int yc, mc, dc; cin >> yc >> mc >> dc; int u = (yc - yb) * tot; int v = 0; for(int i = min(mc, mb) + 1; i < max(mc, mb); i++) { v += a[i - 1]; } if(mc < mb) { v = - (v + a[mc - 1]); } else if(mc > mb) { v = v + a[mb - 1]; } int w = dc - db; int l = (((yc / 4) * 4) - (cei(yb, 4) * 4)) / 4; if(yc % 4 != 0) l++; // cout << u << " " << v << " " << w << endl; cout << u + v + w + l + 1 << endl; } return 0; }
20.65
56
0.360775
codemute
f4cc26f3ef7a3453c78b7e35f6bc3b1d34432453
928
hpp
C++
addons/bw/configs/CfgAmmo.hpp
Braincrushy/TBMod
785f11cd9cd0defb0d01a6d2861beb6c207eb8a3
[ "MIT" ]
null
null
null
addons/bw/configs/CfgAmmo.hpp
Braincrushy/TBMod
785f11cd9cd0defb0d01a6d2861beb6c207eb8a3
[ "MIT" ]
4
2018-12-21T06:57:25.000Z
2020-07-09T09:06:38.000Z
addons/bw/configs/CfgAmmo.hpp
Braincrushy/TBMod
785f11cd9cd0defb0d01a6d2861beb6c207eb8a3
[ "MIT" ]
null
null
null
/* Part of the TBMod ( https://github.com/TacticalBaconDevs/TBMod ) Developed by http://tacticalbacon.de */ class CfgAmmo { class BWA3_B_127x99_Ball; class BWA3_B_127x99_Ball_Raufoss : BWA3_B_127x99_Ball // 50.cal Long-Range Sniper BW { caliber = 2.5; // 5.2 explosive = 0.1; // 0 hit = 24; // 31.5 indirectHit = 30; // 0 indirectHitRange = 0.6; // 0 tracerEndTime = 8; // 3 tracerStartTime = 0.5; // 0.05 }; class BWA3_B_127x99_Ball_Raufoss_Tracer_Dim : BWA3_B_127x99_Ball_Raufoss // 50.cal HEIAP-T BW { caliber = 2.8; // 2.6 hit = 35; // 30 indirectHit = 30; // 12 indirectHitRange = 0.6; // 0.3 }; class B_338_Ball; class BWA3_B_86x70_Ball : B_338_Ball // G29 { ACE_ballisticCoefficients[] = {0.675}; // {0.322} BWMod hat falschen BC verwendet hit = 20; // 16 }; };
26.514286
97
0.577586
Braincrushy
f4d003ba3188b920728e3fc78baa0266093881f5
376
cpp
C++
assembler/main.cpp
terana/pdp-11
720ab9b3a15c832de012b5846cb363a5f0b8ce2c
[ "MIT" ]
null
null
null
assembler/main.cpp
terana/pdp-11
720ab9b3a15c832de012b5846cb363a5f0b8ce2c
[ "MIT" ]
null
null
null
assembler/main.cpp
terana/pdp-11
720ab9b3a15c832de012b5846cb363a5f0b8ce2c
[ "MIT" ]
null
null
null
#include <iostream> #include <fstream> #include "assembler.hpp" int main(int argc, char *argv[]) { std::string asm_file = argc > 1 ? argv[1] : "../programs/white_screen.s"; const char *bin_file = argc > 2 ? argv[2] : "white_screen"; std::ifstream asmStream(asm_file); Assembler assembler; assembler.generateBinary(asmStream, bin_file); return 0; }
23.5
77
0.664894
terana
f4d0e3c0afbe1f9df4e381a502e1800a3d58ba68
5,491
cc
C++
lite/core/profile/profiler.cc
jameswu2014/Paddle-Lite
827e349ac8eb769a873fe9b3aa961af8b8b20a96
[ "Apache-2.0" ]
1
2020-03-09T03:51:31.000Z
2020-03-09T03:51:31.000Z
lite/core/profile/profiler.cc
jameswu2014/Paddle-Lite
827e349ac8eb769a873fe9b3aa961af8b8b20a96
[ "Apache-2.0" ]
null
null
null
lite/core/profile/profiler.cc
jameswu2014/Paddle-Lite
827e349ac8eb769a873fe9b3aa961af8b8b20a96
[ "Apache-2.0" ]
null
null
null
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "lite/core/profile/profiler.h" #include <map> #include <string> #include <utility> namespace paddle { namespace lite { namespace profile { namespace { auto op_comp = [](const OpCharacter& c1, const OpCharacter& c2) { return (c1.target < c2.target) || (c1.op_type < c2.op_type) || (c1.kernel_name < c2.kernel_name) || (c1.remark < c2.remark); }; } std::map<Type, std::string> TypeStr{ {Type::kUnk, "Unknown"}, {Type::kCreate, "Create"}, {Type::kDispatch, "Dispatch"}, }; StatisUnit::StatisUnit(const OpCharacter& ch) : character(ch) { create_t.reset(new DeviceTimer<TargetType::kHost>()); if (ch.target == TargetType::kCUDA) { #ifdef LITE_WITH_CUDA dispatch_t.reset(new DeviceTimer<TargetType::kCUDA>()); #else LOG(ERROR) << "The timer type specified as cuda is uninitialized, so the " "default x86 timer is used instead."; #endif } else { dispatch_t.reset(new DeviceTimer<TargetType::kHost>()); } } lite::profile::Timer* StatisUnit::Timer(Type type) { if (type == Type::kCreate) { return create_t.get(); } else if (type == Type::kDispatch) { return dispatch_t.get(); } LOG(FATAL) << "Timer cannot be returned for unknown platforms."; return nullptr; } int Profiler::NewTimer(const OpCharacter& ch) { StatisUnit unit(ch); units_.push_back(std::move(unit)); return units_.size() - 1; } void Profiler::StartTiming(Type type, const int index, KernelContext* ctx) { CHECK_LT(index, units_.size()) << "The timer index in the profiler is out of range."; units_[index].Timer(type)->Start(ctx); } float Profiler::StopTiming(Type type, const int index, KernelContext* ctx) { CHECK_LT(index, units_.size()) << "The timer index in the profiler is out of range."; return units_[index].Timer(type)->Stop(ctx); } std::string Profiler::Summary(Type type, bool concise, size_t w) { using std::setw; using std::left; using std::fixed; STL::stringstream ss; std::string title; // Title. if (concise) { ss << "Timing cycle = " << units_.front().Timer(type)->LapTimes().Size() << std::endl; ss << "===== Concise " << TypeStr.find(type)->second << " Profiler Summary: " << name_ << ", Exclude " << w << " warm-ups =====" << std::endl; } else { ss << "===== Detailed " << TypeStr.find(type)->second << " Profiler Summary: " << name_ << ", Exclude " << w << " warm-ups =====" << std::endl; } ss << setw(25) << left << "Operator Type" << " " << setw(40) << left << "Kernel Name" << " " << setw(12) << left << "Remark" << " " << setw(12) << left << "Avg (ms)" << " " << setw(12) << left << "Min (ms)" << " " << setw(12) << left << "Max (ms)" << " " << setw(12) << left << "Last (ms)" << std::endl; // Profile information. if (concise) { std::map<OpCharacter, TimeInfo, decltype(op_comp)> summary(op_comp); for (auto& unit : units_) { auto ch = summary.find(unit.Character()); if (ch != summary.end()) { ch->second.avg += unit.Timer(type)->LapTimes().Avg(w); ch->second.min += unit.Timer(type)->LapTimes().Min(w); ch->second.max += unit.Timer(type)->LapTimes().Max(w); } else { TimeInfo info({unit.Timer(type)->LapTimes().Avg(w), unit.Timer(type)->LapTimes().Min(w), unit.Timer(type)->LapTimes().Max(w)}); summary.insert({unit.Character(), info}); } } for (const auto& item : summary) { // clang-format off ss << setw(25) << left << fixed << item.first.op_type \ << " " << setw(40) << left << fixed << item.first.kernel_name \ << " " << setw(12) << left << fixed << item.first.remark \ << " " << setw(12) << left << fixed << item.second.avg \ << " " << setw(12) << left << fixed << item.second.min \ << " " << setw(12) << left << fixed << item.second.max \ << " " << std::endl; // clang-format on } } else { for (auto& unit : units_) { const auto& times = unit.Timer(type)->LapTimes(); // clang-format off ss << setw(25) << left << fixed << unit.Character().op_type \ << " " << setw(40) << left << fixed << unit.Character().kernel_name \ << " " << setw(12) << left << fixed << unit.Character().remark \ << " " << setw(12) << left << fixed << times.Avg(w) \ << " " << setw(12) << left << fixed << times.Min(w) \ << " " << setw(12) << left << fixed << times.Max(w) \ << " " << setw(12) << left << fixed << times.Last(w) \ << std::endl; // clang-format on } } return ss.str(); } } // namespace profile } // namespace lite } // namespace paddle
36.125
78
0.566746
jameswu2014
f4d76bd4782c9ba7e5304c0544e080d7aab2c4b3
5,123
cpp
C++
engine/mysqlparser/listener/dml/CreateTableListener.cpp
zhukovaskychina/XSQL
f91db06bf86f7f6ad321722c3aea11f83d34dba1
[ "MIT" ]
1
2020-10-23T09:38:22.000Z
2020-10-23T09:38:22.000Z
engine/mysqlparser/listener/dml/CreateTableListener.cpp
zhukovaskychina/XSQL
f91db06bf86f7f6ad321722c3aea11f83d34dba1
[ "MIT" ]
null
null
null
engine/mysqlparser/listener/dml/CreateTableListener.cpp
zhukovaskychina/XSQL
f91db06bf86f7f6ad321722c3aea11f83d34dba1
[ "MIT" ]
null
null
null
// // Created by zhukovasky on 2020/9/30. // #include <utils/StringUtils.h> #include "CreateTableListener.h" void CreateTableListener::enterColCreateTable(parser::MySQLParser::ColCreateTableContext *context) { parser::MySQLParser::Table_nameContext *tbContext = context->table_name(); std::string tbName = tbContext->getText(); parser::MySQLParser::If_not_existsContext *ifContxt = context->if_not_exists(); if (ifContxt != NULL) { std::string ifExistsString = ifContxt->getText(); } this->tableName = tbName; this->ifNotExists = false; delete ifContxt; } void CreateTableListener::enterColumnDefinition(parser::MySQLParser::ColumnDefinitionContext *ctx) { MySQLParserBaseListener::enterColumnDefinition(ctx); parser::MySQLParser::Column_definitionContext *columnDefinitions = ctx->column_definition(); std::string columnName = ctx->id_()->getText(); Attribute attribute; attribute.set_attr_name(columnName); parser::MySQLParser::Column_definitionContext *cldfs = ctx->column_definition(); int childrenSize = cldfs->children.size(); if (childrenSize > 0) { std::vector<antlr4::tree::ParseTree *> dc = cldfs->data_type()->children; if (dc.size() > 0) { std::string dataType = cldfs->data_type()->children.at(0)->getText(); attribute.set_data_type_length(cldfs->data_type()->getText()); int dataTypeInt=this->processDataType(dataType); attribute.set_data_type(dataTypeInt); int pureSize=cldfs->data_type()->children.size(); if (pureSize> 1) { std::vector<antlr4::tree::ParseTree *> dcclength=cldfs->data_type()->children.at(1)->children; if(dcclength.size()>0){ std::string length = cldfs->data_type()->children.at(1)->children.at(1)->getText(); std::cout << length << std::endl; int integerLength = Utils::StringUtils::convertStringToInteger(length); attribute.set_length(integerLength); }else{ int rl=-1; switch (dataTypeInt){ case COLUMNENUMS ::FIELD_TYPE_TINY:{ rl=1; break; } case COLUMNENUMS ::FIELD_TYPE_SHORT:{ rl=2; break; } case COLUMNENUMS ::FIELD_TYPE_INT24:{ rl=4; break; } case COLUMNENUMS ::FIELD_TYPE_FLOAT:{ rl=4; break; } } attribute.set_length(rl); } } } } else { //int,long,blob 类型 std::string dataType = cldfs->data_type()->getText(); attribute.set_data_type(this->processDataType(dataType)); } this->attributes.push_back(attribute); } void CreateTableListener::enterColumn_definition(parser::MySQLParser::Column_definitionContext *ctx) { MySQLParserBaseListener::enterColumn_definition(ctx); } /** * * FIELD_TYPE_DECIMAL = 0, FIELD_TYPE_TINY = 1, FIELD_TYPE_SHORT = 2, FIELD_TYPE_LONG = 3, FIELD_TYPE_FLOAT = 4, FIELD_TYPE_DOUBLE = 5, FIELD_TYPE_NULL = 6, FIELD_TYPE_TIMESTAMP = 7, FIELD_TYPE_LONGLONG = 8, FIELD_TYPE_INT24 = 9, FIELD_TYPE_DATE = 10, FIELD_TYPE_TIME = 11, FIELD_TYPE_DATETIME = 12, FIELD_TYPE_YEAR = 13, FIELD_TYPE_NEWDATE = 14, FIELD_TYPE_VARCHAR = 15, FIELD_TYPE_BIT = 16, FIELD_TYPE_NEW_DECIMAL = 246, FIELD_TYPE_ENUM = 247, FIELD_TYPE_SET = 248, FIELD_TYPE_TINY_BLOB = 249, FIELD_TYPE_MEDIUM_BLOB = 250, FIELD_TYPE_LONG_BLOB = 251, FIELD_TYPE_BLOB = 252, FIELD_TYPE_VAR_STRING = 253, FIELD_TYPE_STRING = 254, FIELD_TYPE_GEOMETRY = 255, * **/ int CreateTableListener::processDataType(std::string dataType) { std::string upperType=Utils::StringUtils::toUpper(dataType); if(upperType=="VARCHAR"){ return COLUMNENUMS ::FIELD_TYPE_VARCHAR; } if(upperType=="CHAR"){ return COLUMNENUMS ::FIELD_TYPE_VARCHAR; } if(upperType=="INT"){ return COLUMNENUMS ::FIELD_TYPE_INT24; } if(upperType=="BIGINT"){ return COLUMNENUMS ::FIELD_TYPE_LONG; } if(upperType=="SMALLINT"){ return COLUMNENUMS ::FIELD_TYPE_SHORT; } if(upperType=="TINYINT"){ return COLUMNENUMS ::FIELD_TYPE_TINY; } if(upperType=="DATE"){ return COLUMNENUMS ::FIELD_TYPE_DATE; } if(upperType=="YEAR"){ return COLUMNENUMS ::FIELD_TYPE_YEAR; } if(upperType=="DATETIME"){ return COLUMNENUMS ::FIELD_TYPE_DATETIME; } if(upperType=="TIMESTAMP"){ return COLUMNENUMS ::FIELD_TYPE_TIMESTAMP; } if(upperType=="TIME"){ return COLUMNENUMS ::FIELD_TYPE_TIME; } return -1; }
32.424051
110
0.591841
zhukovaskychina
f4d936e5466b571bf1bda29baf64de22699f36cd
2,619
cc
C++
Modules/Plexil/src/value/PlexilTypeTraits.cc
5nefarious/icarous
bfd759d88a47d9ee079fe35deaa6cf6d4459dcd8
[ "Unlicense" ]
1
2020-02-27T03:35:50.000Z
2020-02-27T03:35:50.000Z
src/value/PlexilTypeTraits.cc
morxa/plexil-4
890e92aa259881dd944d573d6ec519341782a5f2
[ "BSD-3-Clause" ]
null
null
null
src/value/PlexilTypeTraits.cc
morxa/plexil-4
890e92aa259881dd944d573d6ec519341782a5f2
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2006-2016, Universities Space Research Association (USRA). * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Universities Space Research Association 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 USRA ``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 USRA 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 "PlexilTypeTraits.hh" namespace PLEXIL { char const * const PlexilValueType<Boolean>::typeName = BOOLEAN_STR; char const * const PlexilValueType<Integer>::typeName = INTEGER_STR; char const * const PlexilValueType<Real>::typeName = REAL_STR; char const * const PlexilValueType<String>::typeName = STRING_STR; char const * const PlexilValueType<NodeState>::typeName = NODE_STATE_STR; char const * const PlexilValueType<NodeOutcome>::typeName = NODE_OUTCOME_STR; char const * const PlexilValueType<FailureType>::typeName = NODE_FAILURE_STR; char const * const PlexilValueType<CommandHandleValue>::typeName = NODE_COMMAND_HANDLE_STR; char const * const PlexilValueType<Array>::typeName = ARRAY_STR; char const * const PlexilValueType<BooleanArray>::typeName = BOOLEAN_ARRAY_STR; char const * const PlexilValueType<IntegerArray>::typeName = INTEGER_ARRAY_STR; char const * const PlexilValueType<RealArray>::typeName = REAL_ARRAY_STR; char const * const PlexilValueType<StringArray>::typeName = STRING_ARRAY_STR; }
54.5625
93
0.775105
5nefarious
f4dadf33f2b54fa45221dbd32ff8e6ae34f47d5a
614
cpp
C++
src/Npfs/Messages/Rread.cpp
joluxer/NpfsCpp
f19d422b9ab4fa67e35c1e0c29dfa2abc8b0d78f
[ "Zlib" ]
null
null
null
src/Npfs/Messages/Rread.cpp
joluxer/NpfsCpp
f19d422b9ab4fa67e35c1e0c29dfa2abc8b0d78f
[ "Zlib" ]
null
null
null
src/Npfs/Messages/Rread.cpp
joluxer/NpfsCpp
f19d422b9ab4fa67e35c1e0c29dfa2abc8b0d78f
[ "Zlib" ]
null
null
null
/* * Rread.cpp * * Created on: 18.07.2012 * Author: jlode */ #include "Rread.h" namespace Npfs { Rread::Rread(const Npfs::Tread& tref, MemoryManager* mm_) : Rmessage(tref), mm(mm_), count(tref.count), data((unsigned char*) mm->allocate(tref.count)) {} Rread::~Rread() { mm->release(data); } uint32_t Rread::msgLength() const { return 4 + count; /* count[4] data[count] */ } void Rread::serialize() { #ifndef NDEBUG logHeader("Rread"); log("count", count); log("data", NpStr("(not dumped)")); logNewLine(); #endif serializeHeader(); io.putUI32(count); io.put(data, count); } }
14.619048
94
0.627036
joluxer
f4ddbea6636b8499172b446ec266c77a29afebc5
1,177
cpp
C++
InterviewBit/Arrays/Set Matrix Zeros.cpp
sankalpmittal1911-BitSian/Competitive-Coding
eac5b4f465083e27496a0711a527d67ab657a35c
[ "MIT" ]
null
null
null
InterviewBit/Arrays/Set Matrix Zeros.cpp
sankalpmittal1911-BitSian/Competitive-Coding
eac5b4f465083e27496a0711a527d67ab657a35c
[ "MIT" ]
null
null
null
InterviewBit/Arrays/Set Matrix Zeros.cpp
sankalpmittal1911-BitSian/Competitive-Coding
eac5b4f465083e27496a0711a527d67ab657a35c
[ "MIT" ]
null
null
null
/*Asked in: Oracle Amazon Given an m x n matrix of 0s and 1s, if an element is 0, set its entire row and column to 0. Do it in place. Example Given array A as 1 0 1 1 1 1 1 1 1 On returning, the array A should be : 0 0 0 1 0 1 1 0 1 Note that this will be evaluated on the extra memory used. Try to minimize the space and time complexity.*/ void Solution::setZeroes(vector<vector<int> > &A) { // Do not write main() function. // Do not read input, instead use the arguments to the function. // Do not print the output, instead return values as specified // Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for more details int rows[A.size()]; int cols[A[0].size()]; memset(rows,0,sizeof rows); memset(cols,0,sizeof cols); for(int i=0;i<A.size();++i) { for(int j=0;j<A[i].size();++j) { if(A[i][j]==0) { rows[i]=1; cols[j]=1; } } } for(int i=0;i<A.size();++i) { for(int j=0;j<A[i].size();++j) { if(rows[i]==1 || cols[j]==1) A[i][j]=0; } } }
19.949153
107
0.544605
sankalpmittal1911-BitSian
f4dff7852c529967fd685d6dc5520ad3edce7e10
667
cpp
C++
competitive/c++/codeforces/round 690 div 3/maina.cpp
HackintoshwithUbuntu/BigRepo
70746ddf7edc1ec9f13fe5f53a40eb4c3ebd2874
[ "MIT" ]
null
null
null
competitive/c++/codeforces/round 690 div 3/maina.cpp
HackintoshwithUbuntu/BigRepo
70746ddf7edc1ec9f13fe5f53a40eb4c3ebd2874
[ "MIT" ]
null
null
null
competitive/c++/codeforces/round 690 div 3/maina.cpp
HackintoshwithUbuntu/BigRepo
70746ddf7edc1ec9f13fe5f53a40eb4c3ebd2874
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int n, b; void solve() { int a[300]; int ans[300]; cin >> n; for(int i = 0; i < n; i++){ int z; cin >> z; a[i] = z; } int lp = 0; int rp = n - 1; for (int i = 0; i < n; i++) { if ((i & 1) == 0) { ans[i] = a[lp++]; } else { ans[i] = a[rp--]; } } for(int i = 0; i < n; i++){ cout << ans[i] << " "; } cout << "\n"; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while(t--) { solve(); } return 0; }
13.895833
37
0.346327
HackintoshwithUbuntu
f4e14ae2c08845766c7fa9b6b9d3a83791c44bd1
634
cpp
C++
src/absyn/DoubleLiteral.cpp
shiruizhao/swift
2026acce35f0717c7a3e9dc522ff1c69f8dc3227
[ "BSD-4-Clause-UC", "BSD-4-Clause" ]
22
2016-07-11T15:34:14.000Z
2021-04-19T04:11:13.000Z
src/absyn/DoubleLiteral.cpp
shiruizhao/swift
2026acce35f0717c7a3e9dc522ff1c69f8dc3227
[ "BSD-4-Clause-UC", "BSD-4-Clause" ]
14
2016-07-11T14:28:42.000Z
2017-01-27T02:59:24.000Z
src/absyn/DoubleLiteral.cpp
shiruizhao/swift
2026acce35f0717c7a3e9dc522ff1c69f8dc3227
[ "BSD-4-Clause-UC", "BSD-4-Clause" ]
7
2016-10-03T10:05:06.000Z
2021-05-31T00:58:35.000Z
/* * DoubleLiteral.cpp * * Created on: Oct 29, 2013 * Author: yiwu */ #include "DoubleLiteral.h" namespace swift { namespace absyn { DoubleLiteral::DoubleLiteral(int l, int c, double value) : Literal(l, c), value(value) { } DoubleLiteral::~DoubleLiteral() { } double DoubleLiteral::getValue() { return value; } // For Debugging Use void DoubleLiteral::print(FILE* file, int indent) { fprintf(file, "%*s(DoubleLiteral: %f )\n", indent, "", value); } std::string DoubleLiteral::toString() { return std::to_string(value); } Expr* DoubleLiteral::clone() { return new DoubleLiteral(line, col, value); } } }
16.25641
64
0.665615
shiruizhao
f4e329e0eb966a4659fafb31f403f80081093825
278
cpp
C++
platform/include/platform/types/main.cpp
Garph/Carbon
4e412c5ff4a81e15cae2e86ff7476ca2ee3df080
[ "MIT" ]
null
null
null
platform/include/platform/types/main.cpp
Garph/Carbon
4e412c5ff4a81e15cae2e86ff7476ca2ee3df080
[ "MIT" ]
null
null
null
platform/include/platform/types/main.cpp
Garph/Carbon
4e412c5ff4a81e15cae2e86ff7476ca2ee3df080
[ "MIT" ]
null
null
null
#include "view.h" #include <iostream> void foo(emb::view<int> xs) { for (auto const& x : xs) { std::cout << x << ", "; } std::cout << std::endl; } int main(void) { int arr[5] = {0, 1, 2, 3, 4}; emb::view<int> xs(arr); foo(xs); return 0; }
13.9
33
0.478417
Garph
f4e8b4c1b62a21dffa61fb8e2cd3157fc4079071
797
cpp
C++
2018/01/01.cpp
hjaremko/advent-of-code
a108787eb0e10a9eea67b0cec575e81457a8123c
[ "MIT" ]
3
2018-12-01T16:32:24.000Z
2020-12-03T15:03:55.000Z
2018/01/01.cpp
hjaremko/advent-of-code
a108787eb0e10a9eea67b0cec575e81457a8123c
[ "MIT" ]
null
null
null
2018/01/01.cpp
hjaremko/advent-of-code
a108787eb0e10a9eea67b0cec575e81457a8123c
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <fstream> #include <unordered_map> int main() { std::fstream input( "input.txt", std::ios::out | std::ios::in ); int frequency = 0; int delta = 0; std::vector<int> input_arr; std::unordered_map<int, int> frequencies; while ( input >> delta ) { input_arr.push_back( delta ); } for ( int i = 0; true; ++i ) { frequency += input_arr.at( i % input_arr.size() ); auto result = frequencies.find( frequency ); if ( result != std::end( frequencies ) ) { std::cout << result->first << std::endl; break; } else { frequencies.insert( {frequency, frequency} ); } } input.close(); return 0; }
18.97619
68
0.520703
hjaremko
f4ee62a6f6af669296cb2ad9230280d23866b730
6,942
hpp
C++
src/Nodes/Led/LedPattern.hpp
AntorFr/SmartIot
92dc609aafe6f8894d8119b99f7129999e66fce0
[ "MIT" ]
3
2019-02-28T22:01:42.000Z
2020-02-10T12:49:02.000Z
src/Nodes/Led/LedPattern.hpp
AntorFr/SmartIot
92dc609aafe6f8894d8119b99f7129999e66fce0
[ "MIT" ]
1
2022-01-29T16:53:53.000Z
2022-01-29T16:53:53.000Z
src/Nodes/Led/LedPattern.hpp
AntorFr/SmartIot
92dc609aafe6f8894d8119b99f7129999e66fce0
[ "MIT" ]
null
null
null
#pragma once #include "Led.hpp" #include "GradientPalettes.hpp" class LedObject; namespace SmartIotInternals { class LedPattern { friend LedObject; public: LedPattern(const LedObject* obj); bool toShow() {return _show;} void show() {_show=true;} void showed() {_show=false;} protected: virtual void init() {}; virtual void display() {}; void addGlitter(fract8 chanceOfGlitter); void addPowerCut(fract16 chanceOfPowercut); uint8_t _nbLed; CRGB* _leds; const LedObject* _obj; bool _show; }; class OffPattern : public LedPattern { friend LedObject; public: OffPattern(const LedObject* obj):LedPattern(obj){} protected: void init() override; }; class ColorPattern : public LedPattern { friend LedObject; public: ColorPattern(const LedObject* obj):LedPattern(obj){} protected: void init() override; }; class BlinkPattern : public LedPattern { friend LedObject; public: BlinkPattern(const LedObject* obj):LedPattern(obj),_blink(false){} protected: void init() override; void display() override; private: CEveryNMillis _ticker; bool _blink; }; class WipePattern : public LedPattern { friend LedObject; public: WipePattern(const LedObject* obj):LedPattern(obj){} protected: void display() override; }; class LaserPattern : public LedPattern { friend LedObject; public: LaserPattern(const LedObject* obj):LedPattern(obj){} protected: void display() override; }; class BreathePattern : public LedPattern { friend LedObject; public: BreathePattern(const LedObject* obj):LedPattern(obj){} protected: void display() override; }; class RainbowPattern : public LedPattern { friend LedObject; public: RainbowPattern(const LedObject* obj):LedPattern(obj){} protected: void display() override; }; class K2000Pattern : public LedPattern { friend LedObject; public: K2000Pattern(const LedObject* obj):LedPattern(obj){} protected: void display() override; }; class ComputerPattern : public LedPattern { friend LedObject; public: ComputerPattern(const LedObject* obj):LedPattern(obj){} protected: void display() override; }; class ConfettiPattern : public LedPattern { friend LedObject; public: ConfettiPattern(const LedObject* obj):LedPattern(obj){} protected: void display() override; }; class StarPattern : public LedPattern { friend LedObject; public: StarPattern(const LedObject* obj):LedPattern(obj),_stars(nullptr){} protected: uint8_t* _stars; void init() override; void display() override; }; class PridePattern : public LedPattern { friend LedObject; public: PridePattern(const LedObject* obj):LedPattern(obj),sPseudotime(0),sLastMillis(0),sHue16(0){} protected: void display() override; private: uint16_t sPseudotime; uint16_t sLastMillis; uint16_t sHue16 ; }; class TwinkleFoxPattern : public LedPattern { friend LedObject; public: TwinkleFoxPattern(const LedObject* obj, CRGBPalette16 palette):LedPattern(obj),_speed(4),_density(5),gBackgroundColor(CRGB::Black),_autoBGColor(false),_coolLikeIncandescent(true){gCurrentPalette = palette;} protected: void display() override; CRGB computeOneTwinkle( uint32_t ms, uint8_t salt); void coolLikeIncandescent( CRGB& c, uint8_t phase); uint8_t attackDecayWave8( uint8_t i); private: uint8_t _speed; uint8_t _density; CRGB gBackgroundColor; bool _autoBGColor; bool _coolLikeIncandescent; CRGBPalette16 gCurrentPalette; }; class TwinklePattern : public LedPattern { friend LedObject; public: TwinklePattern(const LedObject* obj, CRGBPalette16 palette):LedPattern(obj),_startingBritghtness(64),_fadeInSpeed(32),_fadeOutSpeed(20),_density(255){ gCurrentPalette = palette;} protected: void init() override; void display() override; CRGB makeBrighter( const CRGB& color, fract8 howMuchBrighter); CRGB makeDarker( const CRGB& color, fract8 howMuchDarker); bool getPixelDirection( uint16_t i); void setPixelDirection( uint16_t i, bool dir); void brightenOrDarkenEachPixel(fract8 fadeUpAmount, fract8 fadeDownAmount); private: CEveryNMillis _ticker; uint8_t _startingBritghtness; uint8_t _fadeInSpeed; uint8_t _fadeOutSpeed; uint8_t _density; uint8_t* _directionFlags; CRGBPalette16 gCurrentPalette; enum { GETTING_DARKER = 0, GETTING_BRIGHTER = 1 }; }; class RainbowSoundPattern : public LedPattern { friend LedObject; public: RainbowSoundPattern(const LedObject* obj):LedPattern(obj){} protected: void display() override; }; class HeatMapPattern : public LedPattern { friend LedObject; public: HeatMapPattern(const LedObject* obj,CRGBPalette16 palette, bool up):LedPattern(obj),_cooling(49),_sparking(60){gCurrentPalette = palette; _up = up;} protected: void init() override; void display() override; private: CRGBPalette16 gCurrentPalette; bool _up; uint8_t _halfLedCount; byte** _heat; uint8_t _cooling; uint8_t _sparking; }; class ColorWavePattern : public LedPattern { friend LedObject; public: ColorWavePattern(const LedObject* obj,CRGBPalette16 palette):LedPattern(obj),sPseudotime(0),sLastMillis(0),sHue16(0){gCurrentPalette = palette;} protected: void display() override; private: CRGBPalette16 gCurrentPalette; uint16_t sPseudotime; uint16_t sLastMillis; uint16_t sHue16; }; class SinelonPattern : public LedPattern { friend LedObject; public: SinelonPattern(const LedObject* obj):LedPattern(obj),prevpos(0){} protected: void display() override; private: uint16_t prevpos; }; } // namespace SmartIotInternals
33.057143
218
0.600547
AntorFr
f4efb974f5df44fd84f4518c5d96e68f92ad6fde
804
cpp
C++
apps/vJoyList/MyMFCListCtrl.cpp
lukester1975/vJoy
28bede0a486dd0a303157c1365d4f18464e7034d
[ "MIT" ]
432
2015-08-12T03:06:13.000Z
2022-03-29T17:42:12.000Z
apps/vJoyList/MyMFCListCtrl.cpp
jiangnane/vJoy
911a2a53a972f73ea8b4a021c390c953012b7fb9
[ "MIT" ]
64
2016-01-11T06:31:05.000Z
2022-03-26T21:17:17.000Z
apps/vJoyList/MyMFCListCtrl.cpp
jiangnane/vJoy
911a2a53a972f73ea8b4a021c390c953012b7fb9
[ "MIT" ]
109
2015-10-11T14:27:28.000Z
2022-03-29T17:42:21.000Z
// MyMFCListCtrl.cpp : implementation file // #include "stdafx.h" #include "vJoyList.h" #include "MyMFCListCtrl.h" // CMyMFCListCtrl IMPLEMENT_DYNAMIC(CMyMFCListCtrl, CMFCListCtrl) COLORREF CMyMFCListCtrl::OnGetCellTextColor(int nRow, int nColum) { if (!Exist[nRow]) return RGB(200, 200, 200); else { if (!Owned[nRow]) return RGB(0, 0, 0); else return RGB(250, 50, 0); } } CMyMFCListCtrl::CMyMFCListCtrl() { } CMyMFCListCtrl::~CMyMFCListCtrl() { } void CMyMFCListCtrl::SetExist(int id, bool exist) { if (id < 1 || id>16) return; Exist[id - 1] = exist; } void CMyMFCListCtrl::SetOwned(int id, bool exist) { if (id < 1 || id>16) return; Owned[id - 1] = exist; } BEGIN_MESSAGE_MAP(CMyMFCListCtrl, CMFCListCtrl) END_MESSAGE_MAP() // CMyMFCListCtrl message handlers
13.4
65
0.686567
lukester1975
f4f341c0d915a82506d114579a0967963bae0e65
4,416
cpp
C++
pc-client/Public/LejuTbableWidget.cpp
LejuRobotics/Aelos-Vision-Demo
0b4ad1338bd018e8107533a7164d00442ff1d394
[ "Apache-2.0" ]
6
2018-10-23T07:28:35.000Z
2020-02-06T02:19:40.000Z
pc-client/Public/LejuTbableWidget.cpp
LejuRobotics/Aelos-Vision-Demo
0b4ad1338bd018e8107533a7164d00442ff1d394
[ "Apache-2.0" ]
null
null
null
pc-client/Public/LejuTbableWidget.cpp
LejuRobotics/Aelos-Vision-Demo
0b4ad1338bd018e8107533a7164d00442ff1d394
[ "Apache-2.0" ]
3
2018-12-25T08:34:15.000Z
2020-04-16T07:03:00.000Z
/** * @file LejuTbableWidget.cpp * @version 1.0 * @date 2017年07月22日 * @author C_Are * @copyright Leju * * @brief 记录标记颜色的列表,LejuTbableWidget类的cpp文件 */ #include "LejuTbableWidget.h" LejuTbableWidget::LejuTbableWidget(QWidget *parent) : QTableWidget(parent) { //设置表头 setColumnCount(7); m_headLabelList << tr(" Name") << tr("Time") << tr("Color") << tr("Width") << tr("Type") << tr("Turn") << tr("State"); setHorizontalHeaderLabels(m_headLabelList); horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents); horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents); horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents); horizontalHeader()->setSectionResizeMode(4, QHeaderView::ResizeToContents); horizontalHeader()->setSectionResizeMode(5, QHeaderView::ResizeToContents); horizontalHeader()->setSectionResizeMode(6, QHeaderView::ResizeToContents); // horizontalHeader()->setStyleSheet("color: red;"); // horizontalHeader()->setStyleSheet("color: red; background-color: #424242; "); horizontalHeader()->setStyleSheet("QHeaderView::section {background-color: #797979; border-radius:0px; border-width: 1px;}"); //创建右键菜单 menu = new QMenu(this); QAction *action = new QAction(this); action->setText(tr("删除")); connect(action,SIGNAL(triggered()),this,SLOT(onDeleteItem())); menu->addAction(action); } LejuTbableWidget::~LejuTbableWidget() { } void LejuTbableWidget::addItem(const QString &pTime, const QString &pColor, int pWidth) { insertRow(rowCount()); QComboBox *combox = new QComboBox(this); combox->setProperty("row", rowCount()-1); combox->addItem(tr("障碍物")); combox->addItem(tr("目标")); combox->addItem(tr("足球")); connect(combox, SIGNAL(currentIndexChanged(int)), this, SLOT(onTypeChanged(int))); QComboBox *combox_2 = new QComboBox(this); combox_2->setProperty("row", rowCount()-1); combox_2->addItem(tr("Left")); combox_2->addItem(tr("Right")); connect(combox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(onTurnChanged(int))); LejuColorLabel *colorLabel = new LejuColorLabel(this); colorLabel->setColor(pColor); setItem(rowCount()-1,0,new QTableWidgetItem(QString(tr("目标%1")).arg(rowCount()))); setItem(rowCount()-1,1,new QTableWidgetItem(pTime)); setCellWidget(rowCount()-1, 2, colorLabel); setItem(rowCount()-1,3,new QTableWidgetItem(QString::number(pWidth))); setCellWidget(rowCount()-1, 4, combox); setCellWidget(rowCount()-1, 5, combox_2); setItem(rowCount()-1,6,new QTableWidgetItem(tr("未完成"))); item(rowCount()-1,1)->setTextAlignment(Qt::AlignCenter); item(rowCount()-1,3)->setTextAlignment(Qt::AlignCenter); item(rowCount()-1,6)->setTextAlignment(Qt::AlignCenter); } QString LejuTbableWidget::lastName() const { return item(rowCount()-1, 0)->text(); } int LejuTbableWidget::lastType() const { QComboBox *box = (QComboBox*)cellWidget(rowCount()-1,4); return box->currentIndex(); } int LejuTbableWidget::lastTurn() const { QComboBox *box = (QComboBox*)cellWidget(rowCount()-1,5); return box->currentIndex(); } bool LejuTbableWidget::isAllFinished() const { for (int i=0; i<rowCount(); ++i) { if (item(i, 6)->text() == tr("未完成")) { return false; } } return true; } void LejuTbableWidget::resetState() { for (int i=0; i<rowCount(); ++i) { item(i, 6)->setText(tr("未完成")); } } void LejuTbableWidget::onDeleteItem() { QString msg; msg = QString("Remove Target=%1").arg(currentRow()); emit sendData(msg.toUtf8()); removeRow(currentRow()); } void LejuTbableWidget::onTypeChanged(int index) { int nRow = sender()->property("row").toInt(); QString msg; msg = QString("set Target.Type=%1,%2").arg(nRow).arg(index); emit sendData(msg.toUtf8()); } void LejuTbableWidget::onTurnChanged(int index) { int nRow = sender()->property("row").toInt(); QString msg; msg = QString("set Target.Turn=%1,%2").arg(nRow).arg(index); emit sendData(msg.toUtf8()); } void LejuTbableWidget::contextMenuEvent(QContextMenuEvent *e) { menu->exec(QCursor::pos()); QTableWidget::contextMenuEvent(e); }
30.246575
129
0.666893
LejuRobotics
f4f83be5e7f79391192be51edcd62a436de028cf
7,576
tcc
C++
include/onnc/ADT/Bits/Digraph.tcc
LiuLeif/onnc
3f69e46172a9c33cc04541ff7fd78d5d7b6bdbba
[ "BSD-3-Clause" ]
450
2018-08-03T08:17:03.000Z
2022-03-17T17:21:06.000Z
include/onnc/ADT/Bits/Digraph.tcc
ffk0716/onnc
91e4955ade64b479db17aaeccacf4b7339fe44d2
[ "BSD-3-Clause" ]
104
2018-08-13T07:31:50.000Z
2021-08-24T11:24:40.000Z
include/onnc/ADT/Bits/Digraph.tcc
ffk0716/onnc
91e4955ade64b479db17aaeccacf4b7339fe44d2
[ "BSD-3-Clause" ]
100
2018-08-12T04:27:39.000Z
2022-03-11T04:17:42.000Z
//===-- Digraph.tcc -------------------------------------------------------===// // // The ONNC Project // // See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // Digraph //===----------------------------------------------------------------------===// template<typename NodeType, typename ArcType> Digraph<NodeType, ArcType>::Digraph() : m_pNodeHead(nullptr), m_pNodeRear(nullptr), m_pFreeNodeHead(nullptr), m_pFreeArcHead(nullptr), m_NodeList(), m_ArcList() { } template<typename NodeType, typename ArcType> Digraph<NodeType, ArcType>::~Digraph() { clear(); } template<typename NodeType, typename ArcType> template<class ... NodeCtorParams> typename Digraph<NodeType, ArcType>::Node* Digraph<NodeType, ArcType>::addNode(NodeCtorParams&& ... pParams) { // 1. find an available free node Node* result = nullptr; if (nullptr == m_pFreeNodeHead) { result = new NodeType(pParams...); m_NodeList.push_back(result); } else { result = m_pFreeNodeHead; m_pFreeNodeHead = static_cast<NodeType*>(m_pFreeNodeHead->next); } // 2. set up linkages result->prev = m_pNodeRear; result->next = nullptr; result->first_in = nullptr; result->last_in = nullptr; result->first_out = nullptr; result->last_out = nullptr; // 3. reset rear node if (nullptr != m_pNodeRear) { m_pNodeRear->next = result; } m_pNodeRear = result; if (nullptr == m_pNodeHead) m_pNodeHead = result; return result; } template<typename NodeType, typename ArcType> template<typename ... ArcCtorParams> typename Digraph<NodeType, ArcType>::Arc* Digraph<NodeType, ArcType>::addArc(Node& pU, Node& pV, ArcCtorParams&& ... pParams) { // 1. find an available free arc Arc* result = nullptr; if (nullptr == m_pFreeArcHead) { result = new ArcType(pParams...); m_ArcList.push_back(result); } else { result = m_pFreeArcHead; m_pFreeArcHead = static_cast<ArcType*>(m_pFreeArcHead->next_in); } // 2. set up arc result->source = &pU; result->target = &pV; result->prev_in = nullptr; result->next_in = nullptr; result->prev_out = nullptr; result->next_out = nullptr; // 3. set up fan-out linked list result->prev_out = pU.last_out; if (nullptr != pU.last_out) { pU.last_out->next_out = result; } else { // last_out is nullptr => a node without fan-out arcs. pU.first_out = result; } pU.last_out = result; // 4. set up fan-in linked list result->prev_in = pV.last_in; if (nullptr != pV.last_in) { pV.last_in->next_in = result; } else { // last_in is nullptr => a node without fan-in arcs pV.first_in = result; } pV.last_in = result; return result; } template<typename NodeType, typename ArcType> void Digraph<NodeType, ArcType>::erase(Node& pNode) { // 1. connect previous node and next node. if (nullptr != pNode.next) { pNode.next->prev = pNode.prev; } else { // pNode.next is NULL => pNode is the rear m_pNodeRear = pNode.getPrevNode(); } if (nullptr != pNode.prev) { pNode.prev->next = pNode.next; } else { // pNode.prev is NULL => pNode is the head m_pNodeHead = pNode.getNextNode(); } // 2. remove all fan-in arcs Arc* fan_in = pNode.getFirstInArc(); while(nullptr != fan_in) { Arc* next_in = fan_in->getNextIn(); erase(*fan_in); fan_in = next_in; } // 3. remove all fan-out arcs Arc* fan_out = pNode.getFirstOutArc(); while(nullptr != fan_out) { Arc* next_out = fan_out->getNextOut(); erase(*fan_out); fan_out = next_out; } // 4. put pNode in the free node list pNode.next = m_pFreeNodeHead; pNode.prev = nullptr; if (nullptr != m_pFreeNodeHead) m_pFreeNodeHead->prev = &pNode; m_pFreeNodeHead = &pNode; } template<typename NodeType, typename ArcType> void Digraph<NodeType, ArcType>::erase(Arc& pArc) { // 1. remove from the fan-out list if (nullptr != pArc.prev_out) { pArc.prev_out->next_out = pArc.next_out; } else { // pArc.prev_out is NULL => pArc is the first_out of the source pArc.source->first_out = pArc.next_out; } if (nullptr != pArc.next_out) { // a middle arc pArc.next_out->prev_out = pArc.prev_out; } // 2. remove from the fan-in list if (nullptr != pArc.prev_in) { pArc.prev_in->next_in = pArc.next_in; } else { pArc.target->first_in = pArc.next_in; } if (nullptr != pArc.next_in) { pArc.next_in->prev_in = pArc.prev_in; } // 3. put pArc in the free arc list // Use fan-in links to chain the free list pArc.next_in = m_pFreeArcHead; m_pFreeArcHead = &pArc; } template<typename NodeType, typename ArcType> void Digraph<NodeType, ArcType>::clear() { m_pNodeHead = nullptr; m_pNodeRear = nullptr; m_pFreeNodeHead = nullptr; m_pFreeArcHead = nullptr; // delete all nodes typename NodeList::iterator node, nEnd = m_NodeList.end(); for (node = m_NodeList.begin(); node != nEnd; ++node) delete *node; // delete all arcs typename ArcList::iterator arc, aEnd = m_ArcList.end(); for (arc = m_ArcList.begin(); arc != aEnd; ++arc) delete *arc; m_NodeList.clear(); m_ArcList.clear(); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::iterator Digraph<NodeType, ArcType>::begin() { return iterator(m_pNodeHead); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::iterator Digraph<NodeType, ArcType>::end() { return iterator(nullptr); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::const_iterator Digraph<NodeType, ArcType>::begin() const { return const_iterator(m_pNodeHead); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::const_iterator Digraph<NodeType, ArcType>::end() const { return const_iterator(nullptr); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::dfs_iterator Digraph<NodeType, ArcType>::dfs_begin() { return dfs_iterator(m_pNodeHead); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::dfs_iterator Digraph<NodeType, ArcType>::dfs_end() { return dfs_iterator(); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::const_dfs_iterator Digraph<NodeType, ArcType>::dfs_begin() const { return const_dfs_iterator(m_pNodeHead); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::const_dfs_iterator Digraph<NodeType, ArcType>::dfs_end() const { return const_dfs_iterator(); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::bfs_iterator Digraph<NodeType, ArcType>::bfs_begin() { return bfs_iterator(m_pNodeHead); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::bfs_iterator Digraph<NodeType, ArcType>::bfs_end() { return bfs_iterator(); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::const_bfs_iterator Digraph<NodeType, ArcType>::bfs_begin() const { return const_bfs_iterator(m_pNodeHead); } template<typename NodeType, typename ArcType> typename Digraph<NodeType, ArcType>::const_bfs_iterator Digraph<NodeType, ArcType>::bfs_end() const { return const_bfs_iterator(); } template<typename NodeType, typename ArcType> bool Digraph<NodeType, ArcType>::exists(const Node& pNode) const { iterator node, nEnd = end(); for (node = begin(); node != nEnd; ++node) { if (&pNode == node.node()) return true; } return false; }
25.508418
83
0.679382
LiuLeif
f4fc9b2ec391f323f5a81167ade7d1593280cddc
6,657
cpp
C++
Source/Dreemchest/Io/DiskFileSystem.cpp
dmsovetov/Dreemchest
39255c88943abc69c7fa0710b7ca8486c08260e0
[ "MIT" ]
11
2016-02-18T15:24:49.000Z
2021-01-30T18:26:04.000Z
Source/Dreemchest/Io/DiskFileSystem.cpp
dmsovetov/dreemchest
39255c88943abc69c7fa0710b7ca8486c08260e0
[ "MIT" ]
2
2016-05-23T22:48:35.000Z
2017-02-13T16:43:32.000Z
Source/Dreemchest/Io/DiskFileSystem.cpp
dmsovetov/dreemchest
39255c88943abc69c7fa0710b7ca8486c08260e0
[ "MIT" ]
3
2016-08-19T13:26:59.000Z
2018-08-03T04:28:14.000Z
/************************************************************************** The MIT License (MIT) Copyright (c) 2015 Dmitry Sovetov https://github.com/dmsovetov 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 "DiskFileSystem.h" #include "streams/FileStream.h" #include "Archive.h" DC_BEGIN_DREEMCHEST namespace Io { // ** DiskFileSystem::DiskFileSystem DiskFileSystem::DiskFileSystem( void ) { } DiskFileSystem::~DiskFileSystem( void ) { } // ** DiskFileSystem::open StreamPtr DiskFileSystem::open( const Path& fileName, StreamMode mode ) { Io::DiskFileSystem fs; StreamPtr stream = fs.openFile( fileName, mode ); return stream; } // ** DiskFileSystem::openFile StreamPtr DiskFileSystem::openFile( const Path& fileName, StreamMode mode ) const { FileStreamPtr file = DC_NEW FileStream; if( !file->open( fileName, mode ) ) { return StreamPtr(); } return file; } // ** DiskFileSystem::openFile StreamPtr DiskFileSystem::openFile( const Path& fileName ) const { /* #ifdef DC_PLATFORM_FLASH inline_as3( "import com.adobe.flascc.CModule \n" "" "CModule.rootSprite.addFile( CModule.readString( %0, %1 ) ); \n" : : "r"( fileName ), "r"( strlen( fileName ) ) ); #endif char path[MaxPathLength + 1]; for( int i = 0; i < ( int )m_paths.size(); i++ ) { #if defined( DC_PLATFORM_MACOS ) || defined( DC_PLATFORM_IOS ) if( fileName[0] == '/' ) { _snprintf( path, MaxPathLength, "%s", fileName ); } else { if( m_paths[i][0] != '/' ) { _snprintf( path, MaxPathLength, "%s%s%s", m_baseDir.c_str(), m_paths[i].c_str(), fileName ); } else { _snprintf( path, MaxPathLength, "%s%s", m_paths[i].c_str(), fileName ); } } #else _snprintf( path, MaxPathLength, "%s%s%s", m_baseDir.c_str(), m_paths[i].c_str(), fileName ); #endif if( fileExistsAtPath( path ) ) { return openFile( path, "rb" ); } } for( ArchiveList::const_iterator i = m_packages.begin(), end = m_packages.end(); i != end; i++ ) { if( (*i)->fileExists( fileName ) ) { return (*i)->openFile( fileName ); } } */ if( fileExistsAtPath( fileName ) ) { return openFile( fileName, BinaryReadStream ); } return StreamPtr(); } // ** DiskFileSystem::fileExists bool DiskFileSystem::fileExists( const Path& fileName ) const { /* char path[MaxPathLength + 1]; for( int i = 0; i < ( int )m_paths.size(); i++ ) { _snprintf( path, MaxPathLength, "%s%s%s", m_baseDir.c_str(), m_paths[i].c_str(), fileName ); if( fileExistsAtPath( path ) ) { return true; } } #ifdef DC_ZIP for( tPackageList::const_iterator i = packages.begin(), end = packages.end(); i != end; i++ ) { if( (*i)->fileExists( fileName ) ) { return true; } } #endif */ return fileExistsAtPath( fileName ); } // ** DiskFileSystem::fileExistsAtPath bool DiskFileSystem::fileExistsAtPath( const Path& fileName ) { FILE *file = fopen( fileName.c_str(), "rb" ); if( !file ) { return false; } fclose( file ); return true; } // ** DiskFileSystem::readTextFile String DiskFileSystem::readTextFile( const Path& fileName ) { StreamPtr file = open( fileName ); if( !file.valid() ) { return ""; } String result; result.resize( file->length() ); file->read( &result[0], file->length() ); return result; } // ** DiskFileSystem::openPackage ArchivePtr DiskFileSystem::openPackage( const Path& fileName ) const { StreamPtr file = openFile( fileName ); if( file == NULL ) { return ArchivePtr(); } // ** Open package ArchivePtr package = DC_NEW Archive( this ); if( !package->open( file ) ) { return ArchivePtr(); } return package; } // ** DiskFileSystem::loadPackage ArchivePtr DiskFileSystem::loadPackage( const Path& fileName ) { // ** First search for previously loaded package ArchivePtr alreadyLoaded = findPackage( fileName ); if( alreadyLoaded != NULL ) { return alreadyLoaded; } // ** Open a package ArchivePtr archive = openPackage( fileName ); if( archive != NULL ) { m_archives[fileName] = archive; return archive; } return NULL; } // ** DiskFileSystem::unloadPackage bool DiskFileSystem::unloadPackage( const Path& fileName ) { Archives::iterator i = m_archives.find( fileName ); if( i == m_archives.end() ) { return false; } m_archives.erase( i ); return true; } // ** DiskFileSystem::findPackage ArchivePtr DiskFileSystem::findPackage( const Path& fileName ) { Archives::iterator i = m_archives.find( fileName ); return i != m_archives.end() ? i->second : NULL; } // ** DiskFileSystem::addPath //void DiskFileSystem::addPath( const Path& path ) //{ // m_paths.insert( path ); //} // ** DiskFileSystem::removePath //void DiskFileSystem::removePath( const Path& path ) //{ // PathSet::iterator i = m_paths.find( path ); // // if( i != m_paths.end() ) { // m_paths.erase( i ); // } //} // ** DiskFileSystem::setBaseDir //void DiskFileSystem::setBaseDir( const Path& value ) //{ // m_baseDir = value; //} // ** DiskFileSystem::baseDir //const Path& DiskFileSystem::baseDir(void ) const //{ // return m_baseDir; //} } // namespace Io DC_END_DREEMCHEST
26.208661
108
0.61379
dmsovetov
f4fd6d665b50e8d3cb3fa3ee3b2da2eeedc011fe
4,236
cc
C++
mongoose/challenge/src/vmips/deviceint.cc
assert0/hackasat-qualifier-2021
ffa17fc3c3f167c2a81fd3c12e43af9aacb2e95c
[ "MIT" ]
75
2020-07-20T20:54:00.000Z
2022-03-09T09:18:37.000Z
mongoose/challenge/src/vmips/deviceint.cc
assert0/hackasat-qualifier-2021
ffa17fc3c3f167c2a81fd3c12e43af9aacb2e95c
[ "MIT" ]
3
2020-09-13T00:46:49.000Z
2021-07-06T16:18:22.000Z
mongoose/challenge/src/vmips/deviceint.cc
assert0/hackasat-qualifier-2021
ffa17fc3c3f167c2a81fd3c12e43af9aacb2e95c
[ "MIT" ]
14
2020-07-22T16:34:51.000Z
2021-09-13T12:19:59.000Z
/* Base class for devices that can generate hardware interrupts. Copyright 2001, 2002 Brian R. Gaeke. Copyright 2002, 2003 Paul Twohey. This file is part of VMIPS. VMIPS 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. VMIPS 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 VMIPS; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "deviceint.h" #include "options.h" #include "vmips.h" extern vmips *machine; /* Given a value (LINE) representing one of the bits of the Cause register (IRQ7 .. IRQ0 in deviceint.h), return a string that describes the corresponding interrupt line. The string is returned in a static buffer, so the next call to strlineno will overwrite the result. */ char *DeviceInt::strlineno(uint32 line) { static char buff[50]; if (line == IRQ7) { sprintf(buff, "IRQ7"); } else if (line == IRQ6) { sprintf(buff, "IRQ6"); } else if (line == IRQ5) { sprintf(buff, "IRQ5"); } else if (line == IRQ4) { sprintf(buff, "IRQ4"); } else if (line == IRQ3) { sprintf(buff, "IRQ3"); } else if (line == IRQ2) { sprintf(buff, "IRQ2"); } else if (line == IRQ1) { sprintf(buff, "IRQ1"); } else if (line == IRQ0) { sprintf(buff, "IRQ0"); } else { sprintf(buff, "something strange (0x%08x)", line); } return buff; } uint32 DeviceInt::num2irq(uint32 num) { switch (num) { case 0: return IRQ0; case 1: return IRQ1; case 2: return IRQ2; case 3: return IRQ3; case 4: return IRQ4; case 5: return IRQ5; case 6: return IRQ6; case 7: return IRQ7; default: return 0; } } /* If the `reportirq' option is set, print a message to stderr noting that LINE was asserted. */ void DeviceInt::reportAssert(uint32 line) { if (opt_reportirq) fprintf(stderr, "%s asserted %s\n", descriptor_str(), strlineno(line)); } /* If the `reportirq' option is set, print a message to stderr noting that LINE was asserted even though it was disconnected. */ void DeviceInt::reportAssertDisconnected(uint32 line) { if (opt_reportirq) fprintf(stderr, "%s asserted %s but it wasn't connected\n", descriptor_str(), strlineno(line)); } /* If the `reportirq' option is set, print a message to stderr noting that LINE was deasserted. */ void DeviceInt::reportDeassert(uint32 line) { if (opt_reportirq) fprintf(stderr, "%s deasserted %s\n", descriptor_str(), strlineno(line)); } /* If the `reportirq' option is set, print a message to stderr noting that LINE was deasserted even though it was disconnected. */ void DeviceInt::reportDeassertDisconnected(uint32 line) { if (opt_reportirq) fprintf(stderr, "%s deasserted %s but it wasn't connected\n", descriptor_str(), strlineno(line)); } /* Assert an interrupt request on interrupt line LINE, which must be one of the IRQ7 .. IRQ0 constants in deviceint.h. An interrupt thus asserted remains asserted until it is explicitly deasserted. */ void DeviceInt::assertInt(uint32 line) { if (line & lines_connected) { if (! (line & lines_asserted)) reportAssert(line); lines_asserted |= line; } else { reportAssertDisconnected(line); } } /* Deassert an interrupt request on interrupt line LINE, which must be one of the IRQ7 .. IRQ0 constants in deviceint.h. Note that if one device deasserts the interrupt request, that doesn't necessarily mean that the interrupt line will go to zero; another device may be sharing the same interrupt line. */ void DeviceInt::deassertInt(uint32 line) { if (line & lines_connected) { if (line & lines_asserted) reportDeassert(line); lines_asserted &= ~line; } else { reportDeassertDisconnected(line); } } /* Constructor. */ DeviceInt::DeviceInt() : lines_connected(0), lines_asserted(0) { opt_reportirq = machine->opt->option("reportirq")->flag; }
29.830986
75
0.715297
assert0
f4ff050c8ab412d4b5c1841fbe015805f5200bf6
2,203
hpp
C++
multi_robot_explore_cpp/include/multi_robot_explore_cpp/get_map_value_node.hpp
wt160/multi_robot_explore_testbed
9d5fd50f5c7fd5f77a6dc70c74608c65cdf96396
[ "BSD-3-Clause" ]
null
null
null
multi_robot_explore_cpp/include/multi_robot_explore_cpp/get_map_value_node.hpp
wt160/multi_robot_explore_testbed
9d5fd50f5c7fd5f77a6dc70c74608c65cdf96396
[ "BSD-3-Clause" ]
null
null
null
multi_robot_explore_cpp/include/multi_robot_explore_cpp/get_map_value_node.hpp
wt160/multi_robot_explore_testbed
9d5fd50f5c7fd5f77a6dc70c74608c65cdf96396
[ "BSD-3-Clause" ]
null
null
null
#ifndef ROBOT_CONTROL_INTERFACE_HPP #define ROBOT_CONTROL_INTERFACE_HPP #include "rclcpp/rclcpp.hpp" #include "rclcpp_action/rclcpp_action.hpp" #include "multi_robot_explore_cpp/explore_util.hpp" #include <thread> #include <chrono> #include <future> #include "geometry_msgs/msg/pose.hpp" #include "geometry_msgs/msg/point.hpp" #include "geometry_msgs/msg/twist.hpp" #include "nav_msgs/msg/occupancy_grid.hpp" #include "nav2_msgs/action/compute_path_to_pose.hpp" #include "nav2_msgs/action/navigate_to_pose.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" #include "std_msgs/msg/string.hpp" #include "multi_robot_interfaces/srv/get_peer_map_value_on_coords.hpp" class GetMapValueNode: public rclcpp::Node{ public: using NavigateToPose = nav2_msgs::action::NavigateToPose; using GoalHandleNavigate = rclcpp_action::ClientGoalHandle<NavigateToPose>; GetMapValueNode(std::string robot_name, vector<std::string> peer_list); map<int, vector<int>> getMapValue(vector<pair<double, double>> frontier_pt_world_frame_list); int navigate_to_pose_state_ = 0; private: map<string, rclcpp::Client<multi_robot_interfaces::srv::GetPeerMapValueOnCoords>::SharedPtr> get_map_value_client_dict_; map<string, rclcpp::callback_group::CallbackGroup::SharedPtr> callback_group_map_; vector<string> peer_list_; vector<int> map_value_list_; bool is_received_; rclcpp::Publisher<geometry_msgs::msg::Twist>::SharedPtr cmd_vel_pub_; rclcpp_action::Client<NavigateToPose>::SharedPtr navigate_client_ptr_; rclcpp::Subscription<std_msgs::msg::String>::SharedPtr test_sub_; int total_robot_num_; std::string robot_name_; int current_state_; int previous_state_; std::vector<std::string> persistent_robot_peers_; nav_msgs::msg::OccupancyGrid local_map_; nav_msgs::msg::OccupancyGrid inflated_local_map_; geometry_msgs::msg::Pose current_target_pose_; geometry_msgs::msg::Pose next_target_pose_; nav_msgs::msg::OccupancyGrid merged_map_; std::string robot_map_frame_; std::string robot_base_frame_; }; #endif
37.982759
128
0.744893
wt160
f4ff69185795821275501eb6a0f5f639cfafe54e
251
cpp
C++
NullStream.cpp
malord/prime
f0e8be99b7dcd482708b9c928322bc07a3128506
[ "MIT" ]
null
null
null
NullStream.cpp
malord/prime
f0e8be99b7dcd482708b9c928322bc07a3128506
[ "MIT" ]
null
null
null
NullStream.cpp
malord/prime
f0e8be99b7dcd482708b9c928322bc07a3128506
[ "MIT" ]
null
null
null
// Copyright 2000-2021 Mark H. P. Lord #include "NullStream.h" namespace Prime { ptrdiff_t NullStream::readSome(void*, size_t, Log*) { return 0; } ptrdiff_t NullStream::writeSome(const void*, size_t maxBytes, Log*) { return maxBytes; } }
13.944444
67
0.693227
malord
7605661c6c7945dd63c11ca1145de7d9743bcc63
10,670
cpp
C++
src/cpp/BaseWindow.cpp
orbitrc/blusher
bf90272308c0ff06560f0feace5845d77a05d70f
[ "MIT" ]
3
2019-08-08T05:48:24.000Z
2021-08-23T01:24:29.000Z
src/cpp/BaseWindow.cpp
orbitrc/blusher
bf90272308c0ff06560f0feace5845d77a05d70f
[ "MIT" ]
2
2021-06-28T10:50:52.000Z
2021-07-11T10:37:29.000Z
src/cpp/BaseWindow.cpp
orbitrc/blusher
bf90272308c0ff06560f0feace5845d77a05d70f
[ "MIT" ]
1
2019-08-15T04:19:51.000Z
2019-08-15T04:19:51.000Z
#include "BaseWindow.h" #include <stdint.h> #include <blusher/base.h> #include "DesktopEnvironment.h" #include "Ewmh.h" #include "Blusher.h" #include <QScreen> namespace bl { BaseWindow::BaseWindow(QWindow *parent) : QQuickWindow(parent) { this->m_netWmStrutPartial = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; this->m_type = static_cast<int>(BaseWindow::WindowType::Normal); this->m_pos.setX(QQuickWindow::x()); this->m_pos.setY(QQuickWindow::y()); this->m_size.setWidth(QQuickWindow::width()); this->m_size.setHeight(QQuickWindow::height()); this->m_scale = 1; this->m_menu = nullptr; this->m_anchors.setTop(AnchorLine(this->contentItem())); this->m_anchors.setLeft(AnchorLine(this->contentItem())); this->m_anchors.setRight(AnchorLine(this->contentItem())); this->m_anchors.setBottom(AnchorLine(this->contentItem())); QObject::connect(this, &QQuickWindow::screenChanged, this, &BaseWindow::q_onScreenChanged); QObject::connect(DesktopEnvironment::singleton, &DesktopEnvironment::screenScaleChanged, this, &BaseWindow::changeScale); // Connect signals that window geometry changed by window manager. // Not connect to setX signals because prevent circular signal chain. QObject::connect(this, &QWindow::xChanged, this, &BaseWindow::q_onXChanged); QObject::connect(this, &QWindow::yChanged, this, &BaseWindow::q_onYChanged); QObject::connect(this, &QWindow::widthChanged, this, &BaseWindow::q_onWidthChanged); QObject::connect(this, &QWindow::heightChanged, this, &BaseWindow::q_onHeightChanged); } QList<int> BaseWindow::netWmStrutPartial() const { return this->m_netWmStrutPartial; } void BaseWindow::setNetWmStrutPartial(QList<int> value) { if (value.length() == 12) { this->m_netWmStrutPartial = value; #ifdef BL_PLATFORM_LINUX Ewmh::set_net_wm_strut_partial(winId(), value); #endif // BL_BLATFORM_LINUX emit this->netWmStrutPartialChanged(value); } } bool BaseWindow::onAllDesktops() const { #ifdef BL_PLATFORM_LINUX uint32_t desktop = Ewmh::get_net_wm_desktop(winId()); if (desktop == 0xFFFFFFFF) { return true; } return false; #endif // BL_PLATFORM_LINUX return false; } void BaseWindow::setOnAllDesktops(bool value) { #ifdef BL_PLATFORM_LINUX if (this->onAllDesktops() != value && value == true) { Ewmh::set_net_wm_desktop(winId(), 0xFFFFFFFF); emit this->onAllDesktopsChanged(value); } else if (this->onAllDesktops() != value && value == false) { Ewmh::set_net_wm_desktop(winId(), 1); emit this->onAllDesktopsChanged(value); } #endif // BL_PLATFORM_LINUX } int BaseWindow::transientFor() const { return this->m_transientFor; } void BaseWindow::setTransientFor(int win) { if (this->m_transientFor != win) { this->m_transientFor = win; if (win != 0) { Ewmh::set_wm_transient_for(winId(), win); } emit this->transientForChanged(win); } } int BaseWindow::type() const { return this->m_type; } void BaseWindow::setType(int type) { if (type != this->m_type) { this->m_type = type; // No window frame for menu window. if (type == static_cast<int>(WindowType::Menu)) { QWindow::setFlag(Qt::FramelessWindowHint, true); QWindow::setFlag(Qt::Popup, true); } emit this->typeChanged(); } } int BaseWindow::x() const { return this->m_pos.x(); } void BaseWindow::setX(int x) { if (this->m_pos.x() != x) { this->m_pos.setX(x); QQuickWindow::setX(x); emit this->xChanged(x); } } int BaseWindow::y() const { return this->m_pos.y(); } void BaseWindow::setY(int y) { if (this->m_pos.y() != y) { this->m_pos.setY(y); QQuickWindow::setY(y); emit this->yChanged(y); } } int BaseWindow::width() const { return this->m_size.width(); } void BaseWindow::setWidth(int width) { if (this->m_size.width() != width) { this->m_size.setWidth(width); QQuickWindow::setWidth(width * this->screenScale()); emit this->widthChanged(width); } } int BaseWindow::height() const { return this->m_size.height(); } void BaseWindow::setHeight(int height) { if (this->m_size.height() != height) { this->m_size.setHeight(height); QQuickWindow::setHeight(height * this->screenScale()); emit this->heightChanged(height); } } Menu* BaseWindow::menu() const { return this->m_menu; } void BaseWindow::setMenu(Menu *menu) { if (this->m_menu != menu) { this->m_menu = menu; emit this->menuChanged(); } } qreal BaseWindow::screenScale() const { return this->m_scale; } QString BaseWindow::screenName() const { return this->screen()->name(); } int BaseWindow::windowId() const { return this->winId(); } AnchorLine BaseWindow::top() { return this->m_anchors.top(); } AnchorLine BaseWindow::bottom() { return this->m_anchors.bottom(); } //====================== // Event handlers //====================== bool BaseWindow::event(QEvent *event) { if (event->type() == QEvent::UpdateRequest) { // Grab mouse if window type is menu. if (this->type() == static_cast<int>(WindowType::Menu)) { QWindow::setMouseGrabEnabled(true); } } return QQuickWindow::event(event); } void BaseWindow::keyPressEvent(QKeyEvent *event) { if (this->type() == static_cast<int>(WindowType::Menu) && event->key() == Qt::Key_Escape) { QWindow::setMouseGrabEnabled(false); QQuickWindow::close(); } // Convert Qt key modifiers to Blusher modifiers. using KeyModifier = Blusher::KeyModifier; int modifiers = static_cast<int>(KeyModifier::None); if (event->modifiers() & Qt::ControlModifier) { modifiers |= static_cast<int>(KeyModifier::Control); } if (event->modifiers() & Qt::AltModifier) { modifiers |= static_cast<int>(KeyModifier::Alt); } if (event->modifiers() & Qt::ShiftModifier) { modifiers |= static_cast<int>(KeyModifier::Shift); } if (event->modifiers() & Qt::MetaModifier) { modifiers |= static_cast<int>(KeyModifier::Super); } KeyEvent *ke = new KeyEvent(modifiers, event->key()); ke->deleteLater(); emit this->keyPressed(ke); /* QObject::connect(ke, &QObject::destroyed, this, []() { qDebug() << "destroyed!"; }); */ QQuickWindow::keyPressEvent(event); } void BaseWindow::showEvent(QShowEvent *evt) { #ifdef BL_PLATFORM_LINUX if (this->m_type == static_cast<int>(WindowType::Normal)) { return QQuickWindow::showEvent(evt); } // Set _NET_WM_WINDOW_TYPE. switch (this->type()) { case static_cast<int>(WindowType::Dock): Ewmh::set_net_wm_window_type(winId(), WindowType::Dock); break; case static_cast<int>(WindowType::Desktop): Ewmh::set_net_wm_window_type(winId(), WindowType::Desktop, true); break; case static_cast<int>(WindowType::Toolbar): Ewmh::set_net_wm_window_type(winId(), WindowType::Toolbar); break; case static_cast<int>(WindowType::Menu): Ewmh::set_net_wm_window_type(winId(), WindowType::Menu); break; case static_cast<int>(WindowType::Utility): Ewmh::set_net_wm_window_type(winId(), WindowType::Utility); break; case static_cast<int>(WindowType::Splash): Ewmh::set_net_wm_window_type(winId(), WindowType::Splash); break; case static_cast<int>(WindowType::Dialog): Ewmh::set_net_wm_window_type(winId(), WindowType::Dialog); break; case static_cast<int>(WindowType::DropDownMenu): Ewmh::set_net_wm_window_type(winId(), WindowType::DropDownMenu); break; case static_cast<int>(WindowType::PopUpMenu): Ewmh::set_net_wm_window_type(winId(), WindowType::PopUpMenu); break; case static_cast<int>(WindowType::ToolTip): Ewmh::set_net_wm_window_type(winId(), WindowType::ToolTip); break; case static_cast<int>(WindowType::Notification): Ewmh::set_net_wm_window_type(winId(), WindowType::Notification); break; case static_cast<int>(WindowType::Combo): Ewmh::set_net_wm_window_type(winId(), WindowType::Combo); break; case static_cast<int>(WindowType::Dnd): Ewmh::set_net_wm_window_type(winId(), WindowType::Dnd); break; default: break; } #endif // BL_PLATFORM_LINUX return QQuickWindow::showEvent(evt); } //================= // Public slots //================= void BaseWindow::changeScale() { ScreenInfo *screen_info = nullptr; auto screen_info_list = bl::DesktopEnvironment::singleton->screens(); // Find screen info. for (auto&& info: screen_info_list) { if (info->name() == this->screenName()) { screen_info = info; break; } } qreal scale = screen_info ? screen_info->scale() : 1; this->m_scale = scale; // Scale window size. QWindow::setWidth(this->width() * scale); QWindow::setHeight(this->height() * scale); emit this->screenScaleChanged(scale); } //================= // Private slots //================= void BaseWindow::q_onScreenChanged(QScreen *qscreen) { emit this->screenNameChanged(); QString screen_name = qscreen->name(); ScreenInfo *screen_info = nullptr; auto screen_info_list = bl::DesktopEnvironment::singleton->screens(); // Find screen info. for (auto&& info: screen_info_list) { if (info->name() == screen_name) { screen_info = info; break; } } if (screen_info == nullptr) { qDebug() << "[WARNING] Screen name \"" << screen_name << "\" does not exist."; return; } this->m_scale = screen_info->scale(); emit this->screenScaleChanged(this->m_scale); } void BaseWindow::q_onXChanged(int x) { this->m_pos.setX(x); emit this->xChanged(x); } void BaseWindow::q_onYChanged(int y) { this->m_pos.setY(y); emit this->yChanged(y); } void BaseWindow::q_onWidthChanged(int width) { this->m_size.setWidth(width / this->screenScale()); emit this->widthChanged(width); } void BaseWindow::q_onHeightChanged(int height) { this->m_size.setHeight(height / this->screenScale()); emit this->heightChanged(height); } void BaseWindow::onScreensChanged() { } } // namespace bl
24.813953
92
0.627273
orbitrc
7606b9fc27c686a035d5ba98f410fd51316408f2
51,830
cpp
C++
pizmidi/midiConverter3/midiConverter3.cpp
nonameentername/pizmidi
a985e3d2bf8f02e3c0a87300dfbb82c35608bbd2
[ "BSD-Source-Code" ]
null
null
null
pizmidi/midiConverter3/midiConverter3.cpp
nonameentername/pizmidi
a985e3d2bf8f02e3c0a87300dfbb82c35608bbd2
[ "BSD-Source-Code" ]
null
null
null
pizmidi/midiConverter3/midiConverter3.cpp
nonameentername/pizmidi
a985e3d2bf8f02e3c0a87300dfbb82c35608bbd2
[ "BSD-Source-Code" ]
1
2021-01-26T12:25:01.000Z
2021-01-26T12:25:01.000Z
#include "midiConverter3.hpp" //------------------------------------------------------------------------------------------------------- AudioEffect* createEffectInstance (audioMasterCallback audioMaster) { return new MidiConverter (audioMaster); } MidiConverterProgram::MidiConverterProgram () { // default Program Values param[kIn] = 0.f; //CC in param[kCCin] = MIDI_TO_FLOAT(2.1); //CC 1 param[kNRPNin] = 0.f; param[kChin] = CHANNEL_TO_FLOAT(-1); //Any Channel param[kLowLimit] = 0.f; // param[kHighLimit] = 1.f; // full param[kLow] = 0.f; // range param[kHigh] = 1.f; // param[kRangeMode] = 0.f; param[kOffset] = MIDI_TO_FLOAT(63.1); //no offset param[kOut] = 0.02f; //CC out param[kCCout] = MIDI_TO_FLOAT2(2.1); //really 1 param[kNRPNout] = 0.f; param[kChout] = CHANNEL_TO_FLOAT(-1); //same channel out param[kThru] = 0.f; //don't pass on original message // default program name strcpy (name, "Default"); } //----------------------------------------------------------------------------- MidiConverter::MidiConverter(audioMasterCallback audioMaster) : PizMidi(audioMaster, kNumPrograms, kNumParams), programs(0) { programs = new MidiConverterProgram[numPrograms]; outmode = drop; inmode = cc; if (programs) { CFxBank* defaultBank = new CFxBank(kNumPrograms,kNumParams); if (readDefaultBank(PLUG_NAME,defaultBank)) { if((VstInt32)defaultBank->GetFxID()==PLUG_IDENT) { int i; for(i=0;i<kNumPrograms;i++){ for (int p=0;p<kNumParams;p++) { programs[i].param[p] = defaultBank->GetProgParm(i,p); } strcpy(programs[i].name,defaultBank->GetProgramName(i)); } } } else { // built-in programs int i; for(i=0;i<kNumPrograms;i++){ switch(i){ case 0: sprintf(programs[i].name,"Nothing"); break; default: sprintf(programs[i].name,"Program %d",i+1); break; } } } setProgram (0); } for (int ch=0;ch<16;ch++) { nrpn[ch]=-1; nrpncoarse[ch]=-1; rpn[ch]=-1; rpncoarse[ch]=-1; datafine[ch]=0; datacoarse[ch]=0; data[ch]=0; done[ch]=true; smoothcc[ch]=-1; lastPC[ch]=0; lastSentPC[ch]=0; for (int i=0;i<32;i++) { cc14msb[i][ch]=0; cc14lsb[i][ch]=0; } } //smoothing stuff counter=roundToInt(sampleRate*0.001f); lastpb=0x2000; targetpb=0x2000; lastcc=0; targetcc=0; init(); } //----------------------------------------------------------------------------------------- MidiConverter::~MidiConverter(){ if (programs) delete [] programs; } //------------------------------------------------------------------------ void MidiConverter::setProgram (VstInt32 program) { MidiConverterProgram* ap = &programs[program]; curProgram = program; for (int i=0;i<kNumParams;i++) { setParameter (i, ap->param[i]); } } //------------------------------------------------------------------------ void MidiConverter::setProgramName (char *name) { vst_strncpy (programs[curProgram].name, name, kVstMaxProgNameLen); } //------------------------------------------------------------------------ void MidiConverter::getProgramName (char *name) { if (!strcmp (programs[curProgram].name, "Init")) sprintf (name, "%s %d", programs[curProgram].name, curProgram + 1); else strcpy (name, programs[curProgram].name); } //----------------------------------------------------------------------------------------- bool MidiConverter::getProgramNameIndexed (VstInt32 category, VstInt32 index, char* text) { if (index < kNumPrograms) { strcpy (text, programs[index].name); return true; } return false; } //----------------------------------------------------------------------------------------- void MidiConverter::resume (){ AudioEffectX::resume(); lastpb=0x2000; targetpb=0x2000; counter=roundToInt(sampleRate*0.001f); for (int i=0;i<16;i++) done[i]=true; } //----------------------------------------------------------------------------------------- void MidiConverter::setParameter(VstInt32 index, float value){ MidiConverterProgram* ap = &programs[curProgram]; int lastoutmode=outmode; int lastinmode=inmode; float inc = 1.f/18.f; switch(index){ case kIn : param[kIn] = ap->param[kIn] = value; if (param[kIn]<1*inc) inmode=cc; else if (param[kIn]<2*inc) inmode=cc14; else if (param[kIn]<3*inc) inmode=pc; else if (param[kIn]<4*inc) inmode=pcdec; else if (param[kIn]<5*inc) inmode=pcinc; else if (param[kIn]<6*inc) inmode=cp; else if (param[kIn]<7*inc) inmode=pa; else if (param[kIn]<8*inc) inmode=pb; else if (param[kIn]<9*inc) inmode=pblsb; else if (param[kIn]<10*inc) inmode=NRPN; else if (param[kIn]<11*inc) inmode=NRPNlsb; else if (param[kIn]<12*inc) inmode=RPN; else if (param[kIn]<13*inc) inmode=RPNlsb; else if (param[kIn]<14*inc) inmode=nonn; else if (param[kIn]<15*inc) inmode=nonv; else if (param[kIn]<16*inc) inmode=noffn; else if (param[kIn]<17*inc) inmode=noffv; else inmode=clock; //else if (param[kIn]<0.9f) inmode=undefined; //else if (param[kIn]<0.96f) inmode=undefined; //else if (param[kIn]<1.0f) inmode=undefined; //else inmode=undefined; if (lastinmode != inmode) updateDisplay(); break; case kCCin : param[kCCin] = ap->param[kCCin] = value; updateDisplay(); break; case kNRPNin : param[kNRPNin] = ap->param[kNRPNin] = value; break; case kChin : param[kChin] = ap->param[kChin] = value; break; case kLowLimit : if (value>param[kHighLimit]) setParameterAutomated(kHighLimit,value); param[kLowLimit] = ap->param[kLowLimit] = value; break; case kHighLimit : if (param[kLowLimit]>value) setParameterAutomated(kLowLimit,value); param[kHighLimit] = ap->param[kHighLimit] = value; break; case kLow : param[kLow] = ap->param[kLow] = value; break; case kHigh : param[kHigh] = ap->param[kHigh] = value; break; case kRangeMode : param[kRangeMode] = ap->param[kRangeMode] = value; break; case kOffset : param[kOffset] = ap->param[kOffset] = value; break; case kOut : param[kOut] = ap->param[kOut] = value; inc = 1.f/20.f; if (param[kOut]<1*inc) outmode=drop; else if (param[kOut]<2*inc) outmode=cc; else if (param[kOut]<3*inc) outmode=cc14; else if (param[kOut]<4*inc) outmode=pc; else if (param[kOut]<5*inc) outmode=pcdec; else if (param[kOut]<6*inc) outmode=pcinc; else if (param[kOut]<7*inc) outmode=cp; else if (param[kOut]<8*inc) outmode=pa; else if (param[kOut]<9*inc) outmode=pb; else if (param[kOut]<10*inc) outmode=pblsb; else if (param[kOut]<11*inc) outmode=NRPN; else if (param[kOut]<12*inc) outmode=NRPNlsb; else if (param[kOut]<13*inc) outmode=RPN; else if (param[kOut]<14*inc) outmode=RPNlsb; else if (param[kOut]<15*inc) outmode=nonn; else if (param[kOut]<16*inc) outmode=nonv; else if (param[kOut]<17*inc) outmode=noffn; else if (param[kOut]<18*inc) outmode=noffv; else if (param[kOut]<19*inc) outmode=clock; else outmode=songselect; //else if (param[kOut]<1.0f) outmode=undefined; //else outmode=undefined; if (lastoutmode != outmode) updateDisplay(); break; case kCCout : param[kCCout] = ap->param[kCCout] = value; updateDisplay(); break; case kNRPNout : param[kNRPNout] = ap->param[kNRPNout] = value; break; case kChout : param[kChout] = ap->param[kChout] = value; break; case kThru : param[kThru] = ap->param[kThru] = value; break; default : break; } } //----------------------------------------------------------------------------------------- float MidiConverter::getParameter(VstInt32 index) { if (index<kNumParams) return param[index]; return 0.f; } //----------------------------------------------------------------------------------------- void MidiConverter::getParameterName(VstInt32 index, char *label){ switch(index){ case kIn : strcpy(label, "Input Type"); break; case kCCin : strcpy(label, "In Param 1"); break; case kNRPNin : strcpy(label, "In Param 2"); break; case kChin : strcpy(label, "Channel in"); break; case kLowLimit : strcpy(label, "Low Input"); break; case kHighLimit : strcpy(label, "High Input"); break; case kRangeMode : strcpy(label, "Map Mode"); break; case kLow : strcpy(label, "Low Output"); break; case kHigh : strcpy(label, "High Output"); break; case kOffset : strcpy(label, "Offset"); break; case kOut : strcpy(label, "Output Type"); break; case kCCout : strcpy(label, "Out Param 1"); break; case kNRPNout : strcpy(label, "Out Param 2"); break; case kChout : strcpy(label, "Channel out"); break; case kThru : strcpy(label, "Thru"); break; default : break; } } //----------------------------------------------------------------------------------------- void MidiConverter::getParameterDisplay(VstInt32 index, char *text){ switch(index){ case kIn: switch (inmode) { case cc: strcpy(text, "CC"); break; case cc14: strcpy(text, "14-bit CC"); break; case pc: strcpy(text, "Program Change"); break; case pcinc: strcpy(text, "ProgChg Inc"); break; case pcdec: strcpy(text, "ProgChg Dec"); break; case cp: strcpy(text, "Channel Pressure"); break; case pa: strcpy(text, "Poly Aftertouch"); break; case pb: strcpy(text, "Pitch Bend"); break; case pblsb: strcpy(text, "Pitch Bend (LSB)"); break; case NRPN: strcpy(text, "NRPN"); break; case NRPNlsb: strcpy(text, "NRPN (LSB)"); break; case RPN: strcpy(text, "RPN"); break; case RPNlsb: strcpy(text, "RPN (LSB)"); break; case nonn: strcpy(text, "Note On #"); break; case nonv: strcpy(text, "Note On Velocity"); break; case noffn: strcpy(text, "Note Off #"); break; case noffv: strcpy(text, "Note Off Velocity"); break; case clock: strcpy(text, "MIDI Clock"); break; default: strcpy(text, "???"); break; } break; case kCCin: if (inmode==cc) { if (FLOAT_TO_MIDI_X(param[kCCin])==-1) strcpy(text, "Any CC"); else sprintf(text, "CC %d", FLOAT_TO_MIDI_X(param[kCCin])); } else if (inmode==cc14) { if (FLOAT_TO_MIDI_X(param[kCCin])==-1) strcpy(text, "Any CC"); else if (FLOAT_TO_MIDI_X(param[kCCin])<32) sprintf(text, "CC %d / %d", FLOAT_TO_MIDI_X(param[kCCin]), FLOAT_TO_MIDI_X(param[kCCin])+32); else sprintf(text, "CC %d", FLOAT_TO_MIDI_X(param[kCCin])); } else if (inmode==pa || inmode==nonv || inmode==noffv) { if (FLOAT_TO_MIDI_X(param[kCCin])==-1) strcpy(text, "Any Note"); else sprintf(text, "Note %d (%s)", FLOAT_TO_MIDI_X(param[kCCin]),getNoteName(FLOAT_TO_MIDI_X(param[kCCin]),bottomOctave)); } else if (inmode==NRPN || inmode==NRPNlsb || inmode==RPN || inmode==RPNlsb) { if (FLOAT_TO_MIDI_X(param[kCCin])==-1) strcpy(text, "?"); else if (FLOAT_TO_MIDI_X(param[kCCin])==0) strcpy(text, "0x0000"); else sprintf(text, "%#.4x", (FLOAT_TO_MIDI_X(param[kCCin]))<<7); } else strcpy(text, " "); break; case kNRPNin: if (FLOAT_TO_MIDI_X(param[kCCin])==-1) strcpy(text, " "); else if (inmode==NRPN || inmode==NRPNlsb) { if (((FLOAT_TO_MIDI(param[kNRPNin]))|((FLOAT_TO_MIDI_X(param[kCCin]))<<7))==0) strcpy(text, "NRPN 0x0000"); else sprintf(text, "NRPN %#.4x", (FLOAT_TO_MIDI(param[kNRPNin]))|((FLOAT_TO_MIDI_X(param[kCCin]))<<7)); } else if (inmode==RPN || inmode==RPNlsb) { if ((FLOAT_TO_MIDI(param[kNRPNin])|((FLOAT_TO_MIDI_X(param[kCCin]))<<7))==0) strcpy(text, "RPN 0x0000"); else sprintf(text, "RPN %#.4x", (FLOAT_TO_MIDI(param[kNRPNin]))|((FLOAT_TO_MIDI_X(param[kCCin]))<<7)); } else strcpy(text, " "); break; case kChin: if (inmode==clock || inmode==songposition || inmode==songselect) strcpy(text," "); else { if (FLOAT_TO_CHANNEL(param[kChin])==-1) strcpy(text, "Any"); else sprintf(text, "Channel %d", FLOAT_TO_CHANNEL(param[kChin])+1); break; } case kLowLimit: if (inmode==pb) { sprintf(text, "%d", (FLOAT_TO_MIDI(param[kLowLimit])<<7)-0x2000); } else if (inmode==nonn || inmode==noffn) { sprintf(text, "%d (%s)", FLOAT_TO_MIDI(param[kLowLimit]), getNoteName(FLOAT_TO_MIDI(param[kLowLimit]),bottomOctave)); } else if (inmode==NRPN || inmode==RPN || inmode==cc14) { sprintf(text, "%d", (FLOAT_TO_MIDI(param[kLowLimit])<<7)&0x3f80 | FLOAT_TO_MIDI(param[kLowLimit])&0x007f); } else if (inmode==clock || inmode==pcinc || inmode==pcdec) strcpy(text," "); else sprintf(text, "%d", FLOAT_TO_MIDI(param[kLowLimit])); break; case kHighLimit: if (inmode==pb) { sprintf(text, "%d", (FLOAT_TO_MIDI(param[kHighLimit])<<7) + FLOAT_TO_MIDI(param[kHighLimit])-0x2000); } else if (inmode==nonn || inmode==noffn) sprintf(text, "%d (%s)", FLOAT_TO_MIDI(param[kHighLimit]), getNoteName(FLOAT_TO_MIDI(param[kHighLimit]),bottomOctave)); else if (inmode==NRPN || inmode==RPN || inmode==cc14) { sprintf(text, "%d", (FLOAT_TO_MIDI(param[kHighLimit])<<7)&0x3f80 | FLOAT_TO_MIDI(param[kHighLimit])&0x007f); } else if (inmode==clock || inmode==pcinc || inmode==pcdec) strcpy(text," "); else sprintf(text, "%d", FLOAT_TO_MIDI(param[kHighLimit])); break; case kLow: if (outmode==pb) { sprintf(text, "%d", (FLOAT_TO_MIDI(param[kLow])<<7) - 8192); } else if (outmode==NRPN || outmode==RPN || outmode==cc14) { sprintf(text, "%d", (FLOAT_TO_MIDI(param[kLow])<<7)); } else if (outmode==clock) strcpy(text, " "); else if (outmode==nonn || outmode==noffn) sprintf(text, "%d (%s)",FLOAT_TO_MIDI(param[kLow]),getNoteName(FLOAT_TO_MIDI(param[kLow]),bottomOctave)); else sprintf(text, "%d", FLOAT_TO_MIDI(param[kLow])); break; case kHigh: if (outmode==pb) { sprintf(text, "%d", (FLOAT_TO_MIDI(param[kHigh])<<7) + FLOAT_TO_MIDI(param[kHigh]) - 8192); } else if (outmode==NRPN || outmode==RPN || outmode==cc14) { sprintf(text, "%d", (FLOAT_TO_MIDI(param[kHigh])<<7)&0x3f80 | FLOAT_TO_MIDI(param[kHigh])&0x007f); } else if (outmode==clock) strcpy(text, " "); else if (outmode==nonn || outmode==noffn) sprintf(text, "%d (%s)",FLOAT_TO_MIDI(param[kHigh]),getNoteName(FLOAT_TO_MIDI(param[kHigh]),bottomOctave)); else sprintf(text, "%d", FLOAT_TO_MIDI(param[kHigh])); break; case kRangeMode: if (param[kRangeMode]<0.3f) strcpy(text, "Clip/Stretch/Limit"); else if (param[kRangeMode]<0.5) strcpy(text, "Clip/Stretch"); else if (param[kRangeMode]<0.8) strcpy(text, "Stretch/Stretch"); else strcpy(text,"Clip/Limit"); break; case kOffset: if (outmode==clock) strcpy(text, " "); else sprintf(text, "%d", (signed int)FLOAT_TO_MIDI(param[kOffset])-63); break; case kOut: switch (outmode) { case drop: strcpy(text, "Discard"); break; case cc: strcpy(text, "CC"); break; case cc14: strcpy(text, "14-bit CC"); break; case pc: strcpy(text, "Program Change"); break; case pcinc: strcpy(text, "ProgChg Inc"); break; case pcdec: strcpy(text, "ProgChg Dec"); break; case cp: strcpy(text, "Channel Pressure"); break; case pa: strcpy(text, "Poly Aftertouch"); break; case pb: strcpy(text, "Pitch Bend"); break; case pblsb: strcpy(text, "Pitch Bend (LSB)"); break; case NRPN: strcpy(text, "NRPN"); break; case NRPNlsb: strcpy(text, "NRPN (LSB)"); break; case RPN: strcpy(text, "RPN"); break; case RPNlsb: strcpy(text, "RPN (LSB)"); break; case nonn: strcpy(text, "Note On #"); break; case nonv: strcpy(text, "Note On Velocity"); break; case noffn: strcpy(text, "Note Off #"); break; case noffv: strcpy(text, "Note Off Velocity"); break; case clock: strcpy(text, "MIDI Clock"); break; default: strcpy(text, "???"); break; } break; case kCCout: switch (outmode) { case cc: if (FLOAT_TO_MIDI_X(param[kCCout])==-1) strcpy(text, "As Input"); else sprintf(text, "CC %d", FLOAT_TO_MIDI_X(param[kCCout])); break; case cc14: if (FLOAT_TO_MIDI_X(param[kCCout])==-1) strcpy(text, "As Input"); else if (FLOAT_TO_MIDI_X(param[kCCout])<32) sprintf(text, "CC %d / %d", FLOAT_TO_MIDI_X(param[kCCout]), FLOAT_TO_MIDI_X(param[kCCout])+32); else sprintf(text, "CC %d", FLOAT_TO_MIDI_X(param[kCCout])); break; case pa: case nonv: case noffv: if (FLOAT_TO_MIDI_X(param[kCCout])==-1) strcpy(text, "As Input"); else sprintf(text, "Note %d (%s)", FLOAT_TO_MIDI_X(param[kCCout]),getNoteName(FLOAT_TO_MIDI_X(param[kCCout]),bottomOctave)); break; case pb: if (param[kCCout]<0.5f) strcpy(text, "Rough"); else strcpy(text, "Smooth"); break; case pblsb: if (FLOAT_TO_MIDI_X(param[kCCout])==-1) strcpy(text, "As Input"); else sprintf(text, "MSB: %d", (FLOAT_TO_MIDI_X(param[kCCout])<<7) - 0x2000); break; case NRPN: case NRPNlsb: case RPN: case RPNlsb: if (FLOAT_TO_MIDI_X(param[kCCout])==-1) strcpy(text, "As Input"); else if (FLOAT_TO_MIDI_X(param[kCCout])==0) strcpy(text, "0x0000"); else sprintf(text, "%#.4x", (FLOAT_TO_MIDI_X(param[kCCout]))<<7); break; case nonn: case noffn: if (FLOAT_TO_MIDI_X(param[kCCout])==-1) strcpy(text, "As Input"); else sprintf(text, "Vel %d", FLOAT_TO_MIDI_X(param[kCCout])); break; default: strcpy(text, " "); break; } break; case kNRPNout: if (outmode==pb && param[kCCout]>=0.5f) { sprintf(text, "Inertia: %d", roundToInt(param[kNRPNout]*100.f)); } else if ((outmode==cc || outmode==cc14) && FLOAT_TO_MIDI_X(param[kCCout])!=-1) { sprintf(text, "Inertia: %d", roundToInt(param[kNRPNout]*100.f)); } else if (FLOAT_TO_MIDI_X(param[kCCout])==-1) strcpy(text, " "); else if (outmode==NRPN || outmode==NRPNlsb) { if ((FLOAT_TO_MIDI(param[kNRPNout])|((FLOAT_TO_MIDI_X(param[kCCout]))<<7))==0) strcpy(text, "NRPN 0x0000"); else sprintf(text, "NRPN %#.4x", FLOAT_TO_MIDI(param[kNRPNout])|((FLOAT_TO_MIDI_X(param[kCCout]))<<7)); } else if (outmode==RPN || outmode==RPNlsb) { if ((FLOAT_TO_MIDI(param[kNRPNout])|((FLOAT_TO_MIDI_X(param[kCCout]))<<7))==0) strcpy(text, "RPN 0x0000"); else sprintf(text, "RPN %#.4x", FLOAT_TO_MIDI(param[kNRPNout])|((FLOAT_TO_MIDI_X(param[kCCout]))<<7)); } else if (outmode==nonn) { if (FLOAT_TO_MIDI(param[kNRPNout])==0) strcpy(text, "NoteOn only"); else strcpy(text, "Add NoteOff"); } else { strcpy(text, " "); } break; case kChout : if (outmode==drop || outmode==clock || outmode==songposition || outmode==songselect) strcpy(text," "); else { if (FLOAT_TO_CHANNEL(param[kChout])==-1) strcpy(text, "No Change"); else sprintf(text, "Channel %d", FLOAT_TO_CHANNEL(param[kChout])+1); } break; case kThru: if (param[kThru]==0.f) strcpy(text, "Block All"); else if (param[kThru]<0.5f) strcpy(text, "Block Converted"); else if (param[kThru]<1.0f) strcpy(text, "Thru All"); else strcpy(text, "Converted Only"); break; default : break; } } void MidiConverter::processMidiEvents(VstMidiEventVec *inputs, VstMidiEventVec *outputs, VstInt32 sampleFrames) { // process incoming events for (unsigned int i=0;i<inputs[0].size();i++) { //copying event "i" from input (with all its fields) VstMidiEvent tomod = inputs[0][i]; short status = tomod.midiData[0] & 0xf0; // scraping channel short channel = tomod.midiData[0] & 0x0f; // isolating channel short data1 = tomod.midiData[1] & 0x7f; short data2 = tomod.midiData[2] & 0x7f; if (status==MIDI_NOTEON && data2==0) status=MIDI_NOTEOFF; int incc1 = FLOAT_TO_MIDI_X(param[kCCin]); //-1 == any int outcc1 = FLOAT_TO_MIDI_X(param[kCCout]); //-1 == no change int lolimit1 = FLOAT_TO_MIDI(param[kLowLimit]); int hilimit1 = FLOAT_TO_MIDI(param[kHighLimit]); int low1 = FLOAT_TO_MIDI(param[kLow]); int high1 = FLOAT_TO_MIDI(param[kHigh]); int offset1 = FLOAT_TO_MIDI(param[kOffset])-63; int chin1 = FLOAT_TO_CHANNEL(param[kChin]); int chout1 = FLOAT_TO_CHANNEL(param[kChout]); int inputnrpn1 = FLOAT_TO_MIDI(param[kNRPNin]) | (incc1<<7); int outputnrpn1 = FLOAT_TO_MIDI(param[kNRPNout]) | (outcc1<<7); if (chout1==-1) chout1=channel; if (chin1==-1) chin1=channel; if (incc1==-1) incc1=data1; if (outcc1==-1) outcc1=data1; bool discard = false; int idata = data2; int odata = data2; bool sendout=false; int send=1; int idata14 = data1 | (data2<<7); int odata14 = idata14; int olsb = 0; bool inis14bit=false; bool inisRPN=false; bool inisNRPN=false; bool proginc=false; bool progdec=false; //pre-processing: //keep track of all (N)RPNs if (inisNRPN || inisRPN) { send=0; const int ncoarse = inisNRPN ? 99 : 101; const int nfine = inisNRPN ? 98 : 100; int* c = inisNRPN ? nrpncoarse : rpncoarse; int* n = inisNRPN ? nrpn : rpn; // only send nprn stuff through if "thru" is on if (param[kThru]<0.5 && (data1==nfine || data1==ncoarse || data1==6 || data1==38 || data1==96 || data1==97)) { discard=true; } if (data1==ncoarse) c[channel] = data2; else if (data1==nfine && c[channel]>=0) { n[channel] = data2|(c[channel]<<7); } if (n[channel]==inputnrpn1) { if (data1==6) { //data entry slider (coarse) datacoarse[channel] = data2; data[channel] = datafine[channel] | (datacoarse[channel]<<7); send = 1; } else if (data1==38) { //data entry slider (fine) datafine[channel] = data2; data[channel] = datafine[channel] | (datacoarse[channel]<<7); send = 2; } else if (data1==96) { //data increment button if (outmode==cc) { datacoarse[channel]+=1; if (datacoarse[channel]>127) datacoarse[channel]=127; data[channel] = datafine[channel] | (datacoarse[channel]<<7); send = 1; } else { data[channel]+=1; if (data[channel]>127) data[channel]=127; datacoarse[channel] = (data[channel] & 0x3f80) >> 7; datafine[channel] = data[channel] & 0x007f; send = 2; } } else if (data1==97) { //data decrement button if (outmode==cc) { datacoarse[channel]-=1; if (datacoarse[channel]<0) datacoarse[channel]=0; data[channel] = datafine[channel] | (datacoarse[channel]<<7); send = 1; } else { data[channel]-=1; if (data[channel]<0) data[channel]=0; datacoarse[channel] = (data[channel] & 0x3f80) >> 7; datafine[channel] = data[channel] & 0x007f; send = 2; } } idata14 = data[channel]; if ((idata14>=(lolimit1<<7) && idata14<=(hilimit1|(hilimit1<<7))) || param[kRangeMode]>=0.5f && param[kRangeMode]<0.8f) { if (lolimit1==hilimit1) odata14=(low1|(low1<<7)+high1|(high1<<7))/2 + offset1|(offset1<<7); else if (param[kRangeMode]<0.3f) odata14 = MAP_TO_MIDI(idata14,low1|(low1<<7),high1|(high1<<7),0,16383) + offset1|(offset1<<7); else if (param[kRangeMode]<0.5f) odata14 = MAP_TO_MIDI(idata14,low1|(low1<<7),high1|(high1<<7),lolimit1|(lolimit1<<7),hilimit1|(hilimit1<<7)) + offset1|(offset1<<7); else if (param[kRangeMode]<0.8f){ odata14 = MAP_TO_MIDI(idata14,0,16383,low1|(low1<<7),high1|(high1<<7)); odata14 = MAP_TO_MIDI(odata14,low1|(low1<<7),high1|(high1<<7),lolimit1|(lolimit1<<7),hilimit1|(hilimit1<<7)) + offset1|(offset1<<7); } if (odata14>16383) odata14=16383; else if (odata14<0) odata14=0; odata = (odata14 & 0x3f80) >> 7; //odata = roundToInt((double)odata14*0.0077519379844961240310077519379845); olsb = odata14 & 0x007f; inis14bit = true; } } if (inmode==NRPNlsb || inmode==RPNlsb) idata = roundToInt((double)(data[channel])*0.0077519379844961240310077519379845); } //keep track of program changes else if (status == MIDI_PROGRAMCHANGE) { if ((lastPC[channel]==127 && data1==0) || (data1==lastPC[channel]+1)) { if (channel==chin1) proginc=true; } else if ((lastPC[channel]==0 && data1==127) || (data1==lastPC[channel]-1)) { if (channel==chin1) progdec=true; } lastPC[channel]=data1; } //------------------------------------------------------------------------------ if ( ((inmode==cc || inmode==cc14 || inmode==NRPN || inmode==NRPNlsb || inmode==RPN || inmode==RPNlsb) && status==MIDI_CONTROLCHANGE) || ((inmode==pc || inmode==pcinc || inmode==pcdec) && status==MIDI_PROGRAMCHANGE) || (inmode==cp && status==MIDI_CHANNELPRESSURE) || (inmode==pa && status==MIDI_POLYKEYPRESSURE) || ((inmode==pblsb || inmode==pb) && status==MIDI_PITCHBEND) || (inmode==nonn && status==MIDI_NOTEON) || (inmode==nonv && (status==MIDI_NOTEON || status==MIDI_NOTEOFF)) || ((inmode==noffn || inmode==noffv) && status==MIDI_NOTEOFF) || (inmode==clock && status==MIDI_TIMINGCLOCK) ) { switch (inmode) { case pc: case pcinc: case pcdec: case cp: case pblsb: case noffn: incc1=data1; idata=data1; odata=data1; break; case nonn: idata=data1; break; case nonv: if (status==MIDI_NOTEOFF) data2=0; break; case NRPN: inisNRPN=true; break; case NRPNlsb: inisNRPN=true; incc1=data1; break; case RPN: inisRPN=true; break; case RPNlsb: inisRPN=true; incc1=data1; break; case clock: case songposition: case songselect: chin1=channel; break; default: break; } if (channel==chin1) { if (inmode==pb) { if ((idata14>=(lolimit1<<7) && idata14<=(hilimit1|(hilimit1<<7))) || param[kRangeMode]>=0.5f && param[kRangeMode]<0.8f) { odata14 = idata14; if (lolimit1==hilimit1) odata14 = (low1|(low1<<7)+high1|(high1<<7))/2 + offset1|(offset1<<7); else if (param[kRangeMode]<0.3f) { //stretch clipped input to full range odata14 = MAP_TO_MIDI(idata14,0,16383,lolimit1|(lolimit1<<7),hilimit1|(hilimit1<<7)) + offset1|(offset1<<7); //then limit output if (odata14>(high1|(high1<<7))) odata14=(high1|(high1<<7)); else if (odata14<(low1|(low1<<7))) odata14=(low1|(low1<<7)); } else if (param[kRangeMode]<0.5f) odata14 = MAP_TO_MIDI(idata14,low1|(low1<<7),high1|(high1<<7),lolimit1|(lolimit1<<7),hilimit1|(hilimit1<<7)) + offset1|(offset1<<7); else if (param[kRangeMode]<0.8f) { odata14 = MAP_TO_MIDI(idata14,0,16383,low1|(low1<<7),high1|(high1<<7)); odata14 = MAP_TO_MIDI(idata14,low1|(low1<<7),high1|(high1<<7),lolimit1|(lolimit1<<7),hilimit1|(hilimit1<<7)) + offset1|(offset1<<7); } else { if (odata14>(high1|(high1<<7))) odata14=(high1|(high1<<7)); else if (odata14<(low1|(low1<<7))) odata14=(low1|(low1<<7)); } if (odata14>16383) odata14=16383; else if (odata14<0) odata14=0; odata = (odata14 & 0x3f80) >> 7; olsb = odata14 & 0x007f; inis14bit = true; // send old message if "thru" is on if (channel==chout1 && outmode==pb) discard=true; sendout=true; } else if (param[kThru]<0.5f) discard=true; //outside range } else if (inmode==pcinc && proginc) sendout=true; else if (inmode==pcdec && progdec) sendout=true; else if (inmode==cc14 && incc1<32 && (data1==incc1 || data1==(incc1+32))) { int finecc = incc1+32; if (param[kThru]<0.5) discard=true; if (data1==incc1) cc14msb[incc1][channel] = data2; else if (data1==finecc) cc14lsb[incc1][channel] = data2; idata14 = (cc14lsb[incc1][channel])|(cc14msb[incc1][channel]<<7); if ((idata14>=(lolimit1<<7) && idata14<=(hilimit1|(hilimit1<<7))) || param[kRangeMode]>=0.5f && param[kRangeMode]<0.8f) { if (lolimit1==hilimit1) odata14=(low1|(low1<<7)+high1|(high1<<7))/2 + offset1|(offset1<<7); else if (param[kRangeMode]<0.3f) { //stretch clipped input to full range odata14 = MAP_TO_MIDI(idata14,0,16383,lolimit1|(lolimit1<<7),hilimit1|(hilimit1<<7)) + offset1|(offset1<<7); //then limit output if (odata14>(high1|(high1<<7))) odata14=(high1|(high1<<7)); else if (odata14<(low1|(low1<<7))) odata14=(low1|(low1<<7)); } else if (param[kRangeMode]<0.5f) odata14 = MAP_TO_MIDI(idata14,low1|(low1<<7),high1|(high1<<7),lolimit1|(lolimit1<<7),hilimit1|(hilimit1<<7)) + offset1|(offset1<<7); else if (param[kRangeMode]<0.8f) { odata14 = MAP_TO_MIDI(idata14,0,16383,low1|(low1<<7),high1|(high1<<7)); odata14 = MAP_TO_MIDI(odata14,low1|(low1<<7),high1|(high1<<7),lolimit1|(lolimit1<<7),hilimit1|(hilimit1<<7)) + offset1|(offset1<<7); } if (odata14>16383) odata14=16383; else if (odata14<0) odata14=0; odata = (odata14 & 0x3f80) >> 7; //odata = roundToInt((double)odata14*0.0077519379844961240310077519379845); olsb = odata14 & 0x007f; inis14bit = true; sendout=true; } else if (param[kThru]<0.5f) discard=true; //outside range } else if (inmode==clock) sendout=true; else if (data1==incc1) { //clip input here, unless stretching input to fit in input range if ((idata>=lolimit1 && idata<=hilimit1) || param[kRangeMode]>=0.5f && param[kRangeMode]<0.8f) { if (inmode==NRPNlsb) idata=data1; if (lolimit1==hilimit1) odata=(low1+high1)/2 + offset1; else if (param[kRangeMode]<0.3f) //clip/limit { //stretch clipped input to full range odata = MAP_TO_MIDI(idata,0,127,lolimit1,hilimit1) + offset1; //then limit output if (odata>high1) odata=high1; else if (odata<low1) odata=low1; } else if (param[kRangeMode]<0.5f) //clip/stretch { //stretch clipped input to output range odata = MAP_TO_MIDI(idata,low1,high1,lolimit1,hilimit1) + offset1; } else if (param[kRangeMode]<0.8f){ //stretch/stretch //stretch 0-127 to input range odata = MAP_TO_MIDI(idata,lolimit1,hilimit1,0,127); //then stretch input range to output range odata = MAP_TO_MIDI(odata,low1,high1,lolimit1,hilimit1) + offset1; } else { if (odata>high1) odata=high1; else if (odata<low1) odata=low1; } if (odata>127) odata=127; else if (odata<0) odata=0; if (inmode==nonv && status==MIDI_NOTEOFF) odata=0; // send old message if "thru" is on switch (inmode) { case cc: case pa: if (channel==chout1 && data1==outcc1 && outmode==inmode) discard=true; break; case pc: case cp: if (channel==chout1 && outmode==inmode) discard=true; break; case pblsb: if (channel==chout1 && (outmode==pb || outmode==pblsb)) discard=true; break; case NRPNlsb: if (channel==chout1 && (outmode==NRPN || outmode==NRPNlsb)) discard=true; break; default: break; } //create new message sendout=true; } else if (param[kThru]<0.5f) discard=true; //outside range } } } if (sendout) { // create new message VstMidiEvent outmsg = tomod; if (outmode==drop) { sendout=false; } if (outmode==cc) { if (roundToInt(param[kNRPNout]*100.f)==0 || (FLOAT_TO_MIDI_X(param[kCCout])==-1)) { outmsg.midiData[0] = MIDI_CONTROLCHANGE | chout1; outmsg.midiData[1] = outcc1; outmsg.midiData[2] = odata; } else { targetcc=odata; sendout=false; smoothcc[chout1]=outcc1; } } if (outmode==cc14) { if (roundToInt(param[kNRPNout]*100.f)==0) { if (outcc1 < 32) { outmsg.midiData[0] = MIDI_CONTROLCHANGE | chout1; outmsg.midiData[1] = outcc1; outmsg.midiData[2] = odata; outputs[0].push_back(outmsg); outmsg.midiData[1] = outcc1 + 32; if (!inis14bit) { if (odata>64) olsb = odata; else olsb = 0; } outmsg.midiData[2] = olsb; outputs[0].push_back(outmsg); sendout=false; } else { outmsg.midiData[0] = MIDI_CONTROLCHANGE | chout1; outmsg.midiData[1] = outcc1; outmsg.midiData[2] = odata; } } else { targetcc=olsb|(odata<<7); sendout=false; smoothcc[chout1]=outcc1 + 1000; } } else if (outmode==pc) { //program change outmsg.midiData[0] = MIDI_PROGRAMCHANGE | chout1; outmsg.midiData[1] = odata; outmsg.midiData[2] = 0; } else if (outmode==pc) { //program change outmsg.midiData[0] = MIDI_PROGRAMCHANGE | chout1; outmsg.midiData[1] = odata; outmsg.midiData[2] = 0; } else if (outmode==pcinc) { //program change++ odata = lastSentPC[chout1]+1; if (odata>high1) odata=low1; outmsg.midiData[0] = MIDI_PROGRAMCHANGE | chout1; outmsg.midiData[1] = odata; outmsg.midiData[2] = 0; } else if (outmode==pcdec) { //program change-- odata = lastSentPC[chout1]-1; if (odata<low1) odata=high1; outmsg.midiData[0] = MIDI_PROGRAMCHANGE | chout1; outmsg.midiData[1] = odata; outmsg.midiData[2] = 0; } else if (outmode==cp) { //channel pressure outmsg.midiData[0] = MIDI_CHANNELPRESSURE | chout1; outmsg.midiData[1] = odata; outmsg.midiData[2] = 0; } else if (outmode==pa) { //aftertouch outmsg.midiData[0] = MIDI_POLYKEYPRESSURE | chout1; outmsg.midiData[1] = outcc1; outmsg.midiData[2] = odata; } else if (outmode==pb) { //pitch bend if (!inis14bit) { if (odata>64) olsb = odata; else olsb = 0; } if (param[kCCout]<0.5f) { outmsg.midiData[0] = MIDI_PITCHBEND | chout1; outmsg.midiData[1] = olsb; outmsg.midiData[2] = odata; } else { targetpb=olsb|(odata<<7); sendout=false; done[chout1]=false; } } else if (outmode==pblsb) { //pitch bend (LSB) outmsg.midiData[0] = MIDI_PITCHBEND | chout1; outmsg.midiData[1] = odata; outmsg.midiData[2] = outcc1; } else if (outmode==NRPN) { //NRPN if (outcc1>=0 && send>0) { VstMidiEvent ncoarse = inputs[0][i]; ncoarse.midiData[0] = MIDI_CONTROLCHANGE | chout1; ncoarse.midiData[1] = 99; ncoarse.midiData[2] = outcc1; outputs[0].push_back(ncoarse); VstMidiEvent nfine = inputs[0][i]; nfine.midiData[0] = MIDI_CONTROLCHANGE | chout1; nfine.midiData[1] = 98; nfine.midiData[2] = outputnrpn1; outputs[0].push_back(nfine); VstMidiEvent dcoarse = inputs[0][i]; dcoarse.midiData[0] = MIDI_CONTROLCHANGE | chout1; dcoarse.midiData[1] = 6; dcoarse.midiData[2] = odata; outputs[0].push_back(dcoarse); VstMidiEvent dfine = inputs[0][i]; dfine.midiData[0] = MIDI_CONTROLCHANGE | chout1; dfine.midiData[1] = 38; if (!inis14bit) { if (odata>64) olsb = odata; else olsb = 0; } dfine.midiData[2] = olsb; outputs[0].push_back(dfine); sendout=false; } } else if (outmode==NRPNlsb) { //NRPN LSB if (outcc1>=0 && send>0) { VstMidiEvent ncoarse = inputs[0][i]; ncoarse.midiData[0] = MIDI_CONTROLCHANGE | chout1; ncoarse.midiData[1] = 99; ncoarse.midiData[2] = outcc1; outputs[0].push_back(ncoarse); VstMidiEvent nfine = inputs[0][i]; nfine.midiData[0] = MIDI_CONTROLCHANGE | chout1; nfine.midiData[1] = 98; nfine.midiData[2] = outputnrpn1; outputs[0].push_back(nfine); VstMidiEvent dfine = inputs[0][i]; dfine.midiData[0] = MIDI_CONTROLCHANGE | chout1; dfine.midiData[1] = 38; dfine.midiData[2] = odata; outputs[0].push_back(dfine); sendout=false; } } else if (outmode==RPN) { //RPN if (outcc1>=0 && send>0) { VstMidiEvent ncoarse = inputs[0][i]; ncoarse.midiData[0] = MIDI_CONTROLCHANGE | chout1; ncoarse.midiData[1] = 101; ncoarse.midiData[2] = outcc1; outputs[0].push_back(ncoarse); VstMidiEvent nfine = inputs[0][i]; nfine.midiData[0] = MIDI_CONTROLCHANGE | chout1; nfine.midiData[1] = 100; nfine.midiData[2] = outputnrpn1; outputs[0].push_back(nfine); VstMidiEvent dcoarse = inputs[0][i]; dcoarse.midiData[0] = MIDI_CONTROLCHANGE | chout1; dcoarse.midiData[1] = 6; dcoarse.midiData[2] = odata; outputs[0].push_back(dcoarse); VstMidiEvent dfine = inputs[0][i]; dfine.midiData[0] = MIDI_CONTROLCHANGE | chout1; dfine.midiData[1] = 38; if (!inis14bit) { if (odata>64) olsb = odata; else olsb = 0; } dfine.midiData[2] = olsb; outputs[0].push_back(dfine); sendout=false; } } else if (outmode==RPNlsb) { //RPN LSB if (outcc1>=0 && send>0) { VstMidiEvent ncoarse = inputs[0][i]; ncoarse.midiData[0] = MIDI_CONTROLCHANGE | chout1; ncoarse.midiData[1] = 101; ncoarse.midiData[2] = outcc1; outputs[0].push_back(ncoarse); VstMidiEvent nfine = inputs[0][i]; nfine.midiData[0] = MIDI_CONTROLCHANGE | chout1; nfine.midiData[1] = 100; nfine.midiData[2] = outputnrpn1; outputs[0].push_back(nfine); VstMidiEvent dfine = inputs[0][i]; dfine.midiData[0] = MIDI_CONTROLCHANGE | chout1; dfine.midiData[1] = 38; dfine.midiData[2] = odata; outputs[0].push_back(dfine); sendout=false; } } else if (outmode==nonn) { //Note On # outmsg.midiData[0] = MIDI_NOTEON | chout1; outmsg.midiData[1] = odata; outmsg.midiData[2] = outcc1; if (FLOAT_TO_MIDI(param[kNRPNout])>0) { //fix this part... queue a noteoff for later VstMidiEvent noteoff = outmsg; noteoff.midiData[0] = MIDI_NOTEOFF | chout1; noteoff.midiData[2] = 0; //noteoff.deltaFrames += FLOAT_TO_MIDI(param[kNRPNout]); outputs[0].push_back(outmsg); outputs[0].push_back(noteoff); sendout=false; } } else if (outmode==nonv) { //Note On Vel if (status==MIDI_NOTEOFF && inmode==nonv) odata = 0; outmsg.midiData[0] = MIDI_NOTEON | chout1; outmsg.midiData[1] = outcc1; outmsg.midiData[2] = odata; } else if (outmode==noffn) { //Note Off # outmsg.midiData[0] = MIDI_NOTEOFF | chout1; outmsg.midiData[1] = odata; outmsg.midiData[2] = outcc1; } else if (outmode==noffv) { //Note Off Vel outmsg.midiData[0] = MIDI_NOTEOFF | chout1; outmsg.midiData[1] = outcc1; outmsg.midiData[2] = odata; } else if (outmode==clock) { outmsg.midiData[0] = (char)MIDI_TIMINGCLOCK; outmsg.midiData[1] = 0; outmsg.midiData[2] = 0; } else if (outmode==songselect) { outmsg.midiData[0] = (char)MIDI_SONGSELECT; outmsg.midiData[1] = odata; outmsg.midiData[2] = 0; } if (sendout) { outputs[0].push_back(outmsg); if (outmode==pc || outmode==pcinc || outmode==pcdec) { lastSentPC[chout1] = outmsg.midiData[1]; } } if (param[kThru]<0.5f) discard=true; //block converted } else if (param[kThru]==1.0f) discard=true; //thru converted only if (param[kThru]==0.f) discard=true; //block all //send the original message if (!discard) outputs[0].push_back(tomod); } if (outmode==pb) for (int ch=0;ch<16;ch++) { if (!done[ch]) { //pitch bend smoothing for (int j=0;j<sampleFrames;j++) { if (counter==0) { counter=roundToInt(sampleRate*0.002f); lastpb = smooth(targetpb,lastpb,param[kNRPNout]); int pb2=(lastpb & 0x3F80)>>7; int pb1=(lastpb & 0x007F); VstMidiEvent pb; pb.deltaFrames=j; pb.midiData[0] = MIDI_PITCHBEND | ch; pb.midiData[1] = pb1; pb.midiData[2] = pb2; if (!done[ch]) outputs[0].push_back(pb); if (lastpb==targetpb) done[ch]=true; } counter--; } } } else if (outmode==cc || outmode==cc14) for (int ch=0;ch<16;ch++) { if (smoothcc[ch]>-1) { //cc smoothing bool is14bit = outmode==cc14; for (int j=0;j<sampleFrames;j++) { if (counter==0) { counter=roundToInt(sampleRate*(0.005f+0.002*param[kNRPNout])); lastcc = smooth(targetcc,lastcc,param[kNRPNout],is14bit); if (is14bit) { VstMidiEvent msb; msb.deltaFrames=j; msb.midiData[0] = MIDI_CONTROLCHANGE | ch; msb.midiData[1] = smoothcc[ch]-1000; msb.midiData[2] = (lastcc&0x3f80)>>7; VstMidiEvent lsb; lsb.deltaFrames=j; lsb.midiData[0] = MIDI_CONTROLCHANGE | ch; lsb.midiData[1] = smoothcc[ch]-1000 + 32; lsb.midiData[2] = lastcc&0x007f; if (smoothcc[ch]>-1) { outputs[0].push_back(msb); outputs[0].push_back(lsb); } } else { VstMidiEvent cc; cc.deltaFrames=j; cc.midiData[0] = MIDI_CONTROLCHANGE | ch; cc.midiData[1] = smoothcc[ch]; cc.midiData[2] = lastcc&0x007f; if (smoothcc[ch]>-1) outputs[0].push_back(cc); } if (lastcc==targetcc) smoothcc[ch]=-1; } counter--; } } } } int MidiConverter::smooth(int newvalue, int oldvalue, float inertia, bool is14bit) { float change = (float)(newvalue-oldvalue)*(1.0f-inertia*0.95f); //make sure change isn't smaller than 1 if (change<1.0f && change>0.0f) change=1.0f; else if (change<0.0f && change>-1.0f) change=-1.0f; if (change<0.f) newvalue=oldvalue-roundToInt(-change); else newvalue=oldvalue+roundToInt(change); if (is14bit) { if (newvalue>0x7fff) newvalue = 0x7fff; } else { if (newvalue>0x7f) newvalue = 0x7f; } if (newvalue<0) newvalue = 0; return newvalue; }
43.738397
160
0.482732
nonameentername
76090310b2814e60bfb752addad00581e480c9c5
10,370
cpp
C++
vive_bridge/src/vive_interface.cpp
mortaas/vive_rrcc
cdec4645dd3bc1510e15af4be20c7f8dfef321e0
[ "MIT" ]
1
2020-05-14T02:19:56.000Z
2020-05-14T02:19:56.000Z
vive_bridge/src/vive_interface.cpp
mortaas/vive_rrcc
cdec4645dd3bc1510e15af4be20c7f8dfef321e0
[ "MIT" ]
null
null
null
vive_bridge/src/vive_interface.cpp
mortaas/vive_rrcc
cdec4645dd3bc1510e15af4be20c7f8dfef321e0
[ "MIT" ]
null
null
null
#include "vive_bridge/vive_interface.h" // Default functions for logging inline void DefaultDebugMsgCallback(const std::string &msg) { std::cerr << "VR Debug: " << msg << std::endl; } inline void DefaultInfoMsgCallback(const std::string &msg) { std::cerr << "VR Info: " << msg << std::endl; } inline void DefaultWarnMsgCallback(const std::string &msg) { std::cerr << "VR Warn: " << msg << std::endl; } inline void DefaultErrorMsgCallback(const std::string &msg) { std::cerr << "VR Error: " << msg << std::endl; } inline void DefaultFatalMsgCallback(const std::string &msg) { std::cerr << "VR Fatal: " << msg << std::endl; } std::map<vr::TrackedPropertyError, std::string> TrackedPropErrorStrings { { vr::TrackedProp_Success, "The property request was successful"}, { vr::TrackedProp_WrongDataType, "The property was requested with the wrong typed function." }, { vr::TrackedProp_WrongDeviceClass, "The property was requested on a tracked device with the wrong class." }, { vr::TrackedProp_BufferTooSmall, "The string property will not fit in the provided buffer. The buffer size needed is returned." }, { vr::TrackedProp_UnknownProperty, "The property enum value is unknown." }, { vr::TrackedProp_InvalidDevice, "The tracked device index was invalid." }, { vr::TrackedProp_CouldNotContactServer, "OpenVR could not contact vrserver to query the device for this property." }, { vr::TrackedProp_ValueNotProvidedByDevice, "The driver for this device returned that it does not provide this specific property for this device." }, { vr::TrackedProp_StringExceedsMaximumLength, "The string property value returned by a driver exceeded the maximum property length of 32k." } }; ViveInterface::ViveInterface() : VR_DEBUG(DefaultDebugMsgCallback), VR_INFO(DefaultInfoMsgCallback), VR_WARN(DefaultWarnMsgCallback), VR_ERROR(DefaultErrorMsgCallback), VR_FATAL(DefaultFatalMsgCallback) { } ViveInterface::~ViveInterface() { } bool ViveInterface::Init(int argc, char **argv) { /** * Initialize the OpenVR API and get access to the vr::IVRSystem interface. * The vr::IVRSystem interface provides access to display configuration information, * tracking data, distortion functions, controller state, events, and device properties. */ vr::EVRInitError peError = vr::VRInitError_None; pHMD_ = vr::VR_Init(&peError, vr::VRApplication_Background); if (peError != vr::VRInitError_None) { pHMD_ = nullptr; VR_FATAL("OpenVR API initialization failed: " + std::string(vr::VR_GetVRInitErrorAsEnglishDescription(peError) ) ); return false; } // // Camera interface // pCamera_ = INVALID_TRACKED_CAMERA_HANDLE; // pCamera_ = vr::VRTrackedCamera(); // if (!pCamera_) { // VR_WARN("Camera interface initialization failed"); // } else { // // Check if camera is available // bool bHasCamera = false; // vr::EVRTrackedCameraError nCameraError = pCamera_->HasCamera(vr::k_unTrackedDeviceIndex_Hmd, &bHasCamera); // if (nCameraError == vr::VRTrackedCameraError_None && bHasCamera) { // // Check firmware description of camera to ensure that the communication is valid // vr::TrackedPropertyError pError = vr::TrackedProp_UnknownProperty; // std::string string_prop = GetStringProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_CameraFirmwareDescription_String, &pError); // if (pError != vr::TrackedProp_Success) { // VR_ERROR("Error occurred when getting camera firmware description from HMD: " + TrackedPropErrorStrings[pError] ); // } else { // VR_INFO("Camera is available with firmware: \n" + string_prop); // } // } else { // VR_WARN("Camera is not available"); // } // } VR_INFO("OpenVR API initialization succeeded"); return true; } void ViveInterface::Shutdown() { /** * Shuts down the connection to the VR hardware and cleans up the OpenVR API. * The vr::IVRSystem pointer returned by vr::VR_Init will be invalid after this call is made. */ // Check if the OpenVR API is initialized if (pHMD_) { vr::VR_Shutdown(); pHMD_ = nullptr; } } std::string ViveInterface::GetStringProperty(vr::TrackedDeviceIndex_t unDeviceIndex, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError *pError) { /** * Returns the static string property of a tracked device. * * vr::TrackedDeviceIndex unDeviceIndex - Index of the device to get the property for. * vr::TrackedDeviceProperty prop - Which property to get. */ uint32_t unBufferSize = pHMD_->GetStringTrackedDeviceProperty(unDeviceIndex, prop, nullptr, 0, pError); // Return empty string if the property is empty if (unBufferSize == 0) { return ""; } // Get string property char *pchValue = new char[unBufferSize]; unBufferSize = pHMD_->GetStringTrackedDeviceProperty(unDeviceIndex, prop, pchValue, unBufferSize, pError); std::string strValue = pchValue; delete [] pchValue; return strValue; } void ViveInterface::GetControllerState(const unsigned int &device_index, std::vector<float> &axes, std::vector<int> &buttons) { /** * Get controller state and map it to axes and buttons */ pHMD_->GetControllerState(device_index, &controller_state_, sizeof(vr::VRControllerState_t) ); // Axes axes[0] = controller_state_.rAxis[0].x; axes[1] = controller_state_.rAxis[0].y; axes[2] = controller_state_.rAxis[1].x; // Buttons buttons.assign(13, 0); if (vr::ButtonMaskFromId(vr::k_EButton_ApplicationMenu) & controller_state_.ulButtonPressed) { buttons[0] = 1; } if (vr::ButtonMaskFromId(vr::k_EButton_Dashboard_Back) & controller_state_.ulButtonPressed) { buttons[1] = 1; } if (vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Touchpad) & controller_state_.ulButtonPressed) { buttons[2] = 1; } if (vr::ButtonMaskFromId(vr::k_EButton_SteamVR_Trigger) & controller_state_.ulButtonPressed) { buttons[3] = 1; } } bool ViveInterface::PollNextEvent(unsigned int &event_type, unsigned int &device_index) { /** * Returns true if there is any event waiting in the event queue, * and also returns the event type and device index of this event. * Returns event type VREvent_None (0) and device index k_unTrackedDeviceIndexInvalid (4294967295) * if there is no event waiting in the event queue. */ if (!pHMD_->PollNextEvent(&event_, sizeof(event_) ) ) { event_type = vr::VREvent_None; device_index = vr::k_unTrackedDeviceIndexInvalid; return false; } else { event_type = event_.eventType; device_index = event_.trackedDeviceIndex; return true; } } void ViveInterface::GetDeviceSN(const unsigned int &device_index, std::string &device_sn) { /** * Get the serial number of a tracked device */ vr::TrackedPropertyError pError = vr::TrackedProp_UnknownProperty; device_sn = GetStringProperty(device_index, vr::Prop_SerialNumber_String, &pError); if (pError != vr::TrackedProp_Success) { VR_ERROR("Error occurred when getting serial number from tracked device: " + TrackedPropErrorStrings[pError] ); } } void ViveInterface::GetDevicePose(const unsigned int &device_index, float m[3][4]) { /** * Get the pose of a tracked device * This pose is represented as the top 3 rows of a homogeneous transformation matrix */ for (int i = 0; i < 3; i++) for (int j = 0; j < 4; j++) m[i][j] = device_poses_[device_index].mDeviceToAbsoluteTracking.m[i][j]; } void ViveInterface::GetDeviceVelocity(const unsigned int &device_index, float linear[3], float angular[3]) { /** * Get the linear and angular velocity (twist) of a tracked device */ for (int i = 0; i < 3; i++) { linear[i] = device_poses_[device_index].vVelocity.v[i]; angular[i] = device_poses_[device_index].vAngularVelocity.v[i]; } } unsigned char ViveInterface::GetDeviceClass(const unsigned int &device_index) { /** * Get the class of a tracked device */ return pHMD_->GetTrackedDeviceClass(device_index); } unsigned char ViveInterface::GetControllerRole(const unsigned int &device_index) { /** * Get the controller role of a tracked device, e.g. left or right hand */ return pHMD_->GetControllerRoleForTrackedDeviceIndex(device_index); } bool ViveInterface::PoseIsValid(const unsigned int &device_index) { /** * Check if the pose of a tracked device is valid */ return (device_poses_[device_index].eTrackingResult == vr::TrackingResult_Running_OK && device_poses_[device_index].bPoseIsValid && device_poses_[device_index].bDeviceIsConnected); } void ViveInterface::Update() { /* * Calculates updated poses and velocities for all tracked devices * TrackingUniverseRawAndUncalibrated - provides poses relative to the hardware-specific coordinate system in the driver */ pHMD_->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseSeated, 0, device_poses_, vr::k_unMaxTrackedDeviceCount); } void ViveInterface::TriggerHapticPulse(const unsigned int &device_index, const unsigned short &duration) { /* * Triggers a single haptic pulse on a controller given its device index, and the pulse duration 0-3999 µs ("strength") */ if (GetDeviceClass(device_index) == vr::TrackedDeviceClass_Controller) { unsigned short usDurationMicroSec = duration; usDurationMicroSec = std::min(usDurationMicroSec, (unsigned short) 3999); usDurationMicroSec = std::max(usDurationMicroSec, (unsigned short) 0); pHMD_->TriggerHapticPulse(device_index, 0, usDurationMicroSec); } } // Logging to ROS void ViveInterface::SetDebugMsgCallback(DebugMsgCallback fn) { VR_DEBUG = fn; } void ViveInterface::SetInfoMsgCallback(InfoMsgCallback fn) { VR_INFO = fn; } void ViveInterface::SetWarnMsgCallback(WarnMsgCallback fn) { VR_WARN = fn; } void ViveInterface::SetErrorMsgCallback(ErrorMsgCallback fn) { VR_ERROR = fn; } void ViveInterface::SetFatalMsgCallback(FatalMsgCallback fn) { VR_FATAL = fn; }
38.838951
152
0.694021
mortaas
760953b3829e16f1b8f24601633c3caff4c06347
1,443
cpp
C++
Day2/main.cpp
baldwinmatt/AoC-2021
4a7f18f6364715f6e61127aba175db6fec6e6b13
[ "Apache-2.0" ]
4
2021-12-06T17:14:00.000Z
2021-12-10T06:29:35.000Z
Day2/main.cpp
baldwinmatt/AoC-2021
4a7f18f6364715f6e61127aba175db6fec6e6b13
[ "Apache-2.0" ]
null
null
null
Day2/main.cpp
baldwinmatt/AoC-2021
4a7f18f6364715f6e61127aba175db6fec6e6b13
[ "Apache-2.0" ]
null
null
null
#include "aoc21/helpers.h" #include <set> namespace { using Movement = std::pair<char, int>; constexpr std::string_view DIRECTION_FORWARD("forward"); constexpr std::string_view DIRECTION_UP("up"); constexpr std::string_view DIRECTION_DOWN("down"); std::set<std::string_view> DIRECTIONS = { DIRECTION_FORWARD, DIRECTION_UP, DIRECTION_DOWN, }; }; int main(int argc, char** argv) { aoc::AutoTimer t; auto f = aoc::open_argv_1(argc, argv); // Part 1 int virt = 0; int horiz = 0; // Part 2 int depth = 0; const auto parse_movement = [](const std::string &s) { const auto pos = s.find(' '); assert(pos != std::string::npos); const std::string_view direction(&s[0], pos); const int value = ::atoi(&s[pos + 1]); assert(DIRECTIONS.find(direction) != DIRECTIONS.end()); Movement m = std::make_pair(direction[0], value); return m; }; const auto walk_path = [&](const std::string& line) { const Movement m = parse_movement(line); switch (m.first) { case 'd': virt += m.second; break; case 'u': virt -= m.second; break; case 'f': horiz += m.second; depth += (m.second * virt); break; default: break; } }; std::string l; while (aoc::getline(f, l)) { walk_path(l); } aoc::print_results((virt * horiz), (horiz * depth)); return 0; }
20.323944
60
0.575191
baldwinmatt
7609549b84d30b06941f2bc18f9bdcbb36f4d85e
2,930
cpp
C++
tree/binary_tree/103_binary-tree-zigzag-level-order-traversal.cpp
b1tank/leetcode
0b71eb7a4f52291ff072b1280d6b76e68f7adfee
[ "MIT" ]
null
null
null
tree/binary_tree/103_binary-tree-zigzag-level-order-traversal.cpp
b1tank/leetcode
0b71eb7a4f52291ff072b1280d6b76e68f7adfee
[ "MIT" ]
null
null
null
tree/binary_tree/103_binary-tree-zigzag-level-order-traversal.cpp
b1tank/leetcode
0b71eb7a4f52291ff072b1280d6b76e68f7adfee
[ "MIT" ]
null
null
null
// Author: b1tank // Email: b1tank@outlook.com //================================= /* 103_binary-tree-zigzag-level-order-traversal LeetCode Solution: - BFS (deque rather than queue) - DFS (recursive) (potentially O(logN) space for auto-cast enabled language like Java, Python) */ #include <iostream> #include <vector> #include <deque> using namespace std; // Definition for a binary tree node. struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode() : val(0), left(nullptr), right(nullptr) {} TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} }; class Solution { void dfs(TreeNode* cur, int level, vector<deque<int>>& v_dq) { // use reference !!!! int n = v_dq.size(); if (level >= n) { deque<int> v{cur->val}; v_dq.push_back(v); } else { if (level % 2 == 0) { v_dq[level].push_back(cur->val); } else { v_dq[level].push_front(cur->val); } } if (cur->left) { dfs(cur->left, level+1, v_dq); } if (cur->right) { dfs(cur->right, level+1, v_dq); } return; } public: vector<vector<int>> zigzagLevelOrder(TreeNode* root) { vector<vector<int>> res; if (root == nullptr) return res; vector<deque<int>> res_dq; dfs(root, 0, res_dq); for (auto i = 0; i < res_dq.size(); ++i) { vector<int> tmp(res_dq[i].begin(), res_dq[i].end()); res.push_back(tmp); } return res; // vector<vector<int>> res; // if (root == nullptr) return res; // deque<TreeNode*> dq; // dq.push_back(root); // bool left2right = true; // int count = 0; // int level = dq.size(); // vector<int> tmp; // TreeNode* cur{nullptr}; // while (!dq.empty()) { // cur = left2right ? dq.front() : dq.back(); // if (left2right) { // dq.pop_front(); // if (cur->left) dq.push_back(cur->left); // if (cur->right) dq.push_back(cur->right); // } else { // dq.pop_back(); // if (cur->right) dq.push_front(cur->right); // if (cur->left) dq.push_front(cur->left); // } // tmp.push_back(cur->val); // ++count; // if (count == level) { // res.push_back(tmp); // tmp.clear(); // count = 0; // level = dq.size(); // left2right = !left2right; // } // } // return res; } };
30.206186
99
0.454949
b1tank
760ab8227a4933c0797445037a7ee0c712dca22c
1,103
cpp
C++
Other/Additional Practice 14.12.2019/rightWayToAllocateDynamicMatrix.cpp
terziev-viktor/FMI-UP-2019-2020
1974eec4677257229dcb5f9327aed5dfb38d1f8c
[ "MIT" ]
4
2019-11-06T12:03:06.000Z
2020-02-24T18:33:11.000Z
Other/Additional Practice 14.12.2019/rightWayToAllocateDynamicMatrix.cpp
terziev-viktor/FMI-UP-2019-2020
1974eec4677257229dcb5f9327aed5dfb38d1f8c
[ "MIT" ]
null
null
null
Other/Additional Practice 14.12.2019/rightWayToAllocateDynamicMatrix.cpp
terziev-viktor/FMI-UP-2019-2020
1974eec4677257229dcb5f9327aed5dfb38d1f8c
[ "MIT" ]
3
2019-11-27T17:13:59.000Z
2020-02-24T18:33:15.000Z
#include <iostream> void deleteMatrix(int** matrix, size_t rows) { for(int i = 0; i < rows; ++i) { delete[] matrix[i]; } delete[] matrix; } int** allocateMatrixByRowsAndCols(size_t n, size_t m) { int** matrix = new (std::nothrow) int* [n]; if(matrix == nullptr) { // if operator new can't allocate memory on the heap return nullptr; // return nullptr pointer. But for this, we should write } // option (std::nothrow) after operator new! for(size_t i = 0; i < n; ++i) { matrix[i] = new (std::nothrow) int[m]; // same stuff here if(matrix[i] == nullptr) { // if operator new return nullptr, we should deleteMatrix(matrix, i); // clean all dynamic memory which we allocate before return nullptr; // this moment, and return nullptr } } return matrix; // if all dynamic memory is allocate correctly, we return pointer // to this memory } int main() { size_t n, m; std::cin >> n >> m; int** matrix = allocateMatrixByRowsAndCols(n, m); if(matrix != nullptr) { // do stuff with matrix } if(matrix != nullptr) { deleteMatrix(matrix, n); } return 0; }
25.068182
81
0.646419
terziev-viktor
760cfe2d2337432244fcf713a5b8d8dd97ad8e7c
5,160
cpp
C++
reconciliation/Graphene-Cpp/IBLT-optimization/search.cpp
Libero0809/pbs_organized
da2180909b36ea6b82e4d794afdcc2b8b4ab4b67
[ "MIT" ]
1
2022-01-17T04:59:48.000Z
2022-01-17T04:59:48.000Z
reconciliation/Graphene-Cpp/IBLT-optimization/search.cpp
Libero0809/pbs_organized
da2180909b36ea6b82e4d794afdcc2b8b4ab4b67
[ "MIT" ]
null
null
null
reconciliation/Graphene-Cpp/IBLT-optimization/search.cpp
Libero0809/pbs_organized
da2180909b36ea6b82e4d794afdcc2b8b4ab4b67
[ "MIT" ]
null
null
null
#include <iostream> #include <iomanip> #include <string> #include <map> #include <random> #include <cmath> #include <set> #include <array> // g++ -g -O3 search.cpp -Wno-c++11-extensions -o search std::random_device r; std::default_random_engine e1(r()); //largest K to search for const uint MAX_K = 20; class hypergraph { public: std::set<std::array<uint,MAX_K> > hg; uint items; uint rows; uint k; bool buckets; hypergraph(int m, int _k, int n,bool _buckets){ items = n; rows = m; k = _k; buckets=_buckets; // std::cout<<"items: " << items<<", rows: "<<rows<<", k hashes: "<<k<<"\n"; std::uniform_int_distribution<> uniform_dist; //assert(MAX_K>=k); if (buckets==true) { uniform_dist = std::uniform_int_distribution<>(0,rows/k-1); } else { uniform_dist = std::uniform_int_distribution<>(0,rows-1); // std::cout << "Rows: "<<rows<<" "<<buckets<<"\n"; } for(int i = 0; i < items; ++i){ int bucket=0; std::array<uint,MAX_K> edge; for(int i = 0; i < k; ++i,bucket+=rows/k) { int result = uniform_dist(e1); // std::cout<<"Inserting into "<<i<<" ->"<<result<<" which is "<<result+bucket<<"\n"; if (buckets) { edge.at(i)=result+bucket; } else { edge.at(i)=result; } } hg.insert(edge); } }; // For debugging void print_hg(){ for(auto edge :hg){ print_edge(edge); } }; // For debugging void print_edge(std::array<uint,MAX_K>edge){ std::cout<<"["; for(auto v : edge){ std::cout << v << " "; } std::cout<<"]\n"; } // Peel a hypergraph. This is our main function void peel(){ // std::cout<<"Peeling...\n"; if (hg.size()==0) { return; } /* Count the number of times we see each edge... looking for singles */ std::map<uint,uint> vertex_cnt; for(auto edge :hg){ for(uint v=0;v<k; v++){ // std::cout<<"vertex: "<<v<<" "<<edge[v]<<"\n"; vertex_cnt[edge[v]]+=1; } } std::set<uint> remove_vert; for(auto edge: vertex_cnt){ if (edge.second==1) { // std::cout<<"single kvertex "<<edge.first<<"\n"; //assert(edge.first<rows); remove_vert.insert(edge.first); } } if (buckets==true){ for (auto vert: remove_vert) {//for each vertex r uint r_bucket = floor(vert /(rows/k)) ; //assert(r_bucket < k); auto itr= hg.begin(); auto cnt = 0; while (itr!=hg.end()) { //search each edge for r cnt+=1; // std::cout<<cnt<<" remove "<<vert<<" ?"<<itr->at(r_bucket)<<" "<<hg.size()<<"\n"; if (itr->at(r_bucket) == vert){ hg.erase(itr); itr=hg.end(); break; // there is only one, so we can stop looking for it } if( itr!=hg.end() ) itr++; } // std::cout<<" removed.\n"; } } else { // if we have buckets, it's a little harder for (auto vert: remove_vert) {//for each vertex r // std::cout<<"trying to remove "<<vert<<". Remaining edges: "<<hg.size()<<"\n"; //assert(vert<rows); auto itr= hg.begin(); int cnt = 0; while (itr!=hg.end()) { //search each edge for r cnt+=1; // std::cout<<"cnt: "<<cnt<<"\n"; for(uint v=0;v<k; v++){ // std::cout<<cnt<<" "<<"at "<<"v=="<<v<<"->"<<itr->at(v)<<"\n"; if (itr->at(v) == vert){ // std::cout<<"erase!\n"; itr=hg.erase(itr); v=k; // break; // std::cout<<"success\n"; // itr=hg.end(); // break; // there is only one, so we can stop looking for it } } // std::cout<<"itr++!\n"; if (itr!=hg.end()) itr++; } } } }; //peel // Check if a hypergraph decoded bool check_decode(){ if (items> hg.size()) return(false); uint last_len = hg.size(); // std::cout <<"hg size: "<<hg.size()<<"\n"; // print_hg(); peel(); while(hg.size()<last_len){ last_len = hg.size(); // std::cout <<"hg size: "<<hg.size()<<"\n"; // print_hg(); peel(); } return(hg.size()==0); }; }; // Determine the decode rate using at least 5000 trials. // Trials stop when 95% confidence interval is met, or // mean is within .99999 to 1.00001 """ int main(int argc, char* argv[]){ int entries=atoi(argv[1]); int k=atoi(argv[2]); int rows=atoi(argv[3]); long double goal = 1.0*atoi(argv[4])/atoi(argv[5]); bool buckets = atoi(argv[6])==1; long double ci_limit = (1-goal)/5; long double prob ; long double ci; int success =0; int trials=0; bool not_done=true; while (not_done ==true) { for(int sub=0;sub<100;sub++,trials++){ // std::cout<<"\nNew Trial\n"; hypergraph h = hypergraph(rows,k,entries,buckets); if (h.check_decode()) success+=1; } prob = 1.0*success/trials; if (success < trials){ ci = 1.96*sqrt(prob*(1.0-prob)/trials); } else { ci = -(exp(log(.05)/trials)-1); } if (trials>= 1000){ if (prob-ci > goal){ not_done = false; //std::cerr<<"done 1 "<<prob<<" -"<<ci<<">"<<goal <<"\n"; } if (prob+ci <= goal){ not_done = false; //std::cerr<<"done 2\n"; } if ((prob-ci> goal-ci_limit) && (prob+ci<goal+ci_limit)){ not_done = false; //std::cerr<<"done 3\n"; } } } std::cout<<success<<","<<trials<<"\n"; }
23.669725
90
0.543992
Libero0809
760fc027a88ce6e1c6af2ad87fc7e27045f77a01
3,959
hpp
C++
include/GlobalNamespace/NetworkPlayerEntitlementChecker_CachedTcs.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/GlobalNamespace/NetworkPlayerEntitlementChecker_CachedTcs.hpp
darknight1050/BeatSaber-Quest-Codegen
a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032
[ "Unlicense" ]
null
null
null
include/GlobalNamespace/NetworkPlayerEntitlementChecker_CachedTcs.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: NetworkPlayerEntitlementChecker #include "GlobalNamespace/NetworkPlayerEntitlementChecker.hpp" // Including type: EntitlementsStatus #include "GlobalNamespace/EntitlementsStatus.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: System::Threading::Tasks namespace System::Threading::Tasks { // Forward declaring type: TaskCompletionSource`1<TResult> template<typename TResult> class TaskCompletionSource_1; // Forward declaring type: Task`1<TResult> template<typename TResult> class Task_1; } // Completed forward declares // Type namespace: namespace GlobalNamespace { // Size: 0x24 #pragma pack(push, 1) // Autogenerated type: NetworkPlayerEntitlementChecker/CachedTcs class NetworkPlayerEntitlementChecker::CachedTcs : public ::Il2CppObject { public: // private System.Single kRefreshTime // Size: 0x4 // Offset: 0x10 float kRefreshTime; // Field size check static_assert(sizeof(float) == 0x4); // Padding between fields: kRefreshTime and: source char __padding0[0x4] = {}; // private readonly System.Threading.Tasks.TaskCompletionSource`1<EntitlementsStatus> _source // Size: 0x8 // Offset: 0x18 System::Threading::Tasks::TaskCompletionSource_1<GlobalNamespace::EntitlementsStatus>* source; // Field size check static_assert(sizeof(System::Threading::Tasks::TaskCompletionSource_1<GlobalNamespace::EntitlementsStatus>*) == 0x8); // private System.Single _creationTime // Size: 0x4 // Offset: 0x20 float creationTime; // Field size check static_assert(sizeof(float) == 0x4); // Creating value type constructor for type: CachedTcs CachedTcs(float kRefreshTime_ = {}, System::Threading::Tasks::TaskCompletionSource_1<GlobalNamespace::EntitlementsStatus>* source_ = {}, float creationTime_ = {}) noexcept : kRefreshTime{kRefreshTime_}, source{source_}, creationTime{creationTime_} {} // public System.Threading.Tasks.Task`1<EntitlementsStatus> get_task() // Offset: 0x11B3730 System::Threading::Tasks::Task_1<GlobalNamespace::EntitlementsStatus>* get_task(); // public System.Void SetResult(EntitlementsStatus status) // Offset: 0x11B3780 void SetResult(GlobalNamespace::EntitlementsStatus status); // public System.Boolean Refresh() // Offset: 0x11B3814 bool Refresh(); // public System.Void .ctor() // Offset: 0x11B36A8 // Implemented from: System.Object // Base method: System.Void Object::.ctor() template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static NetworkPlayerEntitlementChecker::CachedTcs* New_ctor() { static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::NetworkPlayerEntitlementChecker::CachedTcs::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<NetworkPlayerEntitlementChecker::CachedTcs*, creationType>())); } }; // NetworkPlayerEntitlementChecker/CachedTcs #pragma pack(pop) static check_size<sizeof(NetworkPlayerEntitlementChecker::CachedTcs), 32 + sizeof(float)> __GlobalNamespace_NetworkPlayerEntitlementChecker_CachedTcsSizeCheck; static_assert(sizeof(NetworkPlayerEntitlementChecker::CachedTcs) == 0x24); } DEFINE_IL2CPP_ARG_TYPE(GlobalNamespace::NetworkPlayerEntitlementChecker::CachedTcs*, "", "NetworkPlayerEntitlementChecker/CachedTcs");
49.4875
255
0.731498
darknight1050
761225811e733aca296c3640596129d68fcbb5d8
1,951
cpp
C++
Dynamic Programming/minimum_diffrenece subset.cpp
siddhi-244/CompetitiveProgrammingQuestionBank
4c265d41b82a7d4370c14d367f78effa9ed95d3c
[ "MIT" ]
931
2020-04-18T11:57:30.000Z
2022-03-31T15:15:39.000Z
Dynamic Programming/minimum_diffrenece subset.cpp
geekySapien/CompetitiveProgrammingQuestionBank
9e84a88a85dbabd95207391967abde298ddc031d
[ "MIT" ]
661
2020-12-13T04:31:48.000Z
2022-03-15T19:11:54.000Z
Dynamic Programming/minimum_diffrenece subset.cpp
geekySapien/CompetitiveProgrammingQuestionBank
9e84a88a85dbabd95207391967abde298ddc031d
[ "MIT" ]
351
2020-08-10T06:49:21.000Z
2022-03-25T04:02:12.000Z
//Link : https://www.interviewbit.com/problems/minimum-difference-subsets/ /* Problem Description Given an integer array A containing N integers. You need to divide the array A into two subsets S1 and S2 such that the absolute difference between their sums is minimum. Find and return this minimum possible absolute difference. NOTE: Subsets can contain elements from A in any order (not necessary to be contiguous). Each element of A should belong to any one subset S1 or S2, not both. It may be possible that one subset remains empty. Problem Constraints 1 <= N <= 100 1 <= A[i] <= 100 Input Format First and only argument is an integer array A. Output Format Return an integer denoting the minimum possible difference among the sums of two subsets. Example Input Input 1: A = [1, 6, 11, 5] Example Output Output 1: 1 Example Explanation Explanation 1: Subset1 = {1, 5, 6}, sum of Subset1 = 12 Subset2 = {11}, sum of Subset2 = 11*/ int Solution::solve(vector<int> &A) { int sum = 0,N=A.size(); for (int i = 0; i < A.size(); i++) sum += A[i]; bool dp[N+1][sum+1]; for(int i=0;i<N+1;i++) { for(int j=0;j<sum+1;j++) { if(j==0) dp[i][j]= true; else if(i==0) dp[i][j]= false; else if(A[i-1] <= j) { dp[i][j] = dp[i-1][j-A[i-1]] || dp[i-1][j]; } else dp[i][j] = dp[i-1][j]; } } // Initialize difference of two sums. int diff = INT_MAX; // Find the largest j such that dp[n][j] // is true where j loops from sum/2 t0 0 for (int j=sum/2; j>=0; j--) { // Find the if (dp[N][j] == true) { diff = sum-2*j; break; } } return diff; }
21.43956
122
0.529472
siddhi-244