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
109
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
sequencelengths
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
sequencelengths
1
9
max_issues_count
int64
1
48.5k
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
sequencelengths
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
bc3bf4d210522a103d2ad6ddc8d8c6f117082c03
1,805
hpp
C++
include/string_algorithm_impl.hpp
Shtan7/KTL
9c0adf8fac2f0bb481060b7bbb15b1356089af3c
[ "MIT" ]
38
2020-12-16T22:12:50.000Z
2022-03-24T04:07:14.000Z
include/string_algorithm_impl.hpp
Shtan7/KTL
9c0adf8fac2f0bb481060b7bbb15b1356089af3c
[ "MIT" ]
165
2020-11-11T21:22:23.000Z
2022-03-26T14:30:40.000Z
include/string_algorithm_impl.hpp
Shtan7/KTL
9c0adf8fac2f0bb481060b7bbb15b1356089af3c
[ "MIT" ]
5
2021-07-16T19:05:28.000Z
2021-12-22T11:46:42.000Z
#pragma once #include <algorithm.hpp> namespace ktl { namespace str::details { template <class Traits, class CharT, class SizeType> constexpr SizeType find_ch(const CharT* str, CharT ch, SizeType length, SizeType start_pos, SizeType npos) { if (start_pos >= length) { return npos; } const CharT* found_ptr{Traits::find(str + start_pos, length - start_pos, ch)}; return found_ptr ? static_cast<SizeType>(found_ptr - str) : npos; } template <class Traits, class CharT, class SizeType> constexpr SizeType rfind_ch(const CharT* str, CharT ch, SizeType length, SizeType start_pos, SizeType npos) { if (start_pos >= length) { return npos; } for (SizeType idx = length; idx > 0; --idx) { const SizeType pos{idx - 1}; if (Traits::eq(str[pos], ch)) { return pos; } } return npos; } template <class Traits, class CharT, class SizeType> constexpr SizeType find_substr(const CharT* str, SizeType str_start_pos, SizeType str_length, const CharT* substr, SizeType substr_length, SizeType npos) { if (substr_length > str_length) { return npos; } const CharT* str_end{str + str_length}; const auto found_ptr{find_subrange( str + str_start_pos, str_end, substr, substr + substr_length, [](CharT lhs, CharT rhs) { return Traits::eq(lhs, rhs); })}; return found_ptr != str_end ? static_cast<SizeType>(found_ptr - str) : npos; } } // namespace str::details } // namespace ktl
33.425926
80
0.556233
Shtan7
bc3e67071673456f2ff996ca5248a914ba86b0a6
983
hpp
C++
include/tools/StringTools.hpp
CapRat/APAL
a08f4bc6ee6299e8e370ef99750262ad23c87d58
[ "MIT" ]
2
2020-09-21T12:30:05.000Z
2020-10-14T19:43:51.000Z
include/tools/StringTools.hpp
CapRat/APAL
a08f4bc6ee6299e8e370ef99750262ad23c87d58
[ "MIT" ]
null
null
null
include/tools/StringTools.hpp
CapRat/APAL
a08f4bc6ee6299e8e370ef99750262ad23c87d58
[ "MIT" ]
null
null
null
#ifndef STRING_TOOLS_HPP #define STRING_TOOLS_HPP #include <string> namespace APAL { /** * @brief Replaces all occurences of an itemToReplace in the given strToChange * @param strToChange string to replaces stuff in. * @param itemToReplace String value, which should be replaces * @param substitute Text to replace itemToReplace with */ std::string replaceInString(std::string strToChange, const std::string itemToReplace, const std::string substitute); /** * @brief Gets the filename from a path with or without extension * When no seperator is found, the whole filePath is returned. * @param filePath filepath, to retreive filename from * @param withExtension return the fileextension with the filename. * @param seperator Seperator for the given fielpath. Defaults to /. * @return */ std::string getFileName(std::string filePath, bool withExtension = true, char seperator = '/'); } #endif //! STRING_TOOLS_HPP
33.896552
78
0.722279
CapRat
bc3ec80aab2aafa2db45125a14f98e557efaa48a
4,217
hpp
C++
data_structure/set_managed_by_interval.hpp
emthrm/library
0876ba7ec64e23b5ec476a7a0b4880d497a36be1
[ "Unlicense" ]
1
2021-12-26T14:17:29.000Z
2021-12-26T14:17:29.000Z
data_structure/set_managed_by_interval.hpp
emthrm/library
0876ba7ec64e23b5ec476a7a0b4880d497a36be1
[ "Unlicense" ]
3
2020-07-13T06:23:02.000Z
2022-02-16T08:54:26.000Z
data_structure/set_managed_by_interval.hpp
emthrm/library
0876ba7ec64e23b5ec476a7a0b4880d497a36be1
[ "Unlicense" ]
null
null
null
#pragma once #include <cassert> #include <iostream> #include <iterator> #include <limits> #include <set> #include <tuple> #include <utility> template <typename T> struct SetManagedByInterval { using IntervalType = std::set<std::pair<T, T>>; IntervalType interval{ {std::numeric_limits<T>::lowest(), std::numeric_limits<T>::lowest()}, {std::numeric_limits<T>::max(), std::numeric_limits<T>::max()}, }; bool contains(T x) const { return contains(x, x); } bool contains(T left, T right) const { typename IntervalType::const_iterator it = interval.lower_bound({left, left}); if (left < it->first) it = std::prev(it); return it->first <= left && right <= it->second; } std::pair<typename IntervalType::const_iterator, bool> erase(T x) { typename IntervalType::const_iterator it = interval.lower_bound({x, x}); if (it->first == x) { T right = it->second; it = interval.erase(it); if (x + 1 <= right) it = interval.emplace(x + 1, right).first; return {it, true}; } it = std::prev(it); T left, right; std::tie(left, right) = *it; if (right < x) return {std::next(it), false}; interval.erase(it); it = std::next(interval.emplace(left, x - 1).first); if (x + 1 <= right) it = interval.emplace(x + 1, right).first; return {it, true}; } std::pair<typename IntervalType::const_iterator, T> erase(T left, T right) { assert(left <= right); typename IntervalType::const_iterator it = interval.lower_bound({left, left}); T res = 0; for (; it->second <= right; it = interval.erase(it)) res += it->second - it->first + 1; if (it->first <= right) { res += right - it->first + 1; T r = it->second; interval.erase(it); it = interval.emplace(right + 1, r).first; } if (left < std::prev(it)->second) { it = std::prev(it); res += it->second - left + 1; T l = it->first; interval.erase(it); it = std::next(interval.emplace(l, left - 1).first); } return {it, res}; } std::pair<typename IntervalType::const_iterator, bool> insert(T x) { typename IntervalType::const_iterator it = interval.lower_bound({x, x}); if (it->first == x) return {it, false}; if (x <= std::prev(it)->second) return {std::prev(it), false}; T left = x, right = x; if (x + 1 == it->first) { right = it->second; it = interval.erase(it); } if (std::prev(it)->second == x - 1) { it = std::prev(it); left = it->first; interval.erase(it); } return {interval.emplace(left, right).first, true}; } std::pair<typename IntervalType::const_iterator, T> insert(T left, T right) { assert(left <= right); typename IntervalType::const_iterator it = interval.lower_bound({left, left}); if (left <= std::prev(it)->second) { it = std::prev(it); left = it->first; } T res = 0; if (left == it->first && right <= it->second) return {it, res}; for (; it->second <= right; it = interval.erase(it)) res -= it->second - it->first + 1; if (it->first <= right) { res -= it->second - it->first + 1; right = it->second; it = interval.erase(it); } res += right - left + 1; if (right + 1 == it->first) { right = it->second; it = interval.erase(it); } if (std::prev(it)->second == left - 1) { it = std::prev(it); left = it->first; interval.erase(it); } return {interval.emplace(left, right).first, res}; } T mex(T x = 0) const { auto it = interval.lower_bound({x, x}); if (x <= std::prev(it)->second) it = std::prev(it); return x < it->first ? x : it->second + 1; } friend std::ostream &operator<<(std::ostream &os, const SetManagedByInterval &st) { if (st.interval.size() == 2) return os; auto it = next(st.interval.begin()); while (true) { os << '[' << it->first << ", " << it->second << ']'; it = next(it); if (next(it) == st.interval.end()) { break; } else { os << ' '; } } return os; } };
32.438462
92
0.549917
emthrm
a4bae2b46f729cf5e390dec87ea27ca6e79be0d4
462
cc
C++
src/base/Exception.cc
plantree/Slack
469fff18792a6d4d20c409f0331e3c93117c5ddf
[ "MIT" ]
2
2019-07-15T08:34:38.000Z
2019-08-07T12:27:23.000Z
src/base/Exception.cc
plantree/Slack
469fff18792a6d4d20c409f0331e3c93117c5ddf
[ "MIT" ]
null
null
null
src/base/Exception.cc
plantree/Slack
469fff18792a6d4d20c409f0331e3c93117c5ddf
[ "MIT" ]
null
null
null
/* * @Author: py.wang * @Date: 2019-05-04 09:08:42 * @Last Modified by: py.wang * @Last Modified time: 2019-06-06 18:26:02 */ #include "src/base/Exception.h" #include "src/base/CurrentThread.h" #include <iostream> #include <cxxabi.h> #include <execinfo.h> #include <stdlib.h> #include <stdio.h> namespace slack { Exception::Exception(string msg) : message_(std::move(msg)), stack_(CurrentThread::stackTrace(false)) { } } // namespace slack
17.111111
44
0.67316
plantree
a4bb20896fd90541883eaa179780cb85402ae1ed
2,078
cpp
C++
dali/public-api/signals/signal-slot-connections.cpp
vcebollada/dali-core
1f880695d4f6cb871db7f946538721e882ba1633
[ "Apache-2.0", "BSD-3-Clause" ]
1
2016-08-05T09:58:38.000Z
2016-08-05T09:58:38.000Z
dali/public-api/signals/signal-slot-connections.cpp
tizenorg/platform.core.uifw.dali-core
dd89513b4bb1fdde74a83996c726e10adaf58349
[ "Apache-2.0" ]
1
2020-03-22T10:19:17.000Z
2020-03-22T10:19:17.000Z
dali/public-api/signals/signal-slot-connections.cpp
tizenorg/platform.core.uifw.dali-core
dd89513b4bb1fdde74a83996c726e10adaf58349
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * 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. * */ // CLASS HEADER #include <dali/public-api/signals/signal-slot-connections.h> // EXTERNAL INCLUDES #include <cstddef> // INTERNAL INCLUDES #include <dali/public-api/signals/callback.h> namespace Dali { SlotConnection::SlotConnection( SlotObserver* slotObserver, CallbackBase* callback ) : mSlotObserver( slotObserver ), mCallback( callback ) { } SlotConnection::~SlotConnection() { } CallbackBase* SlotConnection::GetCallback() { return mCallback; } SlotObserver* SlotConnection::GetSlotObserver() { return mSlotObserver; } SignalConnection::SignalConnection( CallbackBase* callback ) : mSignalObserver( NULL ), mCallback( callback ) { } SignalConnection::SignalConnection( SignalObserver* signalObserver, CallbackBase* callback ) : mSignalObserver( signalObserver ), mCallback( callback ) { } SignalConnection::~SignalConnection() { // signal connections have ownership of the callback. delete mCallback; } void SignalConnection::Disconnect( SlotObserver* slotObserver ) { if( mSignalObserver ) { // tell the slot the signal wants to disconnect mSignalObserver->SignalDisconnected( slotObserver, mCallback ); mSignalObserver = NULL; } // we own the callback, SignalObserver is expected to delete the SlotConnection on Disconnected so its pointer to our mCallback is no longer used delete mCallback; mCallback = NULL; } CallbackBase* SignalConnection::GetCallback() { return mCallback; } } // namespace Dali
23.613636
147
0.751203
vcebollada
a4be20b3add2814e1866e728892150ded1e63d33
1,406
cpp
C++
BOJ_solve/8143.cpp
python-programmer1512/Code_of_gunwookim
e72e6724fb9ee6ccf2e1064583956fa954ba0282
[ "MIT" ]
4
2021-01-27T11:51:30.000Z
2021-01-30T17:02:55.000Z
BOJ_solve/8143.cpp
python-programmer1512/Code_of_gunwookim
e72e6724fb9ee6ccf2e1064583956fa954ba0282
[ "MIT" ]
null
null
null
BOJ_solve/8143.cpp
python-programmer1512/Code_of_gunwookim
e72e6724fb9ee6ccf2e1064583956fa954ba0282
[ "MIT" ]
5
2021-01-27T11:46:12.000Z
2021-05-06T05:37:47.000Z
#include <bits/stdc++.h> #define x first #define y second #define pb push_back #define all(v) v.begin(),v.end() #pragma gcc optimize("O3") #pragma gcc optimize("Ofast") #pragma gcc optimize("unroll-loops") using namespace std; const int INF = 1e9; const int TMX = 1 << 18; const long long llINF = 2e18; const long long mod = 1e18; const long long hashmod = 100003; typedef long long ll; typedef long double ld; typedef pair <int,int> pi; typedef pair <ll,ll> pl; typedef vector <int> vec; typedef vector <pi> vecpi; typedef long long ll; int n,m,p[1000005],hole[1000005]; int ans,a[1005][1005]; vec q[1005]; vecpi op[1005]; int f(int x,int y) {return (x-1)*m+y;} int Find(int x) {return (x^p[x] ? p[x] = Find(p[x]) : x);} int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for(int i = 1;i <= n;i++) { for(int j = 1;j <= m;j++) { cin >> a[i][j]; p[f(i,j)] = f(i,j); if(a[i][j] > 0) q[a[i][j]].pb(f(i,j)); } } for(int i = 1;i <= n;i++) { for(int j = 1;j <= m;j++) { if(i < n) op[max(abs(a[i][j]),abs(a[i+1][j]))].pb({f(i,j),f(i+1,j)}); if(j < m) op[max(abs(a[i][j]),abs(a[i][j+1]))].pb({f(i,j),f(i,j+1)}); } } for(int i = 1;i <= 1000;i++) { for(pi j : op[i]) { if(Find(j.x) == Find(j.y)) continue; hole[p[j.x]] |= hole[p[j.y]]; p[p[j.y]] = p[j.x]; } for(int j : q[i]) { if(!hole[Find(j)]) ans++, hole[p[j]] = 1; } } cout << ans; }
24.666667
72
0.555477
python-programmer1512
a4c0b3a4a0bd799c0bf2bcb12e8d575c70435f37
3,177
hpp
C++
compile_time_sha1.hpp
bb1950328/Compile-time-hash-functions
f0da28457eec122901c90849e544d488009de36a
[ "MIT" ]
26
2021-07-21T18:25:38.000Z
2021-07-29T18:25:06.000Z
compile_time_sha1.hpp
bb1950328/Compile-time-hash-functions
f0da28457eec122901c90849e544d488009de36a
[ "MIT" ]
2
2021-07-22T13:52:51.000Z
2021-07-28T08:21:47.000Z
compile_time_sha1.hpp
bb1950328/Compile-time-hash-functions
f0da28457eec122901c90849e544d488009de36a
[ "MIT" ]
1
2021-07-27T15:28:32.000Z
2021-07-27T15:28:32.000Z
#ifndef COMPILE_TIME_SHA1_H #define COMPILE_TIME_SHA1_H #include "crypto_hash.hpp" #define MASK 0xffffffff #define SHA1_HASH_SIZE 5 template<typename H=const char *> class SHA1 : public CryptoHash<SHA1_HASH_SIZE> { private: constexpr static uint32_t scheduled(CircularQueue<uint32_t,16> queue) { return leftrotate(queue[13]^queue[8]^queue[2]^queue[0],1); } constexpr static uint32_t k[4] = { 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 }; struct hash_parameters { const Array<uint32_t,SHA1_HASH_SIZE> arr; const uint32_t f_array[4][5]; template <typename ... Args> constexpr hash_parameters(Args ... args): arr{args...}, f_array{ {arr[2],arr[3],arr[1],arr[3],MASK}, {arr[2],arr[1],MASK,arr[3],MASK}, {arr[2],arr[1],arr[3],arr[1],arr[2]}, {arr[2],arr[1],MASK,arr[3],MASK} } {} constexpr hash_parameters() : hash_parameters((uint32_t) 0x67452301, (uint32_t) 0xefcdab89, (uint32_t) 0x98badcfe, (uint32_t) 0x10325476, (uint32_t) 0xC3D2E1F0) {} constexpr uint32_t operator [](int index) { return arr[index]; } }; using Hash_T = SHA1<H>; using PaddedValue_T = PaddedValue<H>; using Section_T = Section<H>; constexpr Array<uint32_t,SHA1_HASH_SIZE> create_hash(PaddedValue_T value, hash_parameters h, int block_index=0) { return block_index*64 == value.total_size ? h.arr : create_hash( value, hash_block(Section_T(value,block_index*16,scheduled),h,h,block_index*16), block_index+1); } // (a ^ b) & c ^ (d & e) constexpr uint32_t f(int i, struct hash_parameters h) const { return (h.f_array[i][0] ^ h.f_array[i][1]) & h.f_array[i][2] ^ (h.f_array[i][3] & h.f_array[i][4]); } constexpr uint32_t get_updated_h0(Section_T section, int i, struct hash_parameters h) const { return leftrotate(h[0],5) + f(i/20,h) + h[4] + k[i/20] + section[i % 16]; } constexpr hash_parameters hash_section(Section_T section, hash_parameters h, int start, int i=0) const { return i == 16 ? h : hash_section( section, { get_updated_h0(section,start+i,h), h[0], leftrotate(h[1],30), h[2], h[3] }, start, i+1); } constexpr hash_parameters hash_block(Section_T section, hash_parameters h , hash_parameters prev_h, int start_index, int i=0) const { return i == 80 ? (hash_parameters) { prev_h[0]+h[0], prev_h[1]+h[1], prev_h[2]+h[2], prev_h[3]+h[3], prev_h[4]+h[4] } : hash_block( Section_T(section,start_index+i+16,scheduled), hash_section(section,h,i), prev_h, start_index, i+16); } public: constexpr SHA1(H input) : CryptoHash<SHA1_HASH_SIZE>(create_hash(PaddedValue_T(input,true),{})) {} }; typedef SHA1<> SHA1String; template<typename T> constexpr uint32_t SHA1<T>::k[4]; #endif
30.257143
117
0.585143
bb1950328
a4d27e88f279061cc7a40d1d6ebd9b9c5eaf786f
1,352
cpp
C++
c++/solution393.cpp
imafish/leetcodetests
abee2c2d6c0b25a21ef4294bceb7e069b6547b85
[ "MIT" ]
null
null
null
c++/solution393.cpp
imafish/leetcodetests
abee2c2d6c0b25a21ef4294bceb7e069b6547b85
[ "MIT" ]
null
null
null
c++/solution393.cpp
imafish/leetcodetests
abee2c2d6c0b25a21ef4294bceb7e069b6547b85
[ "MIT" ]
null
null
null
#include "afx.h" using namespace std; class Solution { public: bool validUtf8(vector<int> &data) { /* state: 0: end of byte sequence; >0: in byte sequence, state = bytes remaining */ int state = 0; int result = true; for (auto &i : data) { if (state == 0) { if ((i & 0xF8) == 0xF0) { state = 3; } else if ((i & 0xF0) == 0xE0) { state = 2; } else if ((i & 0xE0) == 0xC0) { state = 1; } else if ((i & 0x80) == 0) { state = 0; } else { result = false; break; } } else if ((i & 0xC0) == 0x80) { state--; } else { result = false; break; } } if (state > 0) { result = false; } return result; } }; int main() { Solution s; vector<int> data = {197, 130, 1}; s.validUtf8(data); return 0; }
19.882353
53
0.293639
imafish
a4d62c89fa73afb1f5bf984935a6c1d5b4af7106
216
cpp
C++
PhoneCall/Source.cpp
TanyaZheleva/OOP
f44c67e5df69a91a77d35668f0709954546f210d
[ "MIT" ]
null
null
null
PhoneCall/Source.cpp
TanyaZheleva/OOP
f44c67e5df69a91a77d35668f0709954546f210d
[ "MIT" ]
null
null
null
PhoneCall/Source.cpp
TanyaZheleva/OOP
f44c67e5df69a91a77d35668f0709954546f210d
[ "MIT" ]
null
null
null
#include <iostream> #include "PhoneCall.h" int main() { PhoneCall p; p.setLength(50); p.getPrice(); p.setNumber(9002121004); std::cout << p.getPrice() << "\n"; std::cout << p.getNumber() << "\n"; return 0; }
15.428571
36
0.611111
TanyaZheleva
a4e4907df8f1e31eadadea20bc86b9db5e0c481d
2,880
cpp
C++
test/qupzilla-master/src/lib/webengine/webscrollbar.cpp
JamesMBallard/qmake-unity
cf5006a83e7fb1bbd173a9506771693a673d387f
[ "MIT" ]
16
2019-05-23T08:10:39.000Z
2021-12-21T11:20:37.000Z
test/qupzilla-master/src/lib/webengine/webscrollbar.cpp
JamesMBallard/qmake-unity
cf5006a83e7fb1bbd173a9506771693a673d387f
[ "MIT" ]
null
null
null
test/qupzilla-master/src/lib/webengine/webscrollbar.cpp
JamesMBallard/qmake-unity
cf5006a83e7fb1bbd173a9506771693a673d387f
[ "MIT" ]
2
2019-05-23T18:37:43.000Z
2021-08-24T21:29:40.000Z
/* ============================================================ * QupZilla - Qt web browser * Copyright (C) 2016-2017 David Rosca <[email protected]> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ============================================================ */ #include "webscrollbar.h" #include "webview.h" #include "webpage.h" #include <QPaintEvent> WebScrollBar::WebScrollBar(Qt::Orientation orientation, WebView *view) : QScrollBar(orientation) , m_view(view) { setFocusProxy(m_view); resize(sizeHint()); connect(this, &QScrollBar::valueChanged, this, &WebScrollBar::performScroll); connect(view, &WebView::focusChanged, this, [this]() { update(); }); } int WebScrollBar::thickness() const { return orientation() == Qt::Vertical ? width() : height(); } void WebScrollBar::updateValues(const QSize &viewport) { setMinimum(0); setParent(m_view->overlayWidget()); int newValue; m_blockScrolling = true; if (orientation() == Qt::Vertical) { setFixedHeight(m_view->height() - (m_view->height() - viewport.height()) * devicePixelRatioF()); move(m_view->width() - width(), 0); setPageStep(viewport.height()); setMaximum(qMax(0, m_view->page()->contentsSize().toSize().height() - viewport.height())); newValue = m_view->page()->scrollPosition().toPoint().y(); } else { setFixedWidth(m_view->width() - (m_view->width() - viewport.width()) * devicePixelRatioF()); move(0, m_view->height() - height()); setPageStep(viewport.width()); setMaximum(qMax(0, m_view->page()->contentsSize().toSize().width() - viewport.width())); newValue = m_view->page()->scrollPosition().toPoint().x(); } if (!isSliderDown()) { setValue(newValue); } m_blockScrolling = false; } void WebScrollBar::performScroll() { if (m_blockScrolling) { return; } QPointF pos = m_view->page()->scrollPosition(); if (orientation() == Qt::Vertical) { pos.setY(value()); } else { pos.setX(value()); } m_view->page()->setScrollPosition(pos); } void WebScrollBar::paintEvent(QPaintEvent *ev) { QPainter painter(this); painter.fillRect(ev->rect(), palette().background()); QScrollBar::paintEvent(ev); }
30.638298
104
0.632986
JamesMBallard
a4e65fccd156afa3f1979ebcfb7e5032c5337d12
1,755
cc
C++
cmd/cmd_wall.cc
jdb19937/makemore
61297dd322b3a9bb6cdfdd15e8886383cb490534
[ "MIT" ]
null
null
null
cmd/cmd_wall.cc
jdb19937/makemore
61297dd322b3a9bb6cdfdd15e8886383cb490534
[ "MIT" ]
null
null
null
cmd/cmd_wall.cc
jdb19937/makemore
61297dd322b3a9bb6cdfdd15e8886383cb490534
[ "MIT" ]
null
null
null
#include <system.hh> #include <process.hh> #include <server.hh> #include <agent.hh> #include <wall.hh> namespace makemore { using namespace makemore; using namespace std; extern "C" void mainmore(Process *); void mainmore( Process *process ) { Session *session = process->session; Server *server = process->system->server; Urb *urb = server->urb; if (process->args.size() != 1) { strvec outvec; outvec.resize(1); outvec[0] = "nope1"; process->write(outvec); return; } if (!session->who) { strvec outvec; outvec.resize(1); outvec[0] = "nope2"; process->write(outvec); return; } Urbite &ufrom = *session->who; Parson *from = ufrom.parson(); if (!from) { strvec outvec; outvec.resize(1); outvec[0] = "nope3"; process->write(outvec); return; } std::string fromnom = from->nom; from->acted = time(NULL); string txt = process->args[0]; txt += "\n"; if (txt.length() > 16384) { strvec outvec; outvec.resize(1); outvec[0] = "nope4"; process->write(outvec); return; } ufrom.make_home_dir(); string wallfn = urb->dir + "/home/" + ufrom.nom + "/wall.txt"; FILE *fp = fopen(wallfn.c_str(), "a"); if (!fp) { strvec outvec; outvec.resize(1); outvec[0] = "nope7"; process->write(outvec); return; } size_t ret = fwrite(txt.data(), 1, txt.length(), fp); if (ret != txt.length()) { strvec outvec; outvec.resize(1); outvec[0] = "nope8"; process->write(outvec); return; } fclose(fp); Wall wall; wall.load(wallfn); if (wall.posts.size() > 8) { wall.truncate(8); wall.save(wallfn); } strvec outvec; outvec.resize(1); outvec[0] = "ok"; process->write(outvec); } }
18.092784
64
0.589744
jdb19937
a4f19349fe7dc82703e99a7e577de29c5ccc593e
352
hpp
C++
src/stan/math/rev/mat/fun/stan_print.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
1
2019-09-06T15:53:17.000Z
2019-09-06T15:53:17.000Z
src/stan/math/rev/mat/fun/stan_print.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
8
2019-01-17T18:51:16.000Z
2019-01-17T18:51:39.000Z
src/stan/math/rev/mat/fun/stan_print.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
null
null
null
#ifndef STAN_MATH_REV_MAT_FUN_STAN_PRINT_HPP #define STAN_MATH_REV_MAT_FUN_STAN_PRINT_HPP #include <stan/math/rev/meta.hpp> #include <stan/math/rev/core.hpp> #include <ostream> namespace stan { namespace math { inline void stan_print(std::ostream* o, const var& x) { *o << x.val(); } } // namespace math } // namespace stan #endif
22
73
0.710227
alashworth
a4ffbecd8a6b47e6681d075332d09fc43f2204b2
1,016
cpp
C++
001-050/027/c++/code.cpp
Shivam010/daily-coding-problem
679376a7b0f5f9bccdd261a1a660e951a1142174
[ "MIT" ]
9
2020-09-13T12:48:35.000Z
2022-03-02T06:25:06.000Z
001-050/027/c++/code.cpp
Shivam010/daily-coding-problem
679376a7b0f5f9bccdd261a1a660e951a1142174
[ "MIT" ]
9
2020-09-11T21:19:27.000Z
2020-09-14T20:18:02.000Z
001-050/027/c++/code.cpp
Shivam010/daily-coding-problem
679376a7b0f5f9bccdd261a1a660e951a1142174
[ "MIT" ]
1
2020-09-11T22:03:29.000Z
2020-09-11T22:03:29.000Z
// Copyright (c) 2020 Shivam Rathore. All rights reserved. // Use of this source code is governed by MIT License that // can be found in the LICENSE file. // This file contains Solution to Challenge #027, run using // g++ 001-050/027/c++/code.cpp -o bin/out // ./bin/out < 001-050/027/c++/in.txt > 001-050/027/c++/out.txt #include <bits/stdc++.h> using namespace std; #define ll long long void solve() { string brk; cin >> brk; int n = brk.size(), top = 0; string stk(n + 1, 0); for (int i = 0; i < n; i++) { if (stk[top] == brk[i]) top--; else if (brk[i] == '(') stk[++top] = ')'; else if (brk[i] == '[') stk[++top] = ']'; else if (brk[i] == '{') stk[++top] = '}'; else { top = -1; break; } } if (top == 0) cout << "true\n"; else cout << "false\n"; return; } int main() { int t; cin >> t; while (t--) { solve(); } }
22.577778
63
0.463583
Shivam010
3503ad6ded863d307e6a0c7b412333db0a909996
26,120
cc
C++
src/object/datatype/bytes.cc
ArgonLang/Argon
462d3d8721acd5131894bcbfa0214b0cbcffdf66
[ "Apache-2.0" ]
13
2021-06-24T17:50:20.000Z
2022-03-13T23:00:16.000Z
src/object/datatype/bytes.cc
ArgonLang/Argon
462d3d8721acd5131894bcbfa0214b0cbcffdf66
[ "Apache-2.0" ]
null
null
null
src/object/datatype/bytes.cc
ArgonLang/Argon
462d3d8721acd5131894bcbfa0214b0cbcffdf66
[ "Apache-2.0" ]
1
2022-03-31T22:58:42.000Z
2022-03-31T22:58:42.000Z
// This source file is part of the Argon project. // // Licensed under the Apache License v2.0 #include <memory/memory.h> #include <vm/runtime.h> #include "bool.h" #include "bounds.h" #include "error.h" #include "integer.h" #include "iterator.h" #include "hash_magic.h" #include "bytes.h" #define BUFFER_GET(bs) (bs->view.buffer) #define BUFFER_LEN(bs) (bs->view.len) #define BUFFER_MAXLEN(left, right) (BUFFER_LEN(left) > BUFFER_LEN(right) ? BUFFER_LEN(right) : BUFFER_LEN(self)) using namespace argon::memory; using namespace argon::object; bool bytes_get_buffer(Bytes *self, ArBuffer *buffer, ArBufferFlags flags) { return BufferSimpleFill(self, buffer, flags, BUFFER_GET(self), BUFFER_LEN(self), !self->frozen); } const BufferSlots bytes_buffer = { (BufferGetFn) bytes_get_buffer, nullptr }; ArSize bytes_len(Bytes *self) { return BUFFER_LEN(self); } ArObject *bytes_get_item(Bytes *self, ArSSize index) { if (index < 0) index = BUFFER_LEN(self) + index; if (index < BUFFER_LEN(self)) return IntegerNew(BUFFER_GET(self)[index]); return ErrorFormat(type_overflow_error_, "bytes index out of range (len: %d, idx: %d)", BUFFER_LEN(self), index); } bool bytes_set_item(Bytes *self, ArObject *obj, ArSSize index) { Bytes *other; ArSize value; if (self->frozen) { ErrorFormat(type_type_error_, "unable to set item to frozen bytes object"); return false; } if (AR_TYPEOF(obj, type_bytes_)) { other = (Bytes *) obj; if (BUFFER_LEN(other) > 1) { ErrorFormat(type_value_error_, "expected bytes of length 1 not %d", BUFFER_LEN(other)); return false; } value = BUFFER_GET(other)[0]; } else if (AR_TYPEOF(obj, type_integer_)) value = ((Integer *) obj)->integer; else { ErrorFormat(type_type_error_, "expected integer or bytes, found '%s'", AR_TYPE_NAME(obj)); return false; } if (value < 0 || value > 255) { ErrorFormat(type_value_error_, "byte must be in range(0, 255)"); return false; } if (index < 0) index = BUFFER_LEN(self) + index; if (index < BUFFER_LEN(self)) { BUFFER_GET(self)[index] = value; return true; } ErrorFormat(type_overflow_error_, "bytes index out of range (len: %d, idx: %d)", BUFFER_LEN(self), index); return false; } ArObject *bytes_get_slice(Bytes *self, Bounds *bounds) { Bytes *ret; ArSSize slice_len; ArSSize start; ArSSize stop; ArSSize step; slice_len = BoundsIndex(bounds, BUFFER_LEN(self), &start, &stop, &step); if (step >= 0) { ret = BytesNew(self, start, slice_len); } else { if ((ret = BytesNew(slice_len, true, false, self->frozen)) == nullptr) return nullptr; for (ArSize i = 0; stop < start; start += step) BUFFER_GET(ret)[i++] = BUFFER_GET(self)[start]; } return ret; } const SequenceSlots bytes_sequence = { (SizeTUnaryOp) bytes_len, (BinaryOpArSize) bytes_get_item, (BoolTernOpArSize) bytes_set_item, (BinaryOp) bytes_get_slice, nullptr }; ARGON_FUNCTION5(bytes_, new, "Creates bytes object." "" "The src parameter is optional, in case of call without src parameter an empty zero-length" "bytes object will be constructed." "" "- Parameter [src]: integer or bytes-like object." "- Returns: construct a new bytes object.", 0, true) { IntegerUnderlying size = 0; if (!VariadicCheckPositional("bytes::new", count, 0, 1)) return nullptr; if (count == 1) { if (!AR_TYPEOF(*argv, type_integer_)) return BytesNew(*argv); size = ((Integer *) *argv)->integer; } return BytesNew(size, true, true, false); } ARGON_METHOD5(bytes_, count, "Returns the number of times a specified value occurs in bytes." "" "- Parameter sub: subsequence to search." "- Returns: number of times a specified value appears in bytes.", 1, false) { ArBuffer buffer{}; Bytes *bytes; ArSSize n; bytes = (Bytes *) self; if (!BufferGet(argv[0], &buffer, ArBufferFlags::READ)) return nullptr; n = support::Count(BUFFER_GET(bytes), BUFFER_LEN(bytes), buffer.buffer, buffer.len, -1); BufferRelease(&buffer); return IntegerNew(n); } ARGON_METHOD5(bytes_, clone, "Returns the number of times a specified value occurs in bytes." "" "- Parameter sub: subsequence to search." "- Returns: number of times a specified value appears in the string.", 0, false) { return BytesNew(self); } ARGON_METHOD5(bytes_, endswith, "Returns true if bytes ends with the specified value." "" "- Parameter suffix: the value to check if the bytes ends with." "- Returns: true if bytes ends with the specified value, false otherwise." "" "# SEE" "- startswith: Returns true if bytes starts with the specified value.", 1, false) { ArBuffer buffer{}; Bytes *bytes; int res; bytes = (Bytes *) self; if (!BufferGet(argv[0], &buffer, ArBufferFlags::READ)) return nullptr; res = BUFFER_LEN(bytes) > buffer.len ? buffer.len : BUFFER_LEN(bytes); res = MemoryCompare(BUFFER_GET(bytes) + (BUFFER_LEN(bytes) - res), buffer.buffer, res); BufferRelease(&buffer); return BoolToArBool(res == 0); } ARGON_METHOD5(bytes_, find, "Searches bytes for a specified value and returns the position of where it was found." "" "- Parameter sub: the value to search for." "- Returns: index of the first position, -1 otherwise." "" "# SEE" "- rfind: Same as find, but returns the index of the last position.", 1, false) { ArBuffer buffer{}; Bytes *bytes; ArSSize pos; bytes = (Bytes *) self; if (!BufferGet(argv[0], &buffer, ArBufferFlags::READ)) return nullptr; pos = support::Find(BUFFER_GET(bytes), BUFFER_LEN(bytes), buffer.buffer, buffer.len, false); return IntegerNew(pos); } ARGON_METHOD5(bytes_, freeze, "Freeze bytes object." "" "If bytes is already frozen, the same object will be returned, otherwise a new frozen bytes(view) will be returned." "- Returns: frozen bytes object.", 0, false) { auto *bytes = (Bytes *) self; return BytesFreeze(bytes); } ARGON_METHOD5(bytes_, hex, "Convert bytes to str of hexadecimal numbers." "" "- Returns: new str object.", 0, false) { StringBuilder builder{}; Bytes *bytes; bytes = (Bytes *) self; if (StringBuilderWriteHex(&builder, BUFFER_GET(bytes), BUFFER_LEN(bytes)) < 0) { StringBuilderClean(&builder); return nullptr; } return StringBuilderFinish(&builder); } ARGON_METHOD5(bytes_, isalnum, "Check if all characters in the bytes are alphanumeric (either alphabets or numbers)." "" "- Returns: true if all characters are alphanumeric, false otherwise." "" "# SEE" "- isalpha: Check if all characters in the bytes are alphabets." "- isascii: Check if all characters in the bytes are ascii." "- isdigit: Check if all characters in the bytes are digits.", 0, false) { auto *bytes = (Bytes *) self; int chr; for (ArSize i = 0; i < BUFFER_LEN(bytes); i++) { chr = BUFFER_GET(bytes)[i]; if ((chr < 'A' || chr > 'Z') && (chr < 'a' || chr > 'z') && (chr < '0' || chr > '9')) return BoolToArBool(false); } return BoolToArBool(true); } ARGON_METHOD5(bytes_, isalpha, "Check if all characters in the bytes are alphabets." "" "- Returns: true if all characters are alphabets, false otherwise." "" "# SEE" "- isalnum: Check if all characters in the bytes are alphanumeric (either alphabets or numbers)." "- isascii: Check if all characters in the bytes are ascii." "- isdigit: Check if all characters in the bytes are digits.", 0, false) { auto *bytes = (Bytes *) self; int chr; for (ArSize i = 0; i < BUFFER_LEN(bytes); i++) { chr = BUFFER_GET(bytes)[i]; if ((chr < 'A' || chr > 'Z') && (chr < 'a' || chr > 'z')) return BoolToArBool(false); } return BoolToArBool(true); } ARGON_METHOD5(bytes_, isascii, "Check if all characters in the bytes are ascii." "" "- Returns: true if all characters are ascii, false otherwise." "" "# SEE" "- isalnum: Check if all characters in the bytes are alphanumeric (either alphabets or numbers)." "- isalpha: Check if all characters in the bytes are alphabets." "- isdigit: Check if all characters in the bytes are digits.", 0, false) { auto *bytes = (Bytes *) self; int chr; for (ArSize i = 0; i < BUFFER_LEN(bytes); i++) { chr = BUFFER_GET(bytes)[i]; if (chr > 0x7F) return BoolToArBool(false); } return BoolToArBool(true); } ARGON_METHOD5(bytes_, isdigit, "Check if all characters in the bytes are digits." "" "- Returns: true if all characters are digits, false otherwise." "" "# SEE" "- isalnum: Check if all characters in the bytes are alphanumeric (either alphabets or numbers)." "- isalpha: Check if all characters in the bytes are alphabets." "- isascii: Check if all characters in the bytes are ascii.", 0, false) { auto *bytes = (Bytes *) self; int chr; for (ArSize i = 0; i < BUFFER_LEN(bytes); i++) { chr = BUFFER_GET(bytes)[i]; if (chr < '0' || chr > '9') return BoolToArBool(false); } return BoolToArBool(true); } ARGON_METHOD5(bytes_, isfrozen, "Check if this bytes object is frozen." "" "- Returns: true if it is frozen, false otherwise.", 0, false) { return BoolToArBool(((Bytes *) self)->frozen); } ARGON_METHOD5(bytes_, join, "Joins the elements of an iterable to the end of the bytes." "" "- Parameter iterable: any iterable object where all the returned values are bytes-like object." "- Returns: new bytes where all items in an iterable are joined into one bytes.", 1, false) { ArBuffer buffer{}; ArObject *item = nullptr; ArObject *iter; Bytes *bytes; Bytes *ret; ArSize idx = 0; ArSize len; bytes = (Bytes *) self; if ((iter = IteratorGet(argv[0])) == nullptr) return nullptr; if ((ret = BytesNew()) == nullptr) goto error; while ((item = IteratorNext(iter)) != nullptr) { if (!BufferGet(item, &buffer, ArBufferFlags::READ)) goto error; len = buffer.len; if (idx > 0) len += bytes->view.len; if (!BufferViewEnlarge(&ret->view, len)) { BufferRelease(&buffer); goto error; } if (idx > 0) { MemoryCopy(BUFFER_GET(ret) + BUFFER_LEN(ret), BUFFER_GET(bytes), BUFFER_LEN(bytes)); ret->view.len += BUFFER_LEN(bytes); } MemoryCopy(BUFFER_GET(ret) + BUFFER_LEN(ret), buffer.buffer, buffer.len); ret->view.len += buffer.len; BufferRelease(&buffer); Release(item); idx++; } Release(iter); return ret; error: Release(item); Release(iter); Release(ret); return nullptr; } ARGON_METHOD5(bytes_, rfind, "Searches bytes for a specified value and returns the position of where it was found." "" "- Parameter sub: the value to search for." "- Returns: index of the first position, -1 otherwise." "" "# SEE" "- find: Same as find, but returns the index of the last position.", 1, false) { ArBuffer buffer{}; Bytes *bytes; ArSSize pos; bytes = (Bytes *) self; if (!BufferGet(argv[0], &buffer, ArBufferFlags::READ)) return nullptr; pos = support::Find(BUFFER_GET(bytes), BUFFER_LEN(bytes), buffer.buffer, buffer.len, true); return IntegerNew(pos); } ARGON_METHOD5(bytes_, rmpostfix, "Returns new bytes without postfix(if present), otherwise return this object." "" "- Parameter postfix: postfix to looking for." "- Returns: new bytes without indicated postfix." "" "# SEE" "- rmprefix: Returns new bytes without prefix(if present), otherwise return this object.", 1, false) { ArBuffer buffer{}; auto *bytes = (Bytes *) self; int len; int compare; if (!BufferGet(argv[0], &buffer, ArBufferFlags::READ)) return nullptr; len = BUFFER_LEN(bytes) > buffer.len ? buffer.len : BUFFER_LEN(bytes); compare = MemoryCompare(BUFFER_GET(bytes) + (BUFFER_LEN(bytes) - len), buffer.buffer, len); BufferRelease(&buffer); if (compare == 0) return BytesNew(bytes, 0, BUFFER_LEN(bytes) - len); return IncRef(bytes); } ARGON_METHOD5(bytes_, rmprefix, "Returns new bytes without prefix(if present), otherwise return this object." "" "- Parameter prefix: prefix to looking for." "- Returns: new bytes without indicated prefix." "" "# SEE" "- rmpostfix: Returns new bytes without postfix(if present), otherwise return this object.", 1, false) { ArBuffer buffer{}; auto *bytes = (Bytes *) self; int len; int compare; if (!BufferGet(argv[0], &buffer, ArBufferFlags::READ)) return nullptr; len = BUFFER_LEN(bytes) > buffer.len ? buffer.len : BUFFER_LEN(bytes); compare = MemoryCompare(BUFFER_GET(bytes), buffer.buffer, len); BufferRelease(&buffer); if (compare == 0) return BytesNew(bytes, len, BUFFER_LEN(bytes) - len); return IncRef(bytes); } ARGON_METHOD5(bytes_, split, "Splits bytes at the specified separator, and returns a list." "" "- Parameters:" " - separator: specifies the separator to use when splitting bytes." " - maxsplit: specifies how many splits to do." "- Returns: new list of bytes.", 2, false) { ArBuffer buffer{}; Bytes *bytes; ArObject *ret; bytes = (Bytes *) self; if (!AR_TYPEOF(argv[1], type_integer_)) return ErrorFormat(type_type_error_, "bytes::split() expected integer not '%s'", AR_TYPE_NAME(argv[1])); if (!BufferGet(argv[0], &buffer, ArBufferFlags::READ)) return nullptr; ret = BytesSplit(bytes, buffer.buffer, buffer.len, ((Integer *) argv[1])->integer); BufferRelease(&buffer); return ret; } ARGON_METHOD5(bytes_, startswith, "Returns true if bytes starts with the specified value." "" "- Parameter prefix: the value to check if the bytes starts with." "- Returns: true if bytes starts with the specified value, false otherwise." "" "# SEE" "- endswith: Returns true if bytes ends with the specified value.", 1, false) { ArBuffer buffer{}; Bytes *bytes; int res; bytes = (Bytes *) self; if (!BufferGet(argv[0], &buffer, ArBufferFlags::READ)) return nullptr; res = BUFFER_LEN(bytes) > buffer.len ? buffer.len : BUFFER_LEN(bytes); res = MemoryCompare(BUFFER_GET(bytes), buffer.buffer, res); BufferRelease(&buffer); return BoolToArBool(res == 0); } ARGON_METHOD5(bytes_, str, "Convert bytes to str object." "" "- Returns: new str object.", 0, false) { auto *bytes = (Bytes *) self; return StringNew((const char *) BUFFER_GET(bytes), BUFFER_LEN(bytes)); } const NativeFunc bytes_methods[] = { bytes_count_, bytes_endswith_, bytes_find_, bytes_freeze_, bytes_hex_, bytes_isalnum_, bytes_isalpha_, bytes_isascii_, bytes_isdigit_, bytes_isfrozen_, bytes_join_, bytes_new_, bytes_rfind_, bytes_rmpostfix_, bytes_rmprefix_, bytes_split_, bytes_startswith_, bytes_str_, ARGON_METHOD_SENTINEL }; const ObjectSlots bytes_obj = { bytes_methods, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, -1 }; ArObject *bytes_add(Bytes *self, ArObject *other) { ArBuffer buffer = {}; Bytes *ret; if (!IsBufferable(other)) return nullptr; if (!BufferGet(other, &buffer, ArBufferFlags::READ)) return nullptr; if ((ret = BytesNew(BUFFER_LEN(self) + buffer.len, true, false, self->frozen)) == nullptr) { BufferRelease(&buffer); return nullptr; } MemoryCopy(BUFFER_GET(ret), BUFFER_GET(self), BUFFER_LEN(self)); MemoryCopy(BUFFER_GET(ret) + BUFFER_LEN(self), buffer.buffer, buffer.len); BufferRelease(&buffer); return ret; } ArObject *bytes_mul(ArObject *left, ArObject *right) { auto *bytes = (Bytes *) left; auto *num = (Integer *) right; Bytes *ret = nullptr; ArSize len; if (!AR_TYPEOF(bytes, type_bytes_)) { bytes = (Bytes *) right; num = (Integer *) left; } if (AR_TYPEOF(num, type_integer_)) { len = BUFFER_LEN(bytes) * num->integer; if ((ret = BytesNew(len, true, false, bytes->frozen)) != nullptr) { for (ArSize i = 0; i < num->integer; i++) MemoryCopy(BUFFER_GET(ret) + BUFFER_LEN(bytes) * i, BUFFER_GET(bytes), BUFFER_LEN(bytes)); } } return ret; } Bytes *ShiftBytes(Bytes *bytes, ArSSize pos) { auto ret = BytesNew(BUFFER_LEN(bytes), true, false, bytes->frozen); if (ret != nullptr) { for (ArSize i = 0; i < BUFFER_LEN(bytes); i++) ret->view.buffer[((BUFFER_LEN(bytes) + pos) + i) % BUFFER_LEN(bytes)] = BUFFER_GET(bytes)[i]; } return ret; } ArObject *bytes_shl(ArObject *left, ArObject *right) { if (AR_TYPEOF(left, type_bytes_) && AR_TYPEOF(right, type_integer_)) return ShiftBytes((Bytes *) left, -((Integer *) right)->integer); return nullptr; } ArObject *bytes_shr(ArObject *left, ArObject *right) { if (AR_TYPEOF(left, type_bytes_) && AR_TYPEOF(right, type_integer_)) return ShiftBytes((Bytes *) left, ((Integer *) right)->integer); return nullptr; } ArObject *bytes_iadd(Bytes *self, ArObject *other) { ArBuffer buffer = {}; Bytes *ret = self; if (!IsBufferable(other)) return nullptr; if (!BufferGet(other, &buffer, ArBufferFlags::READ)) return nullptr; if (self->frozen) { if ((ret = BytesNew(BUFFER_LEN(self) + buffer.len, true, false, true)) == nullptr) { BufferRelease(&buffer); return nullptr; } MemoryCopy(BUFFER_GET(ret), BUFFER_GET(self), BUFFER_LEN(self)); MemoryCopy(BUFFER_GET(ret) + BUFFER_LEN(self), buffer.buffer, buffer.len); BufferRelease(&buffer); return ret; } if (!BufferViewEnlarge(&self->view, buffer.len)) { BufferRelease(&buffer); return nullptr; } MemoryCopy(BUFFER_GET(ret) + BUFFER_LEN(ret), buffer.buffer, buffer.len); ret->view.len += buffer.len; BufferRelease(&buffer); return IncRef(self); } OpSlots bytes_ops{ (BinaryOp) bytes_add, nullptr, bytes_mul, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, bytes_shl, bytes_shr, nullptr, (BinaryOp) bytes_iadd, nullptr, nullptr, nullptr, nullptr, nullptr }; ArObject *bytes_str(Bytes *self) { StringBuilder sb = {}; // Calculate length of string if (!StringBuilderResizeAscii(&sb, BUFFER_GET(self), BUFFER_LEN(self), 3)) // +3 b"" return nullptr; // Build string StringBuilderWrite(&sb, (const unsigned char *) "b\"", 2);; StringBuilderWriteAscii(&sb, BUFFER_GET(self), BUFFER_LEN(self)); StringBuilderWrite(&sb, (const unsigned char *) "\"", 1); return StringBuilderFinish(&sb); } ArObject *bytes_iter_get(Bytes *self) { return IteratorNew(self, false); } ArObject *bytes_iter_rget(Bytes *self) { return IteratorNew(self, true); } ArObject *bytes_compare(Bytes *self, ArObject *other, CompareMode mode) { auto *o = (Bytes *) other; int left = 0; int right = 0; int res; if (!AR_SAME_TYPE(self, other)) return nullptr; if (self != other) { res = MemoryCompare(BUFFER_GET(self), BUFFER_GET(o), BUFFER_MAXLEN(self, o)); if (res < 0) left = -1; else if (res > 0) right = -1; else if (BUFFER_LEN(self) < BUFFER_LEN(o)) left = -1; else if (BUFFER_LEN(self) > BUFFER_LEN(o)) right = -1; } ARGON_RICH_COMPARE_CASES(left, right, mode); } ArSize bytes_hash(Bytes *self) { if (!self->frozen) { ErrorFormat(type_unhashable_error_, "unable to hash unfrozen bytes object"); return 0; } if (self->hash == 0) self->hash = HashBytes(BUFFER_GET(self), BUFFER_LEN(self)); return self->hash; } bool bytes_is_true(Bytes *self) { return BUFFER_LEN(self) > 0; } void bytes_cleanup(Bytes *self) { BufferViewDetach(&self->view); } const TypeInfo BytesType = { TYPEINFO_STATIC_INIT, "bytes", nullptr, sizeof(Bytes), TypeInfoFlags::BASE, nullptr, (VoidUnaryOp) bytes_cleanup, nullptr, (CompareOp) bytes_compare, (BoolUnaryOp) bytes_is_true, (SizeTUnaryOp) bytes_hash, (UnaryOp) bytes_str, (UnaryOp) bytes_iter_get, (UnaryOp) bytes_iter_rget, &bytes_buffer, nullptr, nullptr, nullptr, &bytes_obj, &bytes_sequence, &bytes_ops, nullptr, nullptr }; const TypeInfo *argon::object::type_bytes_ = &BytesType; ArObject *argon::object::BytesSplit(Bytes *bytes, unsigned char *pattern, ArSize plen, ArSSize maxsplit) { Bytes *tmp; List *ret; ArSize idx = 0; ArSSize end; ArSSize counter = 0; if ((ret = ListNew()) == nullptr) return nullptr; if (maxsplit != 0) { while ((end = support::Find(BUFFER_GET(bytes) + idx, BUFFER_LEN(bytes) - idx, pattern, plen)) >= 0) { if ((tmp = BytesNew(bytes, idx, end - idx)) == nullptr) goto error; idx += end + plen; if (!ListAppend(ret, tmp)) goto error; Release(tmp); if (maxsplit > -1 && ++counter >= maxsplit) break; } } if (BUFFER_LEN(bytes) - idx > 0) { if ((tmp = BytesNew(bytes, idx, BUFFER_LEN(bytes) - idx)) == nullptr) goto error; if (!ListAppend(ret, tmp)) goto error; Release(tmp); } return ret; error: Release(tmp); Release(ret); return nullptr; } Bytes *argon::object::BytesNew(ArObject *object) { ArBuffer buffer = {}; Bytes *bs; if (!IsBufferable(object)) return nullptr; if (!BufferGet(object, &buffer, ArBufferFlags::READ)) return nullptr; if ((bs = BytesNew(buffer.len, true, false, false)) != nullptr) MemoryCopy(BUFFER_GET(bs), buffer.buffer, buffer.len); BufferRelease(&buffer); return bs; } Bytes *argon::object::BytesNew(Bytes *stream, ArSize start, ArSize len) { auto bs = ArObjectNew<Bytes>(RCType::INLINE, type_bytes_); if (bs != nullptr) { BufferViewInit(&bs->view, &stream->view, start, len); bs->hash = 0; bs->frozen = stream->frozen; } return bs; } Bytes *argon::object::BytesNew(ArSize cap, bool same_len, bool fill_zero, bool frozen) { auto bs = ArObjectNew<Bytes>(RCType::INLINE, type_bytes_); if (bs != nullptr) { if (!BufferViewInit(&bs->view, cap)) { Release(bs); return nullptr; } if (same_len) bs->view.len = cap; if (fill_zero) MemoryZero(BUFFER_GET(bs), cap); bs->hash = 0; bs->frozen = frozen; } return bs; } Bytes *argon::object::BytesNew(unsigned char *buffer, ArSize len, bool frozen) { auto *bytes = BytesNew(len, true, false, frozen); if (bytes != nullptr) MemoryCopy(BUFFER_GET(bytes), buffer, len); return bytes; } Bytes *argon::object::BytesNewHoldBuffer(unsigned char *buffer, ArSize len, ArSize cap, bool frozen) { auto bs = ArObjectNew<Bytes>(RCType::INLINE, type_bytes_); if (bs != nullptr) { if (!BufferViewHoldBuffer(&bs->view, buffer, len, cap)) { Release(bs); return nullptr; } bs->hash = 0; bs->frozen = frozen; } return bs; } Bytes *argon::object::BytesFreeze(Bytes *stream) { Bytes *ret; if (stream->frozen) return IncRef(stream); if ((ret = BytesNew(stream, 0, BUFFER_LEN(stream))) == nullptr) return nullptr; ret->frozen = true; Hash(ret); return ret; } #undef BUFFER_GET #undef BUFFER_LEN #undef BUFFER_MAXLEN
27.728238
130
0.580283
ArgonLang
350513dd2d806fa3ce14db73d79f36710bdbc344
7,976
cpp
C++
Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Message/FOSSASAT2/FOSSASAT2_Statistics.cpp
FOSSASystems/FOSSA-GroundStationControlPanel
af83a09619239abe9fca09e073ab41c68bfd4822
[ "MIT" ]
2
2021-11-07T16:26:46.000Z
2022-03-20T10:14:41.000Z
Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Message/FOSSASAT2/FOSSASAT2_Statistics.cpp
FOSSASystems/FOSSA-GroundStationControlPanel
af83a09619239abe9fca09e073ab41c68bfd4822
[ "MIT" ]
18
2020-08-28T13:38:36.000Z
2020-09-30T11:08:42.000Z
Desktop/FOSSA-GroundStationControlPanel/FOSSAGSCP/3rdparty/FOSSACommsInterpreter/src/Message/FOSSASAT2/FOSSASAT2_Statistics.cpp
FOSSASystems/FOSSA-GroundStationControlPanel
af83a09619239abe9fca09e073ab41c68bfd4822
[ "MIT" ]
2
2020-07-29T21:19:28.000Z
2021-08-16T03:58:14.000Z
// MIT LICENSE // // Copyright (c) 2020 FOSSA Systems // // 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 "FOSSASAT2_Statistics.h" FOSSASAT2::Messages::Statistics::Statistics(Frame &frame) { uint8_t flagByte = frame.GetByteAt(0); this->temperaturesIncluded = flagByte & 0x01; this->currentsIncluded = (flagByte >> 1) & 0x01; this->voltagesIncluded = (flagByte >> 2) & 0x01; this->lightSensorsIncluded = (flagByte >> 3) & 0x01; this->imuIncluded = (flagByte >> 4) & 0x01; if (this->temperaturesIncluded) { for (int i = 0; i < 15; i++) { int startIndex = 1 + (i*2); uint8_t lsb = frame.GetByteAt(startIndex); uint8_t msb = frame.GetByteAt(startIndex + 1); int16_t temperature = lsb | (msb << 8); float temperaturesRealValue = temperature * 0.01f; this->temperatures.push_back(temperaturesRealValue); } } if (this->currentsIncluded) { for (int i = 0; i < 18; i++) { int startIndex = 31 + (i*2); uint8_t lsb = frame.GetByteAt(startIndex); uint8_t msb = frame.GetByteAt(startIndex + 1); int16_t current = lsb | (msb << 8); float currentsValue = current * 10; this->currents.push_back(currentsValue); } } if (this->voltagesIncluded) { for (int i = 0; i < 18; i++) { int startIndex = 67 + i; float voltage = frame.GetByteAt(startIndex) * 20; this->voltages.push_back(voltage); } } if (this->lightSensorsIncluded) { for (int i = 0; i < 6; i++) { int startIndex = 85 + (i * 4); uint8_t lsb = frame.GetByteAt(startIndex); uint8_t a = frame.GetByteAt(startIndex + 1); uint8_t b = frame.GetByteAt(startIndex + 2); uint8_t msb = frame.GetByteAt(startIndex + 3); uint32_t bytesVal = lsb; bytesVal |= a << 8; bytesVal |= b << 16; bytesVal |= msb << 24; float lightSensorValue = 0.0f; memcpy(&lightSensorValue, &bytesVal, 4); this->currents.push_back(lightSensorValue); } } if (this->imuIncluded) { for (int i = 0; i < 16; i++) { int startIndex = 109 + (i * 4); uint8_t lsb = frame.GetByteAt(startIndex); uint8_t a = frame.GetByteAt(startIndex + 1); uint8_t b = frame.GetByteAt(startIndex + 2); uint8_t msb = frame.GetByteAt(startIndex + 3); uint32_t bytesVal = lsb; bytesVal |= a << 8; bytesVal |= b << 16; bytesVal |= msb << 24; float imuValue = 0.0f; memcpy(&imuValue, &bytesVal, 4); this->imus.push_back(imuValue); } } } std::string FOSSASAT2::Messages::Statistics::ToString() { std::stringstream ss; ss << "Satellite Version: FOSSASAT2" << std::endl; ss << "Message Name: Statistics" << std::endl; ss << "Temperatures included: " << this->temperaturesIncluded << std::endl; ss << "Currents included: " << this->currentsIncluded << std::endl; ss << "Voltages included: " << this->voltagesIncluded << std::endl; ss << "Light sensors included: " << this->lightSensorsIncluded << std::endl; ss << "IMU included: " << this->imuIncluded << std::endl; ss << "Temperatures: " << std::endl; for (float temp : this->temperatures) { ss << " " << temp << " deg. C" << std::endl; } ss << "Currents: " << std::endl; for (float current : this->currents) { ss << " " << current << " uA" << std::endl; } ss << "Voltages: " << std::endl; for (float voltage : this->voltages) { ss << " " << voltage << " mV" << std::endl; } ss << "Light sensors: " << std::endl; for (float lightSensor : this->lightSensors) { ss << " " << lightSensor << std::endl; } ss << "IMU: " << std::endl; for (float imu : this->imus) { ss << " " << imu << std::endl; } std::string out; ss >> out; return out; } std::string FOSSASAT2::Messages::Statistics::ToJSON() { std::stringstream ss; ss << "{" << std::endl; ss << "\"Satellite Version\": \"FOSSASAT2\"," << std::endl; ss << "\"Message Name\": \"Statistics\"," << std::endl; ss << "\"Temperatures included\": " << this->temperaturesIncluded << std::endl; ss << "\"Currents included\": " << this->currentsIncluded << std::endl; ss << "\"Voltages included\": " << this->voltagesIncluded << std::endl; ss << "\"Light sensors included\": " << this->lightSensorsIncluded << std::endl; ss << "\"IMU included\": " << this->imuIncluded << std::endl; ss << "\"Temperatures\": " << std::endl; ss << "{" << std::endl; for (float temp : this->temperatures) { ss << temp << "," << std::endl; } ss << "\"Currents\": " << std::endl; ss << "{" << std::endl; for (float current : this->currents) { ss << " \"" << current << "\"," << std::endl; } ss << "}" << std::endl; ss << "\"Voltages\": " << std::endl; ss << "{" << std::endl; for (float voltage : this->voltages) { ss << " \"" << voltage << "\"," << std::endl; } ss << "}" << std::endl; ss << "\"Light sensors\": " << std::endl; ss << "{" << std::endl; for (float lightSensor : this->lightSensors) { ss << " \"" << lightSensor << "\"," << std::endl; } ss << "}" << std::endl; ss << "\"IMU\": " << std::endl; ss << "{" << std::endl; for (float imu : this->imus) { ss << " \"" << imu << "\"," << std::endl; } ss << "}" << std::endl; ss << "}" << std::endl; std::string out; ss >> out; return out; } bool FOSSASAT2::Messages::Statistics::IsTemperaturesIncluded() const { return temperaturesIncluded; } bool FOSSASAT2::Messages::Statistics::IsCurrentsIncluded() const { return currentsIncluded; } bool FOSSASAT2::Messages::Statistics::IsVoltagesIncluded() const { return voltagesIncluded; } bool FOSSASAT2::Messages::Statistics::IsLightSensorsIncluded() const { return lightSensorsIncluded; } bool FOSSASAT2::Messages::Statistics::IsImuIncluded() const { return imuIncluded; } const std::vector<float> &FOSSASAT2::Messages::Statistics::GetTemperatures() const { return temperatures; } const std::vector<float> &FOSSASAT2::Messages::Statistics::GetCurrents() const { return currents; } const std::vector<float> &FOSSASAT2::Messages::Statistics::GetVoltages() const { return voltages; } const std::vector<float> &FOSSASAT2::Messages::Statistics::GetLightSensors() const { return lightSensors; } const std::vector<float> &FOSSASAT2::Messages::Statistics::GetImus() const { return imus; }
30.676923
84
0.572342
FOSSASystems
35062bf4f84f1a2eee4898af77ad9d1364a24cca
808
cpp
C++
CD6/The K Weakest Rows in a Matrix.cpp
shtanriverdi/CS487-Introduction-to-Competitive-Programming-Progress
0d7a4fa4346ee08d9b2b2f628c3ffab7f3f81166
[ "MIT" ]
4
2019-12-12T19:59:50.000Z
2020-01-20T15:44:44.000Z
CD6/The K Weakest Rows in a Matrix.cpp
shtanriverdi/CS487-Introduction-to-Competitive-Programming-Progress
0d7a4fa4346ee08d9b2b2f628c3ffab7f3f81166
[ "MIT" ]
null
null
null
CD6/The K Weakest Rows in a Matrix.cpp
shtanriverdi/CS487-Introduction-to-Competitive-Programming-Progress
0d7a4fa4346ee08d9b2b2f628c3ffab7f3f81166
[ "MIT" ]
null
null
null
// Question Link ---> https://leetcode.com/problems/the-k-weakest-rows-in-a-matrix/ class Solution { public: vector<int> kWeakestRows(vector<vector<int>>& mat, int k) { vector<int> res; multimap<int, int> soldierRow; // {soldier, row} int M = mat.size(); int N = mat[0].size(); for (int i = 0; i < M; i++) { int j = 1; for (; j < N; j++) { if (mat[i][j] != 0) { mat[i][j] += mat[i][j - 1]; } else break; } soldierRow.insert({mat[i][j - 1], i}); } auto it = soldierRow.begin(); for (int i = 0; i < k && it != soldierRow.end(); i++, it++) { res.push_back(it->second); } return res; } };
33.666667
85
0.423267
shtanriverdi
350a46e5e7cfc9bef25eda4f7dc0cbc960c30320
6,210
hpp
C++
sprout/darkroom/renderers/whitted_style.hpp
jwakely/Sprout
a64938fad0a64608f22d39485bc55a1e0dc07246
[ "BSL-1.0" ]
1
2018-09-21T23:50:44.000Z
2018-09-21T23:50:44.000Z
sprout/darkroom/renderers/whitted_style.hpp
jwakely/Sprout
a64938fad0a64608f22d39485bc55a1e0dc07246
[ "BSL-1.0" ]
null
null
null
sprout/darkroom/renderers/whitted_style.hpp
jwakely/Sprout
a64938fad0a64608f22d39485bc55a1e0dc07246
[ "BSL-1.0" ]
null
null
null
#ifndef SPROUT_DARKROOM_RENDERERS_WHITTED_STYLE_HPP #define SPROUT_DARKROOM_RENDERERS_WHITTED_STYLE_HPP #include <cstddef> #include <limits> #include <type_traits> #include <sprout/config.hpp> #include <sprout/tuple/functions.hpp> #include <sprout/darkroom/access/access.hpp> #include <sprout/darkroom/colors/rgb.hpp> #include <sprout/darkroom/coords/vector.hpp> #include <sprout/darkroom/rays/ray.hpp> #include <sprout/darkroom/materials/material.hpp> #include <sprout/darkroom/intersects/intersection.hpp> #include <sprout/darkroom/objects/intersect.hpp> namespace sprout { namespace darkroom { namespace renderers { // // whitted_mirror // class whitted_mirror { private: template< typename Color, typename Camera, typename Objects, typename Lights, typename Ray, typename Intersection, typename Tracer, typename Direction > SPROUT_CONSTEXPR Color color_1( Camera const& camera, Objects const& objs, Lights const& lights, Ray const& ray, Intersection const& inter, Tracer const& tracer, std::size_t depth_max, Direction const& reflect_dir ) const { return tracer.template operator()<Color>( camera, objs, lights, sprout::tuples::remake<Ray>( ray, sprout::darkroom::coords::add( sprout::darkroom::intersects::point_of_intersection(inter), sprout::darkroom::coords::scale( reflect_dir, std::numeric_limits<typename sprout::darkroom::access::unit<Direction>::type>::epsilon() * 256 ) // !!! // sprout::darkroom::coords::scale( // sprout::darkroom::intersects::normal(inter), // std::numeric_limits<typename sprout::darkroom::access::unit<Direction>::type>::epsilon() * 256 // ) ), reflect_dir ), depth_max - 1 ); } public: template< typename Color, typename Camera, typename Objects, typename Lights, typename Ray, typename Intersection, typename Tracer > SPROUT_CONSTEXPR Color operator()( Camera const& camera, Objects const& objs, Lights const& lights, Ray const& ray, Intersection const& inter, Tracer const& tracer, std::size_t depth_max ) const { typedef typename std::decay< decltype(sprout::darkroom::materials::reflection(sprout::darkroom::intersects::material(inter))) >::type reflection_type; return depth_max > 0 && sprout::darkroom::intersects::does_intersect(inter) && sprout::darkroom::materials::reflection(sprout::darkroom::intersects::material(inter)) > std::numeric_limits<reflection_type>::epsilon() ? color_1<Color>( camera, objs, lights, ray, inter, tracer, depth_max, sprout::darkroom::coords::reflect( sprout::darkroom::rays::direction(ray), sprout::darkroom::intersects::normal(inter) ) ) : sprout::tuples::make<Color>(0, 0, 0) ; } }; // // whitted_style // class whitted_style { private: template< typename Color, typename Ray, typename Intersection > SPROUT_CONSTEXPR Color color_3( Ray const& ray, Intersection const& inter, Color const& diffuse_color, Color const& mirror_color ) const { return sprout::darkroom::intersects::does_intersect(inter) ? sprout::darkroom::colors::add( sprout::darkroom::colors::mul( diffuse_color, 1 - sprout::darkroom::materials::reflection(sprout::darkroom::intersects::material(inter)) ), sprout::darkroom::colors::mul( sprout::darkroom::colors::filter( sprout::darkroom::materials::color(sprout::darkroom::intersects::material(inter)), mirror_color ), sprout::darkroom::materials::reflection(sprout::darkroom::intersects::material(inter)) ) ) : sprout::darkroom::coords::normal_to_color<Color>(sprout::darkroom::rays::direction(ray)) ; } template< typename Color, typename Camera, typename Objects, typename Lights, typename Ray, typename Intersection > SPROUT_CONSTEXPR Color color_2( Camera const& camera, Objects const& objs, Lights const& lights, Ray const& ray, std::size_t depth_max, Intersection const& inter, Color const& diffuse_color ) const { return color_3<Color>( ray, inter, diffuse_color, sprout::darkroom::renderers::whitted_mirror().template operator()<Color>( camera, objs, lights, ray, inter, *this, depth_max ) ); } template< typename Color, typename Camera, typename Objects, typename Lights, typename Ray, typename Intersection > SPROUT_CONSTEXPR Color color_1( Camera const& camera, Objects const& objs, Lights const& lights, Ray const& ray, std::size_t depth_max, Intersection const& inter ) const { return color_2<Color>( camera, objs, lights, ray, depth_max, inter, lights.template operator()(inter, objs) ); } public: template< typename Color, typename Camera, typename Objects, typename Lights, typename Ray > SPROUT_CONSTEXPR Color operator()( Camera const& camera, Objects const& objs, Lights const& lights, Ray const& ray, std::size_t depth_max ) const { return color_1<Color>( camera, objs, lights, ray, depth_max, sprout::darkroom::objects::intersect_list(objs, ray) ); } }; } // namespace renderers } // namespace darkroom } // namespace sprout #endif // #ifndef SPROUT_DARKROOM_RENDERERS_WHITTED_STYLE_HPP
26.092437
106
0.597101
jwakely
350dd3935eb89bd0718345919593ae59d7f97d31
856
cpp
C++
nodes/BlackAndWhiteNode.cpp
zhyvchyky/filters
7158aa8a05fb004cdea63fdbd7d31111a1f4c796
[ "MIT" ]
null
null
null
nodes/BlackAndWhiteNode.cpp
zhyvchyky/filters
7158aa8a05fb004cdea63fdbd7d31111a1f4c796
[ "MIT" ]
2
2020-11-26T21:08:23.000Z
2020-12-03T15:22:09.000Z
nodes/BlackAndWhiteNode.cpp
zhyvchyky/filters
7158aa8a05fb004cdea63fdbd7d31111a1f4c796
[ "MIT" ]
null
null
null
// // Created by makstar on 01.12.2020. // #include "BlackAndWhiteNode.h" void BlackAndWhiteNode::process() { this->outputPtr = applyTransform(this->inputs[0]->getOutputPtr()); } std::shared_ptr<Image> BlackAndWhiteNode::applyTransform(const std::shared_ptr<Image>& img) { int width = img->getWidth(); int height = img->getHeight(); auto new_img = std::make_shared<Image>(height, width, 3, new Pixel[height * width]); int grey; // max, min; Pixel current; for(int i = 0; i < height; i++){ for(int j = 0; j < width; j++){ current = img->getPixel(i, j); grey = (current.red + current.green + current.blue) / 3; new_img->setPixel(i, j, grey, grey, grey); } } return new_img; } NodeType BlackAndWhiteNode::getNodeType() { return NodeType::BlackAndWhiteNode; }
25.176471
93
0.616822
zhyvchyky
350e96dc5fbc370274c3005bb8d70ee22c033f4a
1,317
cpp
C++
Projects/CoX/Common/AuthProtocol/Events/ServerListResponse.cpp
teronis84/Segs
71ac841a079fd769c3a45836ac60f34e4fff32b9
[ "BSD-3-Clause" ]
null
null
null
Projects/CoX/Common/AuthProtocol/Events/ServerListResponse.cpp
teronis84/Segs
71ac841a079fd769c3a45836ac60f34e4fff32b9
[ "BSD-3-Clause" ]
null
null
null
Projects/CoX/Common/AuthProtocol/Events/ServerListResponse.cpp
teronis84/Segs
71ac841a079fd769c3a45836ac60f34e4fff32b9
[ "BSD-3-Clause" ]
null
null
null
#include "ServerListResponse.h" #ifdef _MSC_VER #include <ciso646> #endif void ServerListResponse::serializeto( GrowingBuffer &buf ) const { assert(not m_serv_list.empty()); buf.uPut((uint8_t)4); buf.uPut((uint8_t)m_serv_list.size()); buf.uPut((uint8_t)1); //preferred server number for(const GameServerInfo &srv : m_serv_list) { buf.Put(srv.id); uint32_t addr= srv.addr; buf.Put((uint32_t)ACE_SWAP_LONG(addr)); //must be network byte order buf.Put((uint32_t)srv.port); buf.Put(uint8_t(0)); buf.Put(uint8_t(0)); buf.Put(srv.current_players); buf.Put(srv.max_players); buf.Put((uint8_t)srv.online); } } void ServerListResponse::serializefrom( GrowingBuffer &buf ) { uint8_t op,unused; buf.uGet(op); uint8_t server_list_size; buf.uGet(server_list_size); buf.uGet(m_preferred_server_idx); //preferred server number for(int i = 0; i < server_list_size; i++) { GameServerInfo srv; buf.Get(srv.id); buf.Get(srv.addr); //must be network byte order buf.Get(srv.port); buf.Get(unused); buf.Get(unused); buf.Get(srv.current_players); buf.Get(srv.max_players); buf.Get(srv.online); m_serv_list.push_back(srv); } }
28.021277
76
0.63022
teronis84
3510a2eabe92b719c86ea523f2c6683f3aae2a66
1,118
cpp
C++
alignment/distance/levenshtein.cpp
TianyiShi2001/bio-algorithms-cpp-edu
8f1ea4de0a2ed302f8bb1416d8c3afc9492cfdbb
[ "Apache-2.0" ]
null
null
null
alignment/distance/levenshtein.cpp
TianyiShi2001/bio-algorithms-cpp-edu
8f1ea4de0a2ed302f8bb1416d8c3afc9492cfdbb
[ "Apache-2.0" ]
null
null
null
alignment/distance/levenshtein.cpp
TianyiShi2001/bio-algorithms-cpp-edu
8f1ea4de0a2ed302f8bb1416d8c3afc9492cfdbb
[ "Apache-2.0" ]
null
null
null
/* Levenshtein distance # Examples $ ./levenshtein ABCDEFG ACEG Levenshtein Distance: 3 $ ./levenshtein ABCDEFG AZCPEGM Levenshtein Distance: 4 */ #include<iostream> #include<vector> #include<algorithm> using namespace std; size_t levenshtein(const string& x, const string& y) { auto m{ x.size() }; auto n{ y.size() }; vector<size_t> dp(n + 1, 0); for (size_t i = 1; i < n; i++) { dp[i] = i; } size_t s, e; char p, q; for (size_t i = 1; i <= m; i++) { s = i - 1; e = i; p = x[i - 1]; for (size_t j = 1; j <= n; j++) { q = y[j - 1]; e = min({ e + 1, dp[j] + 1, s + (p == q ? size_t{0} : size_t{1}) }); s = dp[j]; dp[j] = e; } } return dp[n]; } int main(int argc, char* argv[]) { if (argc < 3) { cout << "Please provide two strings!" << endl; return 1; } string x = argv[1]; string y = argv[2]; auto res = levenshtein(x, y); cout << "Levenshtein Distance: " << res << endl; }
18.633333
80
0.457066
TianyiShi2001
352eb217fc7fec112baba5f6eaa82a3af6913fc4
17,529
cpp
C++
VTK_Operation.cpp
jhpark16/PHT3D-Viewer-3D
2f62d95364b664f3cc50af2d77f280c2fb62b543
[ "MIT" ]
null
null
null
VTK_Operation.cpp
jhpark16/PHT3D-Viewer-3D
2f62d95364b664f3cc50af2d77f280c2fb62b543
[ "MIT" ]
null
null
null
VTK_Operation.cpp
jhpark16/PHT3D-Viewer-3D
2f62d95364b664f3cc50af2d77f280c2fb62b543
[ "MIT" ]
null
null
null
// VTK_Operation.cpp : implmentation of VTK operations to visualize a 3D model // // Author: Jungho Park ([email protected]) // Date: May 2015 // Description: // ///////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "resource.h" VTK_Operation::VTK_Operation(HWND hwnd, HWND hwndParent) { CreateVTKObjects(hwnd, hwndParent); } void VTK_Operation::clear(void) { // vtkSmartPointers are deleted by assigning nullptr // (or any other object) to the pointer #ifdef OpenVR actor.~vtkNew(); renderWindow.~vtkNew(); renderer.~vtkNew(); interactor.~vtkNew(); cam.~vtkNew(); // destroy text actor and mapper // Additional variables //reader = nullptr; //mapper = nullptr; //colors = nullptr; #else renderWindow.~vtkNew(); renderer.~vtkNew(); interactor.~vtkNew(); // destroy text actor and mapper textMapper.~vtkNew(); textActor2D.~vtkNew(); scalarBar.~vtkNew(); // Additional variables //reader = nullptr; //mapper = nullptr; //colors = nullptr; actor.~vtkNew(); //backFace = nullptr; #endif } VTK_Operation::~VTK_Operation() { clear(); } int VTK_Operation::CreateVTKObjects(HWND hwnd, HWND hwndParent) { // We create the basic parts of a pipeline and connect them #ifdef OpenVR /* vtkNew<vtkActor> actor; vtkNew<vtkOpenVRRenderer> renderer; vtkNew<vtkOpenVRRenderWindow> renderWindow; vtkNew<vtkOpenVRRenderWindowInteractor> interactor; vtkNew<vtkOpenVRCamera> cam;*/ /* renderer = vtkSmartPointer<vtkOpenVRRenderer>::New(); renderWindow = vtkSmartPointer<vtkOpenVRRenderWindow>::New(); interactor = vtkSmartPointer<vtkOpenVRRenderWindowInteractor>::New(); cam = vtkSmartPointer<vtkOpenVRCamera>::New();*/ #else /* actor = vtkSmartPointer<vtkActor>::New(); renderer = vtkSmartPointer<vtkOpenGLRenderer>::New(); renderWindow = vtkSmartPointer<vtkWin32OpenGLRenderWindow>::New(); interactor = vtkSmartPointer<vtkWin32RenderWindowInteractor>::New(); */ renderWindow->Register(NULL); #endif #ifdef OpenVR renderWindow->AddRenderer(renderer.Get()); renderer->AddActor(actor.Get()); interactor->SetRenderWindow(renderWindow.Get()); renderer->SetActiveCamera(cam.Get()); vtkNew<vtkConeSource> cone; vtkNew<vtkPolyDataMapper> mapper; mapper->SetInputConnection(cone->GetOutputPort()); actor->SetMapper(mapper.Get()); //Reset camera to show the model at the centre renderer->ResetCamera(); #else renderWindow->AddRenderer(renderer); interactor->SetInstallMessageProc(0); // setup the parent window renderWindow->SetWindowId(hwnd); renderWindow->SetParentId(hwndParent); interactor->SetRenderWindow(renderWindow); interactor->Initialize(); vtkNew<vtkInteractorStyleTrackballCamera> style; interactor->SetInteractorStyle(style); // Setup Text Actor //textMapper = vtkSmartPointer<vtkTextMapper>::New(); textMapper->SetInput("MODFLOW Model"); //textActor2D = vtkSmartPointer<vtkActor2D>::New(); textActor2D->SetDisplayPosition(450, 550); textMapper->GetTextProperty()->SetFontSize(30); textMapper->GetTextProperty()->SetColor(1.0, 1.0, 1.0); textActor2D->SetMapper(textMapper); // Add Axis //axes = vtkSmartPointer<vtkAxesActor>::New(); axes->SetNormalizedLabelPosition(1.2, 1.2, 1.2); axes->GetXAxisCaptionActor2D()->SetHeight(0.025); axes->GetYAxisCaptionActor2D()->SetHeight(0.025); axes->GetZAxisCaptionActor2D()->SetHeight(0.025); #ifndef OpenVR //widget = vtkSmartPointer<vtkOrientationMarkerWidget>::New(); widget->SetOutlineColor(0.9300, 0.5700, 0.1300); widget->SetOrientationMarker(axes); widget->SetInteractor(interactor); widget->SetEnabled(1); #endif // Prevent the interaction to fix the location of the coordinate axes triad // at the left bottom //widget->InteractiveOff(); // Trigger WM_SIZE widget->SetViewport(-0.8, -0.8, 0.25, 0.25); //Add the Actors renderer->AddActor(textActor2D); //renderer->SetBackground(colors->GetColor3d("Wheat").GetData()); renderer->SetBackground(.1, .2, .4); //Reset camera to show the model at the centre renderer->ResetCamera(); #endif //renderer->SetBackground(0.0, 0.0, 0.25); return(1); } int VTK_Operation::DestroyVTKObjects() { ATLTRACE("DestroyVTKObjects\n"); return(1); } int VTK_Operation::StepObjects(int count) { return(1); } void VTK_Operation::WidgetInteractiveOff(void) { #ifndef OpenVR widget->InteractiveOff(); // Trigger WM_SIZE #endif } void VTK_Operation::Render() { if (renderWindow) { renderWindow->Render(); //interactor->Render(); } } void VTK_Operation::OnSize(CSize size) { if (renderWindow) { //int *val1; //val1 = renderWindow->GetSize(); renderWindow->SetSize(size.cx, size.cy); if (textMapper && renderer->GetVTKWindow()) { int width = textMapper->GetWidth(renderer); this->size = size; textActor2D->SetDisplayPosition((size.cx - width) / 2, size.cy - 50); //interactor->UpdateSize(size.cx, size.cy); //interactor->SetSize(size.cx, size.cy); } } } void VTK_Operation::OnTimer(HWND hWnd, UINT uMsg) { #ifndef OpenVR interactor->OnTimer(hWnd, uMsg); #endif } void VTK_Operation::OnLButtonDblClk(HWND hWnd, UINT uMsg, CPoint point) { #ifndef OpenVR interactor->OnLButtonDown(hWnd, uMsg, point.x, point.y, 1); #endif } void VTK_Operation::OnLButtonDown(HWND hWnd, UINT uMsg, CPoint point) { #ifndef OpenVR interactor->OnLButtonDown(hWnd, uMsg, point.x, point.y, 0); #endif } void VTK_Operation::OnMButtonDown(HWND hWnd, UINT uMsg, CPoint point) { #ifndef OpenVR interactor->OnMButtonDown(hWnd, uMsg, point.x, point.y, 0); #endif } void VTK_Operation::OnRButtonDown(HWND hWnd, UINT uMsg, CPoint point) { #ifndef OpenVR interactor->OnRButtonDown(hWnd, uMsg, point.x, point.y, 0); #endif } void VTK_Operation::OnLButtonUp(HWND hWnd, UINT uMsg, CPoint point) { #ifndef OpenVR interactor->OnLButtonUp(hWnd, uMsg, point.x, point.y); #endif } void VTK_Operation::OnMButtonUp(HWND hWnd, UINT uMsg, CPoint point) { #ifndef OpenVR interactor->OnMButtonUp(hWnd, uMsg, point.x, point.y); #endif } void VTK_Operation::OnRButtonUp(HWND hWnd, UINT uMsg, CPoint point) { #ifndef OpenVR interactor->OnRButtonUp(hWnd, uMsg, point.x, point.y); #endif } void VTK_Operation::OnMouseMove(HWND hWnd, UINT uMsg, CPoint point) { #ifndef OpenVR interactor->OnMouseMove(hWnd, uMsg, point.x, point.y); #endif } void VTK_Operation::OnChar(HWND hWnd, UINT nChar, UINT nRepCnt, UINT nFlags) { #ifndef OpenVR interactor->OnChar(hWnd, nChar, nRepCnt, nFlags); #endif } void VTK_Operation::FileNew() { renderer->RemoveActor(actor); renderer->RemoveActor(scalarBar); } void VTK_Operation::FileOpen(PHT3D_Model& mPHT3DM, CString fileName) { // Model Data //read all the data from the file /* vtkSmartPointer<vtkXMLUnstructuredGridReader> reader = vtkSmartPointer<vtkXMLUnstructuredGridReader>::New(); reader->SetFileName(_T("D:\\Study\\MODFLOW\\RegionalGroundwaterModelingwithMODFLOWandFlopy\\vtuFiles\\Model1_HD_Heads.vtu")); reader->Update(); vtkSmartPointer<vtkUnstructuredGrid> output = reader->GetOutput(); output->GetCellData()->SetScalars(output->GetCellData()->GetArray(0)); */ //vtkUnstructuredGrid construction vtkNew<vtkUnstructuredGrid> unstGrid; vtkNew<vtkFloatArray> fArr; vtkNew<vtkDoubleArray> dArr; vtkNew<vtkIntArray> iArr; vtkNew<vtkCellArray> cellArr; vtkNew<vtkIdTypeArray> cellIdType; vtkNew<vtkPoints> points; MODFLOWClass& mf = mPHT3DM.MODFLOW; double minVal=0, maxVal = 0; if (1) { OpenModel(mPHT3DM, fileName); int nCol = mf.DIS_NCOL + 1; int nRow = mf.DIS_NROW + 1; int nLay = mf.DIS_NLAY + 1; float *xLoc = new float[nCol]{}; float *yLoc = new float[nRow]{}; float *zLoc = new float[nRow*nCol]{}; xLoc[0] = 0; yLoc[0] = 0; for (int i = 0; i < nCol-1; i++) { xLoc[i + 1] = xLoc[i] + mf.DIS_DELR[i]; } for (int i = 0; i < nRow-1; i++) { yLoc[i + 1] = yLoc[i] + mf.DIS_DELC[i]; } // Reverse Y for correct model display for (int i = 0; i < (nRow-1)/2; i++) { int iTmp = yLoc[i]; yLoc[i] = yLoc[nRow - 1 - i]; yLoc[nRow - 1 - i] = iTmp; } int nPoints = (mf.DIS_NLAY + 1)*(mf.DIS_NROW + 1)*(mf.DIS_NCOL + 1); unique_ptr<float[]> locations(new float[3 * nPoints]); //float *locations = new float[3 * nPoints]{}; unique_ptr<int[]> connectivity(new int[9 * ((nLay - 1)*(nRow - 1)*(nCol - 1))]); unique_ptr<double[]> dVal(new double[((nLay - 1)*(nRow - 1)*(nCol - 1))]); //int *connectivity = new int[9*((nLay - 1)*(nRow - 1)*(nCol - 1))]{}; //int *connectivity = new int[(nLay-1)*(nRow-1)*(nCol-1)] {}; // The heights are not aligned at each nodal points. So, it is necessary to estimate the height // at each node using interpolation of heights CPPMatrix2<double> *elevation = &(mf.DIS_TOP); for (int k = 0; k < nLay; k++) { // Takes care of four corners if (k == 0) { // The elevation of the top layer is from the DIS_TOP elevation = &(mf.DIS_TOP); } else { // The bottom elevation is used for most layers elevation = &(mf.DIS_BOTMS[k - 1]); } zLoc[0 * nCol + 0] = (*elevation)[0][0]; zLoc[0 * nCol + (nCol-1)] = (*elevation)[0][nCol-2]; zLoc[(nRow - 1) * nCol + 0] = (*elevation)[nRow-2][0]; zLoc[(nRow - 1) * nCol + (nCol-1)] = (*elevation)[nRow-2][nCol-2]; // Interpolate edges along X direction for (int i = 1; i < nCol-1; i++) { zLoc[0*nCol + i] = ((*elevation)[0][i-1] + (*elevation)[0][i])/2.0; zLoc[(nRow-1)*nCol + i] = ((*elevation)[nRow-2][i-1] + (*elevation)[nRow - 2][i])/2.0; } // Interpolate edges along Y direction for (int j = 1; j < nRow - 1; j++) { zLoc[(j * nCol) + 0] = ((*elevation)[j-1][0] + (*elevation)[j][0]) / 2.0; zLoc[(j * nCol) + nCol-1] = ((*elevation)[j-1][nCol-2] + (*elevation)[j][nCol-2]) / 2.0; } // Interpolate the remaining part of the 3D model for (int j = 1; j < nRow-1; j++) { for (int i = 1; i < nCol-1; i++) { zLoc[(j * nCol) + i] = ((*elevation)[j - 1][i - 1] + (*elevation)[j][i - 1] + (*elevation)[j - 1][i] + (*elevation)[j][i]) / 4.0; } } // Set the X, Y, Z of all nodal points for (int j = 0; j < nRow; j++) { for (int i = 0; i < nCol; i++) { locations[3 * (k*(nRow*nCol) + j*(nCol)+i) + 0] = xLoc[i]; //X value locations[3 * (k*(nRow*nCol) + j*(nCol)+i) + 1] = yLoc[j]; //Y value locations[3 * (k*(nRow*nCol) + j*(nCol)+i) + 2] = zLoc[j*nCol+i]; //Z value } } } int numCells = 0; minVal = DBL_MAX; maxVal = -DBL_MAX; for (int k = 0; k < nLay-1; k++) { for (int j = 0; j < nRow-1; j++) { for (int i = 0; i < nCol-1; i++) { if (mf.BAS_IBOUND[k][j][i]) { connectivity[9 * numCells + 0] = 8; connectivity[9 * numCells + 1] = (k + 1)*(nRow*nCol) + (j + 1)*nCol + (i); connectivity[9 * numCells + 2] = (k + 1)*(nRow*nCol) + (j + 1)*nCol + (i + 1); connectivity[9 * numCells + 3] = (k+1)*(nRow*nCol) + (j)*nCol + (i+1); connectivity[9 * numCells + 4] = (k + 1)*(nRow*nCol) + (j)*nCol + (i); connectivity[9 * numCells + 5] = (k)*(nRow*nCol) + (j + 1)*nCol + (i); connectivity[9 * numCells + 6] = (k)*(nRow*nCol) + (j + 1)*nCol + (i + 1); connectivity[9 * numCells + 7] = (k)*(nRow*nCol) + (j)*nCol + (i + 1); connectivity[9 * numCells + 8] = (k)*(nRow*nCol) + (j)*nCol + (i); double tVal = mf.BAS_STRT[k][j][i]; dVal[numCells] = tVal; if (tVal < minVal) minVal = tVal; if (tVal > maxVal) maxVal = tVal; numCells++; } } } } cellIdType->SetArray(connectivity.get(), numCells*9, 1); connectivity.release(); fArr->SetNumberOfComponents(3); //3D data points fArr->SetArray(locations.get(), 3 * nPoints, 0); locations.release(); // Must release the pointer to prevent crash points->SetData(fArr); // The array should be allocated on the heap points->SetDataTypeToFloat(); // Setup cell array using the raw data cellArr->SetCells(numCells, cellIdType); dArr->SetNumberOfComponents(1); dArr->SetArray(dVal.get(), numCells, 1); dVal.release(); // Must release the pointer to prevent crash for (int i = 1; i < numCells; i++) { } //dArr->SetTuple1(0, 0.1); dArr->SetTuple1(1, 0.5); // Assemble the unstructured grid unstGrid->SetPoints(points); unstGrid->SetCells(12, cellArr); // 12 is the cell type unstGrid->GetCellData()->SetScalars(dArr); } else { int nPoints = 12; int numCells = 2; //cellIdType->SetNumberOfValues(18); int *iCon = new int[numCells*9]{ 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 4, 5, 6, 7, 8, 9, 10, 11 }; cellIdType->SetArray(iCon, numCells * 9, 1); /* cellIdType->SetValue(0, 8); cellIdType->SetValue(1, 0); cellIdType->SetValue(2, 1); cellIdType->SetValue(3, 2); cellIdType->SetValue(4, 3); cellIdType->SetValue(5, 4); cellIdType->SetValue(6, 5); cellIdType->SetValue(7, 6); cellIdType->SetValue(8, 7); cellIdType->SetValue(9, 8); cellIdType->SetValue(10, 4); cellIdType->SetValue(11, 5); cellIdType->SetValue(12, 6); cellIdType->SetValue(13, 7); cellIdType->SetValue(14, 8); cellIdType->SetValue(15, 9); cellIdType->SetValue(16, 10); cellIdType->SetValue(17, 11); */ cellArr->SetCells(numCells, cellIdType); // Set points double *(val[12]); float *fPos = new float[nPoints * 3]{ 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 0, 2, 0, 1, 2, 1, 1, 2, 1, 0 }; fArr->SetNumberOfComponents(3); //3D data points //fArr->SetNumberOfTuples(12); // 12 set of 3D data points (not necessary) fArr->SetArray(fPos, nPoints*3, 0); points->SetData(fArr); // The array should be allocated on the heap points->SetDataTypeToFloat(); /* for (int i = 0; i<12; i++) val[i] = points->GetPoint(i); points->SetNumberOfPoints(12); points->SetPoint(0, 0, 0, 0.); points->SetPoint(1, 0, 0, 1.); points->SetPoint(2, 0, 1, 1.); points->SetPoint(3, 0, 1, 0.); points->SetPoint(4, 1, 0, 0.); points->SetPoint(5, 1, 0, 1.); points->SetPoint(6, 1, 1, 1.); points->SetPoint(7, 1, 1, 0.); points->SetPoint(8, 2, 0, 0.); points->SetPoint(9, 2, 0, 1.); points->SetPoint(10, 2, 1, 1.); points->SetPoint(11, 2, 1, 0.); points->SetDataTypeToFloat(); // Point set should be float type for (int i = 0; i<12; i++) val[i] = points->GetPoint(i); */ cellArr->SetCells(numCells, cellIdType); dArr->SetNumberOfComponents(1); //dArr->SetNumberOfTuples(2); minVal = 0, maxVal = 1; dArr->SetArray(new double[numCells] {0.1,0.5}, numCells, 1); //dArr->SetTuple1(0, 0.1); dArr->SetTuple1(1, 0.5); unstGrid->SetPoints(points); unstGrid->SetCells(12, cellArr); // 12 is the cell type unstGrid->GetCellData()->SetScalars(dArr); } // Setup Model Actor vtkNew<vtkDataSetMapper> mapper; //mapper->SetInputConnection(reader->GetOutputPort()); mapper->SetInputData(unstGrid); //mapper->ScalarVisibilityOff(); mapper->ScalarVisibilityOn(); // Scale bar actor for the Colormap //scalarBar = vtkSmartPointer<vtkScalarBarActor>::New(); scalarBar->SetLookupTable(mapper->GetLookupTable()); scalarBar->SetUnconstrainedFontSize(true); scalarBar->SetTitle("Head (ft)"); scalarBar->SetVerticalTitleSeparation(5); scalarBar->GetTitleTextProperty()->SetFontSize(20); scalarBar->GetTitleTextProperty()->ItalicOff(); scalarBar->SetLabelFormat("%.1f"); scalarBar->GetLabelTextProperty()->ItalicOff(); scalarBar->GetLabelTextProperty()->SetFontSize(15); scalarBar->SetPosition(0.87, 0.2); scalarBar->SetHeight(0.5); scalarBar->SetWidth(0.11); scalarBar->SetNumberOfLabels(4); // Jet color scheme vtkNew<vtkLookupTable> jet; jet->SetNumberOfColors(257); jet->Build(); for (int i = 0; i <= 64; i++) { jet->SetTableValue(i, 0, i / 64.0, 1, 1); } for (int i = 65; i <= 128; i++) { jet->SetTableValue(i, 0, 1, 1.0 - (i - 64.0) / 64.0, 1); } for (int i = 129; i <= 192; i++) { jet->SetTableValue(i, (i - 128.0) / 64.0, 1, 0, 1); } for (int i = 193; i <= 256; i++) { jet->SetTableValue(i, 1, 1 - (i - 192.0) / 64.0, 0, 1); } //jet->SetTableRange(3407.6445, 4673.021); mapper->SetLookupTable(jet); scalarBar->SetLookupTable(jet); mapper->SetColorModeToMapScalars(); //mapper->SetScalarRange(3407.6445, 4673.021); // min max range cannot be switched mapper->SetScalarRange(minVal, maxVal); // min max range cannot be switched mapper->SetUseLookupTableScalarRange(false); // Set scalar mode mapper->SetScalarModeToUseCellData(); //mapper->SetScalarModeToUsePointData(); actor->SetMapper(mapper); // True for grid lines if (true) { actor->GetProperty()->SetLineWidth(0.001); // This should not be zero => OpenGL error (invalid value) actor->GetProperty()->EdgeVisibilityOn(); } else actor->GetProperty()->EdgeVisibilityOff(); // Backface setup vtkNew<vtkNamedColors> colors; vtkNew<vtkProperty> backFace; backFace->SetColor(colors->GetColor3d("tomato").GetData()); actor->SetBackfaceProperty(backFace); renderer->AddActor(actor); renderer->AddActor(scalarBar); //Reset camera to show the model at the centre renderer->ResetCamera(); #ifdef OpenVR renderWindow->Render(); interactor->Start(); #endif }
33.011299
127
0.641223
jhpark16
352ee369a17dd68ee11d4caa98cd63e6c8139c18
128
hpp
C++
libraries/hayai/src/hayai-fixture.hpp
nuernber/Theia
4bac771b09458a46c44619afa89498a13cd39999
[ "BSD-3-Clause" ]
1
2021-02-02T13:30:52.000Z
2021-02-02T13:30:52.000Z
libraries/hayai/src/hayai-fixture.hpp
nuernber/Theia
4bac771b09458a46c44619afa89498a13cd39999
[ "BSD-3-Clause" ]
null
null
null
libraries/hayai/src/hayai-fixture.hpp
nuernber/Theia
4bac771b09458a46c44619afa89498a13cd39999
[ "BSD-3-Clause" ]
1
2020-09-28T08:43:13.000Z
2020-09-28T08:43:13.000Z
#include "hayai-test.hpp" #ifndef __HAYAI_FIXTURE #define __HAYAI_FIXTURE namespace Hayai { typedef Test Fixture; } #endif
12.8
25
0.765625
nuernber
35316c5c53df9191da565bef5f333ee9e71b0e3f
1,070
cpp
C++
POO 2 - Survival Game/Map.cpp
xaddee/Survival-Game
633beb24f93e313a0764521625c1d45d64875ba9
[ "MIT" ]
1
2018-12-13T19:31:29.000Z
2018-12-13T19:31:29.000Z
POO 2 - Survival Game/Map.cpp
xaddee/Survival-Game
633beb24f93e313a0764521625c1d45d64875ba9
[ "MIT" ]
null
null
null
POO 2 - Survival Game/Map.cpp
xaddee/Survival-Game
633beb24f93e313a0764521625c1d45d64875ba9
[ "MIT" ]
null
null
null
#include "Map.h" Map::Map() { _size = 0; } Map::~Map() { for (int i = 0; i < _size; i++) { delete[] _map_matrix[i]; } delete[] _map_matrix; } void Map::resize(int size) { _size = size; _map_matrix = new char*[size]; for (int i = 0; i < size; i++) { _map_matrix[i] = new char[size]; for (int j = 0; j < size; j++) { _map_matrix[i][j] = ' '; if (j == 0 || j == size - 1) _map_matrix[i][j] = '='; if (i == 0 || i == size - 1) _map_matrix[i][j] = '='; } } } int Map::showSize() { return _size; } void Map::show() { for (int i = 0; i < _size; i++) { for (int j = 0; j < _size; j++) { std::cout << _map_matrix[i][j]; } std::cout << std::endl; } } void Map::setValueAtCoords(Position position, char value) { _map_matrix[position.x][position.y] = value; } char Map::showValueAtCoords(Position position) { if (position.x > _size - 2 || position.y > _size - 2 || position.x < 1 || position.y < 1) return 'n'; // functia returneaza 'n' pt tot ce e in afara mapei return _map_matrix[position.x][position.y]; }
15.507246
90
0.55514
xaddee
35321a538499b25e6b808f7ffead51b6339a414c
450
hpp
C++
Util/timer.hpp
arumakan1727/kyopro-cpplib
b39556b3616c231579937fb86b696c692aa4ef74
[ "MIT" ]
null
null
null
Util/timer.hpp
arumakan1727/kyopro-cpplib
b39556b3616c231579937fb86b696c692aa4ef74
[ "MIT" ]
null
null
null
Util/timer.hpp
arumakan1727/kyopro-cpplib
b39556b3616c231579937fb86b696c692aa4ef74
[ "MIT" ]
null
null
null
#pragma once #include <chrono> /** * @brief Timer (実行時間計測) */ class Timer { std::chrono::system_clock::time_point m_start; public: Timer() = default; inline void start() { m_start = std::chrono::system_clock::now(); } inline uint64_t elapsedMilli() const { using namespace std::chrono; const auto end = system_clock::now(); return duration_cast<milliseconds>(end - m_start).count(); } };
19.565217
66
0.617778
arumakan1727
35326c829dc6ab9ccfadeb519a0ecc1242f9474d
446
cpp
C++
1301/1301A Three Strings/1301A Three Strings.cpp
Poohdxx/codeforces
e0d95eba325d5e720e5589798c7c06894de882f4
[ "MIT" ]
null
null
null
1301/1301A Three Strings/1301A Three Strings.cpp
Poohdxx/codeforces
e0d95eba325d5e720e5589798c7c06894de882f4
[ "MIT" ]
null
null
null
1301/1301A Three Strings/1301A Three Strings.cpp
Poohdxx/codeforces
e0d95eba325d5e720e5589798c7c06894de882f4
[ "MIT" ]
null
null
null
#include <iostream> #include <string> using namespace std; int main() { ios_base::sync_with_stdio(false); int t; cin >> t; for (int i = 0; i < t; i++) { string a, b, c; cin >> a >> b >> c; int n = a.size(); bool pass = true; for (int j = 0; j < n; j++) { if (c[j] != a[j] && c[j] != b[j]) { pass = false; break; } } if (pass) { cout << "YES" << endl; } else { cout << "NO" << endl; } } return 0; }
14.387097
38
0.466368
Poohdxx
3532b78fbcfb49ae23f30a1b9b6963e8e940b051
737
hh
C++
CaloMC/inc/CaloWFExtractor.hh
knoepfel/Offline
bb0e52f2e6627abe223e8adaf6fe326cead595df
[ "Apache-2.0" ]
null
null
null
CaloMC/inc/CaloWFExtractor.hh
knoepfel/Offline
bb0e52f2e6627abe223e8adaf6fe326cead595df
[ "Apache-2.0" ]
null
null
null
CaloMC/inc/CaloWFExtractor.hh
knoepfel/Offline
bb0e52f2e6627abe223e8adaf6fe326cead595df
[ "Apache-2.0" ]
null
null
null
#ifndef CaloMC_CaloWFExtractor_hh #define CaloMC_CaloWFExtractor_hh // // Utility to simulate waveform hit extraction in FPGA // #include <vector> namespace mu2e { class CaloWFExtractor { public: CaloWFExtractor(unsigned bufferDigi, int minPeakADC,unsigned nBinsPeak) : bufferDigi_(bufferDigi),minPeakADC_(minPeakADC),nBinsPeak_(nBinsPeak) {}; void extract(const std::vector<int>& wf, std::vector<unsigned>& starts, std::vector<unsigned>& stops) const; private: unsigned bufferDigi_; int minPeakADC_; unsigned nBinsPeak_; }; } #endif
27.296296
123
0.576662
knoepfel
3538646ae76e0a69bdebac9c6fc2401efb8eba95
118
cpp
C++
sunspec-modbus/common.cpp
PortlandStatePowerLab/temp-susnspec-modbus
ace2d90b07e5f430739b2636fe64a78a4bf5d309
[ "BSD-3-Clause" ]
null
null
null
sunspec-modbus/common.cpp
PortlandStatePowerLab/temp-susnspec-modbus
ace2d90b07e5f430739b2636fe64a78a4bf5d309
[ "BSD-3-Clause" ]
null
null
null
sunspec-modbus/common.cpp
PortlandStatePowerLab/temp-susnspec-modbus
ace2d90b07e5f430739b2636fe64a78a4bf5d309
[ "BSD-3-Clause" ]
null
null
null
#include "include/sunspec/common.hpp" using namespace sunspec; Common::Common(/* args */) { } Common::~Common() { }
10.727273
37
0.669492
PortlandStatePowerLab
35399ccb73eb723be030e9811f09b91fb26bb19f
310
cpp
C++
Widget.cpp
cedoduarte/MovimientoParabolico
825bd490e99eb2c8a2072bc8d1956eafc26a56fa
[ "MIT" ]
null
null
null
Widget.cpp
cedoduarte/MovimientoParabolico
825bd490e99eb2c8a2072bc8d1956eafc26a56fa
[ "MIT" ]
null
null
null
Widget.cpp
cedoduarte/MovimientoParabolico
825bd490e99eb2c8a2072bc8d1956eafc26a56fa
[ "MIT" ]
null
null
null
#include "Widget.h" #include "ui_Widget.h" #include "Escena.h" Widget::Widget(QWidget *parent) : QWidget(parent) , ui(new Ui::Widget) { ui->setupUi(this); mEscena = new Escena(this); ui->graphicsView->setScene(mEscena); mEscena->iniciaEscena(); } Widget::~Widget() { delete ui; }
16.315789
40
0.635484
cedoduarte
353b65bb932f1c7de186038dc4cce1c23e3b234b
2,456
hpp
C++
libpdraw/src/pdraw_media.hpp
Akaaba/pdraw
2411d6b846e83202984f422eeb79553304e7bd03
[ "BSD-3-Clause" ]
4
2018-05-15T01:26:21.000Z
2020-01-27T03:15:34.000Z
libpdraw/src/pdraw_media.hpp
Akaaba/pdraw
2411d6b846e83202984f422eeb79553304e7bd03
[ "BSD-3-Clause" ]
1
2018-10-18T15:53:02.000Z
2018-10-18T15:53:02.000Z
libpdraw/src/pdraw_media.hpp
Akaaba/pdraw
2411d6b846e83202984f422eeb79553304e7bd03
[ "BSD-3-Clause" ]
4
2017-05-16T11:46:12.000Z
2019-01-09T09:13:01.000Z
/** * Parrot Drones Awesome Video Viewer Library * Media interface * * Copyright (c) 2016 Aurelien Barre * * 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 nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 _PDRAW_MEDIA_HPP_ #define _PDRAW_MEDIA_HPP_ #include "pdraw_decoder.hpp" #include <pdraw/pdraw_defs.h> #include <inttypes.h> #include <pthread.h> #include <string> namespace Pdraw { enum elementary_stream_type { ELEMENTARY_STREAM_TYPE_UNKNOWN = 0, ELEMENTARY_STREAM_TYPE_VIDEO_AVC, }; class Session; class Media { public: virtual ~Media( void) {} virtual void lock( void) = 0; virtual void unlock( void) = 0; virtual enum pdraw_media_type getType( void) = 0; virtual unsigned int getId( void) = 0; virtual int enableDecoder( void) = 0; virtual int disableDecoder( void) = 0; virtual Session *getSession( void) = 0; virtual Decoder *getDecoder( void) = 0; protected: pthread_mutex_t mMutex; unsigned int mId; Session *mSession; }; } /* namespace Pdraw */ #endif /* !_PDRAW_MEDIA_HPP_ */
27.595506
79
0.746336
Akaaba
353f99ae03e56ef37978e1d9f6c142b0c27fe9ab
1,862
hpp
C++
src/content_handlers/simulator_handler/inc/aduc/simulator_handler.hpp
bemol38/iot-hub-device-update
2cd165ba05cf7a6eff34cbf6c26e4ae30cc9d5d9
[ "MIT" ]
null
null
null
src/content_handlers/simulator_handler/inc/aduc/simulator_handler.hpp
bemol38/iot-hub-device-update
2cd165ba05cf7a6eff34cbf6c26e4ae30cc9d5d9
[ "MIT" ]
null
null
null
src/content_handlers/simulator_handler/inc/aduc/simulator_handler.hpp
bemol38/iot-hub-device-update
2cd165ba05cf7a6eff34cbf6c26e4ae30cc9d5d9
[ "MIT" ]
null
null
null
/** * @file simulator_handler.hpp * @brief Defines SimulatorHandlerImpl. * * @copyright Copyright (c) Microsoft Corporation. * Licensed under the MIT License. */ #ifndef ADUC_SIMULATOR_HANDLER_HPP #define ADUC_SIMULATOR_HANDLER_HPP #include "aduc/content_handler.hpp" #include "aduc/logging.h" EXTERN_C_BEGIN /** * @brief Instantiates an Update Content Handler simulator. * @return A pointer to an instantiated Update Content Handler object. */ ContentHandler* CreateUpdateContentHandlerExtension(ADUC_LOG_SEVERITY logLevel); EXTERN_C_END /** * @class SimulatorHandlerImpl * @brief The simulator handler implementation. */ class SimulatorHandlerImpl : public ContentHandler { public: static ContentHandler* CreateContentHandler(); // Delete copy ctor, copy assignment, move ctor and move assignment operators. SimulatorHandlerImpl(const SimulatorHandlerImpl&) = delete; SimulatorHandlerImpl& operator=(const SimulatorHandlerImpl&) = delete; SimulatorHandlerImpl(SimulatorHandlerImpl&&) = delete; SimulatorHandlerImpl& operator=(SimulatorHandlerImpl&&) = delete; ~SimulatorHandlerImpl() override; ADUC_Result Download(const tagADUC_WorkflowData* workflowData) override; ADUC_Result Install(const tagADUC_WorkflowData* workflowData) override; ADUC_Result Apply(const tagADUC_WorkflowData* workflowData) override; ADUC_Result Cancel(const tagADUC_WorkflowData* workflowData) override; ADUC_Result IsInstalled(const tagADUC_WorkflowData* workflowData) override; private: // Private constructor, must call CreateContentHandler factory method. SimulatorHandlerImpl() { } }; /** * @brief Get the simulator data file path. * * @return char* A buffer contains file path. Caller must call free() once done. */ char* GetSimulatorDataFilePath(); #endif // ADUC_SIMULATOR_HANDLER_HPP
30.032258
82
0.77551
bemol38
354c1589c2fd08cf037d595611ab9d222ac001aa
220
hpp
C++
include/locker/fs.hpp
gmbeard/locker
0d691f1d6716fa154820c52a97b78ac02a4d06c0
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
include/locker/fs.hpp
gmbeard/locker
0d691f1d6716fa154820c52a97b78ac02a4d06c0
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
include/locker/fs.hpp
gmbeard/locker
0d691f1d6716fa154820c52a97b78ac02a4d06c0
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
#ifndef LOCKER_FS_HPP_INCLUDED #define LOCKER_FS_HPP_INCLUDED #include <string> #include <tuple> namespace locker { auto get_locker_home() noexcept -> std::pair<bool, std::string>; } #endif //LOCKER_FS_HPP_INCLUDED
14.666667
64
0.772727
gmbeard
355084b153344b80aeedc8a2f8176eb8ccf83b5c
245
cpp
C++
src/bolusGUI/dlgtimedate.cpp
dreamshader/bolus
b63ae2e1821019f920cb8adeff373bafbb5e0008
[ "Apache-2.0" ]
null
null
null
src/bolusGUI/dlgtimedate.cpp
dreamshader/bolus
b63ae2e1821019f920cb8adeff373bafbb5e0008
[ "Apache-2.0" ]
null
null
null
src/bolusGUI/dlgtimedate.cpp
dreamshader/bolus
b63ae2e1821019f920cb8adeff373bafbb5e0008
[ "Apache-2.0" ]
null
null
null
#include "dlgtimedate.h" #include "ui_dlgtimedate.h" dlgTimeDate::dlgTimeDate(QWidget *parent) : QDialog(parent), ui(new Ui::dlgTimeDate) { pParent = parent; ui->setupUi(this); } dlgTimeDate::~dlgTimeDate() { delete ui; }
14.411765
43
0.665306
dreamshader
355098ebb5367190cfe9d0af757e0a104ccb948f
243
cpp
C++
src/main/cpp/subsystems/Arm.cpp
roboticsmgci/2022-robot
42833feaac3f4a3a9b53d7182a9b8814c0e22912
[ "BSD-3-Clause" ]
2
2022-03-09T13:54:02.000Z
2022-03-31T02:59:31.000Z
src/main/cpp/subsystems/Arm.cpp
roboticsmgci/2022-robot
42833feaac3f4a3a9b53d7182a9b8814c0e22912
[ "BSD-3-Clause" ]
null
null
null
src/main/cpp/subsystems/Arm.cpp
roboticsmgci/2022-robot
42833feaac3f4a3a9b53d7182a9b8814c0e22912
[ "BSD-3-Clause" ]
8
2022-03-15T14:14:30.000Z
2022-03-29T19:20:17.000Z
#include "subsystems/Arm.h" #include <frc/smartdashboard/SmartDashboard.h> Arm::Arm(){ m_arm.RestoreFactoryDefaults(); SetName("Arm"); } void Arm::Rotate(double speed){ m_arm.Set(speed); } void Arm::Stop(){ m_arm.Set(0); }
14.294118
46
0.658436
roboticsmgci
355a7f39b1f7c34c5851bc2266d4bfe5ee784855
1,414
cpp
C++
code/tile.cpp
DavDag/Tetris-Clone
465342dd7bda0c44b3b71874a8ae7d13beb610e1
[ "MIT" ]
1
2019-08-07T09:13:16.000Z
2019-08-07T09:13:16.000Z
code/tile.cpp
DavDag/Tetris-Clone
465342dd7bda0c44b3b71874a8ae7d13beb610e1
[ "MIT" ]
null
null
null
code/tile.cpp
DavDag/Tetris-Clone
465342dd7bda0c44b3b71874a8ae7d13beb610e1
[ "MIT" ]
null
null
null
#include "tile.hpp" Tile::Tile(int x, int y, int w, int h): sprite(), x(x), y(y), marked(false), color(Textures::EmptyBlock) { this->sprite.setTexture(*texturemanager.get(Textures::EmptyBlock)); this->sprite.scale(w / this->sprite.getGlobalBounds().width, h / this->sprite.getGlobalBounds().height); this->setPosition(this->x * w, this->y * h); } void Tile::setColor(Textures::ID id) { this->sprite.setTexture(*texturemanager.get(id)); this->color = id; } sf::FloatRect Tile::getBounds() { return sf::FloatRect(sf::Vector2f(this->getPosition()), sf::Vector2f(44, 44)); } bool Tile::getMarked() { return this->marked; } Textures::ID Tile::getColor() { return this->color; } void Tile::mark(bool marked) { if(this->marked != marked) { this->marked = marked; if(DEBUG) { if(marked) { this->sprite.setColor(sf::Color::Yellow); } else { this->sprite.setColor(sf::Color::White); } } } } bool Tile::isEmpty() { return this->color == Textures::EmptyBlock || this->color == Textures::EmptyBlockDbg; } void Tile::draw(sf::RenderTarget& rt, sf::RenderStates rs) const { rs.transform *= this->getTransform(); rs.texture = NULL; rt.draw(this->sprite, rs); }
21.424242
109
0.559406
DavDag
355d51843955888b30547d1ee5590a784d442232
1,386
cpp
C++
Classes/Screens/MainMenu.cpp
Kirlos-Melad/Connect-Four
42740dc78754548ca508be6386b897df9504a6e8
[ "MIT" ]
null
null
null
Classes/Screens/MainMenu.cpp
Kirlos-Melad/Connect-Four
42740dc78754548ca508be6386b897df9504a6e8
[ "MIT" ]
null
null
null
Classes/Screens/MainMenu.cpp
Kirlos-Melad/Connect-Four
42740dc78754548ca508be6386b897df9504a6e8
[ "MIT" ]
null
null
null
// // Created by kirlos on 2020-07-19. // #include "MainMenu.h" MainMenu::MainMenu(float width, float height, sf::Font &font) : MenuScroller(width, height, font, MAX_NUMBER_OF_ITEMS){ menu[0].setFont(font); menu[0].setFillColor(sf::Color::Blue); menu[0].setString("Play"); menu[0].setPosition(sf::Vector2f(X_OFFSET, height / (MAX_NUMBER_OF_ITEMS + 1) * 1)); menu[0].setCharacterSize(FONT_SIZE); menu[1].setFont(font); menu[1].setFillColor(sf::Color::Red); menu[1].setString("Hall Of Fame"); menu[1].setPosition(sf::Vector2f(X_OFFSET, height / (MAX_NUMBER_OF_ITEMS + 1) * 2)); menu[1].setCharacterSize(FONT_SIZE); menu[2].setFont(font); menu[2].setFillColor(sf::Color::Red); menu[2].setString("Options"); menu[2].setPosition(sf::Vector2f(X_OFFSET, height / (MAX_NUMBER_OF_ITEMS + 1) * 3)); menu[2].setCharacterSize(FONT_SIZE); menu[3].setFont(font); menu[3].setFillColor(sf::Color::Red); menu[3].setString("About Us"); menu[3].setPosition(sf::Vector2f(X_OFFSET, height / (MAX_NUMBER_OF_ITEMS + 1) * 4)); menu[3].setCharacterSize(FONT_SIZE); menu[4].setFont(font); menu[4].setFillColor(sf::Color::Red); menu[4].setString("Exit"); menu[4].setPosition(sf::Vector2f(X_OFFSET, height / (MAX_NUMBER_OF_ITEMS + 1) * 5)); menu[4].setCharacterSize(FONT_SIZE); } MainMenu::~MainMenu() { }
33
119
0.665945
Kirlos-Melad
355fc94e4c3dd4a41a6f4f74a315abb6aa511606
140
hxx
C++
src/Providers/UNIXProviders/ConfigurationComponent/UNIX_ConfigurationComponent_LINUX.hxx
brunolauze/openpegasus-providers-old
b00f1aad575bae144b8538bf57ba5fd5582a4ec7
[ "MIT" ]
1
2020-10-12T09:00:09.000Z
2020-10-12T09:00:09.000Z
src/Providers/UNIXProviders/ConfigurationComponent/UNIX_ConfigurationComponent_LINUX.hxx
brunolauze/openpegasus-providers-old
b00f1aad575bae144b8538bf57ba5fd5582a4ec7
[ "MIT" ]
null
null
null
src/Providers/UNIXProviders/ConfigurationComponent/UNIX_ConfigurationComponent_LINUX.hxx
brunolauze/openpegasus-providers-old
b00f1aad575bae144b8538bf57ba5fd5582a4ec7
[ "MIT" ]
null
null
null
#ifdef PEGASUS_OS_LINUX #ifndef __UNIX_CONFIGURATIONCOMPONENT_PRIVATE_H #define __UNIX_CONFIGURATIONCOMPONENT_PRIVATE_H #endif #endif
11.666667
47
0.864286
brunolauze
3562b31b74429cd50fb29b14f627f13dcbe1c43d
951
cpp
C++
Codeforces #353 DIV2/D.cpp
kimixuchen/Codeforces
1c259e867310d148d813c3ea7cc4f9cad3f21049
[ "Apache-2.0" ]
null
null
null
Codeforces #353 DIV2/D.cpp
kimixuchen/Codeforces
1c259e867310d148d813c3ea7cc4f9cad3f21049
[ "Apache-2.0" ]
null
null
null
Codeforces #353 DIV2/D.cpp
kimixuchen/Codeforces
1c259e867310d148d813c3ea7cc4f9cad3f21049
[ "Apache-2.0" ]
null
null
null
/** *Codeforces Round #353 DIV2 B *18/05/16 07:44:53 *xuchen * */ #include <stdio.h> #include <iostream> #include <cmath> #include <cstring> #include <map> #include <set> #include <stdlib.h> #include <algorithm> #include <queue> using namespace std; const int N = 100005; set<int> valset; map<int, int> L, R; int main(int argc, char* args[]) { int n, val; scanf("%d", &n); for(int i=0; i<n; ++i) { scanf("%d", &val); if(i==0) valset.insert(val); else { auto iter = valset.lower_bound(val); if(iter == valset.end()) R[*(--iter)] = val; else { if(!L[*iter]) L[*iter] = val; else R[*(--iter)] = val; } if(i==1) printf("%d", *iter); else printf(" %d", *iter); valset.insert(val); } } return 0; }
19.02
48
0.446898
kimixuchen
3565d7db77ec5a5a25550ce7576f1730494d0e6e
1,446
hpp
C++
src/internal/ConversionModel.hpp
escherstair/qTsConverter
ef5c047f088d466544828d3878e808737771ae11
[ "MIT" ]
23
2020-04-10T19:37:40.000Z
2022-03-09T07:59:04.000Z
src/internal/ConversionModel.hpp
escherstair/qTsConverter
ef5c047f088d466544828d3878e808737771ae11
[ "MIT" ]
21
2020-06-09T09:08:08.000Z
2022-01-07T11:45:45.000Z
src/internal/ConversionModel.hpp
escherstair/qTsConverter
ef5c047f088d466544828d3878e808737771ae11
[ "MIT" ]
12
2019-01-10T07:38:29.000Z
2020-03-26T11:19:54.000Z
#pragma once #include <QAbstractListModel> class ConversionModel final : public QAbstractListModel { Q_OBJECT Q_PROPERTY(QString sourceMsg READ sourceMsg NOTIFY sourceMsgChanged) public: ConversionModel() = delete; explicit ConversionModel(QObject *parent = nullptr); ConversionModel(const ConversionModel &) = delete; ConversionModel(ConversionModel &&) = delete; ~ConversionModel() override = default; ConversionModel &operator=(const ConversionModel &) = delete; ConversionModel &operator=(ConversionModel &&) = delete; enum Roles { String = Qt::UserRole + 1 }; int rowCount(const QModelIndex &parent) const override; QVariant data(const QModelIndex &index, int role) const override; QHash<int, QByteArray> roleNames() const override; Q_INVOKABLE void clearInput(); Q_INVOKABLE void addInput(const QString &value); Q_INVOKABLE void setOutput(const QString &value); Q_INVOKABLE QStringList input() noexcept; Q_INVOKABLE void setIndex(const int &newIndex); Q_INVOKABLE void openOutput(); Q_INVOKABLE void openOutputFolder(); QString sourceMsg() const; signals: void setComboBoxIndex(int index); void sourceMsgChanged(); private: QVector<QString> m_conversions; QList<QString> m_input; QString m_output; QString m_sourceMsg; bool inputHaveSameExtension() noexcept; int currentIndex = 4; };
26.777778
72
0.716459
escherstair
8315eee6bdf842eba16b592ea4bdaeebf9dd2500
2,411
cpp
C++
ArrtSource/Rendering/ArrSettings.cpp
makototakemoto/azure-remote-rendering-asset-tool
8aa05c0fc62c630e27b048c6e80e2ebecc81703b
[ "MIT" ]
null
null
null
ArrtSource/Rendering/ArrSettings.cpp
makototakemoto/azure-remote-rendering-asset-tool
8aa05c0fc62c630e27b048c6e80e2ebecc81703b
[ "MIT" ]
null
null
null
ArrtSource/Rendering/ArrSettings.cpp
makototakemoto/azure-remote-rendering-asset-tool
8aa05c0fc62c630e27b048c6e80e2ebecc81703b
[ "MIT" ]
null
null
null
#include "ArrSettings.h" #include <QSettings> void ArrSettings::SetVideoWidth(int width) { width = std::clamp(width, s_videoWidthMin, s_videoWidthMax); if (m_videoWidth != width) { m_videoWidth = width; Q_EMIT OptionsChanged(); } } void ArrSettings::SetVideoHeight(int height) { height = std::clamp(height, s_videoHeightMin, s_videoHeightMax); if (m_videoHeight != height) { m_videoHeight = height; Q_EMIT OptionsChanged(); } } void ArrSettings::SetVideoRefreshRate(int r) { if (m_videoRefreshRate != r) { m_videoRefreshRate = r; Q_EMIT OptionsChanged(); } } void ArrSettings::SetFovAngle(int value) { if (m_fovAngle != value) { m_fovAngle = value; Q_EMIT OptionsChanged(); } } void ArrSettings::SetCameraSpeedInPow2(int value) { if (m_cameraSpeedPow2 != value) { m_cameraSpeedPow2 = value; Q_EMIT OptionsChanged(); } } float ArrSettings::GetCameraSpeedMetersPerSecond() const { return powf(2.0f, (float)m_cameraSpeedPow2) / 100.0f; } void ArrSettings::SetNearPlaneCM(int value) { if (m_nearPlaneCM != value) { m_nearPlaneCM = value; Q_EMIT OptionsChanged(); } } void ArrSettings::SetFarPlaneCM(int value) { if (m_farPlaneCM != value) { m_farPlaneCM = value; Q_EMIT OptionsChanged(); } } void ArrSettings::SaveSettings() const { QSettings s; s.beginGroup("Video"); s.setValue("VideoWidth", m_videoWidth); s.setValue("VideoHeight", m_videoHeight); s.setValue("VideoRefreshRate", m_videoRefreshRate); s.setValue("VideoFOV", m_fovAngle); s.setValue("CameraNear", m_nearPlaneCM); s.setValue("CameraFar", m_farPlaneCM); s.setValue("CameraSpeed", m_cameraSpeedPow2); s.endGroup(); } void ArrSettings::LoadSettings() { QSettings s; s.beginGroup("Video"); m_videoWidth = s.value("VideoWidth", m_videoWidth).toInt(); m_videoHeight = s.value("VideoHeight", m_videoHeight).toInt(); m_videoRefreshRate = s.value("VideoRefreshRate", m_videoRefreshRate).toInt(); m_fovAngle = s.value("VideoFOV", m_fovAngle).toInt(); m_nearPlaneCM = s.value("CameraNear", m_nearPlaneCM).toInt(); m_farPlaneCM = s.value("CameraFar", m_farPlaneCM).toInt(); m_cameraSpeedPow2 = s.value("CameraSpeed", m_cameraSpeedPow2).toInt(); s.endGroup(); }
23.407767
81
0.66321
makototakemoto
831a7ea3291e33f19e983275f092015d8e42d978
7,697
cc
C++
src/simulation/curve.cc
kipje13/RLUtilities
eb887b312e33136b27a64516179ea812c366c2fa
[ "MIT" ]
null
null
null
src/simulation/curve.cc
kipje13/RLUtilities
eb887b312e33136b27a64516179ea812c366c2fa
[ "MIT" ]
null
null
null
src/simulation/curve.cc
kipje13/RLUtilities
eb887b312e33136b27a64516179ea812c366c2fa
[ "MIT" ]
null
null
null
#include "simulation/ogh.h" #include "simulation/curve.h" #include "mechanics/drive.h" #include "misc/io.h" float maximize_speed_with_throttle(float accel, float v0, float sf); float maximize_speed_without_throttle(float accel, float v0, float sf); void Curve::write_to_file(std::string prefix) { write(points, prefix + std::string("_points.txt")); write(tangents, prefix + std::string("_tangents.txt")); write(curvatures, prefix + std::string("_curvatures.txt")); write(distances, prefix + std::string("_distances.txt")); write(max_speeds, prefix + std::string("_max_speeds.txt")); } Curve::Curve() { length = -1.0f; points = std::vector < vec3 >(); tangents = std::vector < vec3 >(); distances = std::vector < float >(); } Curve::Curve(const std::vector<vec3> &_points) { points = _points; calculate_distances(); calculate_tangents(); } Curve::Curve(std::vector< ControlPoint > info) { // the maximum smoothing correction (radians) // const float phi_max = 0.15f; int ndiv = 16; size_t num_segments = info.size() - 1; points.reserve(ndiv * num_segments + 2); tangents.reserve(ndiv * num_segments + 2); curvatures.reserve(ndiv * num_segments + 2); // apply some smoothing, since the paths that come // from the LUT contain some wiggling as a consequence // of coarse angular discretization for (int i = 1; i < num_segments-1; i++) { vec3 delta_before = normalize(info[i].p - info[i-1].p); vec3 delta_after = normalize(info[i+1].p - info[i].p); float phi_before = asin(dot(cross(info[i].t, delta_before), info[i].n)); float phi_after = asin(dot(cross(info[i].t, delta_after), info[i].n)); // if reasonable, apply a small rotation to control point // tangents to smooth out unnecessary extrema if (phi_before * phi_after > 0.0f) { float phi; if (fabs(phi_before) < fabs(phi_after)) { phi = phi_before; } else { phi = phi_after; } info[i].t = dot(axis_to_rotation(info[i].n * phi), info[i].t); } } for (int i = 0; i < num_segments; i++) { vec3 P0 = info[i].p; vec3 P1 = info[i+1].p; vec3 V0 = info[i].t; vec3 V1 = info[i+1].t; vec3 N0 = info[i].n; vec3 N1 = info[i+1].n; OGH piece(P0, V0, P1, V1); int is_last = (i == num_segments - 1); for (int j = 0; j < (ndiv + is_last); j++) { float t = float(j) / float(ndiv); vec3 g = piece.evaluate(t); vec3 dg = piece.tangent(t); vec3 d2g = piece.acceleration(t); // In rocket league, the only curvature that we care about // is the component along the surface normal float kappa = dot(cross(dg, d2g), normalize((1.0f - t) * N0 + t * N1)) / (norm(dg) * norm(dg) * norm(dg)); points.push_back(g); tangents.push_back(normalize(dg)); curvatures.push_back(kappa); } } calculate_distances(); } vec3 Curve::point_at(float s) { s = clip(s, 0, distances[0]); for (int i = 0; i < (points.size() - 1); i++) { if (distances[i] >= s && s >= distances[i + 1]) { float u = (s - distances[i + 1]) / (distances[i] - distances[i + 1]); return lerp(points[i + 1], points[i], u); } } return vec3{ 0.0f, 0.0f, 0.0f }; } vec3 Curve::tangent_at(float s) { s = clip(s, 0, distances[0]); for (int i = 0; i < (points.size() - 1); i++) { if (distances[i] >= s && s >= distances[i + 1]) { float u = (s - distances[i + 1]) / (distances[i] - distances[i + 1]); return normalize(lerp(tangents[i + 1], tangents[i], u)); } } return vec3{ 0.0f, 0.0f, 0.0f }; } float Curve::curvature_at(float s) { s = clip(s, 0, distances[0]); for (int i = 0; i < (points.size() - 1); i++) { if (distances[i] >= s && s >= distances[i + 1]) { float delta_theta = angle_between(tangents[i + 1], tangents[i]); float delta_s = distances[i] - distances[i + 1]; return delta_theta / delta_s; } } return 0.0f; } float Curve::max_speed_at(float s) { s = clip(s, 0, distances[0]); for (int i = 0; i < (points.size() - 1); i++) { if (distances[i] >= s && s >= distances[i + 1]) { float u = (s - distances[i + 1]) / (distances[i] - distances[i + 1]); return lerp(max_speeds[i + 1], max_speeds[i], u); } } return 0.0f; } float Curve::find_nearest(const vec3 &c) { float s = length; float min_distance = norm(c - points[0]); for (int i = 0; i < (points.size() - 1); i++) { vec3 a = points[i]; vec3 b = points[i + 1]; float alpha = clip(dot(b - a, c - a) / dot(b - a, b - a), 0.0f, 1.0f); float distance = norm(c - (a + alpha * (b - a))); if (distance < min_distance) { min_distance = distance; s = lerp(distances[i], distances[i + 1], alpha); } } return s; } void Curve::pop_front() { if (points.size() > 0) { points.erase(points.begin()); tangents.erase(tangents.begin()); distances.erase(distances.begin()); length = distances[0]; } } void Curve::calculate_distances() { distances = std::vector<float>(points.size(), 0.0f); int last = int(points.size() - 1); // measure distances from the end of the curve for (int i = last - 1; i >= 0; i--) { distances[i] = distances[i + 1] + norm(points[i + 1] - points[i]); } length = distances[0]; } void Curve::calculate_tangents() { tangents = std::vector<vec3>(points.size()); size_t last = tangents.size() - 1; tangents[0] = normalize(points[1] - points[0]); for (size_t i = 1; i < last; i++) { tangents[i] = normalize(points[i + 1] - points[i - 1]); } tangents[last] = normalize(points[last] - points[last - 1]); } float Curve::calculate_max_speeds(float v0, float vf) { max_speeds = std::vector < float >(curvatures.size()); for (int i = 0; i < curvatures.size(); i++) { max_speeds[i] = Drive::max_turning_speed(curvatures[i]); } max_speeds[0] = fminf(v0, max_speeds[0]); max_speeds[max_speeds.size() - 1] = fminf(vf, max_speeds[max_speeds.size() - 1]); for (int i = 1; i < curvatures.size(); i++) { float ds = distances[i-1] - distances[i]; float attainable_speed = maximize_speed_with_throttle( Drive::boost_accel, max_speeds[i-1], ds); max_speeds[i] = fminf(max_speeds[i], attainable_speed); } float time = 0.0f; for (int i = int(curvatures.size() - 2); i >= 0; i--) { float ds = distances[i] - distances[i+1]; float attainable_speed = maximize_speed_without_throttle( Drive::brake_accel, max_speeds[i+1], ds); max_speeds[i] = fminf(max_speeds[i], attainable_speed); time += ds / (0.5f * (max_speeds[i] + max_speeds[i+1])); } return time; } float maximize_speed_with_throttle(float accel, float v0, float sf) { float dt = 0.008333f; float s = 0.0f; float v = v0; for (int i = 0; i < 100; i++) { float dv = (Drive::throttle_accel(v) + accel) * dt; float ds = (v + 0.5f * dv) * dt; v += dv; s += ds; if (s > sf) { v -= (s - sf) * (dv / ds); break; } } return v; } float maximize_speed_without_throttle(float accel, float v0, float sf) { float dt = 0.008333f; float s = 0.0f; float v = v0; float dv = accel * dt; for (int i = 0; i < 100; i++) { float ds = (v + 0.5f * dv) * dt; v += dv; s += ds; if (s > sf) { v -= (s - sf) * (dv / ds); break; } } return v; }
26.818815
84
0.561907
kipje13
8325095eb50d42833b326ed5074e0ce3af0ed732
5,797
hpp
C++
include/hta/metric.hpp
metricq/hta
36e822e965593858327c9e4cefd434977597941e
[ "BSD-3-Clause" ]
2
2019-06-26T08:39:52.000Z
2019-07-31T12:16:05.000Z
include/hta/metric.hpp
metricq/hta
36e822e965593858327c9e4cefd434977597941e
[ "BSD-3-Clause" ]
16
2018-10-11T15:45:34.000Z
2021-09-30T12:33:18.000Z
include/hta/metric.hpp
metricq/hta
36e822e965593858327c9e4cefd434977597941e
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2018, ZIH, // Technische Universitaet Dresden, // Federal Republic of Germany // // 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 metricq 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. #pragma once #include <hta/exception.hpp> #include <hta/meta.hpp> #include <hta/types.hpp> #include <nlohmann/json_fwd.hpp> #include <chrono> #include <map> #include <memory> #include <type_traits> #include <variant> #include <vector> namespace hta { using json = nlohmann::json; namespace storage { class Metric; class Directory; } // namespace storage class Level; class Metric { protected: // These classes should not be visible outside class IntervalFactor { public: IntervalFactor() { // needed for linking only throw_exception("uninitialized IntervalFactor"); } explicit IntervalFactor(int64_t factor) : factor_(factor) { } Duration operator*(Duration duration) const { Duration::rep result; if (__builtin_mul_overflow(factor_, duration.count(), &result)) { throw_exception("integer overflow during interval multiplication"); } return Duration(result); } Duration divide_by(Duration duration) const { if (duration.count() % factor_ != 0 || duration.count() <= 0) { throw_exception("interval ", duration.count(), " not divisible by ", factor_); } auto result = duration / factor_; return Duration(result); } friend Duration operator*(Duration duration, IntervalFactor factor) { return factor * duration; } friend Duration operator/(Duration duration, IntervalFactor factor) { return factor.divide_by(duration); } private: int64_t factor_; }; public: // common explicit Metric(std::unique_ptr<storage::Metric> storage_metric); Metric(const Metric&) = delete; Metric& operator=(const Metric&) = delete; Metric(Metric&&); Metric& operator=(Metric&&); ~Metric(); const Meta meta() const; private: // common void check_read() const; void check_write() const; public: // read // infinity scopes are not supported here std::vector<Row> retrieve(TimePoint begin, TimePoint end, uint64_t min_samples, IntervalScope scope = IntervalScope{ Scope::extended, Scope::open }); std::vector<Row> retrieve(TimePoint begin, TimePoint end, Duration interval_max, IntervalScope scope = IntervalScope{ Scope::extended, Scope::open }); std::vector<TimeValue> retrieve(TimePoint begin, TimePoint end, IntervalScope scope = { Scope::closed, Scope::extended }); // TODO decide on proper name std::variant<std::vector<Row>, std::vector<TimeValue>> retrieve_flex(TimePoint begin, TimePoint end, Duration interval_max, IntervalScope scope = IntervalScope{ Scope::extended, Scope::open }, bool smooth = true); // technically this is IntervalScope{ Scope::closed, Scope::open } and used LAST semantics Aggregate aggregate(TimePoint begin, TimePoint end); size_t count(TimePoint begin, TimePoint end, IntervalScope scope = { Scope::closed, Scope::extended }); size_t count(); std::pair<TimePoint, TimePoint> range(); private: // read std::vector<Row> retrieve_raw_row(TimePoint begin, TimePoint end, IntervalScope scope = IntervalScope{ Scope::closed, Scope::extended }); public: // write void insert(TimeValue tv); void flush(); private: // write void insert(Row row); Level& get_level(Duration interval); Level restore_level(Duration interval); private: // common std::unique_ptr<storage::Metric> storage_metric_; Duration interval_min_; Duration interval_max_; IntervalFactor interval_factor_; TimePoint previous_time_; private: // write std::map<Duration, Level> levels_; }; static_assert(std::is_move_constructible_v<Metric>, "Metric is not movable."); } // namespace hta
33.703488
99
0.656546
metricq
8326e6360a86c4f511e0aa48405d1956ee818a24
370
cpp
C++
test/test.cpp
xaxxon/v8toolk
6cf23bfc0b7d20e4476aef5e0463b9316a818b90
[ "MIT" ]
41
2016-06-19T00:08:51.000Z
2021-12-05T16:40:54.000Z
test/test.cpp
xaxxon/v8-class-wrapper
6cf23bfc0b7d20e4476aef5e0463b9316a818b90
[ "MIT" ]
22
2016-07-03T21:23:27.000Z
2019-12-26T15:16:36.000Z
test/test.cpp
xaxxon/v8-class-wrapper
6cf23bfc0b7d20e4476aef5e0463b9316a818b90
[ "MIT" ]
7
2017-03-07T05:31:40.000Z
2021-09-18T10:38:24.000Z
#include "testing.h" #include "v8toolkit/javascript.h" using namespace testing; int main(int argc, char* argv[]) { // std::cerr << fmt::format("platform::init") << std::endl; v8toolkit::Platform::init(argc, argv, "../"); // std::cerr << fmt::format("platform::init done") << std::endl; testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
28.461538
67
0.637838
xaxxon
8328acd8ac2648472608414f38fea4202e9411f0
798
cpp
C++
cpp/src/hackerrank/introduction/variable_sized_arrays.cpp
shunkakinoki/code
4d67f7afb2f4c2afd39ddc7b4dd87a826ebc45a6
[ "MIT" ]
null
null
null
cpp/src/hackerrank/introduction/variable_sized_arrays.cpp
shunkakinoki/code
4d67f7afb2f4c2afd39ddc7b4dd87a826ebc45a6
[ "MIT" ]
3
2019-10-29T07:17:19.000Z
2020-02-01T04:41:53.000Z
cpp/src/hackerrank/introduction/variable_sized_arrays.cpp
shunkakinoki/code
4d67f7afb2f4c2afd39ddc7b4dd87a826ebc45a6
[ "MIT" ]
null
null
null
// Copyright 2019 Shun Kakinoki. // Reference: https://www.hackerrank.com/challenges/variable-sized-arrays/forum #include <iostream> using namespace std; int main() { int n, q; cin >> n >> q; // Create 2d Array int** a = new int*[n]; // Fill 2d Array with 1d Subarrays for (int i = 0; i < n; i++) { int k; cin >> k; // Create the 1d Subarray with the Given Length int* i_arr = new int[k]; // Fill the Subarray with K Values for (int j = 0; j < k; j++) { cin >> i_arr[j]; } a[i] = i_arr; } for (int q_num = 0; q_num < q; q_num++) { int i, j; cin >> i >> j; cout << a[i][j] << endl; } // Delete 2d Array (Each Subarray Must Be Deleted) for (int i = 0; i < n; i++) { delete[] a[i]; } delete[] a; return 0; }
17.733333
79
0.535088
shunkakinoki
8331c091e60fd4f2cd8014bbab2cf4a9c3b66c92
982
hpp
C++
core/include/cubos/core/ecs/null_storage.hpp
GameDevTecnico/cubos
51f89c9f3afc8afe502d167dadecab7dfe5b1c7b
[ "MIT" ]
2
2021-09-28T14:13:27.000Z
2022-03-26T11:36:48.000Z
core/include/cubos/core/ecs/null_storage.hpp
GameDevTecnico/cubos
51f89c9f3afc8afe502d167dadecab7dfe5b1c7b
[ "MIT" ]
72
2021-09-29T08:55:26.000Z
2022-03-29T21:21:00.000Z
core/include/cubos/core/ecs/null_storage.hpp
GameDevTecnico/cubos
51f89c9f3afc8afe502d167dadecab7dfe5b1c7b
[ "MIT" ]
null
null
null
#ifndef CUBOS_CORE_ECS_NULL_STORAGE_HPP #define CUBOS_CORE_ECS_NULL_STORAGE_HPP #include <cubos/core/ecs/storage.hpp> namespace cubos::core::ecs { /// @brief NullStorage is a Storage implementation that doesn't keep any data, made for components /// that don't hold any data and just work as tags. /// @tparam T The type to be stored in the storage. template <typename T> class NullStorage : public Storage<T> { public: T* insert(uint32_t index, T value) override; T* get(uint32_t index) override; void erase(uint32_t index) override; private: T data; }; template <typename T> T* NullStorage<T>::insert(uint32_t index, T value) { return &data; } template <typename T> T* NullStorage<T>::get(uint32_t index) { return &data; } template <typename T> void NullStorage<T>::erase(uint32_t index) { } } // namespace cubos::core::ecs #endif // ECS_NULL_STORAGE_HPP
24.55
102
0.657841
GameDevTecnico
8333c2edf2802e96eea6b72e50754e66672de391
6,992
cpp
C++
firmware/Src/PHIL/DriveSystem.cpp
Northeastern-Micromouse/Master
162d6153665da0cf58a572fc138abcd92579710d
[ "MIT" ]
null
null
null
firmware/Src/PHIL/DriveSystem.cpp
Northeastern-Micromouse/Master
162d6153665da0cf58a572fc138abcd92579710d
[ "MIT" ]
null
null
null
firmware/Src/PHIL/DriveSystem.cpp
Northeastern-Micromouse/Master
162d6153665da0cf58a572fc138abcd92579710d
[ "MIT" ]
null
null
null
#include "DriveSystem.h" phil::DriveSystem::DriveSystem( pal::Gpio* left_step, pal::Gpio* left_dir, pal::Gpio* right_step, pal::Gpio* right_dir, pal::Tim* us_tick, float width, float wheel_radius, float radians_per_step): WIDTH(width), WHEEL_RADIUS(wheel_radius), RADIANS_PER_STEP(radians_per_step), left_step_(left_step), left_dir_(left_dir), right_step_(right_step), right_dir_(right_dir), us_tick_(us_tick) { // Configure the timer to tick every us us_tick_->SetTiming(1, 80000000 / 8000000); } void phil::DriveSystem::DriveEquidistant(float distance, float velocity) { // Calculate us per step // (rad/step) / (rad/s) = (s/step) // Also calculate required angular velocity // v = rw -> w = v/r uint32_t period_us = (uint32_t)(RADIANS_PER_STEP / (velocity / WHEEL_RADIUS) * 1000000.0); // now figure out how long the whole move should take in us //uint32_t time = distance / velocity * 1000000; // now figure out how many steps should be taken // steps = desiredDistance / (distance / step) // = desiredDistance / (radius * radians/step) uint32_t steps = distance / (WHEEL_RADIUS * RADIANS_PER_STEP); // now actually drive, stopping when time is up us_tick_->SetCount(0); us_tick_->Enable(); ResetLeftStepCount(); ResetRightStepCount(); uint32_t us = 0; uint32_t period_start = 0; while (left_step_count_ < steps && right_step_count_ < steps) { // first, update our us count using the timer count if (us_tick_->GetUpdateFlag()) { us++; us_tick_->ClearUpdateFlag(); } if (us % period_us == 0) { // Time to raise the step pin left_step_->Set(true); right_step_->Set(true); period_start = us; } else if (us == (period_start + STEPPER_MOTOR_STEP_TIME)) { left_step_->Set(false); right_step_->Set(false); left_step_count_++; right_step_count_++; } } us_tick_->Disable(); } void phil::DriveSystem::DriveStraight(float distance, float velocity) { // Set both motors forward and drive an equal distance on each wheel left_dir_->Set(false); right_dir_->Set(true); DriveEquidistant(distance, velocity); } void phil::DriveSystem::DriveRelative( float left_distance, float right_distance, float average_velocity) { left_dir_->Set(false); right_dir_->Set(true); // First, figure out how much time the entire operation will take using the // given average velocity float time = ((left_distance + right_distance) / 2.0) / average_velocity; // Now compute the left and right velocities, and accordingly the time per // step of the left and right wheels float left_velocity = left_distance / time; float right_velocity = right_distance / time; // (rad/step) / (rad/s) = (s/step) // Also calculate required angular velocity // v = rw -> w = r/v uint32_t left_period = (uint32_t)(RADIANS_PER_STEP / (left_velocity / WHEEL_RADIUS) * 1000000.0); uint32_t right_period = (uint32_t)(RADIANS_PER_STEP / (right_velocity / WHEEL_RADIUS) * 1000000.0); uint32_t left_steps = left_distance / (WHEEL_RADIUS * RADIANS_PER_STEP); uint32_t right_steps = right_distance / (WHEEL_RADIUS * RADIANS_PER_STEP); ResetLeftStepCount(); ResetRightStepCount(); // Now use the tick to drive the wheels with the appropriate timing us_tick_->SetCount(0); us_tick_->Enable(); uint32_t us = 0; uint32_t left_period_start = 0; uint32_t right_period_start = 0; while (left_step_count_ < left_steps && right_step_count_ < right_steps) { // first, update our us count using the timer count if (us_tick_->GetUpdateFlag()) { us++; us_tick_->ClearUpdateFlag(); } if (us % left_period == 0) { // Time to raise the step pin left_step_->Set(true); left_period_start = us; } else if (us == (left_period_start + STEPPER_MOTOR_STEP_TIME)) { left_step_->Set(false); left_step_count_++; } if (us % right_period == 0) { // Time to raise the step pin right_step_->Set(true); right_period_start = us; } else if (us == (right_period_start + STEPPER_MOTOR_STEP_TIME)) { right_step_->Set(false); right_step_count_++; } } } void phil::DriveSystem::DriveRadius( float arc_length, float radius, float velocity) { // We are basically driving each wheel along two different arcs, each at a // slightly different radius based on the width of the robot. We can just // compute the length of these arcs and call DriveRelative: float angle = arc_length / fabs(radius); float left_radius = fabs(radius) + (radius > 0 ? 1.0 : -1.0) * WIDTH / 2.0; float right_radius = fabs(radius) - (radius > 0 ? 1.0 : -1.0) * WIDTH / 2.0; DriveRelative(left_radius * angle, right_radius * angle, velocity); } void phil::DriveSystem::Turn(float radians, float angularVelocity) { // Set motors in opposite directions and drive an equal distance on each // wheel. Positive values for radians means a clockwise turn, negative // means counter clockwise left_dir_->Set(radians < 0); right_dir_->Set(radians < 0); // Calculate the distance each wheel needs to drive // This is the arc length around the circle formed with the center being // the midpoint of the bot and the radius being half the width of the drive // system // s = r*theta float distance = (WIDTH / 2.0) * radians; // Convert the angular velocity into linear velocity (being the linear // velocity of the wheels travelling along the arc) by computing the time // taken to travel the given number of degrees and dividing the computed // arc length by this time float time = radians / angularVelocity; // Now simply drive the wheels DriveEquidistant(distance, distance / time); } uint32_t phil::DriveSystem::GetLeftStepCount() const { return left_step_count_; } uint32_t phil::DriveSystem::GetRightStepCount() const { return right_step_count_; } void phil::DriveSystem::ResetLeftStepCount() { left_step_count_ = 0; } void phil::DriveSystem::ResetRightStepCount() { right_step_count_ = 0; } float phil::DriveSystem::GetWidth() const { return WIDTH; } float phil::DriveSystem::GetWheelRadius() const { return WHEEL_RADIUS; }
31.638009
79
0.620566
Northeastern-Micromouse
8336e89c3f1483f65210fdb034f3ae29349224b6
120
cpp
C++
app/src/main/cpp/demo.cpp
CameraKit/camerakit-android-jpegtools
01a782f22bdb2fa9b2488731efc72693cd74f703
[ "MIT" ]
155
2018-01-22T19:14:47.000Z
2022-03-22T03:47:48.000Z
app/src/main/cpp/demo.cpp
CameraKit/camerakit-android-jpegtools
01a782f22bdb2fa9b2488731efc72693cd74f703
[ "MIT" ]
8
2018-03-22T23:40:28.000Z
2021-05-31T17:43:23.000Z
app/src/main/cpp/demo.cpp
CameraKit/camerakit-android-jpegtools
01a782f22bdb2fa9b2488731efc72693cd74f703
[ "MIT" ]
32
2018-01-29T05:05:32.000Z
2022-03-22T03:47:50.000Z
#include <jni.h> extern "C" JNIEXPORT void JNICALL Java_com_jpegkit_app_MainActivity_init(JNIEnv *env, jobject obj) { }
24
66
0.791667
CameraKit
833c211d4e2ca4b9236fb5327ad551adbcae2eab
2,511
cpp
C++
Application/decode.cpp
TheRising-cxf/Test
2b827482688446988e8c67ac5a099498ae810097
[ "MIT" ]
null
null
null
Application/decode.cpp
TheRising-cxf/Test
2b827482688446988e8c67ac5a099498ae810097
[ "MIT" ]
null
null
null
Application/decode.cpp
TheRising-cxf/Test
2b827482688446988e8c67ac5a099498ae810097
[ "MIT" ]
null
null
null
/** * @file decode.cpp * @author Haoxuan Zhang ([email protected]) * @brief * @version 0.1 * @date 2019-12-19 * * @copyright Copyright (c) 2019 * */ #include "decode.h" #include "ifft2d.h" Mat getDecodeImg(fftPair *encode, fftPair *origin, vector<vector<float> > &vec){ int width = encode->img.cols; int height = encode->img.rows; Mat middle(height, width, CV_32FC3, Scalar(0)); for(int k = 0; k < 3; ++k){ for(int i = 0; i < height; ++i){ for(int j = 0; j < width; ++j){ float pixel = encode->result_real[k][j][i] - origin->result_real[k][j][i]; if(pixel <= 0) middle.at<Vec3f>(i, j)[k] = 0; else if(pixel >= 1) middle.at<Vec3f>(i, j)[k] = 1; else middle.at<Vec3f>(i, j)[k] = pixel; } } } int half_height = height / 2; Mat res(height, width, CV_32FC3, Scalar(0)); for(int k = 0; k < 3; ++k){ for(int i = 0; i < half_height; ++i){ for(int j = 0; j < width; ++j){ res.at<Vec3f>(vec[0][i], vec[1][j])[k] = middle.at<Vec3f>(i, j)[k]; } } } for(int k = 0; k < 3; ++k){ for(int i = 0; i < half_height; ++i){ for(int j = 0; j < width; ++j){ res.at<Vec3f>(height - 1 - i, width - 1 - j)[k] = res.at<Vec3f>(i, j)[k]; } } } return res; } Mat decode(Mat &ifft_img, Mat &ori_img, vector<vector<float> > &vec){ fftPair origin(ori_img); fftPair encode(ifft_img); fft2d(&origin); fft2d(&encode); Mat res = getDecodeImg(&encode, &origin, vec); return res; } // Interface Mat decode(Mat img, Mat ori_img){ int ori_height = img.rows; int ori_width = img.cols; fftPair encode(img); fftPair origin(ori_img); fft2d(&encode); fft2d(&origin); int height = encode.img.rows; int width = encode.img.cols; int half_height = height / 2; vector<vector<float> > vec; vector<float> M; vector<float> N; for(int i = 0; i < half_height; ++i){ M.push_back(i); } for(int i = 0; i < width; ++i){ N.push_back(i); } getRandSequence(M, 0, half_height); getRandSequence(N, 0, width); vec.push_back(M); vec.push_back(N); Mat res = getDecodeImg(&encode, &origin, vec); resize(res, res, Size(ori_width, ori_height)); if(res.type() != CV_8UC3){ res *= 255; res.convertTo(res, CV_8UC3); } return res; }
26.15625
90
0.526483
TheRising-cxf
83417e651b53a07e58a78f4b6b462e643afc026d
1,369
cpp
C++
test/mpi/mpi_common.cpp
ricosjp/monolish-debian-package
4e8087804e8ab03484d44106599233ed5080ba54
[ "Apache-2.0" ]
172
2021-04-05T10:04:40.000Z
2022-03-28T14:30:38.000Z
test/mpi/mpi_common.cpp
ricosjp/monolish
12757f93883830a89820507d44e2eea20b5026e1
[ "Apache-2.0" ]
96
2021-04-06T01:53:44.000Z
2022-03-09T07:27:09.000Z
test/mpi/mpi_common.cpp
termoshtt/monolish
1cba60864002b55bc666da9baa0f8c2273578e01
[ "Apache-2.0" ]
8
2021-04-05T13:21:07.000Z
2022-03-09T23:24:06.000Z
#include "monolish_mpi.hpp" template <typename T> T test_sum(std::vector<T> &vec) { monolish::mpi::comm &comm = monolish::mpi::comm::get_instance(); double sum = 0; for (size_t i = 0; i < vec.size(); i++) { sum += vec[i]; } return comm.Allreduce(sum); } int main(int argc, char **argv) { if (argc != 2) { std::cout << "error!, $1:vector size" << std::endl; return 1; } size_t size = atoi(argv[1]); std::cout << "size: " << size << std::endl; // monolish::util::set_log_level(3); // monolish::util::set_log_filename("./monolish_test_log.txt"); monolish::mpi::comm &comm = monolish::mpi::comm::get_instance(); comm.Init(argc, argv); int rank = comm.get_rank(); int procs = comm.get_size(); std::cout << "I am" << rank << "/" << procs << std::endl; std::vector<double> dvec(size, 1); std::vector<float> fvec(size, 1); std::vector<int> ivec(size, 1); std::vector<size_t> svec(size, 1); comm.Barrier(); if (test_sum(dvec) != size * procs) { std::cout << "error in double" << std::endl; } if (test_sum(fvec) != size * procs) { std::cout << "error in float" << std::endl; } if (test_sum(ivec) != size * procs) { std::cout << "error in int" << std::endl; } if (test_sum(svec) != size * procs) { std::cout << "error in size_t" << std::endl; } comm.Finalize(); return 0; }
22.816667
66
0.578524
ricosjp
8343dbe73934f02650d375c56dab01cec36f0774
16,618
cxx
C++
ITS/AliITSPid.cxx
AllaMaevskaya/AliRoot
c53712645bf1c7d5f565b0d3228e3a6b9b09011a
[ "BSD-3-Clause" ]
52
2016-12-11T13:04:01.000Z
2022-03-11T11:49:35.000Z
ITS/AliITSPid.cxx
AllaMaevskaya/AliRoot
c53712645bf1c7d5f565b0d3228e3a6b9b09011a
[ "BSD-3-Clause" ]
1,388
2016-11-01T10:27:36.000Z
2022-03-30T15:26:09.000Z
ITS/AliITSPid.cxx
AllaMaevskaya/AliRoot
c53712645bf1c7d5f565b0d3228e3a6b9b09011a
[ "BSD-3-Clause" ]
275
2016-06-21T20:24:05.000Z
2022-03-31T13:06:19.000Z
//------------------------------------------------------------// // Class for identification of pions,kaons and protons in ITS // // Prior particles population (probabilities) are taken from // // Hijing event generator. // //------------------------------------------------------------// // #include <stdlib.h> #include "AliITSPid.h" //#include "TMath.h" #include <Riostream.h> #include <TClonesArray.h> #include <TVector.h> #include "AliKalmanTrack.h" #include "AliITSIOTrack.h" #include "AliITStrackV2.h" #include <TF1.h> ClassImp(AliITSPid) AliITSPid::AliITSPid(const AliITSPid &source) : TObject(source), fMxtrs(source.fMxtrs), fTrs(source.fTrs), fWpi(source.fWpi), fWk(source.fWk), fWp(source.fWp), fRpik(source.fRpik), fRppi(source.fRppi), fRpka(source.fRpka), fRp(source.fRp), fPcode(source.fPcode), fSigmin(source.fSigmin), fSilent(source.fSilent), fCutKa(source.fCutKa), fCutPr(source.fCutPr), fggpi(source.fggpi), fggka(source.fggka), fggpr(source.fggpr){ // Copy constructor. This is a function which is not allowed to be } //______________________________________________________________________ AliITSPid& AliITSPid::operator=(const AliITSPid& source){ // Assignment operator. This is a function which is not allowed to be this->~AliITSPid(); new(this) AliITSPid(source); return *this; } // Float_t AliITSPid::Qtrm(Int_t track) { // // This calculates truncated mean signal for given track. // TVector q(*( this->GetVec(track) )); Int_t ml=(Int_t)q(0); if(ml<1)return 0.; if(ml>6)ml=6; float vf[6]; Int_t nl=0; for(Int_t i=0;i<ml;i++){if(q(i)>fSigmin){vf[nl]=q(i+1);nl++;}} if(nl==0)return 0.; switch(nl){ case 1:q(6)=q(1); break; case 2:q(6)=(q(1)+q(2))/2.; break; default: for(int fi=0;fi<2;fi++){ Int_t swap; do{ swap=0; float qmin=vf[fi]; for(int j=fi+1;j<nl;j++) if(qmin>vf[j]){qmin=vf[j];vf[j]=vf[fi];vf[fi]=qmin;swap=1;}; }while(swap==1); } q(6)= (vf[0]+vf[1])/2.; break; } for(Int_t i=0;i<nl;i++){q(i+1)=vf[i];} this->SetVec(track,q); return (q(6)); } Float_t AliITSPid::Qtrm(Float_t qarr[6],Int_t narr) const{ // //This calculates truncated mean signal for given signal set. // Float_t q[6],qm,qmin; Int_t nl,ml; if(narr>0&&narr<7){ml=narr;}else{return 0;}; nl=0; for(Int_t i=0;i<ml;i++){if(qarr[i]>fSigmin){q[nl]=qarr[i];nl++;}} if(nl==0)return 0.; switch(nl){ case 1:qm=q[0]; break; case 2:qm=(q[0]+q[1])/2.; break; default: Int_t swap; for(int fi=0;fi<2;fi++){ do{ swap=0; qmin=q[fi]; for(int j=fi+1;j<nl;j++) if(qmin>q[j]){qmin=q[j];q[j]=q[fi];q[fi]=qmin;swap=1;}; }while(swap==1); } qm= (q[0]+q[1])/2.; break; } return qm; } Int_t AliITSPid::Wpik(Float_t pm,Float_t q){ //Calcutates probabilityes of pions and kaons //Returns particle code for dominant probability. Double_t par[6]; for(int i=0;i<6;i++){par[i]=fGGpi[i]->Eval(pm);} fggpi->SetParameters(par); for(int i=0;i<3;i++){par[i]=fGGka[i]->Eval(pm);} fggka->SetParameters(par); Float_t ppi=fggpi->Eval(q); Float_t pka=fggka->Eval(q); Float_t p=ppi+pka; /* if(!fSilent){ fggka->Print(); fggpi->Print(); if(p>0)cout<<" ppi,pka="<<ppi/p<<" "<<pka/p<<endl; } */ if(p>0){ ppi=ppi/p; pka=pka/p; fWp=0.; fWpi=ppi; fWk=pka; if( pka>ppi){return fPcode=321;}else{return fPcode=211;} }else{return 0;} } //----------------------------------------------------------- Int_t AliITSPid::Wpikp(Float_t pm,Float_t q){ // //Calcutates probabilityes of pions,kaons and protons. //Returns particle code for dominant probability. Double_t par[6]; for(int i=0;i<6;i++){par[i]=fGGpi[i]->Eval(pm);} fggpi->SetParameters(par); for(int i=0;i<3;i++){par[i]=fGGka[i]->Eval(pm);} fggka->SetParameters(par); for(int i=0;i<3;i++){par[i]=fGGpr[i]->Eval(pm);} fggpr->SetParameters(par); Float_t p,ppi,pka,ppr; if( q>(fggpr->GetParameter(1)+fggpr->GetParameter(2)) ) { p=1.0; ppr=1.0; ppi=pka=0.0; }else{ ppi=fggpi->Eval(q); pka=fggka->Eval(q); ppr=fggpr->Eval(q); p=ppi+pka+ppr; } if(p>0){ ppi=ppi/p; pka=pka/p; ppr=ppr/p; fWp=ppr; fWpi=ppi; fWk=pka; //if(!fSilent)cout<<" ppi,pka,ppr="<<ppi<<" "<<pka<<" "<<ppr<<endl; if( ppi>pka&&ppi>ppr ) {return fPcode=211;} else{ if(pka>ppr){return fPcode=321;}else{return fPcode=2212;} } }else{return 0;} } //----------------------------------------------------------- Int_t AliITSPid::GetPcode(TClonesArray* rps,Float_t pm) { //Returns particle code Info("GetPcode","method not implemented - Inputs TClonesArray *%x , Float_t %f",rps,pm); return 0; } //----------------------------------------------------------- Int_t AliITSPid::GetPcode(AliKalmanTrack *track) { //Returns particle code for given track. Double_t xk,par[5]; track->GetExternalParameters(xk,par); Float_t phi=TMath::ASin(par[2]) + track->GetAlpha(); if (phi<-TMath::Pi()) phi+=2*TMath::Pi(); if (phi>=TMath::Pi()) phi-=2*TMath::Pi(); Float_t lam=TMath::ATan(par[3]); Float_t pt1=TMath::Abs(par[4]); Float_t mom=1./(pt1*TMath::Cos(lam)); Float_t dedx=track->GetPIDsignal(); Int_t pcode=GetPcode(dedx/40.,mom); // cout<<"TPCtrack dedx,mom,pcode="<<dedx<<","<<mom<<","<<pcode<<endl; return pcode?pcode:211; } //------------------------------------------------------------ Int_t AliITSPid::GetPcode(AliITSIOTrack *track) { //Returns particle code for given track(V1). Double_t px,py,pz; px=track->GetPx(); py=track->GetPy(); pz=track->GetPz(); Float_t mom=TMath::Sqrt(px*px+py*py+pz*pz); //??????????????????? // Float_t dedx=1.0; Float_t dedx=track->GetdEdx(); //??????????????????? Int_t pcode=GetPcode(dedx,mom); // cout<<"ITSV1 dedx,mom,pcode="<<dedx<<","<<mom<<","<<pcode<<endl; return pcode?pcode:211; } //----------------------------------------------------------- Int_t AliITSPid::GetPcode(AliITStrackV2 *track) { //Returns particle code for given track(V2). if(track==0)return 0; // track->Propagate(track->GetAlpha(),3.,0.1/65.19*1.848,0.1*1.848); track->PropagateTo(3.,0.0028,65.19); //track->PropagateToVertex(); Not needed. (I.B.) Double_t xk,par[5]; track->GetExternalParameters(xk,par); Float_t lam=TMath::ATan(par[3]); Float_t pt1=TMath::Abs(par[4]); Float_t mom=0.; if( (pt1*TMath::Cos(lam))!=0. ){ mom=1./(pt1*TMath::Cos(lam)); }else{mom=0.;}; Float_t dedx=track->GetdEdx(); // cout<<"lam,pt1,mom,dedx="<<lam<<","<<pt1<<","<<mom<<","<<dedx<<endl; Int_t pcode=GetPcode(dedx,mom); // cout<<"ITS V2 dedx,mom,pcode="<<dedx<<","<<mom<<","<<pcode<<endl; return pcode?pcode:211; } //----------------------------------------------------------- Int_t AliITSPid::GetPcode(Float_t q,Float_t pm) { //Returns particle code for given signal and momentum. fWpi=fWk=fWp=0.; fPcode=0; if ( pm<=0.400 ) { if( q<fCutKa->Eval(pm) ) {return Pion();} else{ if( q<fCutPr->Eval(pm) ) {return Kaon();} else{return Proton();} } } if ( pm<=0.750 ){ if ( q>fCutPr->Eval(pm) ){ return Proton(); } else { return Wpik(pm,q); } } if( pm<=1.10 ){ return Wpikp(pm,q); } return fPcode; } //----------------------------------------------------------- void AliITSPid::SetCut(Int_t n,Float_t pm,Float_t pilo,Float_t pihi, Float_t klo,Float_t khi,Float_t plo,Float_t phi) { // The cut-table initializer method. fCut[n][0]=pm; fCut[n][1]=pilo; fCut[n][2]=pihi; fCut[n][3]=klo; fCut[n][4]=khi; fCut[n][5]=plo; fCut[n][6]=phi; return ; } //------------------------------------------------------------ void AliITSPid::SetVec(Int_t ntrack,const TVector& info) const { //Store track info in tracls table TClonesArray& arr=*fTrs; new( arr[ntrack] ) TVector(info); } //----------------------------------------------------------- TVector* AliITSPid::GetVec(Int_t ntrack) const { //Get given track from track table TClonesArray& arr=*fTrs; return (TVector*)arr[ntrack]; } //----------------------------------------------------------- void AliITSPid::SetEdep(Int_t track,Float_t Edep) { //Set dEdx for given track TVector xx(0,11); if( ((TVector*)fTrs->At(track))->IsValid() ) {TVector yy( *((TVector*)fTrs->At(track)) );xx=yy; } Int_t j=(Int_t)xx(0); if(j>4)return; xx(++j)=Edep;xx(0)=j; TClonesArray &arr=*fTrs; new(arr[track])TVector(xx); } //----------------------------------------------------------- void AliITSPid::SetPmom(Int_t track,Float_t Pmom) { //Set momentum for given track TVector xx(0,11); if( ((TVector*)fTrs->At(track))->IsValid() ) {TVector yy( *((TVector*)fTrs->At(track)) );xx=yy; } xx(10)=Pmom; TClonesArray &arr=*fTrs; new(arr[track])TVector(xx); } //----------------------------------------------------------- void AliITSPid::SetPcod(Int_t track,Int_t partcode) { //Set particle code for given track TVector xx(0,11); if( ((TVector*)fTrs->At(track))->IsValid() ) {TVector yy( *((TVector*)fTrs->At(track)) );xx=yy; } if(xx(11)==0) {xx(11)=partcode; fMxtrs++; TClonesArray &arr=*fTrs; new(arr[track])TVector(xx); } } //----------------------------------------------------------- void AliITSPid::Print(Int_t track) { //Prints information for given track cout<<fMxtrs<<" tracks in AliITSPid obj."<<endl; if( ((TVector*)fTrs->At(track))->IsValid() ) {TVector xx( *((TVector*)fTrs->At(track)) ); xx.Print(); } else {cout<<"No data for track "<<track<<endl;return;} } //----------------------------------------------------------- void AliITSPid::Tab(void) { //Make PID for tracks stored in tracks table if(fTrs->GetEntries()==0){cout<<"No entries in TAB"<<endl;return;} cout<<"------------------------------------------------------------------------"<<endl; cout<<"Nq"<<" q1 "<<" q2 "<<" q3 "<<" q4 "<<" q5 "<< " Qtrm " <<" Wpi "<<" Wk "<<" Wp "<<"Pmom "<<endl; cout<<"------------------------------------------------------------------------"<<endl; for(Int_t i=0;i<fTrs->GetEntries();i++) { TVector xxx( *((TVector*)fTrs->At(i)) ); if( xxx.IsValid() && xxx(0)>0 ) { TVector xx( *((TVector*)fTrs->At(i)) ); if(xx(0)>=2) { // 1)Calculate Qtrm xx(6)=(this->Qtrm(i)); }else{ xx(6)=xx(1); } // 2)Calculate Wpi,Wk,Wp this->GetPcode(xx(6),xx(10)/1000.); xx(7)=GetWpi(); xx(8)=GetWk(); xx(9)=GetWp(); // 3)Print table if(xx(0)>0){ // cout<<xx(0)<<" "; for(Int_t j=1;j<11;j++){ if(i<7){ cout.width(7);cout.precision(4);cout<<xx(j);} if(i>7){ cout.width(7);cout.precision(5);cout<<xx(j);} } cout<<endl; } // 4)Update data in TVector TClonesArray &arr=*fTrs; new(arr[i])TVector(xx); } else {/*cout<<"No data for track "<<i<<endl;*/} }// End loop for tracks } void AliITSPid::Reset(void) { //Reset tracks table for(Int_t i=0;i<fTrs->GetEntries();i++){ TVector xx(0,11); TClonesArray &arr=*fTrs; new(arr[i])TVector(xx); } } //----------------------------------------------------------- AliITSPid::AliITSPid(Int_t ntrack): fMxtrs(0), fTrs(0), fWpi(0), fWk(0), fWp(0), fRpik(0), fRppi(0), fRpka(0), fRp(0), fPcode(0), fSigmin(0.01), fSilent(0), fCutKa(0), fCutPr(0), fggpi(0), fggka(0), fggpr(0){ //Constructor for AliITSPid class fTrs = new TClonesArray("TVector",ntrack); TClonesArray &arr=*fTrs; for(Int_t i=0;i<ntrack;i++)new(arr[i])TVector(0,11); // fCutKa=new TF1("fcutka","pol4",0.05,0.4); Double_t ka[5]={25.616, -161.59, 408.97, -462.17, 192.86}; fCutKa->SetParameters(ka); // fCutPr=new TF1("fcutpr","[0]/x/x+[1]",0.05,1.1); Double_t pr[2]={0.70675,0.4455}; fCutPr->SetParameters(pr); // //---------- signal fit ---------- {//Pions fGGpi[0]=new TF1("fp1pi","pol4",0.34,1.2); Double_t parpi0[10]={ -1.9096471071e+03, 4.5354331545e+04, -1.1860738840e+05, 1.1405329025e+05, -3.8289694496e+04 }; fGGpi[0]->SetParameters(parpi0); fGGpi[1]=new TF1("fp2pi","[0]/x/x+[1]",0.34,1.2); Double_t parpi1[10]={ 1.0791668283e-02, 9.7347716496e-01 }; fGGpi[1]->SetParameters(parpi1); fGGpi[2]=new TF1("fp3pi","[0]/x/x+[1]",0.34,1.2); Double_t parpi2[10]={ 5.8191602279e-04, 9.7285601334e-02 }; fGGpi[2]->SetParameters(parpi2); fGGpi[3]=new TF1("fp4pi","pol4",0.34,1.2); Double_t parpi3[10]={ 6.6267353195e+02, 7.1595101104e+02, -5.3095111914e+03, 6.2900977606e+03, -2.2935862292e+03 }; fGGpi[3]->SetParameters(parpi3); fGGpi[4]=new TF1("fp5pi","[0]/x/x+[1]",0.34,1.2); Double_t parpi4[10]={ 9.0419011783e-03, 1.1628922525e+00 }; fGGpi[4]->SetParameters(parpi4); fGGpi[5]=new TF1("fp6pi","[0]/x/x+[1]",0.34,1.2); Double_t parpi5[10]={ 1.8324872519e-03, 2.1503968838e-01 }; fGGpi[5]->SetParameters(parpi5); }//End Pions {//Kaons fGGka[0]=new TF1("fp1ka","pol4",0.24,1.2); Double_t parka0[20]={ -1.1204243395e+02,4.6716191428e+01,2.2584059281e+03, -3.7123338009e+03,1.6003647641e+03 }; fGGka[0]->SetParameters(parka0); fGGka[1]=new TF1("fp2ka","[0]/x/x+[1]",0.24,1.2); Double_t parka1[20]={ 2.5181172905e-01,8.7566001814e-01 }; fGGka[1]->SetParameters(parka1); fGGka[2]=new TF1("fp3ka","pol6",0.24,1.2); Double_t parka2[20]={ 8.6236021573e+00,-7.0970427531e+01,2.4846827669e+02, -4.6094401290e+02,4.7546751408e+02,-2.5807112462e+02, 5.7545491696e+01 }; fGGka[2]->SetParameters(parka2); }//End Kaons {//Protons fGGpr[0]=new TF1("fp1pr","pol4",0.4,1.2); Double_t parpr0[10]={ 6.0150106543e+01,-8.8176206410e+02,3.1222644604e+03, -3.5269200901e+03,1.2859128345e+03 }; fGGpr[0]->SetParameters(parpr0); fGGpr[1]=new TF1("fp2pr","[0]/x/x+[1]",0.4,1.2); Double_t parpr1[10]={ 9.4970837607e-01,7.3573504201e-01 }; fGGpr[1]->SetParameters(parpr1); fGGpr[2]=new TF1("fp3pr","[0]/x/x+[1]",0.4,1.2); Double_t parpr2[10]={ 1.2498403757e-01,2.7845072306e-02 }; fGGpr[2]->SetParameters(parpr2); }//End Protons //----------- end fit ----------- fggpr=new TF1("ggpr","gaus",0.4,1.2); fggpi=new TF1("ggpi","gaus+gaus(3)",0.4,1.2); fggka=new TF1("ggka","gaus",0.4,1.2); //------------------------------------------------- const int kInf=10; // Ncut Pmom pilo pihi klo khi plo phi // cut[j] [0] [1] [2] [3] [4] [5] [6] //---------------------------------------------------------------- SetCut( 1, 0.12 , 0. , 0. , kInf , kInf , kInf , kInf ); SetCut( 2, 0.20 , 0. , 6.0 , 6.0 , kInf , kInf , kInf ); SetCut( 3, 0.30 , 0. , 3.5 , 3.5 , 9.0 , 9.0 , kInf ); SetCut( 4, 0.41 , 0. , 1.9 , 1.9 , 4.0 , 4.0 , kInf ); //---------------------------------------------------------------- SetCut( 5, 0.47 , 0.935, 0.139, 1.738 , 0.498 , 3.5 , kInf ); //410-470 SetCut( 6, 0.53 , 0.914, 0.136, 1.493 , 0.436 , 3.0 , kInf ); //470-530 //---------------------------------------------------------------- SetCut( 7, 0.59 , 0.895, 0.131, 1.384 , 0.290 , 2.7 , kInf ); //530-590 SetCut( 8, 0.65 , 0.887, 0.121, 1.167 , 0.287 , 2.5 , kInf ); //590-650 SetCut( 9, 0.73 , 0.879, 0.120, 1.153 , 0.257 , 2.0 , kInf ); //650-730 //---------------------------------------------------------------- SetCut( 10, 0.83 , 0.880, 0.126, 1.164 , 0.204 , 2.308 , 0.297 ); //730-830 SetCut( 11, 0.93 , 0.918, 0.145, 1.164 , 0.204 , 2.00 , 0.168 ); //830-930 SetCut( 12, 1.03 , 0.899, 0.128, 1.164 , 0.204 ,1.80 , 0.168); //------------------------ pi,K --------------------- fAprob[0][0]=1212; fAprob[1][0]=33.; // fAprob[0][i] - const for pions,cut[i+5] fAprob[0][1]=1022; fAprob[1][1]=46.2 ; // fAprob[1][i] - kaons //--------------------------------------------------- fAprob[0][2]= 889.7; fAprob[1][2]=66.58; fAprob[2][2]=14.53; fAprob[0][3]= 686.; fAprob[1][3]=88.8; fAprob[2][3]=19.27; fAprob[0][4]= 697.; fAprob[1][4]=125.6; fAprob[2][4]=28.67; //------------------------ pi,K,p ------------------- fAprob[0][5]= 633.7; fAprob[1][5]=100.1; fAprob[2][5]=37.99; // fAprob[2][i] - protons fAprob[0][6]= 469.5; fAprob[1][6]=20.74; fAprob[2][6]=25.43; fAprob[0][7]= 355.; fAprob[1][7]= 355.*(20.74/469.5); fAprob[2][7]=34.08; } //End AliITSPid.cxx
32.267961
97
0.526959
AllaMaevskaya
83456e667f22f00544aeb38fae96b3e6470b1bbc
536
cpp
C++
shopaholic.cpp
nemo201/Kattis
887711eece263965a4529048011847f7a2749fec
[ "MIT" ]
null
null
null
shopaholic.cpp
nemo201/Kattis
887711eece263965a4529048011847f7a2749fec
[ "MIT" ]
null
null
null
shopaholic.cpp
nemo201/Kattis
887711eece263965a4529048011847f7a2749fec
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define trav(a, x) for(auto& a : x) #define all(x) x.begin(), x.end() #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; int main() { vi shop; int n; cin >> n; rep(i,0,n){ int a; cin >> a; shop.push_back(a); } sort(shop.rbegin(), shop.rend()); int discount = 0; for(int i=0; i<n; i++){ if(i%3 == 2) discount += shop[i]; } cout << discount << endl; return 0; }
17.290323
49
0.567164
nemo201
83457675501cf3d38ee6c07385cfd4151b290a63
11,970
cpp
C++
src/LaneDetection/image_signal_processing.cpp
sajid-mohamed/imacs
25810df31eeeb59c65dea71eb9467bec8fb23dd7
[ "Apache-2.0" ]
1
2021-03-22T11:18:10.000Z
2021-03-22T11:18:10.000Z
src/LaneDetection/image_signal_processing.cpp
sajid-mohamed/imacs
25810df31eeeb59c65dea71eb9467bec8fb23dd7
[ "Apache-2.0" ]
null
null
null
src/LaneDetection/image_signal_processing.cpp
sajid-mohamed/imacs
25810df31eeeb59c65dea71eb9467bec8fb23dd7
[ "Apache-2.0" ]
1
2021-03-16T20:01:45.000Z
2021-03-16T20:01:45.000Z
/** @file image_signal_processing.cpp * @brief source file for ISP pipeline * * Name : image_signal_processing.cpp * * Authors : Sayandip De ([email protected]) * Sajid Mohamed ([email protected]) * * Date : March 26, 2020 * * Function : run different approximate ISP versions * * History : * 26-03-20 : Initial version. * Code is modified from https://github.com/mbuckler/ReversiblePipeline [written by Mark Buckler]. * */ #include "image_signal_processing.hpp" using namespace cv; using namespace Halide; using namespace Halide::Tools; imageSignalProcessing::imageSignalProcessing(){} //!< constructor imageSignalProcessing::~imageSignalProcessing(){} //!< destructor Mat imageSignalProcessing::approximate_pipeline(Mat the_img_input, int the_pipe_version) { using namespace std; Mat img_rev, img_fwd, v0_rev, v0_fwd; //!< img_rev: image after applying approximated reverse pipeline //!< img_fwd: image after applying approximated forward ISP pipeline //!< v0_rev: image after applying reverse pipeline without approximation //!< v0_fwd: image after applying forward ISP pipeline without approximation //// Run ISP pipeline (reverse image from VREP/webots to obtain RAW and forward ISP pipeline to obtain *.jpg) for the original image (v0 in papers) v0_rev = run_pipeline(false, the_img_input, 0); //!< v0_rev: image after applying reverse pipeline without approximation v0_fwd = run_pipeline(true, v0_rev, 0); //!< v0_fwd: image after applying forward ISP pipeline without approximation if (the_pipe_version != 0){ //!< image needs approximation //// Run reverse pipeline for the original image from the simulator to obtain RAW image img_rev = run_pipeline(false, v0_fwd, the_pipe_version); if (the_pipe_version == 7) return img_rev; //// Run forward pipeline for the RAW image img_fwd = run_pipeline(true, img_rev, the_pipe_version); } else { //!< no approximation required img_rev = v0_rev; img_fwd = v0_fwd; } //// save_images imwrite(out_string+"/output_rev.png", img_rev); imwrite(out_string+"/output_fwd_v"+to_string(the_pipe_version)+".png", img_fwd); return img_fwd; } //// Reversible pipeline function Mat imageSignalProcessing::run_pipeline(bool direction, Mat the_img_in, int the_pipe_version) { using namespace std; /////////////////////////////////////////////////////////////// /// Input Image Parameters /////////////////////////////////////////////////////////////// Halide::Buffer<uint8_t> input1; Halide::Runtime::Buffer<uint8_t> input; /// convert input Mat to Image if (the_pipe_version == 8 && direction){ //!< if the approximate_pipeline_version == 8 /// Convert the input Matrix image to RGB image in Halide::Buffer<uint8_t> format input1 = Mat2Image <Halide::Buffer<uint8_t>, uint8_t> (&the_img_in); Mat mat_input, mat_output; int width = input1.width(); int height = input1.height(); /// make_scale the input1 image Func scale = make_scale ( &input1); /// scale.realize the opencv_in_image image to input image's (width, height, 3) Buffer<float> opencv_in_image = scale.realize(width, height, 3); /// Convert scaled RGB image to BGR Matrix Mat opencv_in_mat = Image2Mat <Buffer<float>,float,323> (&opencv_in_image); // 323: OutMat(height,width,CV_32FC3); /// OpenCV remosaic the BGR Matrix OpenCV_remosaic(&opencv_in_mat); /// Convert Matrix to RGB image Halide::Runtime::Buffer<float> opencv_out = Mat2Image <Halide::Runtime::Buffer<float>,float> (&opencv_in_mat); /// initialise output_n in Halide::Runtime::Buffer<uint8_t> format using input1 image details Halide::Runtime::Buffer<uint8_t> output_n(input1.width(), input1.height(), input1.channels()); /// auto_schedule_dem_fwd() auto_schedule_dem_fwd(opencv_out, output_n); /// Convert output_n to Matrix form mat_output = Image2Mat <Halide::Runtime::Buffer<uint8_t>,uint8_t,83> (&output_n); // 83: OutMat(height,width,CV_8UC3); /// Write image to file imwrite("out_imgs/img_v8.png", mat_output); mat_input = imread("out_imgs/img_v8.png", IMREAD_COLOR); /// Convert image Matrix to input image forcompression/perception stage input = Mat2Image <Halide::Runtime::Buffer<uint8_t>,uint8_t> (&mat_input); } else{ input = Mat2Image <Halide::Runtime::Buffer<uint8_t>,uint8_t> (&the_img_in); } /////////////////////////////////////////////////////////////////////////////////////// /// Import and format model data: cpp -> halide format /// Declare model parameters vector<vector<float>> Ts, Tw, TsTw; vector<vector<float>> ctrl_pts, weights, coefs; vector<vector<float>> rev_tone; /// Load model parameters from file /// NOTE: Ts, Tw, and TsTw read only forward data /// ctrl_pts, weights, and coefs are either forward or backward /// tone mapping is always backward /// This is due to the the camera model format /////////////////////////////////////////////////////////////// /// Camera Model Parameters /////////////////////////////////////////////////////////////// /// White balance index (select white balance from transform file) /// The first white balance in the file has a wb_index of 1 /// For more information on model format see the readme int wb_index = 3; /// Actual choice = Given no. + 1 /// Number of control points const int num_ctrl_pts = 3702; Ts = get_Ts (&cam_model_path[0]); Tw = get_Tw (&cam_model_path[0], wb_index); TsTw = get_TsTw (&cam_model_path[0], wb_index); ctrl_pts = get_ctrl_pts (&cam_model_path[0], num_ctrl_pts, direction); weights = get_weights (&cam_model_path[0], num_ctrl_pts, direction); coefs = get_coefs (&cam_model_path[0], num_ctrl_pts, direction); rev_tone = get_rev_tone (&cam_model_path[0]); /// Take the transpose of the color map and white balance transform for later use vector<vector<float>> TsTw_tran = transpose_mat (TsTw); /// source of segmentation error /// If we are performing a backward implementation of the pipeline, /// take the inverse of TsTw_tran if (direction == 0) { TsTw_tran = inv_3x3mat(TsTw_tran); } using namespace Halide; using namespace Halide::Tools; /// Convert control points to a Halide image int width = ctrl_pts[0].size(); int length = ctrl_pts.size(); Halide::Runtime::Buffer<float> ctrl_pts_h(width,length); for (int y=0; y<length; y++) { for (int x=0; x<width; x++) { ctrl_pts_h(x,y) = ctrl_pts[y][x]; } } /// Convert weights to a Halide image width = weights[0].size(); length = weights.size(); Halide::Runtime::Buffer<float> weights_h(width,length); for (int y=0; y<length; y++) { for (int x=0; x<width; x++) { weights_h(x,y) = weights[y][x]; } } /// Convert the reverse tone mapping function to a Halide image width = 3; length = 256; Halide::Runtime::Buffer<float> rev_tone_h(width,length); for (int y=0; y<length; y++) { for (int x=0; x<width; x++) { rev_tone_h(x,y) = rev_tone[y][x]; } } /// Convert the TsTw_tran to a Halide image width = 3; length = 3; Halide::Runtime::Buffer<float> TsTw_tran_h(width,length); for (int y=0; y<length; y++) { for (int x=0; x<width; x++) { TsTw_tran_h(x,y) = TsTw_tran[x][y]; } } /// Convert the coefs to a Halide image width = 4; length = 3; //4 [SD] Halide::Runtime::Buffer<float> coefs_h(width,length); for (int y=0; y<length; y++) { for (int x=0; x<width; x++) { coefs_h(x,y) = coefs[x][y]; } } /////////////////////////////////////////////////////////////////////////////////////// /// Declare image handle variables Var x, y, c; //////////////////////////////////////////////////////////////////////// /// run the generator Halide::Runtime::Buffer<uint8_t> output(input.width(), input.height(), input.channels()); if (direction == 1) { switch(the_pipe_version){ case 0: /// full rev + fwd skip 0 stages auto_schedule_true_fwd_v0(input, ctrl_pts_h, weights_h, rev_tone_h, TsTw_tran_h, coefs_h, output); break; case 1: /// rev + fwd_transform_tonemap skip 1 stage auto_schedule_true_fwd_v1(input, ctrl_pts_h, weights_h, rev_tone_h, TsTw_tran_h, coefs_h, output); break; case 2: /// rev + fwd_transform_gamut skip 1 stage auto_schedule_true_fwd_v2(input, ctrl_pts_h, weights_h, rev_tone_h, TsTw_tran_h, coefs_h, output); break; case 3: /// rev + fwd_gamut_tonemap skip 1 stage auto_schedule_true_fwd_v3(input, ctrl_pts_h, weights_h, rev_tone_h, TsTw_tran_h, coefs_h, output); break; case 4: /// rev + fwd_transform skip 2 stages auto_schedule_true_fwd_v4(input, ctrl_pts_h, weights_h, rev_tone_h, TsTw_tran_h, coefs_h, output); break; case 5: /// rev + fwd_gamut skip 2 stages auto_schedule_true_fwd_v5(input, ctrl_pts_h, weights_h, rev_tone_h, TsTw_tran_h, coefs_h, output); break; case 6: /// rev + fwd_tonemap skip 2 stages auto_schedule_true_fwd_v6(input, ctrl_pts_h, weights_h, rev_tone_h, TsTw_tran_h, coefs_h, output); break; case 8: /// skip denoise {auto_schedule_true_fwd_v0(input, ctrl_pts_h, weights_h, rev_tone_h, TsTw_tran_h, coefs_h, output); /// cout << "here3.9" << endl; break; } default: /// should not happen cout << "Approximate pipeline version not defined. Default branch taken, pls check.\n"; break; }/// switch } else { auto_schedule_true_rev(input, ctrl_pts_h, weights_h, rev_tone_h, TsTw_tran_h, coefs_h, output); } /////////////////////////////////////////////////////////////////////// /// convert Image to Mat and return Mat img_out; img_out = Image2Mat <Halide::Runtime::Buffer<uint8_t>,uint8_t,83> (&output); //83: CV_8UC3 (DEFAULT for OutMat) return img_out; } Halide::Func imageSignalProcessing::make_scale( Buffer<uint8_t> *in_img ) { Var x, y, c; /// Cast input to float and scale from 8 bit 0-255 range to 0-1 range Func scale("scale"); scale(x,y,c) = cast<float>( (*in_img)(x,y,c) ) / 255; return scale; } void imageSignalProcessing::OpenCV_remosaic (Mat *InMat ) { vector<Mat> three_channels; cv::split((*InMat), three_channels); /// Re-mosaic aka re-bayer the image /// B G /// G R /// Note: OpenCV stores as BGR not RGB for (int y=0; y<(*InMat).rows; y++) { for (int x=0; x<(*InMat).cols; x++) { /// If an even row if ( y%2 == 0 ) { /// If an even column if ( x%2 == 0 ) { /// Green pixel, remove blue and red three_channels[0].at<float>(y,x) = 0; three_channels[2].at<float>(y,x) = 0; /// Also divide the green by half to account /// for interpolation reversal three_channels[1].at<float>(y,x) = three_channels[1].at<float>(y,x) / 2; } /// If an odd column else { /// Red pixel, remove blue and green three_channels[0].at<float>(y,x) = 0; three_channels[1].at<float>(y,x) = 0; } } /// If an odd row else { /// If an even column if ( x%2 == 0 ) { /// Blue pixel, remove red and green three_channels[2].at<float>(y,x) = 0; three_channels[1].at<float>(y,x) = 0; } /// If an odd column else { /// Green pixel, remove blue and red three_channels[0].at<float>(y,x) = 0; three_channels[2].at<float>(y,x) = 0; /// Also divide the green by half to account /// for interpolation reversal three_channels[1].at<float>(y,x) = three_channels[1].at<float>(y,x) / 2; } } } } cv::merge(three_channels, *InMat); }
38.365385
148
0.621136
sajid-mohamed
83458018ccf6f0cb28c4a6212476df7d9ffce49f
839
hpp
C++
libs/fnd/type_traits/include/bksge/fnd/type_traits/add_rvalue_reference.hpp
myoukaku/bksge
0f8b60e475a3f1709723906e4796b5e60decf06e
[ "MIT" ]
4
2018-06-10T13:35:32.000Z
2021-06-03T14:27:41.000Z
libs/fnd/type_traits/include/bksge/fnd/type_traits/add_rvalue_reference.hpp
myoukaku/bksge
0f8b60e475a3f1709723906e4796b5e60decf06e
[ "MIT" ]
566
2017-01-31T05:36:09.000Z
2022-02-09T05:04:37.000Z
libs/fnd/type_traits/include/bksge/fnd/type_traits/add_rvalue_reference.hpp
myoukaku/bksge
0f8b60e475a3f1709723906e4796b5e60decf06e
[ "MIT" ]
1
2018-07-05T04:40:53.000Z
2018-07-05T04:40:53.000Z
/** * @file add_rvalue_reference.hpp * * @brief add_rvalue_reference の定義 * * @author myoukaku */ #ifndef BKSGE_FND_TYPE_TRAITS_ADD_RVALUE_REFERENCE_HPP #define BKSGE_FND_TYPE_TRAITS_ADD_RVALUE_REFERENCE_HPP #include <type_traits> namespace bksge { /** * @brief 型に右辺値参照を追加する * * @tparam T * * Tがオブジェクト型もしくは関数型の場合(cv修飾や参照型でない)、T&&をメンバ型typeとして定義する。 * そうでない場合、Tをメンバ型typeとして定義する。 * * 例) * add_rvalue_reference<int>::type is int&& * add_rvalue_reference<int&>::type is int& * add_rvalue_reference<int&&>::type is int&& */ using std::add_rvalue_reference; /** * @brief add_rvalue_referenceのエイリアステンプレート */ template <typename T> using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; } // namespace bksge #endif // BKSGE_FND_TYPE_TRAITS_ADD_RVALUE_REFERENCE_HPP
20.463415
71
0.719905
myoukaku
8347af25601a39e8c8006c5c730c755372e810d2
1,679
cpp
C++
SourceCode/ChainBlockerLibrary/Base64.cpp
jamesjohnmcguire/BuildingBlocks
be38f6afd9640e56bf5448d2e00870e0128dbad1
[ "MIT" ]
null
null
null
SourceCode/ChainBlockerLibrary/Base64.cpp
jamesjohnmcguire/BuildingBlocks
be38f6afd9640e56bf5448d2e00870e0128dbad1
[ "MIT" ]
null
null
null
SourceCode/ChainBlockerLibrary/Base64.cpp
jamesjohnmcguire/BuildingBlocks
be38f6afd9640e56bf5448d2e00870e0128dbad1
[ "MIT" ]
null
null
null
#include "pch.h" #include "Base64.h" namespace ChainBlocker { std::vector<unsigned char> Base64::Decode( std::string input, size_t inputLength, size_t* outputLength) { std::vector<unsigned char> output; const unsigned char* inputBuffer = reinterpret_cast<const unsigned char*>(input.c_str()); const size_t bufferLength = 3 * inputLength / 4; unsigned char* rawBuffer = reinterpret_cast<unsigned char*>(calloc(bufferLength, 1)); int inputBufferLength = static_cast<int>(inputLength); int actualLength = EVP_DecodeBlock(rawBuffer, inputBuffer, inputBufferLength); if (actualLength > -1) { if (actualLength != bufferLength) { // log warning } size_t last = inputLength - 1; while (input[last] == '=') { actualLength--; last--; } *outputLength = actualLength; output = std::vector<unsigned char>( rawBuffer, rawBuffer + actualLength); } return output; } std::vector<char> Base64::Encode( const unsigned char* input, size_t inputLength) { std::vector<char> output; size_t encodeLength = 4 * ((inputLength + 2) / 3); // +1 for the terminating null encodeLength = encodeLength + 1; void* buffer = calloc(encodeLength, 1); char* charBuffer = reinterpret_cast<char*>(buffer); unsigned char* encodeBuffer = reinterpret_cast<unsigned char*>(charBuffer); int bufferLength = static_cast<int>(inputLength); int outputLength = EVP_EncodeBlock(encodeBuffer, input, bufferLength); if (outputLength > -1) { if (encodeLength != outputLength) { // log warning } output = std::vector<char>(charBuffer, charBuffer + outputLength); } return output; } }
21.253165
69
0.681358
jamesjohnmcguire
83496e37124bb04f9fe5fa9a6044fc384a12ea85
644
cpp
C++
include/hydro/compiler/hydro/ast/EmptyExpression.cpp
hydraate/hydro
42037a8278dcfdca68fb5cceaf6988da861f0eff
[ "Apache-2.0" ]
null
null
null
include/hydro/compiler/hydro/ast/EmptyExpression.cpp
hydraate/hydro
42037a8278dcfdca68fb5cceaf6988da861f0eff
[ "Apache-2.0" ]
null
null
null
include/hydro/compiler/hydro/ast/EmptyExpression.cpp
hydraate/hydro
42037a8278dcfdca68fb5cceaf6988da861f0eff
[ "Apache-2.0" ]
null
null
null
// // __ __ __ // / / / /__ __ ____/ /_____ ____ // / /_/ // / / // __ // ___// __ \ // / __ // /_/ // /_/ // / / /_/ / // /_/ /_/ \__, / \__,_//_/ \____/ // /____/ // // The Hydro Programming Language // #include "EmptyExpression.hpp" namespace hydro::compiler { EmptyExpression::EmptyExpression(AST *owner) : Expression{owner} {} EmptyExpression::~EmptyExpression() {} void EmptyExpression::accept(ASTVisitor *visitor) { visitor->visit(this); } } // namespace hydro::compiler
24.769231
67
0.448758
hydraate
834fc481fcc1666bca34655edf8786d76b67a8c0
5,233
cc
C++
tc/benchmarks/batchmatmul.cc
yaozhujia/TensorComprehensions
220b5902645886fc2feac61770018419ca5411bc
[ "Apache-2.0" ]
1,841
2018-02-14T01:35:40.000Z
2022-03-21T04:45:27.000Z
tc/benchmarks/batchmatmul.cc
yaozhujia/TensorComprehensions
220b5902645886fc2feac61770018419ca5411bc
[ "Apache-2.0" ]
457
2018-02-14T09:28:12.000Z
2021-01-11T03:49:11.000Z
tc/benchmarks/batchmatmul.cc
yaozhujia/TensorComprehensions
220b5902645886fc2feac61770018419ca5411bc
[ "Apache-2.0" ]
229
2018-02-14T01:43:23.000Z
2022-02-21T23:53:32.000Z
/** * Copyright (c) 2017-present, Facebook, Inc. * * 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 "batchmatmul.h" #include <iostream> #include <string> #include <vector> #include <gflags/gflags.h> #include <glog/logging.h> #include <gtest/gtest.h> #include "tc/aten/aten.h" #include "tc/aten/aten_compiler.h" #include "tc/core/cuda/cuda_mapping_options.h" #include "../test/caffe2/cuda/test_harness.h" #include "../test/caffe2/test_harness.h" #include "../test/test_harness_aten_cuda.h" #include "benchmark_fixture.h" #include "tc/c2/context.h" #include "tc/core/cuda/cuda.h" #include "tc/core/flags.h" using namespace caffe2; DEFINE_uint32(B, 500, "Batch size in Z(b, n, m) += X(b, n, kk) * Y(b, kk, m)"); DEFINE_uint32(N, 26, "N dimension in Z(b, n, m) += X(b, n, kk) * Y(b, kk, m)"); DEFINE_uint32(M, 72, "M dimension in Z(b, n, m) += X(b, n, kk) * Y(b, kk, m)"); DEFINE_uint32(K, 26, "K dimension in Z(b, n, m) += X(b, n, kk) * Y(b, kk, m)"); class BatchMatMul : public Benchmark { protected: uint32_t B, N, M, K; public: void Init(uint32_t b, uint32_t n, uint32_t m, uint32_t k) { B = b; N = n; M = m; K = k; } void runBatchMatMul(const tc::CudaMappingOptions& options); void runCaffe2BatchMatMul(); void runATenBatchMatMul(); }; void BatchMatMul::runBatchMatMul(const tc::CudaMappingOptions& options) { at::Tensor X = at::CUDA(at::kFloat).rand({B, N, M}); at::Tensor Y = at::CUDA(at::kFloat).rand({B, M, K}); auto ref_output = X.bmm(Y); auto check_fun = [&, ref_output]( const std::vector<at::Tensor>& inputs, const std::vector<at::Tensor>& outputs) { TC_CUDA_RUNTIMEAPI_ENFORCE(cudaDeviceSynchronize()); double prec = 3e-7; std::cout << "Checking expected output relative precision @" << prec; at::Tensor diff = outputs[0].sub(ref_output); checkRtol(diff, inputs, M, prec); return true; }; std::vector<at::Tensor> inputs = {X, Y}; std::string tc = R"( def batch_matmul(float(B, N, M) X, float(B, M, K) Y) -> (Z) { Z(b, n, k) +=! X(b, n, r_m) * Y(b, r_m, k) } )"; std::string suffix = std::string("_B_") + std::to_string(FLAGS_B) + std::string("_K_") + std::to_string(FLAGS_K) + std::string("_M_") + std::to_string(FLAGS_M) + std::string("_N_") + std::to_string(FLAGS_N); std::vector<tc::CudaMappingOptions> bestOptions{options}; if (FLAGS_autotune) { bestOptions = autotune(tc, "batch_matmul", inputs, options, check_fun); } Check(tc, "batch_matmul", bestOptions[0], inputs, check_fun); } void BatchMatMul::runCaffe2BatchMatMul() { Workspace w_ref; auto AddInput = AddDeterministicallyRandomInput<caffe2::CUDABackend, float>; AddInput(w_ref, {B, N, M}, "X"); AddInput(w_ref, {B, M, K}, "Y"); OperatorDef ref_def = MakeOperatorDef<caffe2::CUDABackend>("BatchMatMul", {"X", "Y"}, {"Z"}); std::unique_ptr<OperatorBase> net(CreateOperator(ref_def, &w_ref)); Reference([&]() { return true; }, [&](bool flag) { net->Run(); }); } void BatchMatMul::runATenBatchMatMul() { at::Tensor X = at::CUDA(at::kFloat).rand({B, N, M}); at::Tensor Y = at::CUDA(at::kFloat).rand({B, M, K}); Reference( [&]() { return bmm(X, Y); }, [&](at::Tensor& res) { bmm_out(res, X, Y); }); } // Generic TEST_F(BatchMatMul, TransposedBatchMatMul) { Init(FLAGS_B, FLAGS_N, FLAGS_M, FLAGS_K); runBatchMatMul(tc::CudaMappingOptions::makeNaiveMappingOptions()); } // P100 TC TEST_F(BatchMatMul, TransposedBatchMatMul_P100_autotuned_B_500_K_26_M_72_N_26) { Init(500, 26, 72, 26); runBatchMatMul( tc::options_TransposedBatchMatMul_P100_autotuned_B_500_K_26_M_72_N_26); } // P100 ATen TEST_F(BatchMatMul, TransposedBatchMatMul_ATen_P100_B_500_K_26_M_72_N_26) { Init(500, 26, 72, 26); runATenBatchMatMul(); } // P100 Caffe2 TEST_F(BatchMatMul, TransposedBatchMatMul_Caffe2_P100_B_500_K_26_M_72_N_26) { Init(500, 26, 72, 26); runCaffe2BatchMatMul(); } // V100 TC TEST_F(BatchMatMul, TransposedBatchMatMul_V100_autotuned_B_500_K_26_M_72_N_26) { Init(500, 26, 72, 26); runBatchMatMul( tc::options_TransposedBatchMatMul_V100_autotuned_B_500_K_26_M_72_N_26); } // V100 ATen TEST_F(BatchMatMul, TransposedBatchMatMul_ATen_V100_B_500_K_26_M_72_N_26) { Init(500, 26, 72, 26); runATenBatchMatMul(); } // V100 Caffe2 TEST_F(BatchMatMul, TransposedBatchMatMul_Caffe2_V100_B_500_K_26_M_72_N_26) { Init(500, 26, 72, 26); runCaffe2BatchMatMul(); } int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ::gflags::ParseCommandLineFlags(&argc, &argv, true); ::google::InitGoogleLogging(argv[0]); tc::aten::setAtenSeed(tc::initRandomSeed(), at::Backend::CUDA); return RUN_ALL_TESTS(); }
31.524096
80
0.679534
yaozhujia
835eeb9c421c54a05d8e97186d80551cc25a01ad
21,869
cpp
C++
implementations/Vulkan/texture.cpp
rsayers/abstract-gpu
48176fcb88bde7d56de662c9e49d3d0e562819e1
[ "MIT" ]
41
2016-03-25T18:14:37.000Z
2022-01-20T11:16:52.000Z
implementations/Vulkan/texture.cpp
rsayers/abstract-gpu
48176fcb88bde7d56de662c9e49d3d0e562819e1
[ "MIT" ]
4
2016-05-05T22:08:01.000Z
2021-12-10T13:06:55.000Z
implementations/Vulkan/texture.cpp
rsayers/abstract-gpu
48176fcb88bde7d56de662c9e49d3d0e562819e1
[ "MIT" ]
9
2016-05-23T01:51:25.000Z
2021-08-21T15:32:37.000Z
#include <algorithm> #include "texture.hpp" #include "texture_format.hpp" #include "texture_view.hpp" #include "buffer.hpp" #include "constants.hpp" namespace AgpuVulkan { inline enum VkImageType mapImageType(agpu_texture_type type) { switch (type) { case AGPU_TEXTURE_2D: return VK_IMAGE_TYPE_2D; case AGPU_TEXTURE_CUBE: return VK_IMAGE_TYPE_2D; case AGPU_TEXTURE_3D: return VK_IMAGE_TYPE_3D; case AGPU_TEXTURE_UNKNOWN: case AGPU_TEXTURE_BUFFER: case AGPU_TEXTURE_1D: default: return VK_IMAGE_TYPE_1D; } } inline enum VkImageViewType mapImageViewType(agpu_texture_type type, bool isArray) { switch (type) { case AGPU_TEXTURE_UNKNOWN: case AGPU_TEXTURE_BUFFER: case AGPU_TEXTURE_1D: return isArray ? VK_IMAGE_VIEW_TYPE_1D_ARRAY : VK_IMAGE_VIEW_TYPE_1D; case AGPU_TEXTURE_2D: return isArray ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D; case AGPU_TEXTURE_CUBE: return isArray ? VK_IMAGE_VIEW_TYPE_CUBE_ARRAY : VK_IMAGE_VIEW_TYPE_CUBE; case AGPU_TEXTURE_3D: return VK_IMAGE_VIEW_TYPE_3D; default: return VK_IMAGE_VIEW_TYPE_1D; } } inline enum VkComponentSwizzle mapComponentSwizzle(agpu_component_swizzle swizzle) { switch (swizzle) { case AGPU_COMPONENT_SWIZZLE_IDENTITY: return VK_COMPONENT_SWIZZLE_IDENTITY; case AGPU_COMPONENT_SWIZZLE_ONE: return VK_COMPONENT_SWIZZLE_ONE; case AGPU_COMPONENT_SWIZZLE_ZERO: return VK_COMPONENT_SWIZZLE_ZERO; case AGPU_COMPONENT_SWIZZLE_R: return VK_COMPONENT_SWIZZLE_R; case AGPU_COMPONENT_SWIZZLE_G: return VK_COMPONENT_SWIZZLE_G; case AGPU_COMPONENT_SWIZZLE_B: return VK_COMPONENT_SWIZZLE_B; case AGPU_COMPONENT_SWIZZLE_A: return VK_COMPONENT_SWIZZLE_A; default: return VK_COMPONENT_SWIZZLE_ZERO; } } static VkExtent3D getLevelExtent(const agpu_texture_description &description, int level) { VkExtent3D extent; extent.width = description.width >> level; if (extent.width == 0) extent.width = 1; extent.height = description.height >> level; if (description.type == AGPU_TEXTURE_1D || extent.height == 0) extent.height = 1; extent.depth = description.depth >> level; if (description.type != AGPU_TEXTURE_3D || extent.depth == 0) extent.depth = 1; return extent; } static void computeBufferImageTransferLayout(const agpu_texture_description &description, int level, VkSubresourceLayout *layout, VkBufferImageCopy *copy) { auto extent = getLevelExtent(description, level); memset(copy, 0, sizeof(*copy)); memset(layout, 0, sizeof(*layout)); // vkGetImageSubResource layout is not appropiate for this. if(isCompressedTextureFormat(description.format)) { auto compressedBlockSize = blockSizeOfCompressedTextureFormat(description.format); auto compressedBlockWidth = blockWidthOfCompressedTextureFormat(description.format); auto compressedBlockHeight = blockHeightOfCompressedTextureFormat(description.format); auto alignedExtent = extent; alignedExtent.width = (uint32_t)std::max(compressedBlockWidth, (extent.width + compressedBlockWidth - 1)/compressedBlockWidth*compressedBlockWidth); alignedExtent.height = (uint32_t)std::max(compressedBlockHeight, (extent.height + compressedBlockHeight - 1)/compressedBlockHeight*compressedBlockHeight); copy->imageExtent = extent; copy->bufferRowLength = alignedExtent.width; copy->bufferImageHeight = alignedExtent.height; layout->rowPitch = copy->bufferRowLength / compressedBlockWidth * compressedBlockSize; layout->depthPitch = layout->rowPitch * (copy->bufferImageHeight / compressedBlockHeight) ; layout->size = layout->depthPitch * extent.depth; } else { copy->imageExtent = extent; auto uncompressedPixelSize = pixelSizeOfTextureFormat(description.format); layout->rowPitch = (extent.width*uncompressedPixelSize + 3) & -4; layout->depthPitch = layout->rowPitch * extent.height; layout->size = layout->depthPitch; copy->bufferRowLength = uint32_t(layout->rowPitch / uncompressedPixelSize); copy->bufferImageHeight = uint32_t(extent.height); } } AVkTexture::AVkTexture(const agpu::device_ref &device) : device(device) { image = VK_NULL_HANDLE; owned = false; } AVkTexture::~AVkTexture() { if (!owned) return; if(image) vmaDestroyImage(deviceForVk->sharedContext->memoryAllocator, image, memory); } agpu::texture_ref AVkTexture::create(const agpu::device_ref &device, agpu_texture_description *description) { if (!description) return agpu::texture_ref(); if (description->type == AGPU_TEXTURE_CUBE && description->layers % 6 != 0) return agpu::texture_ref(); auto isDepthStencil = (description->usage_modes & (AGPU_TEXTURE_USAGE_DEPTH_ATTACHMENT | AGPU_TEXTURE_USAGE_STENCIL_ATTACHMENT)) != 0; // Create the image VkImageCreateInfo createInfo = {}; createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; createInfo.imageType = mapImageType(description->type); createInfo.format = mapTextureFormat(description->format, isDepthStencil); createInfo.extent.width = description->width; createInfo.extent.height = description->height; createInfo.extent.depth = description->depth; createInfo.arrayLayers = description->layers; createInfo.mipLevels = description->miplevels; createInfo.samples = mapSampleCount(description->sample_count); createInfo.tiling = VK_IMAGE_TILING_OPTIMAL; createInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; createInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; auto initialUsageMode = AGPU_TEXTURE_USAGE_NONE; if(description->type == AGPU_TEXTURE_CUBE) createInfo.flags = VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; auto usageModes = description->usage_modes; auto mainUsageMode = description->main_usage_mode; //VkImageLayout initialLayout = mapTextureUsageModeToLayout(usageModes, mainUsageMode); VkImageAspectFlags imageAspect = VK_IMAGE_ASPECT_COLOR_BIT; if(usageModes & AGPU_TEXTURE_USAGE_SAMPLED) createInfo.usage |= VK_IMAGE_USAGE_SAMPLED_BIT; if(usageModes & AGPU_TEXTURE_USAGE_STORAGE) createInfo.usage |= VK_IMAGE_USAGE_STORAGE_BIT; if (usageModes & AGPU_TEXTURE_USAGE_COLOR_ATTACHMENT) createInfo.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; if (isDepthStencil) { createInfo.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; imageAspect = 0; if (usageModes & (AGPU_TEXTURE_USAGE_DEPTH_ATTACHMENT)) imageAspect = VK_IMAGE_ASPECT_DEPTH_BIT; if (usageModes & (AGPU_TEXTURE_USAGE_STENCIL_ATTACHMENT)) imageAspect |= VK_IMAGE_ASPECT_STENCIL_BIT; } createInfo.usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; VmaAllocationCreateInfo allocInfo = {}; allocInfo.usage = mapHeapType(description->heap_type); VkImage image; VmaAllocation textureMemory; auto error = vmaCreateImage(deviceForVk->sharedContext->memoryAllocator, &createInfo, &allocInfo, &image, &textureMemory, nullptr); if(error) return agpu::texture_ref(); VkImageSubresourceRange wholeImageSubresource = {}; wholeImageSubresource.layerCount = createInfo.arrayLayers; wholeImageSubresource.levelCount = description->miplevels; wholeImageSubresource.aspectMask = imageAspect; bool success = false; auto& descriptionClearValue = description->clear_value; VkClearColorValue colorClearValue = {}; colorClearValue.float32[0] = descriptionClearValue.color.r; colorClearValue.float32[1] = descriptionClearValue.color.g; colorClearValue.float32[2] = descriptionClearValue.color.b; colorClearValue.float32[3] = descriptionClearValue.color.a; if (usageModes & (AGPU_TEXTURE_USAGE_DEPTH_ATTACHMENT | AGPU_TEXTURE_USAGE_STENCIL_ATTACHMENT)) { VkClearDepthStencilValue depthStencilClearValue = {}; depthStencilClearValue.depth = descriptionClearValue.depth_stencil.depth; depthStencilClearValue.stencil = descriptionClearValue.depth_stencil.stencil; deviceForVk->withSetupCommandListDo([&] (AVkImplicitResourceSetupCommandList &setupList) { success = setupList.setupCommandBuffer() && setupList.transitionImageUsageMode(image, usageModes, AGPU_TEXTURE_USAGE_NONE, AGPU_TEXTURE_USAGE_COPY_DESTINATION, wholeImageSubresource) && setupList.clearImageWithDepthStencil(image, wholeImageSubresource, usageModes, AGPU_TEXTURE_USAGE_COPY_DESTINATION, &depthStencilClearValue) && setupList.transitionImageUsageMode(image, usageModes, AGPU_TEXTURE_USAGE_COPY_DESTINATION, mainUsageMode, wholeImageSubresource) && setupList.submitCommandBuffer(); }); } else if (usageModes == AGPU_TEXTURE_USAGE_COLOR_ATTACHMENT) { deviceForVk->withSetupCommandListDo([&] (AVkImplicitResourceSetupCommandList &setupList) { success = setupList.setupCommandBuffer() && setupList.transitionImageUsageMode(image, usageModes, initialUsageMode, AGPU_TEXTURE_USAGE_COPY_DESTINATION, wholeImageSubresource) && setupList.clearImageWithColor(image, wholeImageSubresource, usageModes, AGPU_TEXTURE_USAGE_COPY_DESTINATION, &colorClearValue) && setupList.transitionImageUsageMode(image, usageModes, AGPU_TEXTURE_USAGE_COPY_DESTINATION, mainUsageMode, wholeImageSubresource) && setupList.submitCommandBuffer(); }); } else { if(!isCompressedTextureFormat(description->format)) { deviceForVk->withSetupCommandListDo([&] (AVkImplicitResourceSetupCommandList &setupList) { success = setupList.setupCommandBuffer() && setupList.transitionImageUsageMode(image, usageModes, initialUsageMode, AGPU_TEXTURE_USAGE_COPY_DESTINATION, wholeImageSubresource) && setupList.clearImageWithColor(image, wholeImageSubresource, usageModes, AGPU_TEXTURE_USAGE_COPY_DESTINATION, &colorClearValue) && setupList.transitionImageUsageMode(image, usageModes, AGPU_TEXTURE_USAGE_COPY_DESTINATION, mainUsageMode, wholeImageSubresource) && setupList.submitCommandBuffer(); }); } else { deviceForVk->withSetupCommandListDo([&] (AVkImplicitResourceSetupCommandList &setupList) { success = setupList.setupCommandBuffer() && setupList.transitionImageUsageMode(image, usageModes, initialUsageMode, mainUsageMode, wholeImageSubresource) && setupList.submitCommandBuffer(); }); } } if (!success) { vmaDestroyImage(deviceForVk->sharedContext->memoryAllocator, image, textureMemory); return agpu::texture_ref(); } auto result = agpu::makeObject<AVkTexture> (device); auto texture = result.as<AVkTexture> (); texture->description = *description; texture->image = image; texture->memory = textureMemory; texture->owned = true; texture->imageAspect = imageAspect; if (isCompressedTextureFormat(description->format)) { texture->texelSize = uint8_t(blockSizeOfCompressedTextureFormat(description->format)); texture->texelWidth = uint8_t(blockWidthOfCompressedTextureFormat(description->format)); texture->texelHeight = uint8_t(blockHeightOfCompressedTextureFormat(description->format)); } else { texture->texelSize = pixelSizeOfTextureFormat(description->format); texture->texelWidth = 1; texture->texelHeight = 1; } return result; } agpu::texture_ref AVkTexture::createFromImage(const agpu::device_ref &device, agpu_texture_description *description, VkImage image) { auto result = agpu::makeObject<AVkTexture> (device); auto texture = result.as<AVkTexture> (); texture->description = *description; texture->image = image; return result; } agpu::texture_view_ptr AVkTexture::createView(agpu_texture_view_description* viewDescription) { if(!viewDescription) return nullptr; if(viewDescription->type == AGPU_TEXTURE_CUBE && viewDescription->subresource_range.layer_count % 6 != 0) return nullptr; bool isArray = viewDescription->type == AGPU_TEXTURE_CUBE ? viewDescription->subresource_range.layer_count > 6 : viewDescription->subresource_range.layer_count > 1; VkImageViewCreateInfo createInfo = {}; createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; createInfo.image = image; createInfo.viewType = mapImageViewType(viewDescription->type, isArray); createInfo.format = mapTextureFormat(description.format, imageAspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)); auto &components = createInfo.components; components.r = mapComponentSwizzle(viewDescription->components.r); components.g = mapComponentSwizzle(viewDescription->components.g); components.b = mapComponentSwizzle(viewDescription->components.b); components.a = mapComponentSwizzle(viewDescription->components.a); auto &subresource = createInfo.subresourceRange; subresource.baseMipLevel = viewDescription->subresource_range.base_miplevel; subresource.levelCount = viewDescription->subresource_range.level_count; subresource.baseArrayLayer = viewDescription->subresource_range.base_arraylayer; subresource.layerCount = viewDescription->subresource_range.layer_count; subresource.aspectMask = viewDescription->subresource_range.aspect; VkImageView viewHandle; auto error = vkCreateImageView(deviceForVk->device, &createInfo, nullptr, &viewHandle); if (error) return VK_NULL_HANDLE; return AVkTextureView::create(device, refFromThis<agpu::texture> (), viewHandle, mapTextureUsageModeToLayout(viewDescription->usage_mode), *viewDescription).disown(); } agpu::texture_view_ptr AVkTexture::getOrCreateFullView() { if(!fullTextureView) { agpu_texture_view_description fullTextureViewDescription = {}; getFullViewDescription(&fullTextureViewDescription); fullTextureView = agpu::texture_view_ref(createView(&fullTextureViewDescription)); } return fullTextureView.disownedNewRef(); } agpu_error AVkTexture::getDescription(agpu_texture_description* description) { CHECK_POINTER(description); *description = this->description; return AGPU_OK; } agpu_error AVkTexture::getFullViewDescription(agpu_texture_view_description *viewDescription) { CHECK_POINTER(viewDescription); memset(viewDescription, 0, sizeof(*viewDescription)); viewDescription->type = description.type; viewDescription->format = description.format; viewDescription->sample_count = description.sample_count; viewDescription->components.r = AGPU_COMPONENT_SWIZZLE_R; viewDescription->components.g = AGPU_COMPONENT_SWIZZLE_G; viewDescription->components.b = AGPU_COMPONENT_SWIZZLE_B; viewDescription->components.a = AGPU_COMPONENT_SWIZZLE_A; viewDescription->usage_mode = description.main_usage_mode; viewDescription->subresource_range.aspect = agpu_texture_aspect(imageAspect); viewDescription->subresource_range.base_miplevel = 0; viewDescription->subresource_range.level_count = description.miplevels; viewDescription->subresource_range.base_arraylayer = 0; viewDescription->subresource_range.layer_count = description.layers; return AGPU_OK; } agpu_pointer AVkTexture::mapLevel(agpu_int level, agpu_int arrayIndex, agpu_mapping_access usageModes, agpu_region3d *region) { return nullptr; } agpu_error AVkTexture::unmapLevel() { return AGPU_UNIMPLEMENTED; } VkExtent3D AVkTexture::getLevelExtent(int level) { return AgpuVulkan::getLevelExtent(description, level); } void AVkTexture::computeBufferImageTransferLayout(int level, VkSubresourceLayout *layout, VkBufferImageCopy *copy) { return AgpuVulkan::computeBufferImageTransferLayout(description, level, layout, copy); } agpu_error AVkTexture::readTextureData(agpu_int level, agpu_int arrayIndex, agpu_int pitch, agpu_int slicePitch, agpu_pointer buffer) { return readTextureSubData(level, arrayIndex, pitch, slicePitch, nullptr, nullptr, buffer); } agpu_error AVkTexture::readTextureSubData(agpu_int level, agpu_int arrayIndex, agpu_int pitch, agpu_int slicePitch, agpu_region3d* sourceRegion, agpu_size3d* destSize, agpu_pointer buffer) { CHECK_POINTER(buffer); if ((description.usage_modes & AGPU_TEXTURE_USAGE_READED_BACK) == 0) { return AGPU_INVALID_OPERATION; } VkImageSubresourceRange range; memset(&range, 0, sizeof(range)); range.baseMipLevel = level; range.baseArrayLayer = arrayIndex; range.layerCount = 1; range.levelCount = 1; range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; VkSubresourceLayout layout; VkBufferImageCopy copy; computeBufferImageTransferLayout(level, &layout, &copy); auto extent = getLevelExtent(level); copy.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; copy.imageSubresource.mipLevel = level; copy.imageSubresource.baseArrayLayer = arrayIndex; copy.imageSubresource.layerCount = 1; copy.imageExtent = extent; agpu_error resultCode = AGPU_ERROR; deviceForVk->withReadbackCommandListDo(layout.size, 1, [&](AVkImplicitResourceReadbackCommandList &readbackList) { if(readbackList.currentStagingBufferSize < layout.size) { resultCode = AGPU_OUT_OF_MEMORY; return; } // Copy the image data into staging buffer. auto success = readbackList.setupCommandBuffer() && readbackList.transitionImageUsageMode(image, description.usage_modes, description.main_usage_mode, AGPU_TEXTURE_USAGE_COPY_SOURCE, range) && readbackList.readbackImageDataToBuffer(image, copy) && readbackList.transitionImageUsageMode(image, description.usage_modes, AGPU_TEXTURE_USAGE_COPY_SOURCE, description.main_usage_mode, range) && readbackList.submitCommandBuffer(); if(success) { auto readbackPointer = readbackList.currentStagingBufferPointer; if (agpu_uint(pitch) == layout.rowPitch && agpu_uint(slicePitch) == layout.depthPitch) { memcpy(buffer, readbackPointer, slicePitch); } else { auto srcRow = reinterpret_cast<uint8_t*> (readbackPointer); auto dstRow = reinterpret_cast<uint8_t*> (buffer); for (uint32_t y = 0; y < copy.imageExtent.height; ++y) { memcpy(dstRow, srcRow, pitch); srcRow += layout.rowPitch; dstRow += pitch; } } } resultCode = success ? AGPU_OK : AGPU_ERROR; }); return resultCode; } agpu_error AVkTexture::uploadTextureData(agpu_int level, agpu_int arrayIndex, agpu_int pitch, agpu_int slicePitch, agpu_pointer data) { return uploadTextureSubData(level, arrayIndex, pitch, slicePitch, nullptr, nullptr, data); } agpu_error AVkTexture::uploadTextureSubData (agpu_int level, agpu_int arrayIndex, agpu_int pitch, agpu_int slicePitch, agpu_size3d* sourceSize, agpu_region3d* destRegion, agpu_pointer data ) { CHECK_POINTER(data); if ((description.usage_modes & AGPU_TEXTURE_USAGE_UPLOADED) == 0) { return AGPU_INVALID_OPERATION; } VkImageSubresourceRange range = {}; range.baseMipLevel = level; range.baseArrayLayer = arrayIndex; range.layerCount = 1; range.levelCount = 1; range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; VkSubresourceLayout layout; VkBufferImageCopy copy; computeBufferImageTransferLayout(level, &layout, &copy); copy.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; copy.imageSubresource.mipLevel = level; copy.imageSubresource.baseArrayLayer = arrayIndex; copy.imageSubresource.layerCount = 1; agpu_error resultCode = AGPU_OK; deviceForVk->withUploadCommandListDo(layout.size, 1, [&](AVkImplicitResourceUploadCommandList &uploadList) { if(uploadList.currentStagingBufferSize < layout.size) { resultCode = AGPU_OUT_OF_MEMORY; return; } // Copy the image data into the staging buffer. auto bufferPointer = uploadList.currentStagingBufferPointer; auto &extent = copy.imageExtent; if (agpu_uint(pitch) == layout.rowPitch && agpu_uint(slicePitch) == layout.depthPitch && !sourceSize && !destRegion) { memcpy(bufferPointer, data, slicePitch); } else { auto srcRow = reinterpret_cast<uint8_t*> (data); auto dstRow = reinterpret_cast<uint8_t*> (bufferPointer); for (uint32_t y = 0; y < extent.height; ++y) { memcpy(dstRow, srcRow, pitch); srcRow += pitch; dstRow += layout.rowPitch; } } auto success = uploadList.setupCommandBuffer() && uploadList.transitionImageUsageMode(image, description.usage_modes, description.main_usage_mode, AGPU_TEXTURE_USAGE_COPY_DESTINATION, range) && uploadList.uploadBufferDataToImage(image, copy) && uploadList.transitionImageUsageMode(image, description.usage_modes, AGPU_TEXTURE_USAGE_COPY_DESTINATION, description.main_usage_mode, range) && uploadList.submitCommandBuffer(); resultCode = success ? AGPU_OK : AGPU_ERROR; }); return resultCode; } } // End of namespace AgpuVulkan
42.136802
190
0.728063
rsayers
835f55e717ee01d520b1b5fdafab84f9017a3aff
953
hpp
C++
maxon_epos_driver/include/maxon_epos_driver/control/ControlModeBase.hpp
farshad-heravi/maxon_driver
637688fd4cd1e6aabc4335bad53554f1bc3591bf
[ "MIT" ]
null
null
null
maxon_epos_driver/include/maxon_epos_driver/control/ControlModeBase.hpp
farshad-heravi/maxon_driver
637688fd4cd1e6aabc4335bad53554f1bc3591bf
[ "MIT" ]
null
null
null
maxon_epos_driver/include/maxon_epos_driver/control/ControlModeBase.hpp
farshad-heravi/maxon_driver
637688fd4cd1e6aabc4335bad53554f1bc3591bf
[ "MIT" ]
null
null
null
/** * @file ModeBase * @brief * @author arwtyxouymz * @date 2019-06-04 11:31:01 */ #ifndef _ModeBase_HPP #define _ModeBase_HPP #include <string> #include <vector> #include <ros/ros.h> #include "maxon_epos_driver/Device.hpp" class ControlModeBase { public: std::string name; virtual ~ControlModeBase(); virtual void init(ros::NodeHandle &motor_nh, NodeHandle &node_handle, const std::string &controller_name, const int &m_max_qc); // activate operation mode virtual void activate() = 0; // read something required for operation mode virtual void read(double &pos, double &vel, double &cur); // write commands of operation mode virtual void write(double &pos, double &vel, double &cur) = 0; protected: bool m_use_ros_unit; int m_max_qc_; NodeHandle m_epos_handle; int current_pos_, current_vel_; }; #endif // _ModeBase_HPP
23.825
135
0.655824
farshad-heravi
836029d5e6fe6b5f521d00fbbcd1dac74cc2a8c6
52,229
cpp
C++
src/JSystem/JUT/JUTFontData_Ascfont_fix12.cpp
projectPiki/pikmin2
a431d992acde856d092889a515ecca0e07a3ea7c
[ "Unlicense" ]
33
2021-12-08T11:10:59.000Z
2022-03-26T19:59:37.000Z
src/JSystem/JUT/JUTFontData_Ascfont_fix12.cpp
projectPiki/pikmin2
a431d992acde856d092889a515ecca0e07a3ea7c
[ "Unlicense" ]
6
2021-12-22T17:54:31.000Z
2022-01-07T21:43:18.000Z
src/JSystem/JUT/JUTFontData_Ascfont_fix12.cpp
projectPiki/pikmin2
a431d992acde856d092889a515ecca0e07a3ea7c
[ "Unlicense" ]
2
2022-01-04T06:00:49.000Z
2022-01-26T07:27:28.000Z
#include "types.h" #include "JSystem/JUT/ResFONT.h" const int JUTResFONT_Ascfont_fix12[] ATTRIBUTE_ALIGN(32) = { 0x464F4E54, 0x62666E31, 0x00004160, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x494E4631, 0x00000020, 0x0000000C, 0x0000000C, 0x000C0000, 0x00000000, 0x9FFFFFFF, 0x7FFFFFFF, 0x57494431, 0x000000E0, 0x0000005F, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0x000C000C, 0xEFFFEFFC, 0xF7FFFFFF, 0xFFFFF57F, 0xFFFFFFFF, 0x7FFFFFFD, 0x4D415031, 0x00000020, 0x00000020, 0x007F0000, 0xFFFFFBFF, 0xFF5FFFBF, 0xDFFFBFFF, 0xFFFFFFFE, 0x474C5931, 0x00004020, 0x0000005F, 0x000C000C, 0x00004000, 0x0000002A, 0x00030200, 0x00400000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFFFF0FFF, 0xFFFF0FFF, 0x00FF000F, 0x0FFF00FF, 0xFFF00FFF, 0xFF000FF0, 0x00000000, 0x00000000, 0xF00000FF, 0xF00000FF, 0xF000FFFF, 0xF000FFFF, 0x000000FF, 0x000000FF, 0x0000FFFF, 0x0000FFFF, 0x00FF0000, 0x00FF0000, 0xFFFFFF00, 0xFFFFFF00, 0x00FF0000, 0x00FF0000, 0xFFFFFF00, 0xFFFFFF00, 0x0000FF00, 0x0FFFFFFF, 0xFFFFFFFF, 0xFF00FF00, 0xFFFFFFFF, 0x0FFFFFFF, 0x0000FF00, 0xFFFFFFFF, 0x00000FF0, 0xFF00FFFF, 0xFF00FFFF, 0x00000FF0, 0xF0000000, 0xFF00000F, 0xFF0000FF, 0xFF000FFF, 0x0000FF00, 0x000FFF00, 0x00FFF000, 0x0FFF0000, 0xFFF00000, 0xFF000000, 0xF00FF000, 0x00FFFF00, 0x00FFFFF0, 0x0FFFFFFF, 0x0FF000FF, 0x0FFF0FFF, 0x00FFFFF0, 0x0FFFFFF0, 0xFFF00FFF, 0xFF00FFFF, 0x000000FF, 0x000000FF, 0x00000000, 0x0000000F, 0x000000FF, 0xFF0000FF, 0xFF000000, 0xF0000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xF0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000FF0, 0x0000FFF0, 0x000FFF00, 0x000FF000, 0x000FF000, 0x000FF000, 0x000FF000, 0x000FFF00, 0x0000000F, 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF0000000, 0xFF000000, 0xFFF00000, 0x0FF00000, 0x0FF00000, 0x0FF00000, 0x0FF00000, 0xFFF00000, 0x0000FF00, 0xFF00FF00, 0xFFF0FF0F, 0x0FFFFFFF, 0x00FFFFFF, 0x00FFFFFF, 0x0FFFFFFF, 0xFFF0FF0F, 0x00000000, 0xFF000000, 0xFF000000, 0xF0000000, 0x0000FFFF, 0x0000FFFF, 0xF0000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000FFFF0, 0x000FFFF0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FFFF, 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0x00000F00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000FFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000F, 0x000000FF, 0x00000FFF, 0x0000FF00, 0x000FFF00, 0x00FFF000, 0x0FFF0000, 0xFFF00000, 0xFF000000, 0xF0000000, 0x00000000, 0x0FFFFFFF, 0xFFFFFFFF, 0xFF0000FF, 0xFF000FFF, 0xFF00FFF0, 0xFF0FFF00, 0xFFFFF000, 0xFFFF0000, 0xF0000000, 0xFF00000F, 0xFF00000F, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x0FFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xF000FFFF, 0xFF00FFFF, 0xFF000000, 0xFF000000, 0xFF0000FF, 0xF00000FF, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0xFF00000F, 0xFF00000F, 0xFF00000F, 0xFF00000F, 0xFF00000F, 0xFF00000F, 0xFFFFFFFF, 0xFFFFFFFF, 0xF000FFFF, 0xF000FFFF, 0xF000FF00, 0xF000FF00, 0xF000FFFF, 0xF000FFFF, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0x0FFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF00FFFF, 0xFF00FFFF, 0x00000000, 0x00000000, 0xF0000000, 0xFF000000, 0xFF000000, 0xFF00000F, 0xFFFFFF00, 0xFFFFFF00, 0x0000FF00, 0x000FFF00, 0x00FFF000, 0x0FFF0000, 0xFFF00000, 0xFF000000, 0x0FFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x0FFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xF0000FFF, 0xFF00FFFF, 0xFF00FF00, 0xFF00FF00, 0xF000FFFF, 0xFF000FFF, 0xFF000000, 0xFF000000, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x000FFF00, 0x000FFF00, 0x00000000, 0x00000000, 0x00000000, 0x000FFF00, 0x00000000, 0x00000000, 0x0000000F, 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x0000000F, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0x000000FF, 0x00000FFF, 0x0000FFF0, 0x000FFF00, 0x00FFF000, 0x00FFF000, 0x000FFF00, 0x0000FFF0, 0x00000000, 0x00000000, 0x00000000, 0x000000FF, 0x000000FF, 0x00000000, 0x00000000, 0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFF000, 0x00000000, 0x00000000, 0xFFFFF000, 0x00FF0000, 0x00FFF000, 0x000FFF00, 0x0000FFF0, 0x00000FFF, 0x00000FFF, 0x0000FFF0, 0x000FFF00, 0x00000FFF, 0x0000FFFF, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0x0FFFFF00, 0xFFFFF000, 0xFF000000, 0x00000000, 0x00FFFFFF, 0x0FFFFFFF, 0xFFF0000F, 0xFF00FF00, 0xFF0FFFF0, 0xFF0FFFFF, 0xFF00FFFF, 0xFFF00000, 0x00000FFF, 0xF000FFFF, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FFFF, 0xF000FFFF, 0x0000FF00, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFFF00, 0x0000FF00, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xF0000FFF, 0xFF00FFFF, 0xFF00FF00, 0xFF00FF00, 0xF000FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF00000F, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF00000F, 0x0000FFFF, 0xF000FFFF, 0xFF00FF00, 0xFF00FF00, 0xFF00FFFF, 0xFF00FFFF, 0xFF00FF00, 0xFF00FF00, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFF000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000FFF, 0xFF00FFFF, 0x0000FF00, 0x0000FF00, 0xF000FF00, 0xF000FF00, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000FFF, 0xFF000FFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFF000, 0xFFFFF000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000FFF, 0x00000FFF, 0x0000000F, 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF00, 0xF000FF00, 0xF000FF00, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x0000FF00, 0x000FFF00, 0x00FFF000, 0x0FFF0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x000000FF, 0x000000FF, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FFF0, 0x0000FFFF, 0x0000FFFF, 0x00FF0000, 0x00FF0000, 0x00000000, 0x00000000, 0x0000FF00, 0x000FFF00, 0x00FFFF00, 0xFFFFFF00, 0xFFFFFFFF, 0x0000FF00, 0x00000000, 0x00000000, 0xFF000000, 0xFFF00000, 0xFFFF0000, 0xFFFFF000, 0xF000FFF0, 0x0000FF00, 0x00000000, 0x00000000, 0xFF000FFF, 0xFF00FFFF, 0xFF00FF00, 0xFF00FF00, 0x00FFFF00, 0x000FF000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0xFFFFFF0F, 0x0FFFF000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xF0000FFF, 0xFF00FFFF, 0xFF00FF00, 0xFF00FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0x0000FFF0, 0x00000FF0, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0x0000000F, 0x0000000F, 0x00000000, 0x00000000, 0xF0000FFF, 0xFF00FFFF, 0xFF00FF00, 0xFF00FF00, 0xFF000000, 0xF0000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0xFF00FF00, 0x0000FF00, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000FF00, 0x0000FF00, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF00, 0x0000FF00, 0x0000FF00, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000FF0, 0x0000FFF0, 0x000FFF00, 0x000FF000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x000FFF00, 0x000FFF00, 0x00000000, 0x00000000, 0xFF000000, 0xFFF0000F, 0x0FFF00FF, 0x00FFFFFF, 0x0000FFF0, 0x0000FF00, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FFF0, 0xF0000FFF, 0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FF00, 0x000FFF00, 0x00FFF000, 0xFFFF0000, 0xFFFFFFFF, 0x0FFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x000000FF, 0x00000FFF, 0xFF00000F, 0xF000000F, 0x00000000, 0x00000000, 0xFF00000F, 0xFF00000F, 0xF000000F, 0x0000000F, 0xFFF00000, 0xFFF00000, 0x00000000, 0x00000000, 0xFFF00000, 0xFFF00000, 0xF0000000, 0xF0000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFF000000, 0xFFF00000, 0x0FFF0000, 0x00FFF000, 0xFF00FFFF, 0xFF00FFFF, 0x00000000, 0x00000000, 0x0000000F, 0x0000000F, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFF000, 0x00000000, 0x00000000, 0xFFF00000, 0xFFF00000, 0x0FF00000, 0x0FF00000, 0x0000000F, 0x0000000F, 0x00000000, 0x00000000, 0x0000FF00, 0x000FFFF0, 0x00FFFFFF, 0x0FFF00FF, 0xF000FFFF, 0xF000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF0000000, 0xFFFFFF00, 0xFFFFF000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0x0FFFFFFF, 0x00000000, 0x00000000, 0x00FFFF00, 0x00FFFF00, 0x00FF0000, 0x00FFF000, 0xFF0000FF, 0xF00000FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FFFF, 0x0000FFFF, 0xF0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0xFFFFFFFF, 0x0FFFFFFF, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFF00FFFF, 0xF000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000FFF, 0xF000FFFF, 0xFFFFFF00, 0xFFFFF000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0x000FFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00FFFFFF, 0x000000FF, 0x000000FF, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000FFF, 0xFF00FFFF, 0xF0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0x00000FFF, 0x000000FF, 0x00000000, 0x00000000, 0x0000FFFF, 0x000FFFFF, 0x000FF000, 0x000FF000, 0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000FFF, 0x0000FFFF, 0xFFFFF000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0x00FFF000, 0x00FF0000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF0000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x0FFFFFFF, 0x00FFFFFF, 0x00000000, 0x00000000, 0x000000FF, 0x000000FF, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000FFF00, 0x00FFFF00, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0xFF00FFFF, 0xF0000FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FFFF, 0x0000FFFF, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xF000FFFF, 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF0000FFF, 0xFF00FFFF, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000FFFF, 0x00000FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF0000FFF, 0xFF00FFFF, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0FF00FFF, 0x0FF0FFFF, 0xFF000FFF, 0xFF000FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF0000FFF, 0xFF00FFFF, 0xFFFFF000, 0xFFFFF000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000F, 0x0000000F, 0xFF00000F, 0xFFF0000F, 0x0FFFFFFF, 0x00FFFFFF, 0x00000000, 0x00000000, 0xF000FFFF, 0xF000FFFF, 0xF000FF00, 0xF000FF00, 0xF000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0xFFF00000, 0xFFF00000, 0x0FFF0000, 0x00FFF000, 0x000FFF00, 0x0000FF00, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x0000FF0F, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0xFF00FF00, 0xFF00FF00, 0x00000000, 0x00000000, 0xFFF0FF00, 0xFF00FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0xFF0FFF00, 0xFF00FFF0, 0xFF000FFF, 0xFF0000FF, 0xFF00000F, 0xFF000000, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FFFF, 0xFF000FFF, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFF000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF00FF00, 0xF000FF00, 0x0000FF00, 0x0000FF00, 0x0000FFFF, 0x00000FFF, 0x00000000, 0x00000000, 0xFF00FF00, 0xFFF0FF00, 0x0FFFFF00, 0x00FFF000, 0xFFFFFF00, 0xFFF0FF00, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000FFF, 0xFF0000FF, 0xFF00000F, 0xFF000000, 0x00000000, 0x00000000, 0xFF00FFFF, 0xF0000FFF, 0x00000000, 0xF0000000, 0xFF00FFFF, 0xFF00FFFF, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFF000, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FFFF, 0x00000FFF, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFF000, 0x00000000, 0x00000000, 0xFF000000, 0xFFF0000F, 0x0FFF00FF, 0x00FFFFFF, 0x000FFFF0, 0x0000FF00, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF0F, 0xF000FFFF, 0x0000FFFF, 0x0000FFF0, 0x0000FF00, 0x00000000, 0x00000000, 0xFF00FF00, 0xFFF0FF00, 0xFFFFFF00, 0x00FFFF00, 0x000FFF00, 0x0000FF00, 0x00000000, 0x00000000, 0x000FFFF0, 0x000FFFF0, 0x00FFFFFF, 0x0FFF00FF, 0xFFF0000F, 0xFF000000, 0x00000000, 0x00000000, 0x0000000F, 0x00000000, 0x00000000, 0xF00000F0, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFFF00000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x0000FFF0, 0x000FFF00, 0x00FFF000, 0x0FFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x0000000F, 0x0000000F, 0x0000000F, 0x0000000F, 0xFF00000F, 0xFF00000F, 0x00000000, 0x00000000, 0xF0000000, 0xF0000000, 0xF0000000, 0xF0000000, 0xFFF00000, 0xFFF00000, 0x00000000, 0x00000000, 0x000FFF00, 0x0000FFF0, 0x00000FFF, 0x000000FF, 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF0000000, 0xFF00000F, 0xFF00000F, 0x00000000, 0x00000000, 0x0FF00000, 0x0FF00000, 0x0FF00000, 0x0FF00000, 0xFFF00000, 0xFFF00000, 0x00000000, 0x00000000, 0x0FF0000F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FFFF, 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0x000FFF00, 0x0000FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000FFF, 0x0000FFFF, 0x0000FF00, 0x0000FFFF, 0x00000FFF, 0x00000000, 0x00000000, 0x0000FF00, 0xFFFFFF00, 0xFFFFFF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FFFF, 0xF0000FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0x0FFFFFFF, 0x0FF00000, 0x0FF00000, 0x0FF00000, 0x0FFFFFFF, 0x00FFFFFF, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FFFF, 0xFF00FFFF, 0xFF00FF00, 0xFF00FFFF, 0xFF000FFF, 0x00000000, 0x00000000, 0x0000FF00, 0xFFFFFF00, 0xFFFFF000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x000FF000, 0x000FF000, 0x000FF000, 0x000FF000, 0x00000000, 0x00000000, 0xF000FF00, 0xF000FF00, 0x0000FFFF, 0x00000FFF, 0x00000000, 0x00000000, 0x00000FFF, 0x00000FFF, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFF000, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF, 0x000000FF, 0x0FF000FF, 0x0FFFFFFF, 0x00FFFFF0, 0x0000FF00, 0x0000FFFF, 0x0000FFFF, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x0FFF0000, 0xFFF00000, 0xFFF00000, 0x0FFF0000, 0x00FFFF00, 0x000FFF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FFFF, 0x00000FFF, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0xF000FF00, 0xF000FF00, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FFFF, 0xFF000FFF, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFF000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF00FF00, 0xFF00FF00, 0xFF00FFFF, 0xF0000FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFFF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0FFFFF00, 0x0FFFF000, 0x0FFF0000, 0x0FF00000, 0x0FF00000, 0x0FF00000, 0x00000000, 0x00000000, 0xFF00FF00, 0x0000FFFF, 0x00000FFF, 0x00000000, 0x0000FFFF, 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0xFFFFF000, 0xFFFFFF00, 0x0000FF00, 0xFFFFFF00, 0xFFFFF000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000FF000, 0x000FF000, 0xFFFFFFFF, 0xFFFFFFFF, 0x000FF000, 0x000FF000, 0x000FF000, 0x000FF000, 0x00000000, 0x00000000, 0xF000FF00, 0xF000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFF0000F, 0x0FFF00FF, 0x00FFFFFF, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FF00, 0xFF00FF00, 0xFF00FF0F, 0xF000FFFF, 0x0000FFFF, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0xFF00FF00, 0xFFF0FF00, 0xFFFFFF00, 0x00FFFF00, 0x00000000, 0x00000000, 0xFF000000, 0xFFF0000F, 0x0FFF00FF, 0x00FFFFFF, 0x00FFFFFF, 0x0FFF00FF, 0x00000000, 0x00000000, 0xFF00FF00, 0xFF00FFF0, 0xF0000FFF, 0x000000FF, 0x0000000F, 0xF0000000, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x000FFF00, 0xF0FFF000, 0xFFFF0000, 0xFFF00000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000FFF, 0x0000FFF0, 0x000FFF00, 0x00FFF000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0x00000FFF, 0x00000FFF, 0x00000000, 0x00000000, 0x00FF0000, 0x0FFF0000, 0xFFF00000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFF00000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x000000FF, 0x000000FF, 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000F, 0x00000000, 0xF0000000, 0xFF000000, 0xFF000000, 0xFFFFF000, 0xFFFFF000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00FFF000, 0x0FFFFF0F, 0xFFF0FFFF, 0xFF000FFF, 0x00000000, 0x0000F0F0, 0x00000000, 0x0000F000, 0xFF000000, 0xFF00F000, 0xF0000000, 0x0000F000, 0x00000000, 0xF0F0F0F0, 0x00000000, 0x000000F0, 0x00000000, 0x000000F0, 0x00000000, 0x000000F0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000FFFFF, 0x0000FFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FFFF, 0x00000FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFF00, 0xFFFFFF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000FFFF0, 0x0000FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FFF0, 0x0000FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000FFF00, 0x0000FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFF0000F, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF00000F, 0xFF0000FF, 0x00000FFF, 0x00000FF0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xF0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0FFF0000, 0x00FF0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000FF, 0x000000FF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xF0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000F000, 0x00000000, 0x0000F0F0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000000F0, 0x00000000, 0xF0F0F0F0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
134.958656
139
0.802753
projectPiki
83657a83df638e52db271108ef1b9c692a20ca10
8,178
cpp
C++
10-11/JackTokenizer.cpp
jomiller/nand2tetris
4be20996e1b5185654ef4de5234a9543f957d6fc
[ "MIT" ]
1
2020-10-13T07:06:37.000Z
2020-10-13T07:06:37.000Z
10-11/JackTokenizer.cpp
jomiller/nand2tetris
4be20996e1b5185654ef4de5234a9543f957d6fc
[ "MIT" ]
null
null
null
10-11/JackTokenizer.cpp
jomiller/nand2tetris
4be20996e1b5185654ef4de5234a9543f957d6fc
[ "MIT" ]
null
null
null
/* * This file is part of Nand2Tetris. * * Copyright © 2013-2020 Jonathan Miller * * 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 "JackTokenizer.h" #include "JackUtil.h" #include <Assert.h> #include <Util.h> #include <boost/algorithm/string/classification.hpp> #include <boost/lexical_cast.hpp> #include <frozen/unordered_set.h> #include <algorithm> #include <locale> #include <string_view> #include <utility> n2t::JackTokenizer::TokenizerFunction::TokenizerFunction(unsigned int* lineNumber) : m_lineNumber{lineNumber} { } void n2t::JackTokenizer::TokenizerFunction::reset() { if (m_lineNumber) { *m_lineNumber = 0; } m_lineCount = 0; } #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4706) // assignment within conditional expression #endif bool n2t::JackTokenizer::TokenizerFunction::operator()(std::istreambuf_iterator<char>& next, std::istreambuf_iterator<char> end, std::string& tok) { tok.clear(); if (m_lineNumber) { *m_lineNumber += m_lineCount; } m_lineCount = 0; // skip past all whitespace and comments bool isSpace = false; std::locale loc; while ((next != end) && ((isSpace = std::isspace(*next, loc)) || (*next == '/'))) { if (isSpace) { if (*next == '\n') { ++m_lineCount; } ++next; } else // (*next == '/') { char curr = *next; ++next; if (next == end) { tok += curr; return true; } if (*next == '/') // comment to end of line { for (++next; (next != end) && (*next != '\n'); ++next) { } if (next != end) { ++m_lineCount; ++next; } } else if (*next == '*') /* comment until closing */ /** or API documentation comment */ { curr = *next; ++next; if (next != end) { curr = *next; } for (++next; (next != end) && ((curr != '*') || (*next != '/')); ++next) { if (curr == '\n') { ++m_lineCount; } curr = *next; } if (next != end) { ++next; } } else { tok += curr; return true; } } } if (next == end) { return false; } if (isDelimiter(*next)) { if (*next == '"') // string constant { do { tok += *next; ++next; } while ((next != end) && (*next != '\r') && (*next != '\n') && (*next != '"')); if (*next == '"') { tok += *next; ++next; } } else // delimiter character { tok += *next; ++next; } } else { // append all the non-delimiter characters for (; (next != end) && !std::isspace(*next, loc) && !isDelimiter(*next); ++next) { tok += *next; } } return true; } #ifdef _MSC_VER #pragma warning(pop) #endif bool n2t::JackTokenizer::TokenizerFunction::isDelimiter(char c) { static constexpr std::string_view delimiters{"{}()[].,;+-*/&|~<=>\""}; return (delimiters.find(c) != std::string_view::npos); } n2t::JackTokenizer::JackTokenizer(const std::filesystem::path& filename) : m_filename{filename.filename().string()}, m_file{filename.string().data()} { throwUnless<std::runtime_error>(m_file.good(), "Could not open input file ({})", filename.string()); m_fileIter = boost::make_token_iterator<std::string>( std::istreambuf_iterator<char>(m_file), std::istreambuf_iterator<char>(), TokenizerFunction(&m_lineNumber)); m_lineNumber = 1; } bool n2t::JackTokenizer::hasMoreTokens() const { static const TokenIterator fileEnd; return (m_fileIter != fileEnd); } void n2t::JackTokenizer::advance() { auto currentToken = readNextToken(); const auto key = toKeyword(currentToken); if (key.second) { m_tokenType = TokenType::Keyword; m_keyword = key.first; return; } // clang-format off static constexpr auto symbols = frozen::make_unordered_set<char>( { '{', '}', '(', ')', '[', ']', '.', ',', ';', '+', '-', '*', '/', '&', '|', '~', '<', '=', '>' }); // clang-format on if (currentToken.length() == 1) { const auto iter = symbols.find(currentToken.front()); // NOLINT(readability-qualified-auto) if (iter != symbols.end()) { m_tokenType = TokenType::Symbol; m_symbol = *iter; return; } } if (currentToken.front() == '"') { throwUnless( currentToken.back() == '"', "Expected closing double quotation mark in string constant ({})", currentToken); m_tokenType = TokenType::StringConst; m_stringVal = currentToken.substr(/* __pos = */ 1, currentToken.length() - 2); return; } if (std::all_of(currentToken.begin(), currentToken.end(), boost::is_digit())) { try { m_intVal = boost::lexical_cast<int16_t>(currentToken); } catch (const boost::bad_lexical_cast&) { throwAlways("Integer constant ({}) is too large", currentToken); } m_tokenType = TokenType::IntConst; } else { throwUnless( !std::isdigit(currentToken.front(), std::locale{}), "Identifier ({}) begins with a digit", currentToken); m_tokenType = TokenType::Identifier; m_identifier = std::move(currentToken); } } n2t::TokenType n2t::JackTokenizer::tokenType() const { return m_tokenType; } n2t::Keyword n2t::JackTokenizer::keyword() const { N2T_ASSERT(m_tokenType == TokenType::Keyword); return m_keyword; } char n2t::JackTokenizer::symbol() const { N2T_ASSERT(m_tokenType == TokenType::Symbol); return m_symbol; } const std::string& n2t::JackTokenizer::identifier() const { N2T_ASSERT(m_tokenType == TokenType::Identifier); return m_identifier; } int16_t n2t::JackTokenizer::intVal() const { N2T_ASSERT(m_tokenType == TokenType::IntConst); return m_intVal; } const std::string& n2t::JackTokenizer::stringVal() const { N2T_ASSERT(m_tokenType == TokenType::StringConst); return m_stringVal; } std::string n2t::JackTokenizer::readNextToken() { throwUnless(hasMoreTokens(), "Unexpected end of file reached"); return *m_fileIter++; }
26.638436
120
0.534483
jomiller
83674a979c998d35be2cbf41aec0226e3adb034c
4,397
cpp
C++
apps/PhotoconsistencyVisualOdometry/src/CRGBDGrabberRawlog.cpp
doctorwk007/photoconsistency-visual-odometry
861706c27bba2993e775131b6622c66d3b663439
[ "BSD-3-Clause" ]
7
2017-01-09T16:58:50.000Z
2021-08-23T15:44:51.000Z
apps/PhotoconsistencyVisualOdometry/src/CRGBDGrabberRawlog.cpp
doctorwk007/photoconsistency-visual-odometry
861706c27bba2993e775131b6622c66d3b663439
[ "BSD-3-Clause" ]
null
null
null
apps/PhotoconsistencyVisualOdometry/src/CRGBDGrabberRawlog.cpp
doctorwk007/photoconsistency-visual-odometry
861706c27bba2993e775131b6622c66d3b663439
[ "BSD-3-Clause" ]
1
2019-11-23T09:40:49.000Z
2019-11-23T09:40:49.000Z
/* * Photoconsistency-Visual-Odometry * Multiscale Photoconsistency Visual Odometry from RGBD Images * Copyright (c) 2012, Miguel Algaba Borrego * * http://code.google.com/p/photoconsistency-visual-odometry/ * * 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 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 <COPYRIGHT HOLDER> 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 "../include/CRGBDGrabberRawlog.h" #include <iostream> CRGBDGrabberRawlog::CRGBDGrabberRawlog(const std::string &rawlog_file = std::string()) { //Open the rawlog file dataset = new mrpt::utils::CFileGZInputStream(); if (!dataset->open(rawlog_file)) throw std::runtime_error("Couldn't open rawlog dataset file for input..."); // Set external images directory: mrpt::utils::CImage::IMAGES_PATH_BASE = mrpt::slam::CRawlog::detectImagesDirectory(rawlog_file); endGrabbing = false; lastTimestamp = 0; } //CRGBDGrabberRawlog::~CRGBDGrabberRawlog(){} void CRGBDGrabberRawlog::grab(CFrameRGBD* framePtr) { bool grabbed=false; while(!grabbed) { //Read observations until we get a CObservation3DRangeScan mrpt::slam::CObservationPtr obs; do { try { *dataset >> obs; } catch (std::exception &e) { throw std::runtime_error( std::string("\nError reading from dataset file (EOF?):\n")+std::string(e.what()) ); } } while (!IS_CLASS(obs,CObservation3DRangeScan)); // We have one observation: currentObservationPtr = CObservation3DRangeScanPtr(obs); if(currentObservationPtr->timestamp>lastTimestamp) //discard frames grabbed before { currentObservationPtr->load(); // *Important* This is needed to load the range image if stored as a separate file. if (currentObservationPtr->hasRangeImage && currentObservationPtr->hasIntensityImage) { //Retain the RGB image of the current frame cv::Mat rgbImage = cv::Mat((IplImage *) currentObservationPtr->intensityImage.getAs<IplImage>()).clone(); framePtr->setRGBImage(rgbImage); //Retain the depth image of the current frame cv::Mat depthImage(rgbImage.rows,rgbImage.cols,CV_32FC1); mrpt::math::CMatrix depthImageMRPT = currentObservationPtr->rangeImage; #pragma omp parallel for for(int i=0;i<depthImage.rows;i++) { for(int j=0;j<depthImage.cols;j++) { depthImage.at<float>(i,j)=depthImageMRPT(i,j); } } framePtr->setDepthImage(depthImage); //Retain the timestamp of the current frame framePtr->setTimeStamp(currentObservationPtr->timestamp); grabbed=true; } } } }
40.33945
126
0.650216
doctorwk007
83698a1cd3160d74beed9123c0bd2a3d5964362e
2,998
cpp
C++
lib/timers/backends/src/win32/backend.cpp
voivoid/CppMockIO
510318d188662166370fb16ba83faa1817e445bb
[ "MIT" ]
null
null
null
lib/timers/backends/src/win32/backend.cpp
voivoid/CppMockIO
510318d188662166370fb16ba83faa1817e445bb
[ "MIT" ]
null
null
null
lib/timers/backends/src/win32/backend.cpp
voivoid/CppMockIO
510318d188662166370fb16ba83faa1817e445bb
[ "MIT" ]
null
null
null
#include "CppMockIO/timers/backend.h" #include <mutex> #include <stdexcept> #include <cassert> #define WIN32_LEAN_AND_MEAN #include <sdkddkver.h> #include <Windows.h> namespace CppMockIO { namespace timers { namespace backend { namespace { void safe_run_action(const runnable& runnable) { try { runnable.action(); } catch (const std::exception & ex) { } } HANDLE TimerQueue = {}; VOID NTAPI scheduled_timer_callback( PVOID param, BOOLEAN ) { std::unique_ptr<runnable> runnable( reinterpret_cast<runnable*>( param ) ); safe_run_action( *runnable ); while (!runnable->timer_handle){} assert(TimerQueue); const auto is_deleted = ::DeleteTimerQueueTimer(TimerQueue, runnable->timer_handle, NULL); if (!is_deleted) { // TODO: handle error } } VOID NTAPI timer_callback(PVOID param, BOOLEAN) { std::unique_ptr<runnable> runnable(reinterpret_cast<runnable*>(param)); safe_run_action(*runnable); } handle create_timer(timeout timeout, std::unique_ptr<runnable> runnable, bool is_scheduled) { assert(TimerQueue); HANDLE timer_handle{}; const auto callback = is_scheduled ? &scheduled_timer_callback : &timer_callback; BOOL created = ::CreateTimerQueueTimer( &timer_handle, TimerQueue, callback, runnable.get(), static_cast<DWORD>(timeout), 0, WT_EXECUTEONLYONCE ); if (!created) { throw std::runtime_error("::CreateTimerQueueTimer failed"); } runnable->timer_handle = timer_handle; runnable.release(); return timer_handle; } } void init() { assert( !TimerQueue ); TimerQueue = ::CreateTimerQueue(); if ( !TimerQueue ) { throw std::runtime_error( "::CreateTimerQueue failed" ); } } void deinit() { assert( TimerQueue ); BOOL is_deleted = ::DeleteTimerQueueEx( TimerQueue, NULL ); if ( !is_deleted ) { throw std::runtime_error( "::DeleteTimerQueueEx failed" ); } } void schedule( timeout timeout, std::unique_ptr<runnable> runnable ) { create_timer(timeout, std::move(runnable), false ); } timer start( timeout timeout, std::unique_ptr<runnable> runnable ) { auto timer = create_timer( timeout, std::move( runnable ), true ); return{ timer }; } void stop( const timer& timer ) { assert( TimerQueue ); BOOL is_deleted = ::DeleteTimerQueueTimer( TimerQueue, timer.handle, INVALID_HANDLE_VALUE ); if ( !is_deleted ) { throw std::runtime_error( "::DeleteTimerQueueTimer failed" ); } } } } }
24.983333
156
0.56938
voivoid
836c2a34119e0046901bd9d0f46ac6b369d56f94
5,996
hxx
C++
externals/src/moderngpu/loadstore.hxx
aka-chris/mini
608751ff11f74e1ee59222399cbf6c9ee92208fb
[ "Apache-2.0" ]
216
2021-07-21T02:24:54.000Z
2021-07-30T03:33:10.000Z
externals/src/moderngpu/loadstore.hxx
aka-chris/mini
608751ff11f74e1ee59222399cbf6c9ee92208fb
[ "Apache-2.0" ]
null
null
null
externals/src/moderngpu/loadstore.hxx
aka-chris/mini
608751ff11f74e1ee59222399cbf6c9ee92208fb
[ "Apache-2.0" ]
94
2021-07-21T02:24:56.000Z
2021-07-24T23:50:38.000Z
// moderngpu copyright (c) 2016, Sean Baxter http://www.moderngpu.com #pragma once #include "types.hxx" #include "intrinsics.hxx" BEGIN_MGPU_NAMESPACE //////////////////////////////////////////////////////////////////////////////// // reg<->shared template<int nt, int vt, typename type_t, int shared_size> MGPU_DEVICE void reg_to_shared_thread(array_t<type_t, vt> x, int tid, type_t (&shared)[shared_size], bool sync = true) { static_assert(shared_size >= nt * vt, "reg_to_shared_thread must have at least nt * vt storage"); thread_iterate<vt>([&](int i, int j) { shared[j] = x[i]; }, tid); if(sync) __syncthreads(); } template<int nt, int vt, typename type_t, int shared_size> MGPU_DEVICE array_t<type_t, vt> shared_to_reg_thread( const type_t (&shared)[shared_size], int tid, bool sync = true) { static_assert(shared_size >= nt * vt, "reg_to_shared_thread must have at least nt * vt storage"); array_t<type_t, vt> x; thread_iterate<vt>([&](int i, int j) { x[i] = shared[j]; }, tid); if(sync) __syncthreads(); return x; } template<int nt, int vt, typename type_t, int shared_size> MGPU_DEVICE void reg_to_shared_strided(array_t<type_t, vt> x, int tid, type_t (&shared)[shared_size], bool sync = true) { static_assert(shared_size >= nt * vt, "reg_to_shared_strided must have at least nt * vt storage"); strided_iterate<nt, vt>([&](int i, int j) { shared[j] = x[i]; }, tid); if(sync) __syncthreads(); } template<int nt, int vt, typename type_t, int shared_size> MGPU_DEVICE array_t<type_t, vt> shared_to_reg_strided( const type_t (&shared)[shared_size], int tid, bool sync = true) { static_assert(shared_size >= nt * vt, "shared_to_reg_strided must have at least nt * vt storage"); array_t<type_t, vt> x; strided_iterate<nt, vt>([&](int i, int j) { x[i] = shared[j]; }, tid); if(sync) __syncthreads(); return x; } template<int nt, int vt, typename type_t, int shared_size> MGPU_DEVICE array_t<type_t, vt> shared_gather(const type_t(&data)[shared_size], array_t<int, vt> indices, bool sync = true) { static_assert(shared_size >= nt * vt, "shared_gather must have at least nt * vt storage"); array_t<type_t, vt> x; iterate<vt>([&](int i) { x[i] = data[indices[i]]; }); if(sync) __syncthreads(); return x; } template<int nt, int vt, typename type_t, int shared_size> MGPU_DEVICE array_t<type_t, vt> thread_to_strided(array_t<type_t, vt> x, int tid, type_t (&shared)[shared_size]) { reg_to_shared_thread<nt, vt>(x, tid, shared); return shared_to_reg_strided<nt, vt>(shared, tid); } //////////////////////////////////////////////////////////////////////////////// // reg<->memory template<int nt, int vt, int vt0 = vt, typename type_t, typename it_t> MGPU_DEVICE void reg_to_mem_strided(array_t<type_t, vt> x, int tid, int count, it_t mem) { strided_iterate<nt, vt, vt0>([=](int i, int j) { mem[j] = x[i]; }, tid, count); } template<int nt, int vt, int vt0 = vt, typename it_t> MGPU_DEVICE array_t<typename std::iterator_traits<it_t>::value_type, vt> mem_to_reg_strided(it_t mem, int tid, int count) { typedef typename std::iterator_traits<it_t>::value_type type_t; array_t<type_t, vt> x; strided_iterate<nt, vt, vt0>([&](int i, int j) { x[i] = mem[j]; }, tid, count); return x; } template<int nt, int vt, int vt0 = vt, typename type_t, typename it_t, int shared_size> MGPU_DEVICE void reg_to_mem_thread(array_t<type_t, vt> x, int tid, int count, it_t mem, type_t (&shared)[shared_size]) { reg_to_shared_thread<nt>(x, tid, shared); array_t<type_t, vt> y = shared_to_reg_strided<nt, vt>(shared, tid); reg_to_mem_strided<nt, vt, vt0>(y, tid, count, mem); } template<int nt, int vt, int vt0 = vt, typename type_t, typename it_t, int shared_size> MGPU_DEVICE array_t<type_t, vt> mem_to_reg_thread(it_t mem, int tid, int count, type_t (&shared)[shared_size]) { array_t<type_t, vt> x = mem_to_reg_strided<nt, vt, vt0>(mem, tid, count); reg_to_shared_strided<nt, vt>(x, tid, shared); array_t<type_t, vt> y = shared_to_reg_thread<nt, vt>(shared, tid); return y; } template<int nt, int vt, int vt0 = vt, typename input_it, typename output_it> MGPU_DEVICE void mem_to_mem(input_it input, int tid, int count, output_it output) { typedef typename std::iterator_traits<input_it>::value_type type_t; type_t x[vt]; strided_iterate<nt, vt, vt0>([&](int i, int j) { x[i] = input[j]; }, tid, count); strided_iterate<nt, vt, vt0>([&](int i, int j) { output[j] = x[i]; }, tid, count); } //////////////////////////////////////////////////////////////////////////////// // memory<->memory template<int nt, int vt, int vt0 = vt, typename type_t, typename it_t> MGPU_DEVICE void mem_to_shared(it_t mem, int tid, int count, type_t* shared, bool sync = true) { array_t<type_t, vt> x = mem_to_reg_strided<nt, vt, vt0>(mem, tid, count); strided_iterate<nt, vt, vt0>([&](int i, int j) { shared[j] = x[i]; }, tid, count); if(sync) __syncthreads(); } template<int nt, int vt, typename type_t, typename it_t> MGPU_DEVICE void shared_to_mem(const type_t* shared, int tid, int count, it_t mem, bool sync = true) { strided_iterate<nt, vt>([&](int i, int j) { mem[j] = shared[j]; }, tid, count); if(sync) __syncthreads(); } //////////////////////////////////////////////////////////////////////////////// // reg<->reg template<int nt, int vt, typename type_t, int shared_size> MGPU_DEVICE array_t<type_t, vt> reg_thread_to_strided(array_t<type_t, vt> x, int tid, type_t (&shared)[shared_size]) { reg_to_shared_thread<nt>(x, tid, shared); return shared_to_reg_strided<nt, vt>(shared, tid); } template<int nt, int vt, typename type_t, int shared_size> MGPU_DEVICE array_t<type_t, vt> reg_strided_to_thread(array_t<type_t, vt> x, int tid, type_t (&shared)[shared_size]) { reg_to_shared_strided<nt>(x, tid, shared); return shared_to_reg_thread<nt, vt>(shared, tid); } END_MGPU_NAMESPACE
31.724868
80
0.652435
aka-chris
8374c392966aff5692a7065530eee27c8c4b8785
2,687
cpp
C++
SpaceshIT!/SpaceshIT!/Queue.cpp
ColdSpotYZ/SpaceshIT
8fe2dcdd202536b5127e14a140c5f833720b1eeb
[ "MIT" ]
null
null
null
SpaceshIT!/SpaceshIT!/Queue.cpp
ColdSpotYZ/SpaceshIT
8fe2dcdd202536b5127e14a140c5f833720b1eeb
[ "MIT" ]
null
null
null
SpaceshIT!/SpaceshIT!/Queue.cpp
ColdSpotYZ/SpaceshIT
8fe2dcdd202536b5127e14a140c5f833720b1eeb
[ "MIT" ]
null
null
null
/* Team member: Lim Kai Xian Group: CookieZ studentID: S10195450H */ #pragma once #include "stdafx.h" #include "Queue.h" #include <string> using namespace std; Queue::Queue() { size = 0; current = 0; salt = rand() % 512;} Queue::~Queue() { while (!isEmpty()) { dequeue_back(); } current = NULL; size = NULL; } bool Queue::enqueue_back(ItemType item) { if (size >= 4) { dequeue_front(); } string hashoflocation = xhash((std::to_string(item.x) + std::to_string(item.y))); locations[current] = item; hashes[current] = hashoflocation; size++; current++; current = current % 5; return true; } bool Queue::enqueue_front(ItemType item) { if (size >= 4) { dequeue_back(); } string hashoflocation = xhash((std::to_string(item.x) + std::to_string(item.y))); locations[current] = item; hashes[current] = hashoflocation; size++; current--; current = current % 5; return true; } bool Queue::dequeue_back() { bool success = !isEmpty(); if (success) { current++; current = current % 5; locations[current].x = NULL; locations[current].y = NULL; hashes[current] = ""; size--; } return success; } bool Queue::dequeue_back(ItemType& location, std::string& hash) { bool success = !isEmpty(); if (success) { current++; current = current % 5; location = locations[current]; hash = hashes[current]; locations[current].x = NULL; locations[current].y = NULL; hashes[current] = ""; size--; } return success; } bool Queue::dequeue_front() { bool success = !isEmpty(); if (success) { current--; current = current % 5; locations[current].x = NULL; locations[current].y = NULL; hashes[current] = ""; size--; } return success; } bool Queue::dequeue_front(ItemType& location, std::string& hash) { bool success = !isEmpty(); if (success) { current--; current = current % 5; location = locations[current]; hash = hashes[current]; locations[current].x = NULL; locations[current].y = NULL; hashes[current] = ""; size--; } return success; } void Queue::getFront(ItemType& location, std::string& hash) { if (!isEmpty()) { if (size == 5) // When the array is full the front of the queue would be the next of the current { location = locations[current + 1]; hash = hashes[current + 1]; } else { location = locations[current - size]; hash = hashes[current - size]; } } } void Queue::getBack(ItemType& location, std::string& hash) { if (!isEmpty()) { int temp = current - 1; temp = temp % 5; location = locations[temp]; hash = hashes[temp]; } } bool Queue::isEmpty() { if (size == 0) return true; else return false; } int Queue::getNoOfElements() { return size; }
16.899371
98
0.639747
ColdSpotYZ
83778138193b88547af0fa4ece2272a9b3df8b2c
2,290
cpp
C++
deps/reproc/reproc++/examples/cmake-help.cpp
Fookdies301/GrinPlusPlus
981a99af0ae04633afbd02666894b5c199e06339
[ "MIT" ]
135
2018-12-17T15:38:16.000Z
2022-03-01T05:38:29.000Z
deps/reproc/reproc++/examples/cmake-help.cpp
Fookdies301/GrinPlusPlus
981a99af0ae04633afbd02666894b5c199e06339
[ "MIT" ]
185
2018-12-21T13:56:29.000Z
2022-03-23T14:41:46.000Z
deps/reproc/reproc++/examples/cmake-help.cpp
Fookdies301/GrinPlusPlus
981a99af0ae04633afbd02666894b5c199e06339
[ "MIT" ]
49
2018-12-23T12:05:51.000Z
2022-03-26T14:24:49.000Z
#include <reproc++/reproc.hpp> #include <reproc++/sink.hpp> #include <array> #include <iostream> static int fail(std::error_code ec) { std::cerr << ec.message(); return 1; } // Uses reproc++ to print CMake's help page. int main() { reproc::process process; // The `process::start` method works with any container containing strings and // takes care of converting the vector into the array of null-terminated // strings expected by `reproc_start` (including adding the `NULL` value at // the end of the array). std::array<std::string, 2> argv = { "cmake", "--help" }; // reproc++ uses error codes to report errors. If exceptions are preferred, // convert `std::error_code`'s to exceptions using `std::system_error`. std::error_code ec = process.start(argv); // reproc++ converts system errors to `std::error_code`'s of the system // category. These can be matched against using values from the `std::errc` // error condition. See https://en.cppreference.com/w/cpp/error/errc for more // information. if (ec == std::errc::no_such_file_or_directory) { std::cerr << "cmake not found. Make sure it's available from the PATH."; return 1; } else if (ec) { return fail(ec); } std::string output; // `process::drain` reads from the stdout and stderr streams of the child // process until both are closed or an error occurs. Providing it with a // string sink makes it store all output in the string(s) passed to the string // sink. Passing the same string to both the `out` and `err` arguments of // `sink::string` causes the stdout and stderr output to get stored in the // same string. ec = process.drain(reproc::sink::string(output, output)); if (ec) { return fail(ec); } std::cout << output << std::flush; // It's easy to define your own sinks as well. Take a look at `sink.cpp` in // the repository to see how `sink::string` and other sinks are implemented. // The documentation of `process::drain` also provides more information on the // requirements a sink should fulfill. // By default, The `process` destructor waits indefinitely for the child // process to exit to ensure proper cleanup. See the forward example for // information on how this can be configured. return EXIT_SUCCESS; }
35.230769
80
0.69607
Fookdies301
8378bd5c7770e1f67f5dc446fd971de0ecd8c729
6,625
cpp
C++
apps/heat/run.cpp
POETSII/jordmorr-tinsel
39249538d532e4945d9916748346c261dc5ea75d
[ "BSD-2-Clause" ]
31
2019-09-18T10:55:47.000Z
2021-12-01T20:39:46.000Z
apps/heat/run.cpp
POETSII/jordmorr-tinsel
39249538d532e4945d9916748346c261dc5ea75d
[ "BSD-2-Clause" ]
26
2019-10-13T13:33:04.000Z
2021-11-10T11:09:48.000Z
apps/heat/run.cpp
POETSII/jordmorr-tinsel
39249538d532e4945d9916748346c261dc5ea75d
[ "BSD-2-Clause" ]
1
2020-09-11T17:32:43.000Z
2020-09-11T17:32:43.000Z
// SPDX-License-Identifier: BSD-2-Clause #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <assert.h> #include <sys/time.h> #include <HostLink.h> #include "heat.h" // Magnification factor when displaying heat map const int MAG = 2; // 256 x RGB colours representing heat intensities int heat[] = { 0x00, 0x00, 0x76, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x83, 0x00, 0x00, 0x88, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x91, 0x00, 0x00, 0x95, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x9e, 0x00, 0x00, 0xa3, 0x00, 0x00, 0xa3, 0x00, 0x00, 0xa7, 0x00, 0x00, 0xac, 0x00, 0x00, 0xb0, 0x00, 0x00, 0xb5, 0x00, 0x00, 0xb9, 0x00, 0x00, 0xbe, 0x00, 0x00, 0xc2, 0x00, 0x00, 0xc7, 0x00, 0x00, 0xcb, 0x00, 0x00, 0xd0, 0x00, 0x00, 0xd4, 0x00, 0x00, 0xd9, 0x00, 0x00, 0xde, 0x00, 0x00, 0xe2, 0x00, 0x00, 0xe7, 0x00, 0x00, 0xeb, 0x00, 0x00, 0xf0, 0x00, 0x00, 0xf4, 0x00, 0x00, 0xf9, 0x00, 0x00, 0xfd, 0x00, 0x03, 0xff, 0x00, 0x07, 0xff, 0x00, 0x0c, 0xff, 0x00, 0x10, 0xff, 0x00, 0x15, 0xff, 0x00, 0x19, 0xff, 0x00, 0x1e, 0xff, 0x00, 0x22, 0xff, 0x00, 0x27, 0xff, 0x00, 0x2b, 0xff, 0x00, 0x30, 0xff, 0x00, 0x34, 0xff, 0x00, 0x39, 0xff, 0x00, 0x3d, 0xff, 0x00, 0x42, 0xff, 0x00, 0x47, 0xff, 0x00, 0x4b, 0xff, 0x00, 0x50, 0xff, 0x00, 0x54, 0xff, 0x00, 0x59, 0xff, 0x00, 0x5d, 0xff, 0x00, 0x62, 0xff, 0x00, 0x66, 0xff, 0x00, 0x6b, 0xff, 0x00, 0x6f, 0xff, 0x00, 0x74, 0xff, 0x00, 0x78, 0xff, 0x00, 0x7d, 0xff, 0x00, 0x81, 0xff, 0x00, 0x86, 0xff, 0x00, 0x8a, 0xff, 0x00, 0x8f, 0xff, 0x00, 0x93, 0xff, 0x00, 0x98, 0xff, 0x00, 0x9c, 0xff, 0x00, 0xa1, 0xff, 0x00, 0xa5, 0xff, 0x00, 0xaa, 0xff, 0x00, 0xaf, 0xff, 0x00, 0xb3, 0xff, 0x00, 0xb8, 0xff, 0x00, 0xbc, 0xff, 0x00, 0xc1, 0xff, 0x00, 0xc5, 0xff, 0x00, 0xca, 0xff, 0x00, 0xce, 0xff, 0x00, 0xd3, 0xff, 0x00, 0xd7, 0xff, 0x00, 0xdc, 0xff, 0x00, 0xe0, 0xff, 0x00, 0xe5, 0xff, 0x00, 0xe9, 0xff, 0x00, 0xee, 0xff, 0x00, 0xf2, 0xff, 0x00, 0xf7, 0xff, 0x00, 0xfb, 0xff, 0x00, 0xff, 0xff, 0x00, 0xff, 0xfa, 0x00, 0xff, 0xf5, 0x00, 0xff, 0xf1, 0x00, 0xff, 0xec, 0x00, 0xff, 0xe7, 0x00, 0xff, 0xe3, 0x00, 0xff, 0xde, 0x00, 0xff, 0xda, 0x00, 0xff, 0xd5, 0x00, 0xff, 0xd1, 0x00, 0xff, 0xcc, 0x00, 0xff, 0xc8, 0x00, 0xff, 0xc3, 0x00, 0xff, 0xbf, 0x00, 0xff, 0xba, 0x00, 0xff, 0xb6, 0x00, 0xff, 0xb1, 0x00, 0xff, 0xad, 0x00, 0xff, 0xa8, 0x00, 0xff, 0xa4, 0x00, 0xff, 0x9f, 0x00, 0xff, 0x9b, 0x00, 0xff, 0x96, 0x00, 0xff, 0x92, 0x00, 0xff, 0x8d, 0x00, 0xff, 0x89, 0x00, 0xff, 0x84, 0x00, 0xff, 0x80, 0x00, 0xff, 0x7b, 0x00, 0xff, 0x76, 0x00, 0xff, 0x72, 0x00, 0xff, 0x6d, 0x00, 0xff, 0x69, 0x00, 0xff, 0x64, 0x00, 0xff, 0x60, 0x00, 0xff, 0x5b, 0x00, 0xff, 0x57, 0x00, 0xff, 0x52, 0x00, 0xff, 0x4e, 0x00, 0xff, 0x49, 0x00, 0xff, 0x45, 0x00, 0xff, 0x40, 0x00, 0xff, 0x3c, 0x00, 0xff, 0x37, 0x00, 0xff, 0x33, 0x00, 0xff, 0x2e, 0x00, 0xff, 0x2a, 0x00, 0xff, 0x25, 0x00, 0xff, 0x21, 0x00, 0xff, 0x1c, 0x00, 0xff, 0x18, 0x00, 0xff, 0x13, 0x00, 0xff, 0x0e, 0x00, 0xff, 0x0a, 0x00, 0xff, 0x05, 0x00, 0xff, 0x01, 0x04, 0xff, 0x00, 0x08, 0xff, 0x00, 0x0d, 0xff, 0x00, 0x11, 0xff, 0x00, 0x16, 0xff, 0x00, 0x1a, 0xff, 0x00, 0x1f, 0xff, 0x00, 0x23, 0xff, 0x00, 0x28, 0xff, 0x00, 0x2c, 0xff, 0x00, 0x31, 0xff, 0x00, 0x35, 0xff, 0x00, 0x3a, 0xff, 0x00, 0x3e, 0xff, 0x00, 0x43, 0xff, 0x00, 0x47, 0xff, 0x00, 0x4c, 0xff, 0x00, 0x50, 0xff, 0x00, 0x55, 0xff, 0x00, 0x5a, 0xff, 0x00, 0x5e, 0xff, 0x00, 0x63, 0xff, 0x00, 0x67, 0xff, 0x00, 0x6c, 0xff, 0x00, 0x70, 0xff, 0x00, 0x75, 0xff, 0x00, 0x79, 0xff, 0x00, 0x7e, 0xff, 0x00, 0x82, 0xff, 0x00, 0x87, 0xff, 0x00, 0x8b, 0xff, 0x00, 0x90, 0xff, 0x00, 0x94, 0xff, 0x00, 0x99, 0xff, 0x00, 0x9d, 0xff, 0x00, 0xa2, 0xff, 0x00, 0xa6, 0xff, 0x00, 0xab, 0xff, 0x00, 0xaf, 0xff, 0x00, 0xb4, 0xff, 0x00, 0xb8, 0xff, 0x00, 0xbd, 0xff, 0x00, 0xc2, 0xff, 0x00, 0xc6, 0xff, 0x00, 0xcb, 0xff, 0x00, 0xcf, 0xff, 0x00, 0xd4, 0xff, 0x00, 0xd8, 0xff, 0x00, 0xdd, 0xff, 0x00, 0xe1, 0xff, 0x00, 0xe6, 0xff, 0x00, 0xea, 0xff, 0x00, 0xef, 0xff, 0x00, 0xf3, 0xff, 0x00, 0xf8, 0xff, 0x00, 0xfc, 0xff, 0x00, 0xff, 0xfd, 0x00, 0xff, 0xf9, 0x00, 0xff, 0xf4, 0x00, 0xff, 0xf0, 0x00, 0xff, 0xeb, 0x00, 0xff, 0xe7, 0x00, 0xff, 0xe2, 0x00, 0xff, 0xde, 0x00, 0xff, 0xd9, 0x00, 0xff, 0xd5, 0x00, 0xff, 0xd0, 0x00, 0xff, 0xcb, 0x00, 0xff, 0xc7, 0x00, 0xff, 0xc2, 0x00, 0xff, 0xbe, 0x00, 0xff, 0xb9, 0x00, 0xff, 0xb5, 0x00, 0xff, 0xb0, 0x00, 0xff, 0xac, 0x00, 0xff, 0xa7, 0x00, 0xff, 0xa3, 0x00, 0xff, 0x9e, 0x00, 0xff, 0x9a, 0x00, 0xff, 0x95, 0x00, 0xff, 0x91, 0x00, 0xff, 0x8c, 0x00, 0xff, 0x88, 0x00, 0xff, 0x83, 0x00, 0xff, 0x7f, 0x00, 0xff, 0x7a, 0x00, 0xff, 0x76, 0x00, 0xff, 0x71, 0x00, 0xff, 0x6d, 0x00, 0xff, 0x68, 0x00, 0xff, 0x63, 0x00, 0xff, 0x5f, 0x00, 0xff, 0x5a, 0x00, 0xff, 0x56, 0x00, 0xff, 0x51, 0x00, 0xff, 0x4d, 0x00, 0xff, 0x48, 0x00, 0xff, 0x44, 0x00, 0xff, 0x3f, 0x00, 0xff, 0x3b, 0x00, 0xff, 0x36, 0x00, 0xff, 0x32, 0x00, 0xff, 0x2d, 0x00, 0xff, 0x29, 0x00, 0xff, 0x24, 0x00, 0xff, 0x20, 0x00, 0xff, 0x1b, 0x00, 0xff, 0x17, 0x00, 0xff, 0x12, 0x00, 0xff, 0x0e, 0x00, 0xff, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; int main() { HostLink hostLink; // Load application hostLink.boot("code.v", "data.v"); // Start timer struct timeval start, finish, diff; gettimeofday(&start, NULL); // Start application hostLink.go(); // 2D grid int NX = X_LEN*8; int NY = Y_LEN*8; int** grid = new int* [NY]; for (int i = 0; i < NY; i++) grid[i] = new int [NX]; // Initialise 2D grid for (int y = 0; y < NY; y++) for (int x = 0; x < NX; x++) grid[y][x] = 0; for (int n = 0; n < 1; n++) { // Fill 2D grid for (int i = 0; i < 8*X_LEN*Y_LEN; i++) { HostMsg msg; hostLink.recvMsg(&msg, sizeof(HostMsg)); for (int j = 0; j < 8; j++) grid[msg.y][msg.x+j] = msg.temps[j]; } FILE* fp = fopen("out.ppm", "w"); if (fp == NULL) { fprintf(stderr, "Failed to open file 'out.ppm'\n"); } // Emit PPM int L = 8 * MAG; fprintf(fp, "P3\n%i %i\n255\n", MAG*NX, MAG*NY); for (int y = 0; y < MAG*NY; y++) for (int x = 0; x < MAG*NX; x++) { int t = grid[y/MAG][x/MAG]; if (((x%L) == 0 && (y&1)) || ((y%L) == 0 && (x&1))) fprintf(fp, "0 0 0\n"); else fprintf(fp, "%d %d %d\n", heat[t*3], heat[t*3+1], heat[t*3+2]); } fclose(fp); } // Stop timer gettimeofday(&finish, NULL); // Display time timersub(&finish, &start, &diff); double duration = (double) diff.tv_sec + (double) diff.tv_usec / 1000000.0; printf("Time = %lf\n", duration); return 0; }
45.376712
77
0.618113
POETSII
837c8b732b65fa6297e16029f409247ebb602f1f
178,287
cc
C++
keynote-protos/gen/TSCHArchives.Common.pb.cc
eth-siplab/SVG2Keynote-lib
b7e6dfe5084911dac1fa6261a14254bfbbd8065b
[ "MIT" ]
4
2021-11-24T14:27:32.000Z
2022-03-14T07:52:44.000Z
keynote-protos/gen/TSCHArchives.Common.pb.cc
eth-siplab/SVG2Keynote-lib
b7e6dfe5084911dac1fa6261a14254bfbbd8065b
[ "MIT" ]
null
null
null
keynote-protos/gen/TSCHArchives.Common.pb.cc
eth-siplab/SVG2Keynote-lib
b7e6dfe5084911dac1fa6261a14254bfbbd8065b
[ "MIT" ]
null
null
null
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: TSCHArchives.Common.proto #include "TSCHArchives.Common.pb.h" #include <algorithm> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/wire_format_lite.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> // @@protoc_insertion_point(includes) #include <google/protobuf/port_def.inc> PROTOBUF_PRAGMA_INIT_SEG namespace TSCH { constexpr RectArchive::RectArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : origin_(nullptr) , size_(nullptr){} struct RectArchiveDefaultTypeInternal { constexpr RectArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~RectArchiveDefaultTypeInternal() {} union { RectArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT RectArchiveDefaultTypeInternal _RectArchive_default_instance_; constexpr ChartsNSNumberDoubleArchive::ChartsNSNumberDoubleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : number_archive_(0){} struct ChartsNSNumberDoubleArchiveDefaultTypeInternal { constexpr ChartsNSNumberDoubleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ChartsNSNumberDoubleArchiveDefaultTypeInternal() {} union { ChartsNSNumberDoubleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ChartsNSNumberDoubleArchiveDefaultTypeInternal _ChartsNSNumberDoubleArchive_default_instance_; constexpr ChartsNSArrayOfNSNumberDoubleArchive::ChartsNSArrayOfNSNumberDoubleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : numbers_(){} struct ChartsNSArrayOfNSNumberDoubleArchiveDefaultTypeInternal { constexpr ChartsNSArrayOfNSNumberDoubleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ChartsNSArrayOfNSNumberDoubleArchiveDefaultTypeInternal() {} union { ChartsNSArrayOfNSNumberDoubleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ChartsNSArrayOfNSNumberDoubleArchiveDefaultTypeInternal _ChartsNSArrayOfNSNumberDoubleArchive_default_instance_; constexpr DEPRECATEDChart3DFillArchive::DEPRECATEDChart3DFillArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : textureset_id_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) , fill_(nullptr) , lightingmodel_(nullptr) , fill_type_(0) , series_index_(0u){} struct DEPRECATEDChart3DFillArchiveDefaultTypeInternal { constexpr DEPRECATEDChart3DFillArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~DEPRECATEDChart3DFillArchiveDefaultTypeInternal() {} union { DEPRECATEDChart3DFillArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT DEPRECATEDChart3DFillArchiveDefaultTypeInternal _DEPRECATEDChart3DFillArchive_default_instance_; constexpr ChartStyleArchive::ChartStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct ChartStyleArchiveDefaultTypeInternal { constexpr ChartStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ChartStyleArchiveDefaultTypeInternal() {} union { ChartStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ChartStyleArchiveDefaultTypeInternal _ChartStyleArchive_default_instance_; constexpr ChartNonStyleArchive::ChartNonStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct ChartNonStyleArchiveDefaultTypeInternal { constexpr ChartNonStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ChartNonStyleArchiveDefaultTypeInternal() {} union { ChartNonStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ChartNonStyleArchiveDefaultTypeInternal _ChartNonStyleArchive_default_instance_; constexpr LegendStyleArchive::LegendStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct LegendStyleArchiveDefaultTypeInternal { constexpr LegendStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~LegendStyleArchiveDefaultTypeInternal() {} union { LegendStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LegendStyleArchiveDefaultTypeInternal _LegendStyleArchive_default_instance_; constexpr LegendNonStyleArchive::LegendNonStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct LegendNonStyleArchiveDefaultTypeInternal { constexpr LegendNonStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~LegendNonStyleArchiveDefaultTypeInternal() {} union { LegendNonStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT LegendNonStyleArchiveDefaultTypeInternal _LegendNonStyleArchive_default_instance_; constexpr ChartAxisStyleArchive::ChartAxisStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct ChartAxisStyleArchiveDefaultTypeInternal { constexpr ChartAxisStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ChartAxisStyleArchiveDefaultTypeInternal() {} union { ChartAxisStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ChartAxisStyleArchiveDefaultTypeInternal _ChartAxisStyleArchive_default_instance_; constexpr ChartAxisNonStyleArchive::ChartAxisNonStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct ChartAxisNonStyleArchiveDefaultTypeInternal { constexpr ChartAxisNonStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ChartAxisNonStyleArchiveDefaultTypeInternal() {} union { ChartAxisNonStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ChartAxisNonStyleArchiveDefaultTypeInternal _ChartAxisNonStyleArchive_default_instance_; constexpr ChartSeriesStyleArchive::ChartSeriesStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct ChartSeriesStyleArchiveDefaultTypeInternal { constexpr ChartSeriesStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ChartSeriesStyleArchiveDefaultTypeInternal() {} union { ChartSeriesStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ChartSeriesStyleArchiveDefaultTypeInternal _ChartSeriesStyleArchive_default_instance_; constexpr ChartSeriesNonStyleArchive::ChartSeriesNonStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct ChartSeriesNonStyleArchiveDefaultTypeInternal { constexpr ChartSeriesNonStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ChartSeriesNonStyleArchiveDefaultTypeInternal() {} union { ChartSeriesNonStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ChartSeriesNonStyleArchiveDefaultTypeInternal _ChartSeriesNonStyleArchive_default_instance_; constexpr GridValue::GridValue( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : numeric_value_(0) , date_value_1_0_(0) , duration_value_(0) , date_value_(0){} struct GridValueDefaultTypeInternal { constexpr GridValueDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~GridValueDefaultTypeInternal() {} union { GridValue _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GridValueDefaultTypeInternal _GridValue_default_instance_; constexpr GridRow::GridRow( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : value_(){} struct GridRowDefaultTypeInternal { constexpr GridRowDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~GridRowDefaultTypeInternal() {} union { GridRow _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GridRowDefaultTypeInternal _GridRow_default_instance_; constexpr ReferenceLineStyleArchive::ReferenceLineStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct ReferenceLineStyleArchiveDefaultTypeInternal { constexpr ReferenceLineStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ReferenceLineStyleArchiveDefaultTypeInternal() {} union { ReferenceLineStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ReferenceLineStyleArchiveDefaultTypeInternal _ReferenceLineStyleArchive_default_instance_; constexpr ReferenceLineNonStyleArchive::ReferenceLineNonStyleArchive( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : super_(nullptr){} struct ReferenceLineNonStyleArchiveDefaultTypeInternal { constexpr ReferenceLineNonStyleArchiveDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ReferenceLineNonStyleArchiveDefaultTypeInternal() {} union { ReferenceLineNonStyleArchive _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ReferenceLineNonStyleArchiveDefaultTypeInternal _ReferenceLineNonStyleArchive_default_instance_; } // namespace TSCH static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_TSCHArchives_2eCommon_2eproto[16]; static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_TSCHArchives_2eCommon_2eproto[7]; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_TSCHArchives_2eCommon_2eproto = nullptr; const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_TSCHArchives_2eCommon_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { PROTOBUF_FIELD_OFFSET(::TSCH::RectArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::RectArchive, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::RectArchive, origin_), PROTOBUF_FIELD_OFFSET(::TSCH::RectArchive, size_), 0, 1, PROTOBUF_FIELD_OFFSET(::TSCH::ChartsNSNumberDoubleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartsNSNumberDoubleArchive, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ChartsNSNumberDoubleArchive, number_archive_), 0, ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::TSCH::ChartsNSArrayOfNSNumberDoubleArchive, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ChartsNSArrayOfNSNumberDoubleArchive, numbers_), PROTOBUF_FIELD_OFFSET(::TSCH::DEPRECATEDChart3DFillArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::DEPRECATEDChart3DFillArchive, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::DEPRECATEDChart3DFillArchive, fill_), PROTOBUF_FIELD_OFFSET(::TSCH::DEPRECATEDChart3DFillArchive, lightingmodel_), PROTOBUF_FIELD_OFFSET(::TSCH::DEPRECATEDChart3DFillArchive, textureset_id_), PROTOBUF_FIELD_OFFSET(::TSCH::DEPRECATEDChart3DFillArchive, fill_type_), PROTOBUF_FIELD_OFFSET(::TSCH::DEPRECATEDChart3DFillArchive, series_index_), 1, 2, 0, 3, 4, PROTOBUF_FIELD_OFFSET(::TSCH::ChartStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ChartStyleArchive, super_), 0, PROTOBUF_FIELD_OFFSET(::TSCH::ChartNonStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartNonStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartNonStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ChartNonStyleArchive, super_), 0, PROTOBUF_FIELD_OFFSET(::TSCH::LegendStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::LegendStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::LegendStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::LegendStyleArchive, super_), 0, PROTOBUF_FIELD_OFFSET(::TSCH::LegendNonStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::LegendNonStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::LegendNonStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::LegendNonStyleArchive, super_), 0, PROTOBUF_FIELD_OFFSET(::TSCH::ChartAxisStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartAxisStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartAxisStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ChartAxisStyleArchive, super_), 0, PROTOBUF_FIELD_OFFSET(::TSCH::ChartAxisNonStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartAxisNonStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartAxisNonStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ChartAxisNonStyleArchive, super_), 0, PROTOBUF_FIELD_OFFSET(::TSCH::ChartSeriesStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartSeriesStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartSeriesStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ChartSeriesStyleArchive, super_), 0, PROTOBUF_FIELD_OFFSET(::TSCH::ChartSeriesNonStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartSeriesNonStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::ChartSeriesNonStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ChartSeriesNonStyleArchive, super_), 0, PROTOBUF_FIELD_OFFSET(::TSCH::GridValue, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::GridValue, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::GridValue, numeric_value_), PROTOBUF_FIELD_OFFSET(::TSCH::GridValue, date_value_1_0_), PROTOBUF_FIELD_OFFSET(::TSCH::GridValue, duration_value_), PROTOBUF_FIELD_OFFSET(::TSCH::GridValue, date_value_), 0, 1, 2, 3, ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::TSCH::GridRow, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::GridRow, value_), PROTOBUF_FIELD_OFFSET(::TSCH::ReferenceLineStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::ReferenceLineStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::ReferenceLineStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ReferenceLineStyleArchive, super_), 0, PROTOBUF_FIELD_OFFSET(::TSCH::ReferenceLineNonStyleArchive, _has_bits_), PROTOBUF_FIELD_OFFSET(::TSCH::ReferenceLineNonStyleArchive, _internal_metadata_), PROTOBUF_FIELD_OFFSET(::TSCH::ReferenceLineNonStyleArchive, _extensions_), ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::TSCH::ReferenceLineNonStyleArchive, super_), 0, }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, 7, sizeof(::TSCH::RectArchive)}, { 9, 15, sizeof(::TSCH::ChartsNSNumberDoubleArchive)}, { 16, -1, sizeof(::TSCH::ChartsNSArrayOfNSNumberDoubleArchive)}, { 22, 32, sizeof(::TSCH::DEPRECATEDChart3DFillArchive)}, { 37, 43, sizeof(::TSCH::ChartStyleArchive)}, { 44, 50, sizeof(::TSCH::ChartNonStyleArchive)}, { 51, 57, sizeof(::TSCH::LegendStyleArchive)}, { 58, 64, sizeof(::TSCH::LegendNonStyleArchive)}, { 65, 71, sizeof(::TSCH::ChartAxisStyleArchive)}, { 72, 78, sizeof(::TSCH::ChartAxisNonStyleArchive)}, { 79, 85, sizeof(::TSCH::ChartSeriesStyleArchive)}, { 86, 92, sizeof(::TSCH::ChartSeriesNonStyleArchive)}, { 93, 102, sizeof(::TSCH::GridValue)}, { 106, -1, sizeof(::TSCH::GridRow)}, { 112, 118, sizeof(::TSCH::ReferenceLineStyleArchive)}, { 119, 125, sizeof(::TSCH::ReferenceLineNonStyleArchive)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_RectArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ChartsNSNumberDoubleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ChartsNSArrayOfNSNumberDoubleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_DEPRECATEDChart3DFillArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ChartStyleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ChartNonStyleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_LegendStyleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_LegendNonStyleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ChartAxisStyleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ChartAxisNonStyleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ChartSeriesStyleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ChartSeriesNonStyleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_GridValue_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_GridRow_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ReferenceLineStyleArchive_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::TSCH::_ReferenceLineNonStyleArchive_default_instance_), }; const char descriptor_table_protodef_TSCHArchives_2eCommon_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n\031TSCHArchives.Common.proto\022\004TSCH\032\021TSPMe" "ssages.proto\032\021TSKArchives.proto\032\021TSDArch" "ives.proto\032\021TSSArchives.proto\032\024TSCH3DArc" "hives.proto\"B\n\013RectArchive\022\032\n\006origin\030\001 \002" "(\0132\n.TSP.Point\022\027\n\004size\030\002 \002(\0132\t.TSP.Size\"" "5\n\033ChartsNSNumberDoubleArchive\022\026\n\016number" "_archive\030\001 \001(\001\"7\n$ChartsNSArrayOfNSNumbe" "rDoubleArchive\022\017\n\007numbers\030\001 \003(\001\"\320\001\n\034DEPR" "ECATEDChart3DFillArchive\022\036\n\004fill\030\001 \001(\0132\020" ".TSD.FillArchive\0228\n\rlightingmodel\030\002 \001(\0132" "!.TSCH.Chart3DLightingModelArchive\022\025\n\rte" "xtureset_id\030\003 \001(\t\022)\n\tfill_type\030\004 \001(\0162\026.T" "SCH.FillPropertyType\022\024\n\014series_index\030\005 \001" "(\r\"@\n\021ChartStyleArchive\022 \n\005super\030\001 \001(\0132\021" ".TSS.StyleArchive*\t\010\220N\020\200\200\200\200\002\"C\n\024ChartNon" "StyleArchive\022 \n\005super\030\001 \001(\0132\021.TSS.StyleA" "rchive*\t\010\220N\020\200\200\200\200\002\"A\n\022LegendStyleArchive\022" " \n\005super\030\001 \001(\0132\021.TSS.StyleArchive*\t\010\220N\020\200" "\200\200\200\002\"D\n\025LegendNonStyleArchive\022 \n\005super\030\001" " \001(\0132\021.TSS.StyleArchive*\t\010\220N\020\200\200\200\200\002\"D\n\025Ch" "artAxisStyleArchive\022 \n\005super\030\001 \001(\0132\021.TSS" ".StyleArchive*\t\010\220N\020\200\200\200\200\002\"G\n\030ChartAxisNon" "StyleArchive\022 \n\005super\030\001 \001(\0132\021.TSS.StyleA" "rchive*\t\010\220N\020\200\200\200\200\002\"F\n\027ChartSeriesStyleArc" "hive\022 \n\005super\030\001 \001(\0132\021.TSS.StyleArchive*\t" "\010\220N\020\200\200\200\200\002\"I\n\032ChartSeriesNonStyleArchive\022" " \n\005super\030\001 \001(\0132\021.TSS.StyleArchive*\t\010\220N\020\200" "\200\200\200\002\"f\n\tGridValue\022\025\n\rnumeric_value\030\001 \001(\001" "\022\026\n\016date_value_1_0\030\002 \001(\001\022\026\n\016duration_val" "ue\030\003 \001(\001\022\022\n\ndate_value\030\004 \001(\001\")\n\007GridRow\022" "\036\n\005value\030\001 \003(\0132\017.TSCH.GridValue\"H\n\031Refer" "enceLineStyleArchive\022 \n\005super\030\001 \001(\0132\021.TS" "S.StyleArchive*\t\010\220N\020\200\200\200\200\002\"K\n\034ReferenceLi" "neNonStyleArchive\022 \n\005super\030\001 \001(\0132\021.TSS.S" "tyleArchive*\t\010\220N\020\200\200\200\200\002*\246\005\n\tChartType\022\026\n\022" "undefinedChartType\020\000\022\025\n\021columnChartType2" "D\020\001\022\022\n\016barChartType2D\020\002\022\023\n\017lineChartType" "2D\020\003\022\023\n\017areaChartType2D\020\004\022\022\n\016pieChartTyp" "e2D\020\005\022\034\n\030stackedColumnChartType2D\020\006\022\031\n\025s" "tackedBarChartType2D\020\007\022\032\n\026stackedAreaCha" "rtType2D\020\010\022\026\n\022scatterChartType2D\020\t\022\024\n\020mi" "xedChartType2D\020\n\022\026\n\022twoAxisChartType2D\020\013" "\022\025\n\021columnChartType3D\020\014\022\022\n\016barChartType3" "D\020\r\022\023\n\017lineChartType3D\020\016\022\023\n\017areaChartTyp" "e3D\020\017\022\022\n\016pieChartType3D\020\020\022\034\n\030stackedColu" "mnChartType3D\020\021\022\031\n\025stackedBarChartType3D" "\020\022\022\032\n\026stackedAreaChartType3D\020\023\022\036\n\032multiD" "ataColumnChartType2D\020\024\022\033\n\027multiDataBarCh" "artType2D\020\025\022\025\n\021bubbleChartType2D\020\026\022\037\n\033mu" "ltiDataScatterChartType2D\020\027\022\036\n\032multiData" "BubbleChartType2D\020\030\022\024\n\020donutChartType2D\020" "\031\022\024\n\020donutChartType3D\020\032*j\n\010AxisType\022\025\n\021a" "xis_type_unknown\020\000\022\017\n\013axis_type_x\020\001\022\017\n\013a" "xis_type_y\020\002\022\021\n\raxis_type_pie\020\003\022\022\n\016axis_" "type_size\020\004*g\n\rScatterFormat\022\032\n\026scatter_" "format_unknown\020\000\022\035\n\031scatter_format_separ" "ate_x\020\001\022\033\n\027scatter_format_shared_x\020\002*l\n\017" "SeriesDirection\022\034\n\030series_direction_unkn" "own\020\000\022\033\n\027series_direction_by_row\020\001\022\036\n\032se" "ries_direction_by_column\020\002*\343\001\n\017NumberVal" "ueType\022\032\n\026numberValueTypeDecimal\020\000\022\033\n\027nu" "mberValueTypeCurrency\020\001\022\035\n\031numberValueTy" "pePercentage\020\002\022\035\n\031numberValueTypeScienti" "fic\020\003\022\033\n\027numberValueTypeFraction\020\004\022\027\n\023nu" "mberValueTypeBase\020\005\022#\n\026numberValueTypeUn" "known\020\231\370\377\377\377\377\377\377\377\001*\272\001\n\023NegativeNumberStyle" "\022\034\n\030negativeNumberStyleMinus\020\000\022\032\n\026negati" "veNumberStyleRed\020\001\022\"\n\036negativeNumberStyl" "eParentheses\020\002\022(\n$negativeNumberStyleRed" "AndParentheses\020\003\022\033\n\027negativeNumberStyleN" "one\020\004*\353\002\n\020FractionAccuracy\022\037\n\033fractionAc" "curacyConflicting\020\000\022)\n\034fractionAccuracyU" "pToOneDigit\020\377\377\377\377\377\377\377\377\377\001\022*\n\035fractionAccura" "cyUpToTwoDigits\020\376\377\377\377\377\377\377\377\377\001\022,\n\037fractionAc" "curacyUpToThreeDigits\020\375\377\377\377\377\377\377\377\377\001\022\032\n\026frac" "tionAccuracyHalves\020\002\022\034\n\030fractionAccuracy" "Quarters\020\004\022\033\n\027fractionAccuracyEighths\020\010\022" "\036\n\032fractionAccuracySixteenths\020\020\022\032\n\026fract" "ionAccuracyTenths\020\n\022\036\n\032fractionAccuracyH" "undredths\020d" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_TSCHArchives_2eCommon_2eproto_deps[5] = { &::descriptor_table_TSCH3DArchives_2eproto, &::descriptor_table_TSDArchives_2eproto, &::descriptor_table_TSKArchives_2eproto, &::descriptor_table_TSPMessages_2eproto, &::descriptor_table_TSSArchives_2eproto, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_TSCHArchives_2eCommon_2eproto_once; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_TSCHArchives_2eCommon_2eproto = { false, false, 3171, descriptor_table_protodef_TSCHArchives_2eCommon_2eproto, "TSCHArchives.Common.proto", &descriptor_table_TSCHArchives_2eCommon_2eproto_once, descriptor_table_TSCHArchives_2eCommon_2eproto_deps, 5, 16, schemas, file_default_instances, TableStruct_TSCHArchives_2eCommon_2eproto::offsets, file_level_metadata_TSCHArchives_2eCommon_2eproto, file_level_enum_descriptors_TSCHArchives_2eCommon_2eproto, file_level_service_descriptors_TSCHArchives_2eCommon_2eproto, }; PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_TSCHArchives_2eCommon_2eproto_getter() { return &descriptor_table_TSCHArchives_2eCommon_2eproto; } // Force running AddDescriptors() at dynamic initialization time. PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_TSCHArchives_2eCommon_2eproto(&descriptor_table_TSCHArchives_2eCommon_2eproto); namespace TSCH { const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ChartType_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_TSCHArchives_2eCommon_2eproto); return file_level_enum_descriptors_TSCHArchives_2eCommon_2eproto[0]; } bool ChartType_IsValid(int value) { switch (value) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: return true; default: return false; } } const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* AxisType_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_TSCHArchives_2eCommon_2eproto); return file_level_enum_descriptors_TSCHArchives_2eCommon_2eproto[1]; } bool AxisType_IsValid(int value) { switch (value) { case 0: case 1: case 2: case 3: case 4: return true; default: return false; } } const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ScatterFormat_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_TSCHArchives_2eCommon_2eproto); return file_level_enum_descriptors_TSCHArchives_2eCommon_2eproto[2]; } bool ScatterFormat_IsValid(int value) { switch (value) { case 0: case 1: case 2: return true; default: return false; } } const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* SeriesDirection_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_TSCHArchives_2eCommon_2eproto); return file_level_enum_descriptors_TSCHArchives_2eCommon_2eproto[3]; } bool SeriesDirection_IsValid(int value) { switch (value) { case 0: case 1: case 2: return true; default: return false; } } const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* NumberValueType_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_TSCHArchives_2eCommon_2eproto); return file_level_enum_descriptors_TSCHArchives_2eCommon_2eproto[4]; } bool NumberValueType_IsValid(int value) { switch (value) { case -999: case 0: case 1: case 2: case 3: case 4: case 5: return true; default: return false; } } const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* NegativeNumberStyle_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_TSCHArchives_2eCommon_2eproto); return file_level_enum_descriptors_TSCHArchives_2eCommon_2eproto[5]; } bool NegativeNumberStyle_IsValid(int value) { switch (value) { case 0: case 1: case 2: case 3: case 4: return true; default: return false; } } const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FractionAccuracy_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_TSCHArchives_2eCommon_2eproto); return file_level_enum_descriptors_TSCHArchives_2eCommon_2eproto[6]; } bool FractionAccuracy_IsValid(int value) { switch (value) { case -3: case -2: case -1: case 0: case 2: case 4: case 8: case 10: case 16: case 100: return true; default: return false; } } // =================================================================== class RectArchive::_Internal { public: using HasBits = decltype(std::declval<RectArchive>()._has_bits_); static const ::TSP::Point& origin(const RectArchive* msg); static void set_has_origin(HasBits* has_bits) { (*has_bits)[0] |= 1u; } static const ::TSP::Size& size(const RectArchive* msg); static void set_has_size(HasBits* has_bits) { (*has_bits)[0] |= 2u; } static bool MissingRequiredFields(const HasBits& has_bits) { return ((has_bits[0] & 0x00000003) ^ 0x00000003) != 0; } }; const ::TSP::Point& RectArchive::_Internal::origin(const RectArchive* msg) { return *msg->origin_; } const ::TSP::Size& RectArchive::_Internal::size(const RectArchive* msg) { return *msg->size_; } void RectArchive::clear_origin() { if (origin_ != nullptr) origin_->Clear(); _has_bits_[0] &= ~0x00000001u; } void RectArchive::clear_size() { if (size_ != nullptr) size_->Clear(); _has_bits_[0] &= ~0x00000002u; } RectArchive::RectArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.RectArchive) } RectArchive::RectArchive(const RectArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); if (from._internal_has_origin()) { origin_ = new ::TSP::Point(*from.origin_); } else { origin_ = nullptr; } if (from._internal_has_size()) { size_ = new ::TSP::Size(*from.size_); } else { size_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.RectArchive) } inline void RectArchive::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&origin_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&size_) - reinterpret_cast<char*>(&origin_)) + sizeof(size_)); } RectArchive::~RectArchive() { // @@protoc_insertion_point(destructor:TSCH.RectArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void RectArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete origin_; if (this != internal_default_instance()) delete size_; } void RectArchive::ArenaDtor(void* object) { RectArchive* _this = reinterpret_cast< RectArchive* >(object); (void)_this; } void RectArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void RectArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void RectArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.RectArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000003u) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(origin_ != nullptr); origin_->Clear(); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(size_ != nullptr); size_->Clear(); } } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* RectArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // required .TSP.Point origin = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_origin(), ptr); CHK_(ptr); } else goto handle_unusual; continue; // required .TSP.Size size = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { ptr = ctx->ParseMessage(_internal_mutable_size(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* RectArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.RectArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // required .TSP.Point origin = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::origin(this), target, stream); } // required .TSP.Size size = 2; if (cached_has_bits & 0x00000002u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 2, _Internal::size(this), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.RectArchive) return target; } size_t RectArchive::RequiredFieldsByteSizeFallback() const { // @@protoc_insertion_point(required_fields_byte_size_fallback_start:TSCH.RectArchive) size_t total_size = 0; if (_internal_has_origin()) { // required .TSP.Point origin = 1; total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *origin_); } if (_internal_has_size()) { // required .TSP.Size size = 2; total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *size_); } return total_size; } size_t RectArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.RectArchive) size_t total_size = 0; if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) { // All required fields are present. // required .TSP.Point origin = 1; total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *origin_); // required .TSP.Size size = 2; total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *size_); } else { total_size += RequiredFieldsByteSizeFallback(); } ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData RectArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, RectArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*RectArchive::GetClassData() const { return &_class_data_; } void RectArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<RectArchive *>(to)->MergeFrom( static_cast<const RectArchive &>(from)); } void RectArchive::MergeFrom(const RectArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.RectArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 0x00000003u) { if (cached_has_bits & 0x00000001u) { _internal_mutable_origin()->::TSP::Point::MergeFrom(from._internal_origin()); } if (cached_has_bits & 0x00000002u) { _internal_mutable_size()->::TSP::Size::MergeFrom(from._internal_size()); } } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void RectArchive::CopyFrom(const RectArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.RectArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool RectArchive::IsInitialized() const { if (_Internal::MissingRequiredFields(_has_bits_)) return false; if (_internal_has_origin()) { if (!origin_->IsInitialized()) return false; } if (_internal_has_size()) { if (!size_->IsInitialized()) return false; } return true; } void RectArchive::InternalSwap(RectArchive* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(RectArchive, size_) + sizeof(RectArchive::size_) - PROTOBUF_FIELD_OFFSET(RectArchive, origin_)>( reinterpret_cast<char*>(&origin_), reinterpret_cast<char*>(&other->origin_)); } ::PROTOBUF_NAMESPACE_ID::Metadata RectArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[0]); } // =================================================================== class ChartsNSNumberDoubleArchive::_Internal { public: using HasBits = decltype(std::declval<ChartsNSNumberDoubleArchive>()._has_bits_); static void set_has_number_archive(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; ChartsNSNumberDoubleArchive::ChartsNSNumberDoubleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ChartsNSNumberDoubleArchive) } ChartsNSNumberDoubleArchive::ChartsNSNumberDoubleArchive(const ChartsNSNumberDoubleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); number_archive_ = from.number_archive_; // @@protoc_insertion_point(copy_constructor:TSCH.ChartsNSNumberDoubleArchive) } inline void ChartsNSNumberDoubleArchive::SharedCtor() { number_archive_ = 0; } ChartsNSNumberDoubleArchive::~ChartsNSNumberDoubleArchive() { // @@protoc_insertion_point(destructor:TSCH.ChartsNSNumberDoubleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ChartsNSNumberDoubleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); } void ChartsNSNumberDoubleArchive::ArenaDtor(void* object) { ChartsNSNumberDoubleArchive* _this = reinterpret_cast< ChartsNSNumberDoubleArchive* >(object); (void)_this; } void ChartsNSNumberDoubleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ChartsNSNumberDoubleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ChartsNSNumberDoubleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ChartsNSNumberDoubleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; number_archive_ = 0; _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ChartsNSNumberDoubleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional double number_archive = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 9)) { _Internal::set_has_number_archive(&has_bits); number_archive_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); ptr += sizeof(double); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ChartsNSNumberDoubleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ChartsNSNumberDoubleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional double number_archive = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(1, this->_internal_number_archive(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ChartsNSNumberDoubleArchive) return target; } size_t ChartsNSNumberDoubleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ChartsNSNumberDoubleArchive) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional double number_archive = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + 8; } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ChartsNSNumberDoubleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ChartsNSNumberDoubleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ChartsNSNumberDoubleArchive::GetClassData() const { return &_class_data_; } void ChartsNSNumberDoubleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ChartsNSNumberDoubleArchive *>(to)->MergeFrom( static_cast<const ChartsNSNumberDoubleArchive &>(from)); } void ChartsNSNumberDoubleArchive::MergeFrom(const ChartsNSNumberDoubleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ChartsNSNumberDoubleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_number_archive()) { _internal_set_number_archive(from._internal_number_archive()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ChartsNSNumberDoubleArchive::CopyFrom(const ChartsNSNumberDoubleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ChartsNSNumberDoubleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ChartsNSNumberDoubleArchive::IsInitialized() const { return true; } void ChartsNSNumberDoubleArchive::InternalSwap(ChartsNSNumberDoubleArchive* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(number_archive_, other->number_archive_); } ::PROTOBUF_NAMESPACE_ID::Metadata ChartsNSNumberDoubleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[1]); } // =================================================================== class ChartsNSArrayOfNSNumberDoubleArchive::_Internal { public: }; ChartsNSArrayOfNSNumberDoubleArchive::ChartsNSArrayOfNSNumberDoubleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), numbers_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ChartsNSArrayOfNSNumberDoubleArchive) } ChartsNSArrayOfNSNumberDoubleArchive::ChartsNSArrayOfNSNumberDoubleArchive(const ChartsNSArrayOfNSNumberDoubleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), numbers_(from.numbers_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); // @@protoc_insertion_point(copy_constructor:TSCH.ChartsNSArrayOfNSNumberDoubleArchive) } inline void ChartsNSArrayOfNSNumberDoubleArchive::SharedCtor() { } ChartsNSArrayOfNSNumberDoubleArchive::~ChartsNSArrayOfNSNumberDoubleArchive() { // @@protoc_insertion_point(destructor:TSCH.ChartsNSArrayOfNSNumberDoubleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ChartsNSArrayOfNSNumberDoubleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); } void ChartsNSArrayOfNSNumberDoubleArchive::ArenaDtor(void* object) { ChartsNSArrayOfNSNumberDoubleArchive* _this = reinterpret_cast< ChartsNSArrayOfNSNumberDoubleArchive* >(object); (void)_this; } void ChartsNSArrayOfNSNumberDoubleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ChartsNSArrayOfNSNumberDoubleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ChartsNSArrayOfNSNumberDoubleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ChartsNSArrayOfNSNumberDoubleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; numbers_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ChartsNSArrayOfNSNumberDoubleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated double numbers = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 9)) { ptr -= 1; do { ptr += 1; _internal_add_numbers(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr)); ptr += sizeof(double); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<9>(ptr)); } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10) { ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedDoubleParser(_internal_mutable_numbers(), ptr, ctx); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ChartsNSArrayOfNSNumberDoubleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ChartsNSArrayOfNSNumberDoubleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // repeated double numbers = 1; for (int i = 0, n = this->_internal_numbers_size(); i < n; i++) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(1, this->_internal_numbers(i), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ChartsNSArrayOfNSNumberDoubleArchive) return target; } size_t ChartsNSArrayOfNSNumberDoubleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ChartsNSArrayOfNSNumberDoubleArchive) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // repeated double numbers = 1; { unsigned int count = static_cast<unsigned int>(this->_internal_numbers_size()); size_t data_size = 8UL * count; total_size += 1 * ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_numbers_size()); total_size += data_size; } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ChartsNSArrayOfNSNumberDoubleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ChartsNSArrayOfNSNumberDoubleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ChartsNSArrayOfNSNumberDoubleArchive::GetClassData() const { return &_class_data_; } void ChartsNSArrayOfNSNumberDoubleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ChartsNSArrayOfNSNumberDoubleArchive *>(to)->MergeFrom( static_cast<const ChartsNSArrayOfNSNumberDoubleArchive &>(from)); } void ChartsNSArrayOfNSNumberDoubleArchive::MergeFrom(const ChartsNSArrayOfNSNumberDoubleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ChartsNSArrayOfNSNumberDoubleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; numbers_.MergeFrom(from.numbers_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ChartsNSArrayOfNSNumberDoubleArchive::CopyFrom(const ChartsNSArrayOfNSNumberDoubleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ChartsNSArrayOfNSNumberDoubleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ChartsNSArrayOfNSNumberDoubleArchive::IsInitialized() const { return true; } void ChartsNSArrayOfNSNumberDoubleArchive::InternalSwap(ChartsNSArrayOfNSNumberDoubleArchive* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); numbers_.InternalSwap(&other->numbers_); } ::PROTOBUF_NAMESPACE_ID::Metadata ChartsNSArrayOfNSNumberDoubleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[2]); } // =================================================================== class DEPRECATEDChart3DFillArchive::_Internal { public: using HasBits = decltype(std::declval<DEPRECATEDChart3DFillArchive>()._has_bits_); static const ::TSD::FillArchive& fill(const DEPRECATEDChart3DFillArchive* msg); static void set_has_fill(HasBits* has_bits) { (*has_bits)[0] |= 2u; } static const ::TSCH::Chart3DLightingModelArchive& lightingmodel(const DEPRECATEDChart3DFillArchive* msg); static void set_has_lightingmodel(HasBits* has_bits) { (*has_bits)[0] |= 4u; } static void set_has_textureset_id(HasBits* has_bits) { (*has_bits)[0] |= 1u; } static void set_has_fill_type(HasBits* has_bits) { (*has_bits)[0] |= 8u; } static void set_has_series_index(HasBits* has_bits) { (*has_bits)[0] |= 16u; } }; const ::TSD::FillArchive& DEPRECATEDChart3DFillArchive::_Internal::fill(const DEPRECATEDChart3DFillArchive* msg) { return *msg->fill_; } const ::TSCH::Chart3DLightingModelArchive& DEPRECATEDChart3DFillArchive::_Internal::lightingmodel(const DEPRECATEDChart3DFillArchive* msg) { return *msg->lightingmodel_; } void DEPRECATEDChart3DFillArchive::clear_fill() { if (fill_ != nullptr) fill_->Clear(); _has_bits_[0] &= ~0x00000002u; } void DEPRECATEDChart3DFillArchive::clear_lightingmodel() { if (lightingmodel_ != nullptr) lightingmodel_->Clear(); _has_bits_[0] &= ~0x00000004u; } DEPRECATEDChart3DFillArchive::DEPRECATEDChart3DFillArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.DEPRECATEDChart3DFillArchive) } DEPRECATEDChart3DFillArchive::DEPRECATEDChart3DFillArchive(const DEPRECATEDChart3DFillArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); textureset_id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (from._internal_has_textureset_id()) { textureset_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_textureset_id(), GetArenaForAllocation()); } if (from._internal_has_fill()) { fill_ = new ::TSD::FillArchive(*from.fill_); } else { fill_ = nullptr; } if (from._internal_has_lightingmodel()) { lightingmodel_ = new ::TSCH::Chart3DLightingModelArchive(*from.lightingmodel_); } else { lightingmodel_ = nullptr; } ::memcpy(&fill_type_, &from.fill_type_, static_cast<size_t>(reinterpret_cast<char*>(&series_index_) - reinterpret_cast<char*>(&fill_type_)) + sizeof(series_index_)); // @@protoc_insertion_point(copy_constructor:TSCH.DEPRECATEDChart3DFillArchive) } inline void DEPRECATEDChart3DFillArchive::SharedCtor() { textureset_id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&fill_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&series_index_) - reinterpret_cast<char*>(&fill_)) + sizeof(series_index_)); } DEPRECATEDChart3DFillArchive::~DEPRECATEDChart3DFillArchive() { // @@protoc_insertion_point(destructor:TSCH.DEPRECATEDChart3DFillArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void DEPRECATEDChart3DFillArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); textureset_id_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete fill_; if (this != internal_default_instance()) delete lightingmodel_; } void DEPRECATEDChart3DFillArchive::ArenaDtor(void* object) { DEPRECATEDChart3DFillArchive* _this = reinterpret_cast< DEPRECATEDChart3DFillArchive* >(object); (void)_this; } void DEPRECATEDChart3DFillArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void DEPRECATEDChart3DFillArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void DEPRECATEDChart3DFillArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.DEPRECATEDChart3DFillArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000007u) { if (cached_has_bits & 0x00000001u) { textureset_id_.ClearNonDefaultToEmpty(); } if (cached_has_bits & 0x00000002u) { GOOGLE_DCHECK(fill_ != nullptr); fill_->Clear(); } if (cached_has_bits & 0x00000004u) { GOOGLE_DCHECK(lightingmodel_ != nullptr); lightingmodel_->Clear(); } } if (cached_has_bits & 0x00000018u) { ::memset(&fill_type_, 0, static_cast<size_t>( reinterpret_cast<char*>(&series_index_) - reinterpret_cast<char*>(&fill_type_)) + sizeof(series_index_)); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* DEPRECATEDChart3DFillArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSD.FillArchive fill = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_fill(), ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional .TSCH.Chart3DLightingModelArchive lightingmodel = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { ptr = ctx->ParseMessage(_internal_mutable_lightingmodel(), ptr); CHK_(ptr); } else goto handle_unusual; continue; // optional string textureset_id = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) { auto str = _internal_mutable_textureset_id(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); #ifndef NDEBUG ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "TSCH.DEPRECATEDChart3DFillArchive.textureset_id"); #endif // !NDEBUG CHK_(ptr); } else goto handle_unusual; continue; // optional .TSCH.FillPropertyType fill_type = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); if (PROTOBUF_PREDICT_TRUE(::TSCH::FillPropertyType_IsValid(val))) { _internal_set_fill_type(static_cast<::TSCH::FillPropertyType>(val)); } else { ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); } } else goto handle_unusual; continue; // optional uint32 series_index = 5; case 5: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) { _Internal::set_has_series_index(&has_bits); series_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* DEPRECATEDChart3DFillArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.DEPRECATEDChart3DFillArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSD.FillArchive fill = 1; if (cached_has_bits & 0x00000002u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::fill(this), target, stream); } // optional .TSCH.Chart3DLightingModelArchive lightingmodel = 2; if (cached_has_bits & 0x00000004u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 2, _Internal::lightingmodel(this), target, stream); } // optional string textureset_id = 3; if (cached_has_bits & 0x00000001u) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField( this->_internal_textureset_id().data(), static_cast<int>(this->_internal_textureset_id().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE, "TSCH.DEPRECATEDChart3DFillArchive.textureset_id"); target = stream->WriteStringMaybeAliased( 3, this->_internal_textureset_id(), target); } // optional .TSCH.FillPropertyType fill_type = 4; if (cached_has_bits & 0x00000008u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 4, this->_internal_fill_type(), target); } // optional uint32 series_index = 5; if (cached_has_bits & 0x00000010u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(5, this->_internal_series_index(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.DEPRECATEDChart3DFillArchive) return target; } size_t DEPRECATEDChart3DFillArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.DEPRECATEDChart3DFillArchive) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x0000001fu) { // optional string textureset_id = 3; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_textureset_id()); } // optional .TSD.FillArchive fill = 1; if (cached_has_bits & 0x00000002u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *fill_); } // optional .TSCH.Chart3DLightingModelArchive lightingmodel = 2; if (cached_has_bits & 0x00000004u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *lightingmodel_); } // optional .TSCH.FillPropertyType fill_type = 4; if (cached_has_bits & 0x00000008u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_fill_type()); } // optional uint32 series_index = 5; if (cached_has_bits & 0x00000010u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( this->_internal_series_index()); } } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData DEPRECATEDChart3DFillArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, DEPRECATEDChart3DFillArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*DEPRECATEDChart3DFillArchive::GetClassData() const { return &_class_data_; } void DEPRECATEDChart3DFillArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<DEPRECATEDChart3DFillArchive *>(to)->MergeFrom( static_cast<const DEPRECATEDChart3DFillArchive &>(from)); } void DEPRECATEDChart3DFillArchive::MergeFrom(const DEPRECATEDChart3DFillArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.DEPRECATEDChart3DFillArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 0x0000001fu) { if (cached_has_bits & 0x00000001u) { _internal_set_textureset_id(from._internal_textureset_id()); } if (cached_has_bits & 0x00000002u) { _internal_mutable_fill()->::TSD::FillArchive::MergeFrom(from._internal_fill()); } if (cached_has_bits & 0x00000004u) { _internal_mutable_lightingmodel()->::TSCH::Chart3DLightingModelArchive::MergeFrom(from._internal_lightingmodel()); } if (cached_has_bits & 0x00000008u) { fill_type_ = from.fill_type_; } if (cached_has_bits & 0x00000010u) { series_index_ = from.series_index_; } _has_bits_[0] |= cached_has_bits; } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void DEPRECATEDChart3DFillArchive::CopyFrom(const DEPRECATEDChart3DFillArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.DEPRECATEDChart3DFillArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool DEPRECATEDChart3DFillArchive::IsInitialized() const { if (_internal_has_fill()) { if (!fill_->IsInitialized()) return false; } if (_internal_has_lightingmodel()) { if (!lightingmodel_->IsInitialized()) return false; } return true; } void DEPRECATEDChart3DFillArchive::InternalSwap(DEPRECATEDChart3DFillArchive* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), &textureset_id_, GetArenaForAllocation(), &other->textureset_id_, other->GetArenaForAllocation() ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(DEPRECATEDChart3DFillArchive, series_index_) + sizeof(DEPRECATEDChart3DFillArchive::series_index_) - PROTOBUF_FIELD_OFFSET(DEPRECATEDChart3DFillArchive, fill_)>( reinterpret_cast<char*>(&fill_), reinterpret_cast<char*>(&other->fill_)); } ::PROTOBUF_NAMESPACE_ID::Metadata DEPRECATEDChart3DFillArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[3]); } // =================================================================== class ChartStyleArchive::_Internal { public: using HasBits = decltype(std::declval<ChartStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const ChartStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& ChartStyleArchive::_Internal::super(const ChartStyleArchive* msg) { return *msg->super_; } void ChartStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } ChartStyleArchive::ChartStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ChartStyleArchive) } ChartStyleArchive::ChartStyleArchive(const ChartStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.ChartStyleArchive) } inline void ChartStyleArchive::SharedCtor() { super_ = nullptr; } ChartStyleArchive::~ChartStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.ChartStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ChartStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void ChartStyleArchive::ArenaDtor(void* object) { ChartStyleArchive* _this = reinterpret_cast< ChartStyleArchive* >(object); (void)_this; } void ChartStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ChartStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ChartStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ChartStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ChartStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ChartStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ChartStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ChartStyleArchive) return target; } size_t ChartStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ChartStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ChartStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ChartStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ChartStyleArchive::GetClassData() const { return &_class_data_; } void ChartStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ChartStyleArchive *>(to)->MergeFrom( static_cast<const ChartStyleArchive &>(from)); } void ChartStyleArchive::MergeFrom(const ChartStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ChartStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ChartStyleArchive::CopyFrom(const ChartStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ChartStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ChartStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void ChartStyleArchive::InternalSwap(ChartStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata ChartStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[4]); } // =================================================================== class ChartNonStyleArchive::_Internal { public: using HasBits = decltype(std::declval<ChartNonStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const ChartNonStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& ChartNonStyleArchive::_Internal::super(const ChartNonStyleArchive* msg) { return *msg->super_; } void ChartNonStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } ChartNonStyleArchive::ChartNonStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ChartNonStyleArchive) } ChartNonStyleArchive::ChartNonStyleArchive(const ChartNonStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.ChartNonStyleArchive) } inline void ChartNonStyleArchive::SharedCtor() { super_ = nullptr; } ChartNonStyleArchive::~ChartNonStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.ChartNonStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ChartNonStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void ChartNonStyleArchive::ArenaDtor(void* object) { ChartNonStyleArchive* _this = reinterpret_cast< ChartNonStyleArchive* >(object); (void)_this; } void ChartNonStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ChartNonStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ChartNonStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ChartNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ChartNonStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ChartNonStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ChartNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ChartNonStyleArchive) return target; } size_t ChartNonStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ChartNonStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ChartNonStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ChartNonStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ChartNonStyleArchive::GetClassData() const { return &_class_data_; } void ChartNonStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ChartNonStyleArchive *>(to)->MergeFrom( static_cast<const ChartNonStyleArchive &>(from)); } void ChartNonStyleArchive::MergeFrom(const ChartNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ChartNonStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ChartNonStyleArchive::CopyFrom(const ChartNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ChartNonStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ChartNonStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void ChartNonStyleArchive::InternalSwap(ChartNonStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata ChartNonStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[5]); } // =================================================================== class LegendStyleArchive::_Internal { public: using HasBits = decltype(std::declval<LegendStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const LegendStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& LegendStyleArchive::_Internal::super(const LegendStyleArchive* msg) { return *msg->super_; } void LegendStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } LegendStyleArchive::LegendStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.LegendStyleArchive) } LegendStyleArchive::LegendStyleArchive(const LegendStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.LegendStyleArchive) } inline void LegendStyleArchive::SharedCtor() { super_ = nullptr; } LegendStyleArchive::~LegendStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.LegendStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void LegendStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void LegendStyleArchive::ArenaDtor(void* object) { LegendStyleArchive* _this = reinterpret_cast< LegendStyleArchive* >(object); (void)_this; } void LegendStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void LegendStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void LegendStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.LegendStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* LegendStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* LegendStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.LegendStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.LegendStyleArchive) return target; } size_t LegendStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.LegendStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LegendStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, LegendStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LegendStyleArchive::GetClassData() const { return &_class_data_; } void LegendStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<LegendStyleArchive *>(to)->MergeFrom( static_cast<const LegendStyleArchive &>(from)); } void LegendStyleArchive::MergeFrom(const LegendStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.LegendStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void LegendStyleArchive::CopyFrom(const LegendStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.LegendStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool LegendStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void LegendStyleArchive::InternalSwap(LegendStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata LegendStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[6]); } // =================================================================== class LegendNonStyleArchive::_Internal { public: using HasBits = decltype(std::declval<LegendNonStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const LegendNonStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& LegendNonStyleArchive::_Internal::super(const LegendNonStyleArchive* msg) { return *msg->super_; } void LegendNonStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } LegendNonStyleArchive::LegendNonStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.LegendNonStyleArchive) } LegendNonStyleArchive::LegendNonStyleArchive(const LegendNonStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.LegendNonStyleArchive) } inline void LegendNonStyleArchive::SharedCtor() { super_ = nullptr; } LegendNonStyleArchive::~LegendNonStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.LegendNonStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void LegendNonStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void LegendNonStyleArchive::ArenaDtor(void* object) { LegendNonStyleArchive* _this = reinterpret_cast< LegendNonStyleArchive* >(object); (void)_this; } void LegendNonStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void LegendNonStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void LegendNonStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.LegendNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* LegendNonStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* LegendNonStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.LegendNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.LegendNonStyleArchive) return target; } size_t LegendNonStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.LegendNonStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData LegendNonStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, LegendNonStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*LegendNonStyleArchive::GetClassData() const { return &_class_data_; } void LegendNonStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<LegendNonStyleArchive *>(to)->MergeFrom( static_cast<const LegendNonStyleArchive &>(from)); } void LegendNonStyleArchive::MergeFrom(const LegendNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.LegendNonStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void LegendNonStyleArchive::CopyFrom(const LegendNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.LegendNonStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool LegendNonStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void LegendNonStyleArchive::InternalSwap(LegendNonStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata LegendNonStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[7]); } // =================================================================== class ChartAxisStyleArchive::_Internal { public: using HasBits = decltype(std::declval<ChartAxisStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const ChartAxisStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& ChartAxisStyleArchive::_Internal::super(const ChartAxisStyleArchive* msg) { return *msg->super_; } void ChartAxisStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } ChartAxisStyleArchive::ChartAxisStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ChartAxisStyleArchive) } ChartAxisStyleArchive::ChartAxisStyleArchive(const ChartAxisStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.ChartAxisStyleArchive) } inline void ChartAxisStyleArchive::SharedCtor() { super_ = nullptr; } ChartAxisStyleArchive::~ChartAxisStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.ChartAxisStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ChartAxisStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void ChartAxisStyleArchive::ArenaDtor(void* object) { ChartAxisStyleArchive* _this = reinterpret_cast< ChartAxisStyleArchive* >(object); (void)_this; } void ChartAxisStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ChartAxisStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ChartAxisStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ChartAxisStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ChartAxisStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ChartAxisStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ChartAxisStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ChartAxisStyleArchive) return target; } size_t ChartAxisStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ChartAxisStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ChartAxisStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ChartAxisStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ChartAxisStyleArchive::GetClassData() const { return &_class_data_; } void ChartAxisStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ChartAxisStyleArchive *>(to)->MergeFrom( static_cast<const ChartAxisStyleArchive &>(from)); } void ChartAxisStyleArchive::MergeFrom(const ChartAxisStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ChartAxisStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ChartAxisStyleArchive::CopyFrom(const ChartAxisStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ChartAxisStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ChartAxisStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void ChartAxisStyleArchive::InternalSwap(ChartAxisStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata ChartAxisStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[8]); } // =================================================================== class ChartAxisNonStyleArchive::_Internal { public: using HasBits = decltype(std::declval<ChartAxisNonStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const ChartAxisNonStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& ChartAxisNonStyleArchive::_Internal::super(const ChartAxisNonStyleArchive* msg) { return *msg->super_; } void ChartAxisNonStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } ChartAxisNonStyleArchive::ChartAxisNonStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ChartAxisNonStyleArchive) } ChartAxisNonStyleArchive::ChartAxisNonStyleArchive(const ChartAxisNonStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.ChartAxisNonStyleArchive) } inline void ChartAxisNonStyleArchive::SharedCtor() { super_ = nullptr; } ChartAxisNonStyleArchive::~ChartAxisNonStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.ChartAxisNonStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ChartAxisNonStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void ChartAxisNonStyleArchive::ArenaDtor(void* object) { ChartAxisNonStyleArchive* _this = reinterpret_cast< ChartAxisNonStyleArchive* >(object); (void)_this; } void ChartAxisNonStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ChartAxisNonStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ChartAxisNonStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ChartAxisNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ChartAxisNonStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ChartAxisNonStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ChartAxisNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ChartAxisNonStyleArchive) return target; } size_t ChartAxisNonStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ChartAxisNonStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ChartAxisNonStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ChartAxisNonStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ChartAxisNonStyleArchive::GetClassData() const { return &_class_data_; } void ChartAxisNonStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ChartAxisNonStyleArchive *>(to)->MergeFrom( static_cast<const ChartAxisNonStyleArchive &>(from)); } void ChartAxisNonStyleArchive::MergeFrom(const ChartAxisNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ChartAxisNonStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ChartAxisNonStyleArchive::CopyFrom(const ChartAxisNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ChartAxisNonStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ChartAxisNonStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void ChartAxisNonStyleArchive::InternalSwap(ChartAxisNonStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata ChartAxisNonStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[9]); } // =================================================================== class ChartSeriesStyleArchive::_Internal { public: using HasBits = decltype(std::declval<ChartSeriesStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const ChartSeriesStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& ChartSeriesStyleArchive::_Internal::super(const ChartSeriesStyleArchive* msg) { return *msg->super_; } void ChartSeriesStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } ChartSeriesStyleArchive::ChartSeriesStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ChartSeriesStyleArchive) } ChartSeriesStyleArchive::ChartSeriesStyleArchive(const ChartSeriesStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.ChartSeriesStyleArchive) } inline void ChartSeriesStyleArchive::SharedCtor() { super_ = nullptr; } ChartSeriesStyleArchive::~ChartSeriesStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.ChartSeriesStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ChartSeriesStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void ChartSeriesStyleArchive::ArenaDtor(void* object) { ChartSeriesStyleArchive* _this = reinterpret_cast< ChartSeriesStyleArchive* >(object); (void)_this; } void ChartSeriesStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ChartSeriesStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ChartSeriesStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ChartSeriesStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ChartSeriesStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ChartSeriesStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ChartSeriesStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ChartSeriesStyleArchive) return target; } size_t ChartSeriesStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ChartSeriesStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ChartSeriesStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ChartSeriesStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ChartSeriesStyleArchive::GetClassData() const { return &_class_data_; } void ChartSeriesStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ChartSeriesStyleArchive *>(to)->MergeFrom( static_cast<const ChartSeriesStyleArchive &>(from)); } void ChartSeriesStyleArchive::MergeFrom(const ChartSeriesStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ChartSeriesStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ChartSeriesStyleArchive::CopyFrom(const ChartSeriesStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ChartSeriesStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ChartSeriesStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void ChartSeriesStyleArchive::InternalSwap(ChartSeriesStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata ChartSeriesStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[10]); } // =================================================================== class ChartSeriesNonStyleArchive::_Internal { public: using HasBits = decltype(std::declval<ChartSeriesNonStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const ChartSeriesNonStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& ChartSeriesNonStyleArchive::_Internal::super(const ChartSeriesNonStyleArchive* msg) { return *msg->super_; } void ChartSeriesNonStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } ChartSeriesNonStyleArchive::ChartSeriesNonStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ChartSeriesNonStyleArchive) } ChartSeriesNonStyleArchive::ChartSeriesNonStyleArchive(const ChartSeriesNonStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.ChartSeriesNonStyleArchive) } inline void ChartSeriesNonStyleArchive::SharedCtor() { super_ = nullptr; } ChartSeriesNonStyleArchive::~ChartSeriesNonStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.ChartSeriesNonStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ChartSeriesNonStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void ChartSeriesNonStyleArchive::ArenaDtor(void* object) { ChartSeriesNonStyleArchive* _this = reinterpret_cast< ChartSeriesNonStyleArchive* >(object); (void)_this; } void ChartSeriesNonStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ChartSeriesNonStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ChartSeriesNonStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ChartSeriesNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ChartSeriesNonStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ChartSeriesNonStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ChartSeriesNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ChartSeriesNonStyleArchive) return target; } size_t ChartSeriesNonStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ChartSeriesNonStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ChartSeriesNonStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ChartSeriesNonStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ChartSeriesNonStyleArchive::GetClassData() const { return &_class_data_; } void ChartSeriesNonStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ChartSeriesNonStyleArchive *>(to)->MergeFrom( static_cast<const ChartSeriesNonStyleArchive &>(from)); } void ChartSeriesNonStyleArchive::MergeFrom(const ChartSeriesNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ChartSeriesNonStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ChartSeriesNonStyleArchive::CopyFrom(const ChartSeriesNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ChartSeriesNonStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ChartSeriesNonStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void ChartSeriesNonStyleArchive::InternalSwap(ChartSeriesNonStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata ChartSeriesNonStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[11]); } // =================================================================== class GridValue::_Internal { public: using HasBits = decltype(std::declval<GridValue>()._has_bits_); static void set_has_numeric_value(HasBits* has_bits) { (*has_bits)[0] |= 1u; } static void set_has_date_value_1_0(HasBits* has_bits) { (*has_bits)[0] |= 2u; } static void set_has_duration_value(HasBits* has_bits) { (*has_bits)[0] |= 4u; } static void set_has_date_value(HasBits* has_bits) { (*has_bits)[0] |= 8u; } }; GridValue::GridValue(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.GridValue) } GridValue::GridValue(const GridValue& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); ::memcpy(&numeric_value_, &from.numeric_value_, static_cast<size_t>(reinterpret_cast<char*>(&date_value_) - reinterpret_cast<char*>(&numeric_value_)) + sizeof(date_value_)); // @@protoc_insertion_point(copy_constructor:TSCH.GridValue) } inline void GridValue::SharedCtor() { ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>( reinterpret_cast<char*>(&numeric_value_) - reinterpret_cast<char*>(this)), 0, static_cast<size_t>(reinterpret_cast<char*>(&date_value_) - reinterpret_cast<char*>(&numeric_value_)) + sizeof(date_value_)); } GridValue::~GridValue() { // @@protoc_insertion_point(destructor:TSCH.GridValue) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void GridValue::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); } void GridValue::ArenaDtor(void* object) { GridValue* _this = reinterpret_cast< GridValue* >(object); (void)_this; } void GridValue::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void GridValue::SetCachedSize(int size) const { _cached_size_.Set(size); } void GridValue::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.GridValue) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x0000000fu) { ::memset(&numeric_value_, 0, static_cast<size_t>( reinterpret_cast<char*>(&date_value_) - reinterpret_cast<char*>(&numeric_value_)) + sizeof(date_value_)); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* GridValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional double numeric_value = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 9)) { _Internal::set_has_numeric_value(&has_bits); numeric_value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); ptr += sizeof(double); } else goto handle_unusual; continue; // optional double date_value_1_0 = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 17)) { _Internal::set_has_date_value_1_0(&has_bits); date_value_1_0_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); ptr += sizeof(double); } else goto handle_unusual; continue; // optional double duration_value = 3; case 3: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 25)) { _Internal::set_has_duration_value(&has_bits); duration_value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); ptr += sizeof(double); } else goto handle_unusual; continue; // optional double date_value = 4; case 4: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 33)) { _Internal::set_has_date_value(&has_bits); date_value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr); ptr += sizeof(double); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* GridValue::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.GridValue) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional double numeric_value = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(1, this->_internal_numeric_value(), target); } // optional double date_value_1_0 = 2; if (cached_has_bits & 0x00000002u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(2, this->_internal_date_value_1_0(), target); } // optional double duration_value = 3; if (cached_has_bits & 0x00000004u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(3, this->_internal_duration_value(), target); } // optional double date_value = 4; if (cached_has_bits & 0x00000008u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(4, this->_internal_date_value(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.GridValue) return target; } size_t GridValue::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.GridValue) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x0000000fu) { // optional double numeric_value = 1; if (cached_has_bits & 0x00000001u) { total_size += 1 + 8; } // optional double date_value_1_0 = 2; if (cached_has_bits & 0x00000002u) { total_size += 1 + 8; } // optional double duration_value = 3; if (cached_has_bits & 0x00000004u) { total_size += 1 + 8; } // optional double date_value = 4; if (cached_has_bits & 0x00000008u) { total_size += 1 + 8; } } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GridValue::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, GridValue::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GridValue::GetClassData() const { return &_class_data_; } void GridValue::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<GridValue *>(to)->MergeFrom( static_cast<const GridValue &>(from)); } void GridValue::MergeFrom(const GridValue& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.GridValue) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; if (cached_has_bits & 0x0000000fu) { if (cached_has_bits & 0x00000001u) { numeric_value_ = from.numeric_value_; } if (cached_has_bits & 0x00000002u) { date_value_1_0_ = from.date_value_1_0_; } if (cached_has_bits & 0x00000004u) { duration_value_ = from.duration_value_; } if (cached_has_bits & 0x00000008u) { date_value_ = from.date_value_; } _has_bits_[0] |= cached_has_bits; } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void GridValue::CopyFrom(const GridValue& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.GridValue) if (&from == this) return; Clear(); MergeFrom(from); } bool GridValue::IsInitialized() const { return true; } void GridValue::InternalSwap(GridValue* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(GridValue, date_value_) + sizeof(GridValue::date_value_) - PROTOBUF_FIELD_OFFSET(GridValue, numeric_value_)>( reinterpret_cast<char*>(&numeric_value_), reinterpret_cast<char*>(&other->numeric_value_)); } ::PROTOBUF_NAMESPACE_ID::Metadata GridValue::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[12]); } // =================================================================== class GridRow::_Internal { public: }; GridRow::GridRow(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), value_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.GridRow) } GridRow::GridRow(const GridRow& from) : ::PROTOBUF_NAMESPACE_ID::Message(), value_(from.value_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); // @@protoc_insertion_point(copy_constructor:TSCH.GridRow) } inline void GridRow::SharedCtor() { } GridRow::~GridRow() { // @@protoc_insertion_point(destructor:TSCH.GridRow) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void GridRow::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); } void GridRow::ArenaDtor(void* object) { GridRow* _this = reinterpret_cast< GridRow* >(object); (void)_this; } void GridRow::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void GridRow::SetCachedSize(int size) const { _cached_size_.Set(size); } void GridRow::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.GridRow) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; value_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* GridRow::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // repeated .TSCH.GridValue value = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr -= 1; do { ptr += 1; ptr = ctx->ParseMessage(_internal_add_value(), ptr); CHK_(ptr); if (!ctx->DataAvailable(ptr)) break; } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* GridRow::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.GridRow) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // repeated .TSCH.GridValue value = 1; for (unsigned int i = 0, n = static_cast<unsigned int>(this->_internal_value_size()); i < n; i++) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage(1, this->_internal_value(i), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.GridRow) return target; } size_t GridRow::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.GridRow) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // repeated .TSCH.GridValue value = 1; total_size += 1UL * this->_internal_value_size(); for (const auto& msg : this->value_) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData GridRow::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, GridRow::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GridRow::GetClassData() const { return &_class_data_; } void GridRow::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<GridRow *>(to)->MergeFrom( static_cast<const GridRow &>(from)); } void GridRow::MergeFrom(const GridRow& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.GridRow) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; value_.MergeFrom(from.value_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void GridRow::CopyFrom(const GridRow& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.GridRow) if (&from == this) return; Clear(); MergeFrom(from); } bool GridRow::IsInitialized() const { return true; } void GridRow::InternalSwap(GridRow* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); value_.InternalSwap(&other->value_); } ::PROTOBUF_NAMESPACE_ID::Metadata GridRow::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[13]); } // =================================================================== class ReferenceLineStyleArchive::_Internal { public: using HasBits = decltype(std::declval<ReferenceLineStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const ReferenceLineStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& ReferenceLineStyleArchive::_Internal::super(const ReferenceLineStyleArchive* msg) { return *msg->super_; } void ReferenceLineStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } ReferenceLineStyleArchive::ReferenceLineStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ReferenceLineStyleArchive) } ReferenceLineStyleArchive::ReferenceLineStyleArchive(const ReferenceLineStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.ReferenceLineStyleArchive) } inline void ReferenceLineStyleArchive::SharedCtor() { super_ = nullptr; } ReferenceLineStyleArchive::~ReferenceLineStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.ReferenceLineStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ReferenceLineStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void ReferenceLineStyleArchive::ArenaDtor(void* object) { ReferenceLineStyleArchive* _this = reinterpret_cast< ReferenceLineStyleArchive* >(object); (void)_this; } void ReferenceLineStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ReferenceLineStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ReferenceLineStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ReferenceLineStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ReferenceLineStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ReferenceLineStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ReferenceLineStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ReferenceLineStyleArchive) return target; } size_t ReferenceLineStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ReferenceLineStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ReferenceLineStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ReferenceLineStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ReferenceLineStyleArchive::GetClassData() const { return &_class_data_; } void ReferenceLineStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ReferenceLineStyleArchive *>(to)->MergeFrom( static_cast<const ReferenceLineStyleArchive &>(from)); } void ReferenceLineStyleArchive::MergeFrom(const ReferenceLineStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ReferenceLineStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ReferenceLineStyleArchive::CopyFrom(const ReferenceLineStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ReferenceLineStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ReferenceLineStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void ReferenceLineStyleArchive::InternalSwap(ReferenceLineStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata ReferenceLineStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[14]); } // =================================================================== class ReferenceLineNonStyleArchive::_Internal { public: using HasBits = decltype(std::declval<ReferenceLineNonStyleArchive>()._has_bits_); static const ::TSS::StyleArchive& super(const ReferenceLineNonStyleArchive* msg); static void set_has_super(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; const ::TSS::StyleArchive& ReferenceLineNonStyleArchive::_Internal::super(const ReferenceLineNonStyleArchive* msg) { return *msg->super_; } void ReferenceLineNonStyleArchive::clear_super() { if (super_ != nullptr) super_->Clear(); _has_bits_[0] &= ~0x00000001u; } ReferenceLineNonStyleArchive::ReferenceLineNonStyleArchive(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned), _extensions_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:TSCH.ReferenceLineNonStyleArchive) } ReferenceLineNonStyleArchive::ReferenceLineNonStyleArchive(const ReferenceLineNonStyleArchive& from) : ::PROTOBUF_NAMESPACE_ID::Message(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); _extensions_.MergeFrom(from._extensions_); if (from._internal_has_super()) { super_ = new ::TSS::StyleArchive(*from.super_); } else { super_ = nullptr; } // @@protoc_insertion_point(copy_constructor:TSCH.ReferenceLineNonStyleArchive) } inline void ReferenceLineNonStyleArchive::SharedCtor() { super_ = nullptr; } ReferenceLineNonStyleArchive::~ReferenceLineNonStyleArchive() { // @@protoc_insertion_point(destructor:TSCH.ReferenceLineNonStyleArchive) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ReferenceLineNonStyleArchive::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete super_; } void ReferenceLineNonStyleArchive::ArenaDtor(void* object) { ReferenceLineNonStyleArchive* _this = reinterpret_cast< ReferenceLineNonStyleArchive* >(object); (void)_this; } void ReferenceLineNonStyleArchive::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ReferenceLineNonStyleArchive::SetCachedSize(int size) const { _cached_size_.Set(size); } void ReferenceLineNonStyleArchive::Clear() { // @@protoc_insertion_point(message_clear_start:TSCH.ReferenceLineNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _extensions_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(super_ != nullptr); super_->Clear(); } _has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ReferenceLineNonStyleArchive::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure _Internal::HasBits has_bits{}; while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // optional .TSS.StyleArchive super = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_super(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } if ((80000u <= tag)) { ptr = _extensions_.ParseField(tag, ptr, internal_default_instance(), &_internal_metadata_, ctx); CHK_(ptr != nullptr); continue; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: _has_bits_.Or(has_bits); return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ReferenceLineNonStyleArchive::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:TSCH.ReferenceLineNonStyleArchive) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; cached_has_bits = _has_bits_[0]; // optional .TSS.StyleArchive super = 1; if (cached_has_bits & 0x00000001u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::super(this), target, stream); } // Extension range [10000, 536870912) target = _extensions_._InternalSerialize( 10000, 536870912, target, stream); if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:TSCH.ReferenceLineNonStyleArchive) return target; } size_t ReferenceLineNonStyleArchive::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:TSCH.ReferenceLineNonStyleArchive) size_t total_size = 0; total_size += _extensions_.ByteSize(); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // optional .TSS.StyleArchive super = 1; cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *super_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ReferenceLineNonStyleArchive::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ReferenceLineNonStyleArchive::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ReferenceLineNonStyleArchive::GetClassData() const { return &_class_data_; } void ReferenceLineNonStyleArchive::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ReferenceLineNonStyleArchive *>(to)->MergeFrom( static_cast<const ReferenceLineNonStyleArchive &>(from)); } void ReferenceLineNonStyleArchive::MergeFrom(const ReferenceLineNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_merge_from_start:TSCH.ReferenceLineNonStyleArchive) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_super()) { _internal_mutable_super()->::TSS::StyleArchive::MergeFrom(from._internal_super()); } _extensions_.MergeFrom(from._extensions_); _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ReferenceLineNonStyleArchive::CopyFrom(const ReferenceLineNonStyleArchive& from) { // @@protoc_insertion_point(class_specific_copy_from_start:TSCH.ReferenceLineNonStyleArchive) if (&from == this) return; Clear(); MergeFrom(from); } bool ReferenceLineNonStyleArchive::IsInitialized() const { if (!_extensions_.IsInitialized()) { return false; } if (_internal_has_super()) { if (!super_->IsInitialized()) return false; } return true; } void ReferenceLineNonStyleArchive::InternalSwap(ReferenceLineNonStyleArchive* other) { using std::swap; _extensions_.InternalSwap(&other->_extensions_); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); swap(super_, other->super_); } ::PROTOBUF_NAMESPACE_ID::Metadata ReferenceLineNonStyleArchive::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_TSCHArchives_2eCommon_2eproto_getter, &descriptor_table_TSCHArchives_2eCommon_2eproto_once, file_level_metadata_TSCHArchives_2eCommon_2eproto[15]); } // @@protoc_insertion_point(namespace_scope) } // namespace TSCH PROTOBUF_NAMESPACE_OPEN template<> PROTOBUF_NOINLINE ::TSCH::RectArchive* Arena::CreateMaybeMessage< ::TSCH::RectArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::RectArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ChartsNSNumberDoubleArchive* Arena::CreateMaybeMessage< ::TSCH::ChartsNSNumberDoubleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ChartsNSNumberDoubleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ChartsNSArrayOfNSNumberDoubleArchive* Arena::CreateMaybeMessage< ::TSCH::ChartsNSArrayOfNSNumberDoubleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ChartsNSArrayOfNSNumberDoubleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::DEPRECATEDChart3DFillArchive* Arena::CreateMaybeMessage< ::TSCH::DEPRECATEDChart3DFillArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::DEPRECATEDChart3DFillArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ChartStyleArchive* Arena::CreateMaybeMessage< ::TSCH::ChartStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ChartStyleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ChartNonStyleArchive* Arena::CreateMaybeMessage< ::TSCH::ChartNonStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ChartNonStyleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::LegendStyleArchive* Arena::CreateMaybeMessage< ::TSCH::LegendStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::LegendStyleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::LegendNonStyleArchive* Arena::CreateMaybeMessage< ::TSCH::LegendNonStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::LegendNonStyleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ChartAxisStyleArchive* Arena::CreateMaybeMessage< ::TSCH::ChartAxisStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ChartAxisStyleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ChartAxisNonStyleArchive* Arena::CreateMaybeMessage< ::TSCH::ChartAxisNonStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ChartAxisNonStyleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ChartSeriesStyleArchive* Arena::CreateMaybeMessage< ::TSCH::ChartSeriesStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ChartSeriesStyleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ChartSeriesNonStyleArchive* Arena::CreateMaybeMessage< ::TSCH::ChartSeriesNonStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ChartSeriesNonStyleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::GridValue* Arena::CreateMaybeMessage< ::TSCH::GridValue >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::GridValue >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::GridRow* Arena::CreateMaybeMessage< ::TSCH::GridRow >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::GridRow >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ReferenceLineStyleArchive* Arena::CreateMaybeMessage< ::TSCH::ReferenceLineStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ReferenceLineStyleArchive >(arena); } template<> PROTOBUF_NOINLINE ::TSCH::ReferenceLineNonStyleArchive* Arena::CreateMaybeMessage< ::TSCH::ReferenceLineNonStyleArchive >(Arena* arena) { return Arena::CreateMessageInternal< ::TSCH::ReferenceLineNonStyleArchive >(arena); } PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) #include <google/protobuf/port_undef.inc>
38.185265
194
0.74131
eth-siplab
837d9f6d44723ba8afe7f9b91c002461cc41994c
367
cpp
C++
FSM/TrafficLight/TrafficLightSystem.cpp
Labae/CK_2-2-Game_AI
a8d953835883fd0cf7f92ba5d86fa93785f373bc
[ "MIT" ]
null
null
null
FSM/TrafficLight/TrafficLightSystem.cpp
Labae/CK_2-2-Game_AI
a8d953835883fd0cf7f92ba5d86fa93785f373bc
[ "MIT" ]
null
null
null
FSM/TrafficLight/TrafficLightSystem.cpp
Labae/CK_2-2-Game_AI
a8d953835883fd0cf7f92ba5d86fa93785f373bc
[ "MIT" ]
null
null
null
#include "TrafficLightSystem.h" #include "RedState.h" TrafficLightSystem::TrafficLightSystem() { _currentState = RedState::GetInstance(); } void TrafficLightSystem::Update() { _currentState->Execute(this); } void TrafficLightSystem::ChangeState(TrafficLightState* newState) { _currentState->Exit(this); _currentState = newState; _currentState->Enter(this); }
18.35
65
0.773842
Labae
838e8dec8f1d5233f656f598d5b753e55ab36237
2,757
cpp
C++
src/interpreter/ReplyTemplateInterpreter.cpp
open-intent-io/open-intent
57d8c4fc89c038f51138d51e776880e728152194
[ "MIT" ]
47
2016-07-05T15:20:33.000Z
2021-08-06T05:38:33.000Z
src/interpreter/ReplyTemplateInterpreter.cpp
open-intent-io/open-intent
57d8c4fc89c038f51138d51e776880e728152194
[ "MIT" ]
30
2016-07-03T22:42:11.000Z
2017-11-17T15:58:10.000Z
src/interpreter/ReplyTemplateInterpreter.cpp
open-intent-io/open-intent
57d8c4fc89c038f51138d51e776880e728152194
[ "MIT" ]
8
2016-07-22T20:07:58.000Z
2017-11-05T10:40:29.000Z
/* |---------------------------------------------------------| | ___ ___ _ _ | | / _ \ _ __ ___ _ __ |_ _|_ __ | |_ ___ _ __ | |_ | | | | | | '_ \ / _ \ '_ \ | || '_ \| __/ _ \ '_ \| __| | | | |_| | |_) | __/ | | || || | | | || __/ | | | |_ | | \___/| .__/ \___|_| |_|___|_| |_|\__\___|_| |_|\__| | | |_| | | | | - The users first... | | | | Authors: | | - Clement Michaud | | - Sergei Kireev | | | | Version: 1.0.0 | | | |---------------------------------------------------------| The MIT License (MIT) Copyright (c) 2016 - Clement Michaud, Sergei Kireev 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 "intent/interpreter/ReplyTemplateInterpreter.hpp" #include "intent/interpreter/Interpreter.hpp" namespace intent { const std::string ReplyTemplateInterpreter::ARG_MARKER("_"); void ReplyTemplateInterpreter::adapt(std::string& replyTemplate) { int counter = 0; for (size_t i = 0; i < replyTemplate.size(); ++i) { std::string templateArgMarker = "${" + std::to_string(counter) + "}"; if (replyTemplate.substr(i, ARG_MARKER.size()) == ARG_MARKER) { replyTemplate.replace(i, ARG_MARKER.size(), templateArgMarker); ++counter; i += templateArgMarker.size() - ARG_MARKER.size() - 1; } } } }
45.95
79
0.524846
open-intent-io
8b55e101684c32b0bb4881f21702911da48a3b45
574
cpp
C++
PAT/A1067.cpp
iphelf/Programming-Practice
2a95bb7153957b035427046b250bf7ffc6b00906
[ "WTFPL" ]
null
null
null
PAT/A1067.cpp
iphelf/Programming-Practice
2a95bb7153957b035427046b250bf7ffc6b00906
[ "WTFPL" ]
null
null
null
PAT/A1067.cpp
iphelf/Programming-Practice
2a95bb7153957b035427046b250bf7ffc6b00906
[ "WTFPL" ]
null
null
null
#include<cstdio> #include<algorithm> using namespace std; const int MAXN=1e5; int N,a[MAXN]; int main(void) { // freopen("in.txt","r",stdin); scanf("%d",&N); for(int i=0; i<N; i++) scanf("%d",&a[i]); int cnt=0; for(int i=0; i<N; i++) { if(a[i]==i) continue; if(i>0) { swap(a[0],a[i]); cnt++; } while(a[0]!=0) { swap(a[0],a[a[0]]); cnt++; } } printf("%d\n",cnt); return 0; } /* 10 3 5 7 2 6 4 9 0 8 1 9 */
15.513514
35
0.38676
iphelf
8b5d56fa1d1ffb753838142c830fcee19891e72b
6,209
cpp
C++
EScript/Objects/Type.cpp
antifermion/EScript
eca6765c28e319eb77b4da81125bdbb2510c9add
[ "MIT" ]
3
2017-06-01T15:58:43.000Z
2019-08-07T05:36:44.000Z
EScript/Objects/Type.cpp
antifermion/EScript
eca6765c28e319eb77b4da81125bdbb2510c9add
[ "MIT" ]
4
2015-01-23T18:17:50.000Z
2019-02-10T11:48:55.000Z
EScript/Objects/Type.cpp
antifermion/EScript
eca6765c28e319eb77b4da81125bdbb2510c9add
[ "MIT" ]
12
2015-01-04T16:07:45.000Z
2020-10-06T15:42:46.000Z
// Type.cpp // This file is part of the EScript programming language (https://github.com/EScript) // // Copyright (C) 2011-2013 Claudius Jähn <[email protected]> // Copyright (C) 2012 Benjamin Eikel <[email protected]> // // Licensed under the MIT License. See LICENSE file for details. // --------------------------------------------------------------------------------- #include "Type.h" #include "../Basics.h" #include "../StdObjects.h" #include "Exception.h" namespace EScript{ //! (static) Type * Type::getTypeObject(){ struct factory{ // use factory for static one time initialization Type * operator()(){ // This object defines the type of all 'Type' objects. // It inherits from Object and the type of the object is defined by itthisObj. Type * typeObject = new Type(Object::getTypeObject(),nullptr); typeObject->typeRef = typeObject; return typeObject; } }; static Type * typeObject = factory()(); return typeObject; } //! initMembers void Type::init(EScript::Namespace & globals) { // [Type] ---|> [Object] Type * typeObject = getTypeObject(); initPrintableName(typeObject,getClassName()); declareConstant(&globals,getClassName(),typeObject); //! [ESMF] Type new Type( [BaseType = ExtObject] ) ES_CONSTRUCTOR(typeObject,0,1,{ Type * baseType = parameter.count() == 0 ? ExtObject::getTypeObject() : assertType<Type>(rt,parameter[0]); if(!baseType->allowsUserInheritance()){ rt.setException("Basetype '"+baseType->toString()+"' does not allow user inheritance."); return nullptr; } Type * newType = new Type(baseType); newType->allowUserInheritance(true); // user defined Types allow user inheritance per default. return newType; }) //! [ESMF] Type Type.getBaseType() ES_MFUN(typeObject,const Type,"getBaseType",0,0, thisObj->getBaseType()) // attrMap_t is declared outside of the getObjAttributes declaration as it otherwise leads to a strange // preprocessor error on gcc. typedef std::unordered_map<StringId, Object *> attrMap_t; //! [ESMF] Map Type.getObjAttributes() ES_MFUNCTION(typeObject,const Type,"getObjAttributes",0,0,{ attrMap_t attrs; thisObj->collectObjAttributes(attrs); return Map::create(attrs); }) //! [ESMF] Map Type.getTypeAttributes() ES_MFUNCTION(typeObject,const Type,"getTypeAttributes",0,0,{ attrMap_t attrs; thisObj->collectTypeAttributes(attrs); return Map::create(attrs); }) //! [ESMF] Type Type.hasBase(Type) ES_MFUN(typeObject,const Type,"hasBase",1,1, thisObj->hasBase(parameter[0].to<Type*>(rt))) //! [ESMF] Type Type.isBaseOf(Type) ES_MFUN(typeObject,const Type,"isBaseOf",1,1, thisObj->isBaseOf(parameter[0].to<Type*>(rt))) } //--- //! (ctor) Type::Type(): Object(Type::getTypeObject()),flags(0),baseType(Object::getTypeObject()) { //ctor } //! (ctor) Type::Type(Type * _baseType): Object(Type::getTypeObject()),flags(0),baseType(_baseType) { if(getBaseType()!=nullptr) getBaseType()->copyObjAttributesTo(this); //ctor } //! (ctor) Type::Type(Type * _baseType,Type * typeOfType): Object(typeOfType),flags(0),baseType(_baseType) { if(getBaseType()!=nullptr) getBaseType()->copyObjAttributesTo(this); //ctor } //! (dtor) Type::~Type() { //dtor } //! ---|> [Object] Object * Type::clone() const{ return new Type(getBaseType(),getType()); } static const char * typeAttrErrorHint = "This may be a result of: Adding object attributes to a Type AFTER inheriting from that Type, " "adding object attributes to a Type AFTER creating instances of that Type, " "or adding object attributes to a Type whose instances cannot store object attributes. "; Attribute * Type::findTypeAttribute(const StringId & id){ Type * t = this; do{ Attribute * attr = t->attributes.accessAttribute(id); if( attr != nullptr ){ if( attr->isObjAttribute() ){ std::string message = "(findTypeAttribute) type-attribute expected but object-attribute found. ('"; message += id.toString() + "')\n" + typeAttrErrorHint; throw new Exception(message); } return attr; } t = t->getBaseType(); }while(t!=nullptr); return nullptr; } //! ---|> Object Attribute * Type::_accessAttribute(const StringId & id,bool localOnly){ // is local attribute? Attribute * attr = attributes.accessAttribute(id); if(attr!=nullptr || localOnly) return attr; // try to find the attribute along the inherited path... if(getBaseType()!=nullptr){ attr = getBaseType()->findTypeAttribute(id); if(attr!=nullptr) return attr; } // try to find the attribute from this type's type. return getType()!=nullptr ? getType()->findTypeAttribute(id) : nullptr; } //! ---|> Object bool Type::setAttribute(const StringId & id,const Attribute & attr){ attributes.setAttribute(id,attr); if(attr.isObjAttribute()) setFlag(FLAG_CONTAINS_OBJ_ATTRS,true); return true; } void Type::copyObjAttributesTo(Object * instance){ // init member vars of type if(getFlag(FLAG_CONTAINS_OBJ_ATTRS)){ for(const auto & keyValuePair : attributes) { const Attribute & a = keyValuePair.second; if( a.isNull() || a.isTypeAttribute() ) continue; instance->setAttribute(keyValuePair.first, Attribute(a.getValue()->getRefOrCopy(),a.getProperties())); } } } void Type::collectTypeAttributes(std::unordered_map<StringId,Object *> & attrs)const{ for(const auto & keyValuePair : attributes) { if(keyValuePair.second.isTypeAttribute()) { attrs[keyValuePair.first] = keyValuePair.second.getValue(); } } } void Type::collectObjAttributes(std::unordered_map<StringId,Object *> & attrs)const{ for(const auto & keyValuePair : attributes) { if(keyValuePair.second.isObjAttribute()) { attrs[keyValuePair.first] = keyValuePair.second.getValue(); } } } //! ---|> Object void Type::collectLocalAttributes(std::unordered_map<StringId,Object *> & attrs){ for(const auto & keyValuePair : attributes) { attrs[keyValuePair.first] = keyValuePair.second.getValue(); } } bool Type::hasBase(const Type * type) const { for(const Type * t = this; t; t = t->getBaseType()){ if(t==type) return true; } return false; } bool Type::isBaseOf(const Type * type) const { while(type){ if(type==this) return true; type = type->getBaseType(); } return false; } }
27.968468
108
0.692543
antifermion
8b612dd0b54e11f296b684877d4b2728f2c7298e
1,081
cpp
C++
geotrans3.7/CCS/src/dtcc/CoordinateSystemParameters/CoordinateSystemParameters.cpp
mjj203/tippecanoe
140ae1da6438a23d82f41e9c7b7b129107bf6e2d
[ "BSD-2-Clause" ]
1
2021-07-05T07:40:49.000Z
2021-07-05T07:40:49.000Z
geotrans3.7/CCS/src/dtcc/CoordinateSystemParameters/CoordinateSystemParameters.cpp
mjj203/tippecanoe
140ae1da6438a23d82f41e9c7b7b129107bf6e2d
[ "BSD-2-Clause" ]
1
2015-01-13T10:08:35.000Z
2015-01-13T10:08:35.000Z
geotrans3.7/CCS/src/dtcc/CoordinateSystemParameters/CoordinateSystemParameters.cpp
mjj203/tippecanoe
140ae1da6438a23d82f41e9c7b7b129107bf6e2d
[ "BSD-2-Clause" ]
2
2017-07-24T13:34:49.000Z
2017-11-14T16:52:38.000Z
// CLASSIFICATION: UNCLASSIFIED #include "CoordinateSystemParameters.h" #include "CoordinateType.h" using namespace MSP::CCS; CoordinateSystemParameters::CoordinateSystemParameters() : _coordinateType( CoordinateType::geodetic ) { } CoordinateSystemParameters::CoordinateSystemParameters( MSP::CCS::CoordinateType::Enum __coordinateType ) : _coordinateType( __coordinateType ) { } CoordinateSystemParameters::CoordinateSystemParameters( const CoordinateSystemParameters &csp ) { _coordinateType = csp._coordinateType; } CoordinateSystemParameters::~CoordinateSystemParameters() { } CoordinateSystemParameters& CoordinateSystemParameters::operator=( const CoordinateSystemParameters &csp ) { if( this != &csp ) { _coordinateType = csp._coordinateType; } return *this; } void CoordinateSystemParameters::setCoordinateType( MSP::CCS::CoordinateType::Enum __coordinateType ) { _coordinateType = __coordinateType; } CoordinateType::Enum CoordinateSystemParameters::coordinateType() const { return _coordinateType; } // CLASSIFICATION: UNCLASSIFIED
19.654545
107
0.794635
mjj203
8b61628ab559bc8a80489b06dfbb9f4bebd11da6
65
cpp
C++
shared/src/shared/state/player_input.cpp
dumheter/wind_simulation
adf731847cb6145a85792a0ebceacc725a3acf9e
[ "MIT" ]
1
2021-04-26T11:24:02.000Z
2021-04-26T11:24:02.000Z
shared/src/shared/state/player_input.cpp
dumheter/wind_simulation
adf731847cb6145a85792a0ebceacc725a3acf9e
[ "MIT" ]
1
2020-06-09T08:53:07.000Z
2020-06-16T13:37:15.000Z
shared/src/shared/state/player_input.cpp
dumheter/wind_simulation
adf731847cb6145a85792a0ebceacc725a3acf9e
[ "MIT" ]
null
null
null
#include "player_input.hpp" namespace wind {} // namespace wind
16.25
35
0.738462
dumheter
8b62211d5d084f24cfc854b4e2fb56e49c8acf61
282
cpp
C++
src/c++ primer 5th/ch13-content/ch_13.6.3_cont_test.cpp
aparesse/Eudemonia
cb2d9cde5e9ab60a8f62747a9c48d7a44eabe8d1
[ "MIT" ]
null
null
null
src/c++ primer 5th/ch13-content/ch_13.6.3_cont_test.cpp
aparesse/Eudemonia
cb2d9cde5e9ab60a8f62747a9c48d7a44eabe8d1
[ "MIT" ]
null
null
null
src/c++ primer 5th/ch13-content/ch_13.6.3_cont_test.cpp
aparesse/Eudemonia
cb2d9cde5e9ab60a8f62747a9c48d7a44eabe8d1
[ "MIT" ]
null
null
null
#include "ch_13.6.3_cont.h" #include <string> using std::string; int main() { StrVec vec; //空StrVec string s = "some string or another"; vec.push_back(s); //调用push_back(const string&) vec.push_back("done"); //调用push_back(string&&) 字面值是右值,此处是(从"done"创建的临时string) return 0; }
18.8
78
0.695035
aparesse
8b7096e9227912d4a345aceaf3dacf8ccc93c7a6
4,405
cpp
C++
tic-tac-toe (1).cpp
Weaam-Yehiaa/tic_tac_toe
d46b6171a4429d9fa200aca8da96db3ae68ae980
[ "MIT" ]
null
null
null
tic-tac-toe (1).cpp
Weaam-Yehiaa/tic_tac_toe
d46b6171a4429d9fa200aca8da96db3ae68ae980
[ "MIT" ]
null
null
null
tic-tac-toe (1).cpp
Weaam-Yehiaa/tic_tac_toe
d46b6171a4429d9fa200aca8da96db3ae68ae980
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; const int N = 3; const char marks[2] = {'X', 'O'}; char grid[N][N]; vector<pair<int,int > > v; //This function prints the grid of Tic-Tac-Toe Game as the game progresses void print_grid() { cout << "Player 1: " << marks[0] << " vs Player 2: " << marks[1] << "\n"; cout << "--"; for (int i = 0; i < N; cout << "---", i++); cout << "--\n"; for (int i = 0; i < N; i++) { cout << "| "; for (int j = 0; j < N; j++) cout << grid[i][j] << " "; cout << "|\n"; cout << "--"; for (int i = 0; i < N; cout << "---", i++); cout << "--\n"; } } //This function checks if the game has a win state or not bool check_win() { for(int i=0;i<N;++i) { if(grid[i][0]==grid[i][1]&&grid[i][1]==grid[i][2]&&grid[i][2]!='.')return true; } for(int j=0;j<N;++j) { if(grid[0][j]==grid[1][j]&&grid[1][j]==grid[2][j]&&grid[2][j]!='.')return true; } if(grid[0][0]==grid[1][1]&&grid[1][1]==grid[2][2]&&grid[0][0]!='.')return true; if(grid[2][0]==grid[1][1]&&grid[1][1]==grid[0][2]&&grid[0][2]!='.')return true; return false; } //This function checks if the game has a tie state or not for the given mark bool check_tie_player(char mark){ for(int i=0;i<N;++i) { for(int j=0;j<N;++j) { if(grid[i][j]=='.') { grid[i][j]=mark; v.push_back(make_pair(i,j)); } } } if(!check_win()){ for(int x=0;x<v.size();++x) { pair<int,int >vv=v[x]; int i=vv.first,j=vv.second; grid[i][j]='.'; } v.clear(); return true; } else { for(int x=0;x<v.size();++x) { pair<int,int >vv=v[x]; int i=vv.first,j=vv.second; grid[i][j]='.'; } v.clear(); return false; } } //This function checks if the game has a tie state or not bool check_tie() { bool all_tie = true; for (int i = 0; i < 2; i++) if (!check_tie_player(marks[i])) all_tie = false; return all_tie; } //This function checks if given cell is empty or not bool check_empty(int i, int j) { if(grid[i][j]=='.')return true; else return false; } //This function checks if given position is valid or not bool check_valid_position(int i, int j) { if(i<=N&&j<=N&&i>=0&&j>=0)return true; else return false; } //This function sets the given mark to the given cell void set_cell(int i, int j, char mark) { grid[i][j]=mark; } //This function clears the game structures void grid_clear() { memset(grid,'.',sizeof(grid)); } //This function reads a valid position input void read_input(int &i, int &j) { cout << "Enter the row index and column index: "; cin >> i >> j; while (!check_valid_position(i, j) || !check_empty(i, j)) { cout << "Enter a valid row index and a valid column index: "; cin >> i >> j; } } //MAIN FUNCTION void play_game() { cout << "Tic-Tac-Toe Game!\n"; cout << "Welcome...\n"; cout << "============================\n"; bool player = 0; while (true) { //Prints the grid print_grid(); //Read an input position from the player cout << "Player " << marks[player] << " is playing now\n"; int i, j; read_input(i, j); //Set the player mark in the input position set_cell(i, j, marks[player]); //Check if the grid has a win state if (check_win()) { //Prints the grid print_grid(); //Announcement of the final statement cout << "Congrats, Player " << marks[player] << " is won!\n"; break; } //Check if the grid has a tie state if (check_tie()) { //Prints the grid print_grid(); //Announcement of the final statement cout << "Woah! That's a tie!\n"; break; } //Player number changes after each turn player = 1 - player; } } int main() { while (true) { grid_clear(); play_game(); char c; cout << "Play Again [Y/N] "; cin >> c; if (c != 'y' && c != 'Y') break; } }
27.879747
87
0.481725
Weaam-Yehiaa
8b75b54a1e0b4a61562fc217f92759f34e03bbe6
1,590
cpp
C++
P/1066-WA.cpp
langonginc/cfile
46458897b8a4a8d58a2bc63ecb6ef84f76bdb61f
[ "MIT" ]
1
2020-09-13T02:51:25.000Z
2020-09-13T02:51:25.000Z
P/1066-WA.cpp
langonginc/cfile
46458897b8a4a8d58a2bc63ecb6ef84f76bdb61f
[ "MIT" ]
null
null
null
P/1066-WA.cpp
langonginc/cfile
46458897b8a4a8d58a2bc63ecb6ef84f76bdb61f
[ "MIT" ]
1
2021-06-05T03:37:57.000Z
2021-06-05T03:37:57.000Z
#include<iostream> #include<cstdio> #include<cstring> using namespace std; #define mms(tpp,xgg) memset(tpp,xgg,sizeof(tpp)) typedef long long ll; const ll inf=30001; // 1.计算质数 ll prime[inf],ta[inf],pc; void pt() { for(ll i=2;i<inf;i++) { ta[i]=1; } for(ll i=2;i<inf;i++) { if(ta[i]) { prime[pc++]=i; } for(ll j=0;j<pc&&i*prime[j]<inf;j++) { ta[i*prime[j]]=0; if(i%prime[j]==0) { break; } } } } ll a[inf],b[inf],sum[inf]; inline short factor(ll n,short flag) { for(int x=2;x<=n;x++) { int tx=x; for(int i=0;i<pc && tx>1;i++) { while(tx%prime[i]==0) { tx/=prime[i]; a[i]+=flag; } } } return flag; } void gc(ll n,ll m) { memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); factor(n,1), factor(m,-1), factor(n-m,-1);//约分 b[0]=1; for(int i=0;i<pc;i++) { for(int j=0;j<a[i];j++) { for(int ti=0;ti<205;ti++) b[ti]*=prime[i]; for(int ti=0;ti<205;ti++){ b[ti+1]+=b[ti]/10,b[ti]%=10; } } } for(int i=0;i<205;sum[i]+=b[i],i++); for(int i=0;i<205;sum[i+1]+=sum[i]/10,sum[i]%=10,i++); } int main() { ll k,w; // scanf("%lld%lld",&k,&w); cin>>k>>w; pt(); ll m=k/w,ma=(1<<k)-1; for(int i=2;i<=m;i++) { if(ma>=i) { gc(ma,i); } } if(w%k!=0 && m>=1) { ll temp=(1<<(w%k))-1; for(int i=1;i<=temp && ma-i>=m;i++) { gc(ma-i,m); } } ll p=204; while(sum[p]==0)p--; //p++; for(ll i=p;i>=0;i--) { printf("%lld",sum[i]); } return 0; }
14.859813
56
0.445283
langonginc
8b78836e2b09e573c82493a200bb35bcd80286bd
10,207
cpp
C++
src/lib/huffman_enc.cpp
Special-graphic-formats/himg
62859ca604f33629239d0da5fbf2dceae9fc4b8b
[ "Unlicense" ]
17
2015-09-08T09:08:02.000Z
2019-05-11T06:08:18.000Z
src/lib/huffman_enc.cpp
Special-graphic-formats/himg
62859ca604f33629239d0da5fbf2dceae9fc4b8b
[ "Unlicense" ]
3
2015-09-14T09:00:49.000Z
2021-12-16T11:47:01.000Z
src/lib/huffman_enc.cpp
Special-graphic-formats/himg
62859ca604f33629239d0da5fbf2dceae9fc4b8b
[ "Unlicense" ]
3
2015-06-13T22:04:31.000Z
2019-12-29T11:22:49.000Z
//----------------------------------------------------------------------------- // HIMG, by Marcus Geelnard, 2015 // // This is free and unencumbered software released into the public domain. // // See LICENSE for details. //----------------------------------------------------------------------------- #include "huffman_enc.h" #include <algorithm> #include <vector> #include "huffman_common.h" namespace himg { namespace { // The maximum size of the tree representation (there are two additional bits // per leaf node, representing the branches in the tree). const int kMaxTreeDataSize = ((2 + kSymbolSize) * kNumSymbols + 7) / 8; class OutBitstream { public: // Initialize a bitstream. explicit OutBitstream(uint8_t *buf) : m_base_ptr(buf), m_byte_ptr(buf), m_bit_pos(0) {} // Write bits to a bitstream. void WriteBits(uint32_t x, int bits) { // Get current stream state. uint8_t *buf = m_byte_ptr; int bit = m_bit_pos; // Append bits. // TODO(m): Optimize this! while (bits--) { *buf = (*buf & (0xff ^ (1 << bit))) | ((x & 1) << bit); x >>= 1; bit = (bit + 1) & 7; if (!bit) { ++buf; } } // Store new stream state. m_byte_ptr = buf; m_bit_pos = bit; } // Align the stream to a byte boundary (do nothing if already aligned). void AlignToByte() { if (m_bit_pos) { m_bit_pos = 0; ++m_byte_ptr; } } // Advance N bytes. void AdvanceBytes(int N) { m_byte_ptr += N; } int Size() const { int total_bytes = static_cast<int>(m_byte_ptr - m_base_ptr); if (m_bit_pos > 0) { ++total_bytes; } return total_bytes; } uint8_t *byte_ptr() { return m_byte_ptr; } private: uint8_t *m_base_ptr; uint8_t *m_byte_ptr; int m_bit_pos; }; // Used by the encoder for building the optimal Huffman tree. struct SymbolInfo { Symbol symbol; int count; uint32_t code; int bits; }; struct EncodeNode { EncodeNode *child_a, *child_b; int count; int symbol; }; // Calculate (sorted) histogram for a block of data. void Histogram(const uint8_t *in, SymbolInfo *symbols, int size, int block_size) { // Clear/init histogram. for (int k = 0; k < kNumSymbols; ++k) { symbols[k].symbol = static_cast<Symbol>(k); symbols[k].count = 0; symbols[k].code = 0; symbols[k].bits = 0; } // Build the histogram for all blocks. const uint8_t *in_end = in + size; for (const uint8_t *block = in; block < in_end; block += block_size) { // Build the histogram for this block. for (int k = 0; k < block_size;) { Symbol symbol = static_cast<Symbol>(block[k]); // Possible RLE? if (symbol == 0) { int zeros; for (zeros = 1; zeros < 16662 && (k + zeros) < block_size; ++zeros) { if (block[k + zeros] != 0) break; } if (zeros == 1) { symbols[0].count++; } else if (zeros == 2) { symbols[kSymTwoZeros].count++; } else if (zeros <= 6) { symbols[kSymUpTo6Zeros].count++; } else if (zeros <= 22) { symbols[kSymUpTo22Zeros].count++; } else if (zeros <= 278) { symbols[kSymUpTo278Zeros].count++; } else { symbols[kSymUpTo16662Zeros].count++; } k += zeros; } else { symbols[symbol].count++; k++; } } } } // Store a Huffman tree in the output stream and in a look-up-table (a symbol // array). void StoreTree(EncodeNode *node, SymbolInfo *symbols, OutBitstream *stream, uint32_t code, int bits) { // Is this a leaf node? if (node->symbol >= 0) { // Append symbol to tree description. stream->WriteBits(1, 1); stream->WriteBits(static_cast<uint32_t>(node->symbol), kSymbolSize); // Find symbol index. int sym_idx; for (sym_idx = 0; sym_idx < kNumSymbols; ++sym_idx) { if (symbols[sym_idx].symbol == static_cast<Symbol>(node->symbol)) break; } // Store code info in symbol array. symbols[sym_idx].code = code; symbols[sym_idx].bits = bits; return; } else { // This was not a leaf node. stream->WriteBits(0, 1); } // Branch A. StoreTree(node->child_a, symbols, stream, code, bits + 1); // Branch B. StoreTree(node->child_b, symbols, stream, code + (1 << bits), bits + 1); } // Generate a Huffman tree. void MakeTree(SymbolInfo *sym, OutBitstream *stream) { // Initialize all leaf nodes. EncodeNode nodes[kMaxTreeNodes]; int num_symbols = 0; for (int k = 0; k < kNumSymbols; ++k) { if (sym[k].count > 0) { nodes[num_symbols].symbol = static_cast<int>(sym[k].symbol); nodes[num_symbols].count = sym[k].count; nodes[num_symbols].child_a = nullptr; nodes[num_symbols].child_b = nullptr; ++num_symbols; } } // Build tree by joining the lightest nodes until there is only one node left // (the root node). EncodeNode *root = nullptr; int nodes_left = num_symbols; int next_idx = num_symbols; while (nodes_left > 1) { // Find the two lightest nodes. EncodeNode *node_1 = nullptr; EncodeNode *node_2 = nullptr; for (int k = 0; k < next_idx; ++k) { if (nodes[k].count > 0) { if (!node_1 || (nodes[k].count <= node_1->count)) { node_2 = node_1; node_1 = &nodes[k]; } else if (!node_2 || (nodes[k].count <= node_2->count)) { node_2 = &nodes[k]; } } } // Join the two nodes into a new parent node. root = &nodes[next_idx]; root->child_a = node_1; root->child_b = node_2; root->count = node_1->count + node_2->count; root->symbol = -1; node_1->count = 0; node_2->count = 0; ++next_idx; --nodes_left; } // Store the tree in the output stream, and in the sym[] array (the latter is // used as a look-up-table for faster encoding). if (root) { StoreTree(root, sym, stream, 0, 0); } else { // Special case: only one symbol => no binary tree. root = &nodes[0]; StoreTree(root, sym, stream, 0, 1); } } } // namespace int HuffmanEnc::MaxCompressedSize(int uncompressed_size) { return uncompressed_size + kMaxTreeDataSize; } int HuffmanEnc::Compress(uint8_t *out, const uint8_t *in, int in_size, int block_size) { // Do we have anything to compress? if (in_size < 1) return 0; if (block_size < 1) block_size = in_size; const bool use_blocks = block_size < in_size; // Sanity check: Do the blocks add up the the entire input buffer? if (in_size % block_size != 0) return 0; // Initialize bitstream. OutBitstream stream(out); // Calculate and sort histogram for input data. SymbolInfo symbols[kNumSymbols]; Histogram(in, symbols, in_size, block_size); // Build Huffman tree. MakeTree(symbols, &stream); stream.AlignToByte(); // Sort histogram - first symbol first (bubble sort). // TODO(m): Quick-sort. bool swaps; do { swaps = false; for (int k = 0; k < kNumSymbols - 1; ++k) { if (symbols[k].symbol > symbols[k + 1].symbol) { SymbolInfo tmp = symbols[k]; symbols[k] = symbols[k + 1]; symbols[k + 1] = tmp; swaps = true; } } } while (swaps); std::vector<uint8_t> block_buffer(block_size); // Encode input stream. const uint8_t *in_end = in + in_size; for (const uint8_t *block = in; block < in_end; block += block_size) { // Create a temporary output stream for this block. OutBitstream block_stream(block_buffer.data()); // Encode this block. for (int k = 0; k < block_size;) { uint8_t symbol = block[k]; // Possible RLE? if (symbol == 0) { int zeros; for (zeros = 1; zeros < 16662 && (k + zeros) < block_size; ++zeros) { if (block[k + zeros] != 0) break; } if (zeros == 1) { block_stream.WriteBits(symbols[0].code, symbols[0].bits); } else if (zeros == 2) { block_stream.WriteBits(symbols[kSymTwoZeros].code, symbols[kSymTwoZeros].bits); } else if (zeros <= 6) { uint32_t count = static_cast<uint32_t>(zeros - 3); block_stream.WriteBits(symbols[kSymUpTo6Zeros].code, symbols[kSymUpTo6Zeros].bits); block_stream.WriteBits(count, 2); } else if (zeros <= 22) { uint32_t count = static_cast<uint32_t>(zeros - 7); block_stream.WriteBits(symbols[kSymUpTo22Zeros].code, symbols[kSymUpTo22Zeros].bits); block_stream.WriteBits(count, 4); } else if (zeros <= 278) { uint32_t count = static_cast<uint32_t>(zeros - 23); block_stream.WriteBits(symbols[kSymUpTo278Zeros].code, symbols[kSymUpTo278Zeros].bits); block_stream.WriteBits(count, 8); } else { uint32_t count = static_cast<uint32_t>(zeros - 279); block_stream.WriteBits(symbols[kSymUpTo16662Zeros].code, symbols[kSymUpTo16662Zeros].bits); block_stream.WriteBits(count, 14); } k += zeros; } else { block_stream.WriteBits(symbols[symbol].code, symbols[symbol].bits); k++; } } const int packed_size = block_stream.Size(); if (use_blocks) { // Write the packed size (in bytes) as two or four bytes (depending on the // size). stream.AlignToByte(); if (packed_size <= 0x7fff) { stream.WriteBits(packed_size, 16); } else { stream.WriteBits((packed_size & 0x7fff) | 0x8000, 16); stream.WriteBits(packed_size >> 15, 16); } } // Append the block stream to the output stream. std::copy(block_buffer.data(), block_buffer.data() + packed_size, stream.byte_ptr()); stream.AdvanceBytes(packed_size); } // Calculate size of output data. return stream.Size(); } } // namespace himg
27.887978
80
0.573332
Special-graphic-formats
8b7e8ed58a6d1116de57374978914c72f171a5d9
2,629
hh
C++
src/Simulation.hh
arafin-lab/FaultSim-A-Memory-Reliability-Simulator
4caee9ffd6d8fae2a0db34c743d94107e618723d
[ "BSD-3-Clause" ]
2
2016-04-05T00:57:49.000Z
2017-03-16T21:54:04.000Z
src/Simulation.hh
arafin-lab/FaultSim-A-Memory-Reliability-Simulator
4caee9ffd6d8fae2a0db34c743d94107e618723d
[ "BSD-3-Clause" ]
1
2020-04-19T21:40:12.000Z
2020-04-19T21:41:06.000Z
src/Simulation.hh
arafin-lab/FaultSim-A-Memory-Reliability-Simulator
4caee9ffd6d8fae2a0db34c743d94107e618723d
[ "BSD-3-Clause" ]
9
2015-09-04T16:36:16.000Z
2021-12-01T09:15:36.000Z
/* Copyright (c) 2015, Advanced Micro Devices, 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: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef SIMULATION_HH_ #define SIMULATION_HH_ #include "FaultDomain.hh" class Simulation { public: Simulation( uint64_t interval_t, uint64_t scrub_interval_t, double fit_factor_t, uint test_mode_t, bool debug_mode_t, bool cont_running_t, uint64_t output_bucket_t ); void init( uint64_t max_s ); void reset( void ); void finalize( void ); void simulate( uint64_t max_time, uint64_t n_sims, int verbose, std::string output_file); virtual uint64_t runOne( uint64_t max_time, int verbose, uint64_t bin_length ); void addDomain( FaultDomain *domain ); void getFaultCounts( uint64_t *pTrans, uint64_t *pPerm ); void resetStats( void ); void printStats( void ); // output end-of-run stats protected: uint64_t m_interval; uint64_t m_iteration; uint64_t m_scrub_interval; double m_fit_factor; uint test_mode; bool debug_mode; bool cont_running; uint64_t m_output_bucket; uint64_t stat_total_failures, stat_total_sims, stat_sim_seconds; uint64_t *fail_time_bins; uint64_t *fail_uncorrectable; uint64_t *fail_undetectable; list<FaultDomain*> m_domains; }; #endif /* SIMULATION_HH_ */
49.603774
755
0.79574
arafin-lab
8b817af602c7933198707586d5005581f5a6f022
3,533
cpp
C++
src/Odom.cpp
matheusbg8/aracati2017
bb00a847e02087f012c9094126120ea5f0a9324c
[ "MIT" ]
1
2022-03-24T04:46:50.000Z
2022-03-24T04:46:50.000Z
src/Odom.cpp
matheusbg8/aracati2017
bb00a847e02087f012c9094126120ea5f0a9324c
[ "MIT" ]
null
null
null
src/Odom.cpp
matheusbg8/aracati2017
bb00a847e02087f012c9094126120ea5f0a9324c
[ "MIT" ]
1
2022-01-01T04:28:31.000Z
2022-01-01T04:28:31.000Z
#include "Odom.h" void Odom::publishInitialPose(const ros::Time &time, double x, double y, double yaw) { geometry_msgs::PoseWithCovarianceStamped msg; msg.header.stamp = time; msg.header.frame_id = worldFrameId; msg.pose.pose.position.x = x; msg.pose.pose.position.y = y; msg.pose.pose.position.z = 0.0; tf2::Quaternion quat_tf; quat_tf.setRPY(0.0,0.0,yaw); tf2::convert(quat_tf,msg.pose.pose.orientation); double *m = msg.pose.covariance.elems; for(uint i = 0; i < 36;i++) m[i]=0.0; m[6*0+0] = 0.5*0.5; // CovX m[6*1+1] = 0.5*0.5; // CovY m[6*3+3] = 0.4*0.4; // CovYaw // Publish Initial Pose pubIniPose.publish(msg); } void Odom::CmdVelCallback(const geometry_msgs::TwistStamped &msg) { double time = msg.header.stamp.toSec(); // Update odometry with fake local velocity odom.updateVelocity(time, msg.twist.linear.x, msg.twist.linear.y, msg.twist.angular.z); double odomX,odomY,odomYaw; // Predict odometry on time if(odom.predict(time,odomX,odomY,odomYaw)) { // Pose msg geometry_msgs::PoseStamped msg; msg.header.stamp = ros::Time(time); msg.header.frame_id = odomFrameId; msg.pose.position.x = odomX; msg.pose.position.y = odomY; msg.pose.position.z = 0.0; tf2::Quaternion quat_tf; quat_tf.setRPY(0.0,0.0,odomYaw); tf2::convert(quat_tf,msg.pose.orientation); // Publish odom pubOdom.publish(msg); // Publish TF geometry_msgs::TransformStamped tf_odom; tf_odom.header.stamp = msg.header.stamp; tf_odom.header.frame_id = odomFrameId; tf_odom.child_frame_id = baseLinkFrameId; tf_odom.transform.translation.x = odomX; tf_odom.transform.translation.y = odomY; tf_odom.transform.translation.z = 0.0; tf_odom.transform.rotation = tf2::toMsg(quat_tf); tfBroadcastOdom.sendTransform(tf_odom); } } void Odom::initROS() { subCmdVel = n.subscribe("/cmd_vel",5, &Odom::CmdVelCallback,this); pubOdom = n.advertise<geometry_msgs::PoseStamped>("/odom_pose",1); pubIniPose = n.advertise<geometry_msgs::PoseWithCovarianceStamped>("/initialpose",1); ros::NodeHandle nh("~"); nh.param<string>("world_frame_id", worldFrameId, "map"); nh.param<string>("odom_frame_id", odomFrameId, "odom"); nh.param<string>("base_frame_id", baseLinkFrameId, "son"); // We assume the initial vehicle position // is know in order to generate odometry // so the referential of our ground truth // and the odom are the same. // Receiving first vehicle pose ROS_INFO("Waiting first vehicle pose."); geometry_msgs::PoseStamped::ConstPtr msg = ros::topic::waitForMessage<geometry_msgs::PoseStamped>("/pose_gt"); if (msg != nullptr) { // Get yaw tf::Quaternion q; tf::quaternionMsgToTF(msg->pose.orientation,q); tf::Matrix3x3 mat(q); double yaw=tf2::getYaw(msg->pose.orientation), time = msg->header.stamp.toSec(), x = msg->pose.position.x, y = msg->pose.position.y; odom.setInitialPose(time,x,y,yaw); publishInitialPose(msg->header.stamp, x,y,yaw); } else { ROS_ERROR("No initial position received!"); ros::Time time = ros::Time::now(); odom.setInitialPose(time.toSec(), 0.0, 0.0,0.0); publishInitialPose(msg->header.stamp, 0.0,0.0,0.0); } } Odom::Odom() { initROS(); } void Odom::start() { ros::spin(); }
25.601449
112
0.638834
matheusbg8
8b848057633509ceb19b8e8b0c955831243b8e61
4,455
cpp
C++
module_02/ex02/Fixed.cpp
laisarena/CPP_piscine
47831fa443116d2b37e1081a3eddf8ca40fc954f
[ "MIT" ]
null
null
null
module_02/ex02/Fixed.cpp
laisarena/CPP_piscine
47831fa443116d2b37e1081a3eddf8ca40fc954f
[ "MIT" ]
null
null
null
module_02/ex02/Fixed.cpp
laisarena/CPP_piscine
47831fa443116d2b37e1081a3eddf8ca40fc954f
[ "MIT" ]
null
null
null
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Fixed.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lfrasson <[email protected] +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/27 10:43:50 by lfrasson #+# #+# */ /* Updated: 2021/11/01 21:18:24 by lfrasson ### ########.fr */ /* */ /* ************************************************************************** */ #include "Fixed.hpp" Fixed::Fixed(void) : _fixedPointValue(0) { return; } Fixed::Fixed(int const integerValue) { this->_fixedPointValue = integerValue << this->_numberOfFractionalBits; } Fixed::Fixed(float const floatValue) { this->_fixedPointValue = roundf(floatValue * (1 << this->_numberOfFractionalBits)); } Fixed::Fixed(Fixed const &object) { *this = object; } Fixed::~Fixed(void) { return; } int Fixed::getRawBits(void) const { return this->_fixedPointValue; } void Fixed::setRawBits(int const raw) { this->_fixedPointValue = raw; } float Fixed::toFloat(void) const { float floatValue; int fixedPointConverter; fixedPointConverter = 1 << this->_numberOfFractionalBits; floatValue = (float)this->_fixedPointValue / (float)fixedPointConverter; return floatValue; } int Fixed::toInt(void) const { return this->_fixedPointValue >> this->_numberOfFractionalBits; } Fixed &Fixed::operator=(Fixed const &rightSideObject) { this->_fixedPointValue = rightSideObject.getRawBits(); return *this; } Fixed Fixed::operator+(Fixed const &rightSideObject) { Fixed result(*this); result.setRawBits(result.getRawBits() + rightSideObject.getRawBits()); return result; } Fixed Fixed::operator-(Fixed const &rightSideObject) { Fixed result(*this); result.setRawBits(result.getRawBits() - rightSideObject.getRawBits()); return result; } Fixed Fixed::operator*(Fixed const &rightSideObject) { Fixed result(*this); int rawBits; rawBits = result.getRawBits() * rightSideObject.getRawBits(); result.setRawBits(rawBits >> this->_numberOfFractionalBits); return result; } Fixed Fixed::operator/(Fixed const &rightSideObject) { Fixed result(*this); int rawBits; rawBits = result.getRawBits() / (rightSideObject.getRawBits() >> this->_numberOfFractionalBits); result.setRawBits(rawBits); return result; } Fixed &Fixed::operator++(void) { this->_fixedPointValue++; return *this; } Fixed Fixed::operator++(int) { Fixed temp = *this; this->_fixedPointValue++; return temp; } Fixed &Fixed::operator--(void) { this->_fixedPointValue--; return *this; } Fixed Fixed::operator--(int) { Fixed temp = *this; this->_fixedPointValue--; return temp; } bool Fixed::operator>(Fixed const &rightSideObject) const { return this->_fixedPointValue > rightSideObject.getRawBits(); } bool Fixed::operator<(Fixed const &rightSideObject) const { return this->_fixedPointValue < rightSideObject.getRawBits(); } bool Fixed::operator>=(Fixed const &rightSideObject) const { return this->_fixedPointValue >= rightSideObject.getRawBits(); } bool Fixed::operator<=(Fixed const &rightSideObject) const { return this->_fixedPointValue <= rightSideObject.getRawBits(); } bool Fixed::operator==(Fixed const &rightSideObject) const { return this->_fixedPointValue == rightSideObject.getRawBits(); } bool Fixed::operator!=(Fixed const &rightSideObject) const { return this->_fixedPointValue != rightSideObject.getRawBits(); } Fixed &Fixed::min(Fixed &value1, Fixed &value2) { if (value1 > value2) return value2; return value1; } Fixed const &Fixed::min(Fixed const &value1, Fixed const &value2) { if (value1 > value2) return value2; return value1; } Fixed &Fixed::max(Fixed &value1, Fixed &value2) { if (value1 < value2) return value2; return value1; } Fixed const &Fixed::max(Fixed const &value1, Fixed const &value2) { if (value1 < value2) return value2; return value1; } std::ostream & operator<<(std::ostream &output, Fixed const &rightSideObject) { output << rightSideObject.toFloat(); return output; }
22.5
80
0.60853
laisarena
8b8596a1d5c2715ce3b0fb6ccb81447b0362935d
5,034
hpp
C++
SDK/ARKSurvivalEvolved_DinoAttackStateFollowSpline_parameters.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
10
2020-02-17T19:08:46.000Z
2021-07-31T11:07:19.000Z
SDK/ARKSurvivalEvolved_DinoAttackStateFollowSpline_parameters.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
9
2020-02-17T18:15:41.000Z
2021-06-06T19:17:34.000Z
SDK/ARKSurvivalEvolved_DinoAttackStateFollowSpline_parameters.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
3
2020-07-22T17:42:07.000Z
2021-06-19T17:16:13.000Z
#pragma once // ARKSurvivalEvolved (329.9) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_DinoAttackStateFollowSpline_classes.hpp" namespace sdk { //--------------------------------------------------------------------------- //Parameters //--------------------------------------------------------------------------- // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.OnTickEvent struct UDinoAttackStateFollowSpline_C_OnTickEvent_Params { float* DeltaSeconds; // (Parm, ZeroConstructor, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.OnBeginEvent struct UDinoAttackStateFollowSpline_C_OnBeginEvent_Params { class UPrimalAIState** InParentState; // (Parm, ZeroConstructor, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.ShouldSkipIntervalCheckEvent struct UDinoAttackStateFollowSpline_C_ShouldSkipIntervalCheckEvent_Params { bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.EndAnimationStateEvent struct UDinoAttackStateFollowSpline_C_EndAnimationStateEvent_Params { struct FName* CustomEventName; // (Parm, ZeroConstructor, IsPlainOldData) TEnumAsByte<ENetRole>* Role; // (Parm, ZeroConstructor, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.OnChildStateEndedEvent struct UDinoAttackStateFollowSpline_C_OnChildStateEndedEvent_Params { class UPrimalAIState** PrimalAIState; // (Parm, ZeroConstructor, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.StartAnimationStateEvent struct UDinoAttackStateFollowSpline_C_StartAnimationStateEvent_Params { struct FName* CustomEventName; // (Parm, ZeroConstructor, IsPlainOldData) TEnumAsByte<ENetRole>* Role; // (Parm, ZeroConstructor, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.TickAnimationStateEvent struct UDinoAttackStateFollowSpline_C_TickAnimationStateEvent_Params { float* DeltaTime; // (Parm, ZeroConstructor, IsPlainOldData) struct FName* CustomEventName; // (Parm, ZeroConstructor, IsPlainOldData) TEnumAsByte<ENetRole>* Role; // (Parm, ZeroConstructor, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.OnCanUseStateEvent struct UDinoAttackStateFollowSpline_C_OnCanUseStateEvent_Params { bool ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.OnEndEvent struct UDinoAttackStateFollowSpline_C_OnEndEvent_Params { }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.TickRangedState struct UDinoAttackStateFollowSpline_C_TickRangedState_Params { }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.GotoNextSpline struct UDinoAttackStateFollowSpline_C_GotoNextSpline_Params { }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.UpgradePawnAcceleration struct UDinoAttackStateFollowSpline_C_UpgradePawnAcceleration_Params { bool Upgrade; // (Parm, ZeroConstructor, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.FindDragonSplines struct UDinoAttackStateFollowSpline_C_FindDragonSplines_Params { bool found; // (Parm, OutParm, ZeroConstructor, IsPlainOldData) }; // Function DinoAttackStateFollowSpline.DinoAttackStateFollowSpline_C.ExecuteUbergraph_DinoAttackStateFollowSpline struct UDinoAttackStateFollowSpline_C_ExecuteUbergraph_DinoAttackStateFollowSpline_Params { int EntryPoint; // (Parm, ZeroConstructor, IsPlainOldData) }; } #ifdef _MSC_VER #pragma pack(pop) #endif
47.046729
173
0.617004
2bite
8b8c4a360560e547f838d7eb2d00d5fec99f42d4
6,760
cpp
C++
source/Irrlicht/rtc/mediahandlerelement.cpp
MagicAtom/irrlicht-ce
b94ea7f97d7d0d3000d5a8c9c7c712debef1e55d
[ "IJG" ]
null
null
null
source/Irrlicht/rtc/mediahandlerelement.cpp
MagicAtom/irrlicht-ce
b94ea7f97d7d0d3000d5a8c9c7c712debef1e55d
[ "IJG" ]
null
null
null
source/Irrlicht/rtc/mediahandlerelement.cpp
MagicAtom/irrlicht-ce
b94ea7f97d7d0d3000d5a8c9c7c712debef1e55d
[ "IJG" ]
null
null
null
/** * Copyright (c) 2020 Filip Klembara (in2core) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #if RTC_ENABLE_MEDIA #include "mediahandlerelement.hpp" #include "impl/internals.hpp" #include <cassert> namespace rtc { ChainedMessagesProduct make_chained_messages_product() { return std::make_shared<std::vector<binary_ptr>>(); } ChainedMessagesProduct make_chained_messages_product(message_ptr msg) { std::vector<binary_ptr> msgs = {msg}; return std::make_shared<std::vector<binary_ptr>>(msgs); } ChainedOutgoingProduct::ChainedOutgoingProduct(ChainedMessagesProduct messages, message_ptr control) : messages(messages), control(control) {} ChainedIncomingProduct::ChainedIncomingProduct(ChainedMessagesProduct incoming, ChainedMessagesProduct outgoing) : incoming(incoming), outgoing(outgoing) {} ChainedIncomingControlProduct::ChainedIncomingControlProduct( message_ptr incoming, optional<ChainedOutgoingProduct> outgoing) : incoming(incoming), outgoing(outgoing) {} MediaHandlerElement::MediaHandlerElement() {} void MediaHandlerElement::removeFromChain() { if (upstream) { upstream->downstream = downstream; } if (downstream) { downstream->upstream = upstream; } upstream = nullptr; downstream = nullptr; } void MediaHandlerElement::recursiveRemoveChain() { if (downstream) { // `recursiveRemoveChain` removes last strong reference to downstream element // we need to keep strong reference to prevent deallocation of downstream element // during `recursiveRemoveChain` auto strongDownstreamPtr = downstream; downstream->recursiveRemoveChain(); } removeFromChain(); } optional<ChainedOutgoingProduct> MediaHandlerElement::processOutgoingResponse(ChainedOutgoingProduct messages) { if (messages.messages) { if (upstream) { auto msgs = upstream->formOutgoingBinaryMessage( ChainedOutgoingProduct(messages.messages, messages.control)); if (msgs.has_value()) { return msgs.value(); } else { LOG_ERROR << "Generating outgoing message failed"; return nullopt; } } else { return messages; } } else if (messages.control) { if (upstream) { auto control = upstream->formOutgoingControlMessage(messages.control); if (control) { return ChainedOutgoingProduct(nullptr, control); } else { LOG_ERROR << "Generating outgoing control message failed"; return nullopt; } } else { return messages; } } else { return ChainedOutgoingProduct(); } } void MediaHandlerElement::prepareAndSendResponse(optional<ChainedOutgoingProduct> outgoing, std::function<bool(ChainedOutgoingProduct)> send) { if (outgoing.has_value()) { auto message = outgoing.value(); auto response = processOutgoingResponse(message); if (response.has_value()) { if (!send(response.value())) { LOG_DEBUG << "Send failed"; } } else { LOG_DEBUG << "No response to send"; } } } message_ptr MediaHandlerElement::formIncomingControlMessage(message_ptr message, std::function<bool(ChainedOutgoingProduct)> send) { assert(message); auto product = processIncomingControlMessage(message); prepareAndSendResponse(product.outgoing, send); if (product.incoming) { if (downstream) { return downstream->formIncomingControlMessage(product.incoming, send); } else { return product.incoming; } } else { return nullptr; } } ChainedMessagesProduct MediaHandlerElement::formIncomingBinaryMessage(ChainedMessagesProduct messages, std::function<bool(ChainedOutgoingProduct)> send) { assert(messages && !messages->empty()); auto product = processIncomingBinaryMessage(messages); prepareAndSendResponse(product.outgoing, send); if (product.incoming) { if (downstream) { return downstream->formIncomingBinaryMessage(product.incoming, send); } else { return product.incoming; } } else { return nullptr; } } message_ptr MediaHandlerElement::formOutgoingControlMessage(message_ptr message) { assert(message); auto newMessage = processOutgoingControlMessage(message); assert(newMessage); if (!newMessage) { LOG_ERROR << "Failed to generate outgoing message"; return nullptr; } if (upstream) { return upstream->formOutgoingControlMessage(newMessage); } else { return newMessage; } } optional<ChainedOutgoingProduct> MediaHandlerElement::formOutgoingBinaryMessage(ChainedOutgoingProduct product) { assert(product.messages && !product.messages->empty()); auto newProduct = processOutgoingBinaryMessage(product.messages, product.control); assert(!product.control || newProduct.control); assert(newProduct.messages && !newProduct.messages->empty()); if (product.control && !newProduct.control) { LOG_ERROR << "Outgoing message must not remove control message"; return nullopt; } if (!newProduct.messages || newProduct.messages->empty()) { LOG_ERROR << "Failed to generate message"; return nullopt; } if (upstream) { return upstream->formOutgoingBinaryMessage(newProduct); } else { return newProduct; } } ChainedIncomingControlProduct MediaHandlerElement::processIncomingControlMessage(message_ptr messages) { return {messages}; } message_ptr MediaHandlerElement::processOutgoingControlMessage(message_ptr messages) { return messages; } ChainedIncomingProduct MediaHandlerElement::processIncomingBinaryMessage(ChainedMessagesProduct messages) { return {messages}; } ChainedOutgoingProduct MediaHandlerElement::processOutgoingBinaryMessage(ChainedMessagesProduct messages, message_ptr control) { return {messages, control}; } shared_ptr<MediaHandlerElement> MediaHandlerElement::chainWith(shared_ptr<MediaHandlerElement> upstream) { assert(this->upstream == nullptr); assert(upstream->downstream == nullptr); this->upstream = upstream; upstream->downstream = shared_from_this(); return upstream; } } // namespace rtc #endif /* RTC_ENABLE_MEDIA */
30.45045
100
0.735503
MagicAtom
8b8cadbface4d6ed93e5ac29f89a3ad868911280
2,771
cc
C++
tool/SecVerilog-1.0/SecVerilog/symbol_search.cc
gokulprasath7c/secure_i2c_using_ift
124384983ba70e8164b7217db70c43dfdf302d4b
[ "MIT" ]
1
2019-01-28T21:23:37.000Z
2019-01-28T21:23:37.000Z
tool/SecVerilog-1.0/SecVerilog/symbol_search.cc
gokulprasath7c/secure_i2c_using_ift
124384983ba70e8164b7217db70c43dfdf302d4b
[ "MIT" ]
null
null
null
tool/SecVerilog-1.0/SecVerilog/symbol_search.cc
gokulprasath7c/secure_i2c_using_ift
124384983ba70e8164b7217db70c43dfdf302d4b
[ "MIT" ]
null
null
null
/* * Copyright (c) 2003-2010 Stephen Williams ([email protected]) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ # include "netlist.h" # include "netmisc.h" # include <cassert> /* * Search for the hierarchical name. */ NetScope*symbol_search(const LineInfo*li, Design*des, NetScope*scope, pform_name_t path, NetNet*&net, const NetExpr*&par, NetEvent*&eve, const NetExpr*&ex1, const NetExpr*&ex2) { assert(scope); bool hier_path = false; /* Get the tail name of the object we are looking for. */ perm_string key = peek_tail_name(path); path.pop_back(); /* Initialize output argument to cleared. */ net = 0; par = 0; eve = 0; /* If the path has a scope part, then search for the specified scope that we are supposed to search. */ if (! path.empty()) { list<hname_t> path_list = eval_scope_path(des, scope, path); assert(path_list.size() <= path.size()); // If eval_scope_path returns a short list, then some // part of the scope was not found. Abort. if (path_list.size() < path.size()) return 0; scope = des->find_scope(scope, path_list); if (scope && scope->is_auto() && li) { cerr << li->get_fileline() << ": error: Hierarchical " "reference to automatically allocated item " "`" << key << "' in path `" << path << "'" << endl; des->errors += 1; } hier_path = true; } while (scope) { if ( (net = scope->find_signal(key)) ) return scope; if ( (eve = scope->find_event(key)) ) return scope; if ( (par = scope->get_parameter(key, ex1, ex2)) ) return scope; /* We can't look up if we are at the enclosing module scope * or if a hierarchical path was given. */ if ((scope->type() == NetScope::MODULE) || hier_path) scope = 0; else scope = scope->parent(); } return 0; }
30.788889
79
0.600505
gokulprasath7c
8b973a205c4634d3ce7ea4c375189c9bbe8e0733
15,254
cpp
C++
src/OE_Error.cpp
antsouchlos/OxygenEngine2
5a123a2dacbc3b66ba9e97b9e5db7d8c17490ddb
[ "MIT" ]
null
null
null
src/OE_Error.cpp
antsouchlos/OxygenEngine2
5a123a2dacbc3b66ba9e97b9e5db7d8c17490ddb
[ "MIT" ]
22
2020-05-19T18:18:45.000Z
2022-03-31T12:11:08.000Z
src/OE_Error.cpp
antsouchlos/OxygenEngine2
5a123a2dacbc3b66ba9e97b9e5db7d8c17490ddb
[ "MIT" ]
null
null
null
#include <OE_Error.h> #include <OE_TaskManager.h> #include <Events/OE_Event.h> #include <types/OE_Libs.h> using namespace std; // This is where events' error handling is happening int OE_Event::internal_call(){ /***************************/ ///generic handling if (!this->has_init_){ this->task_ = OE_Task(this->name_, 0, 0, SDL_GetTicks()); this->has_init_ = true; } task_.update(); try { func_(task_, name_); } catch(oe::api_error& e){ std::string error_str = "[OE Error] " + e.name_ + " thrown in event: '" + this->name_ + "', event invocation counter: " + std::to_string(this->task_.GetCounter()) + "\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(csl::parser_error& e){ std::string error_str = "[CSL Error] " + e.name_ + " thrown in event: '" + this->name_ + "', event invocation counter: " + std::to_string(this->task_.GetCounter()) + "\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(csl::interpreter_error& e){ std::string error_str = "[CSL Error] " + e.name_ + " thrown in event: '" + this->name_ + "', event invocation counter: " + std::to_string(this->task_.GetCounter()) + "\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(std::exception& e){ std::string error_str = "[OE Error] std::exception variant thrown in event: '" + this->name_ + "', event invocation counter: " + std::to_string(this->task_.GetCounter()) + "\n"; error_str += "\t" + string(e.what()) + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(...){ std::string error_str = "[OE Error] Exception thrown in event: '" + this->name_ + "', event invocation counter: " + std::to_string(this->task_.GetCounter()); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } return 0; /**************************/ } // error handling functions int OE_TaskManager::tryRun_unsync_thread(OE_UnsyncThreadData* actual_data){ int output = 1; OE_Task unsync_task = OE_Task(actual_data->name, 0, 0, actual_data->taskMgr->getTicks()); try{ output = actual_data->func(unsync_task); } catch(oe::api_error& e){ std::string error_str = "[OE Error] " + e.name_ + " thrown in unsync thread: '" + unsync_task.GetName() + "'" +"\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(csl::parser_error& e){ std::string error_str = "[CSL Error] " + e.name_ + " thrown in unsync thread: '" + unsync_task.GetName() + "'" +"\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(csl::interpreter_error& e){ std::string error_str = "[CSL Error] " + e.name_ + " thrown in unsync thread: '" + unsync_task.GetName() + "'" +"\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(oe::networking_error& e){ std::string error_str = "[SLC Error] " + e.name_ + " thrown in unsync thread: '" + unsync_task.GetName() + "'" +"\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(std::exception& e){ std::string error_str = "[OE Error] std::exception variant thrown in unsync thread: '" + unsync_task.GetName() + "'" +"\n"; error_str += "\t" + string(e.what()) + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch (...){ std::string error_str = "[OE Error] Exception thrown in unsync thread: '" + unsync_task.GetName() + "'"; cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } return output; } int OE_TaskManager::tryRun_task(const std::string& name, OE_Task& task){ int output = 0; try{ if (this->threads[name].functions[task.name] != nullptr) output = this->threads[name].functions[task.name](task); } catch(oe::api_error& e){ std::string error_str = "[OE Error] " + e.name_ + " thrown in task: '" + task.name + "', thread: '" + name; error_str += "', invocation: " + std::to_string(task.counter) + "\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); output = 1; } catch(csl::parser_error& e){ std::string error_str = "[CSL Error] " + e.name_ + " thrown in task: '" + task.name + "', thread: '" + name; error_str += "', invocation: " + std::to_string(task.counter) + "\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); output = 1; } catch(csl::interpreter_error& e){ std::string error_str = "[CSL Error] " + e.name_ + " thrown in task: '" + task.name + "', thread: '" + name; error_str += "', invocation: " + std::to_string(task.counter) + "\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); output = 1; } catch(std::exception& e){ std::string error_str = "[OE Error] " + string(typeid(e).name()) + " thrown in task: '" + task.name + "', thread: '" + name; error_str += "', invocation: " + std::to_string(task.counter) + "\n"; error_str += "\t" + string(e.what()) + "\n"; cout << error_str; OE_WriteToLog(error_str); output = 1; } catch(...){ /// universal error handling. will catch any exception /// feel free to add specific handling for specific errors string outputa = string("[OE Error] Exception thrown in task: '" + task.name + "', thread: '" + name); outputa += "', invocation: " + std::to_string(task.counter); cout << outputa << endl; OE_WriteToLog(outputa + "\n"); output = 1; } return output; } void OE_TaskManager::tryRun_physics_updateMultiThread(const std::string &name, const int& comp_threads_copy){ try{ this->physics->updateMultiThread(&this->threads[name].physics_task, comp_threads_copy); } catch(oe::api_error& e){ std::string error_str = "[OE Error] " + e.name_ + " thrown in updateMultiThread in thread: '" + name + "', thread_num: " + std::to_string(comp_threads_copy); error_str += ", invocation: " + std::to_string(this->threads[name].physics_task.counter) + "\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(oe::physics_error& e){ std::string error_str = "[OE Error] " + e.name_ + " thrown in updateMultiThread in thread: '" + name + "', thread_num: " + std::to_string(comp_threads_copy); error_str += ", invocation: " + std::to_string(this->threads[name].physics_task.counter) + "\n"; error_str += "\t" + e.what() + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(std::exception& e){ std::string error_str = "[OE Error] " + string(typeid(e).name()) + " thrown in updateMultiThread in thread: '" + name + "', thread_num: " + std::to_string(comp_threads_copy); error_str += ", invocation: " + std::to_string(this->threads[name].physics_task.counter) + "\n"; error_str += "\t" + string(e.what()) + "\n"; cout << error_str; OE_WriteToLog(error_str); } catch(...){ /// universal error handling. will catch any exception /// feel free to add specific handling for specific errors auto task = this->threads[name].physics_task; string outputa = string("[OE Error] Physics exception thrown in updateMultiThread in thread: '" + name + "', thread_num: " + std::to_string(comp_threads_copy)); outputa += ", invocation: " + std::to_string(task.counter); cout << outputa << endl; OE_WriteToLog(outputa + "\n"); } } bool OE_TaskManager::tryRun_renderer_updateSingleThread(){ bool output = false; try{ output = this->renderer->updateSingleThread(); } catch(oe::api_error &e){ std::string error_str = "[NRE Error] " + e.name_ + " thrown in updateSingleThread, invocation: " + std::to_string(this->countar); error_str += "\n\t" + e.what(); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(oe::renderer_error &e){ std::string error_str = "[NRE Error] " + e.name_ + " thrown in updateSingleThread, invocation: " + std::to_string(this->countar); error_str += "\n\t" + e.what(); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(std::exception &e){ std::string error_str = "[NRE Error] " + string(typeid(e).name()) + " thrown in updateSingleThread, invocation: " + std::to_string(this->countar); error_str += "\n\t" + string(e.what()); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(...){ std::string error_str = "[NRE Error] Renderer exception thrown in updateSingleThread, invocation: " + std::to_string(this->countar); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } return output; } void OE_TaskManager::tryRun_renderer_updateData(){ try{ this->renderer->updateData(); } catch(oe::api_error &e){ std::string error_str = "[NRE Error] " + e.name_ + " thrown in updateData, invocation: " + std::to_string(this->countar); error_str += "\n\t" + e.what(); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(oe::renderer_error &e){ std::string error_str = "[NRE Error] " + e.name_ + " thrown in updateData, invocation: " + std::to_string(this->countar); error_str += "\n\t" + e.what(); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(std::exception &e){ std::string error_str = "[NRE Error] " + string(typeid(e).name()) + " thrown in updateData, invocation: " + std::to_string(this->countar); error_str += "\n\t" + string(e.what()); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(...){ std::string error_str = "[NRE Error] Renderer exception thrown in updateData, invocation: " + std::to_string(this->countar); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } } bool OE_TaskManager::tryRun_winsys_update(){ bool output = true; try{ output = this->window->update(); } catch(oe::winsys_error &e){ std::string error_str = "[OE WINSYS Error] " + e.name_ + " thrown in winsys update, invocation: " + std::to_string(this->countar); error_str += "\n\t" + e.what(); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(std::exception &e){ std::string error_str = "[OE WINSYS Error] " + string(typeid(e).name()) + " thrown in winsys update, invocation: " + std::to_string(this->countar); error_str += "\n\t" + string(e.what()); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(...){ std::string error_str = "[OE WINSYS Error] Exception thrown in winsys update, invocation: " + std::to_string(this->countar); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } return output; } void OE_TaskManager::tryRun_winsys_init(int x, int y, std::string titlea, bool fullscreen, void* params){ try{ this->window->init(x, y, titlea, fullscreen, params); } catch(oe::winsys_error &e){ std::string error_str = "[OE WINSYS Error] " + e.name_ + " thrown in window system initialization"; error_str += "\n\t" + e.what(); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(std::exception &e){ std::string error_str = "[OE WINSYS Error] " + string(typeid(e).name()) + " thrown in window system initialization"; error_str += "\n\t" + string(e.what()); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(...){ std::string error_str = "[OE WINSYS Error] Could not initialize window system due to thrown exception in window->init()"; cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } } void OE_TaskManager::tryRun_physics_init(){ try{ this->physics->init(); } catch(oe::physics_error &e){ std::string error_str = "[OE Error] " + e.name_ + " thrown in physics engine initialization"; error_str += "\n\t" + e.what(); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(std::exception &e){ std::string error_str = "[OE Error] " + string(typeid(e).name()) + " thrown in physics engine initialization"; error_str += "\n\t" + string(e.what()); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(...){ std::string error_str = "[OE Error] Could not initialize physics engine due to thrown exception in physics->init()"; cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } } void OE_TaskManager::tryRun_renderer_init(){ try{ this->renderer->init(); } catch(oe::renderer_error &e){ std::string error_str = "[NRE Error] " + e.name_ + " thrown in renderer initialization"; error_str += "\n\t" + e.what(); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(std::exception &e){ std::string error_str = "[NRE Error] " + string(typeid(e).name()) + " thrown in renderer initialization"; error_str += "\n\t" + string(e.what()); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(...){ std::string error_str = "[NRE Error] Could not initialize renderer due to thrown exception in renderer->init()"; cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } } void OE_TaskManager::tryRun_network_init(){ try{ this->network->init(); } catch(oe::networking_error &e){ std::string error_str = "[SLC Error] " + e.name_ + " thrown in networking initialization"; error_str += "\n\t" + e.what(); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(std::exception &e){ std::string error_str = "[SLC Error] " + string(typeid(e).name()) + " thrown in networking initialization"; error_str += "\n\t" + string(e.what()); cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } catch(...){ std::string error_str = "[SLC Error] Could not initialize networking due to thrown exception in network->init()"; cout << error_str << endl; OE_WriteToLog(error_str + "\n"); } }
40.569149
185
0.570932
antsouchlos
8ba3f9d3d85228fcbeadc4203f705466973a827a
1,206
cpp
C++
ImageProcessing/Dispatcher/DispatchManager.cpp
theradeonxt/FastImageEditor
6b1a18393402cf2aa44ff9a399d1bb819a7aa971
[ "MIT" ]
3
2016-11-07T16:20:28.000Z
2016-11-08T21:18:25.000Z
ImageProcessing/Dispatcher/DispatchManager.cpp
theradeonxt/FastImageEditor
6b1a18393402cf2aa44ff9a399d1bb819a7aa971
[ "MIT" ]
6
2015-10-11T20:38:10.000Z
2016-11-27T19:24:43.000Z
ImageProcessing/Dispatcher/DispatchManager.cpp
theradeonxt/FastImageEditor
6b1a18393402cf2aa44ff9a399d1bb819a7aa971
[ "MIT" ]
null
null
null
#include "DispatchManager.h" #include "Common.h" #include "ConfigManager.h" #include "ModuleConfig.h" DispatchManager& g_DispatchManager() { static DispatchManager* ans = new DispatchManager(); return *ans; } void DispatchManager::Register(std::string entryPointKey, std::function<int(void**)> entryPoint) { if (ContainsKey(entryPointKey)) { return; } dispatcher[entryPointKey] = entryPoint; } int32_t DispatchManager::Run(std::string moduleName, void** args) { Config::ModuleConfig* config; bool configFound = Config::g_ConfigManager().getSingleConfig(moduleName, config); if (configFound) { return dispatcher.at(config->m_DispatcherKey)(args); } return OperationFailed; } int32_t DispatchManager::RunFallback(const std::string& moduleName, void** args) { Config::ModuleConfig* config; bool configFound = Config::g_ConfigManager().getSingleConfig(moduleName, config); if (configFound) { return dispatcher.at(moduleName + Config::g_CodepathSuffix[None])(args); } return OperationFailed; } bool DispatchManager::ContainsKey(const std::string& key) { return dispatcher.find(key) != dispatcher.end(); }
25.125
96
0.708126
theradeonxt
8ba7c5c2e0f37c988226176c3c9ed02e3da25e26
127
cpp
C++
src/multiply.cpp
markuspg/minimal_cmake_cpp_lib_sample
6258bc7f148f3e2b401e678b615196bfbe397d5f
[ "MIT" ]
null
null
null
src/multiply.cpp
markuspg/minimal_cmake_cpp_lib_sample
6258bc7f148f3e2b401e678b615196bfbe397d5f
[ "MIT" ]
null
null
null
src/multiply.cpp
markuspg/minimal_cmake_cpp_lib_sample
6258bc7f148f3e2b401e678b615196bfbe397d5f
[ "MIT" ]
null
null
null
#include "multiply.h" uint32_t multiply(uint32_t multiplicant, uint32_t multiplier) { return multiplicant * multiplier; }
21.166667
63
0.771654
markuspg
8ba83653da54aac72acdfad36a5caca5b72ca812
924
hpp
C++
MEX/src/cpp/vision/min_max_filter.hpp
umariqb/3D_Pose_Estimation_CVPR2016
83f6bf36aa68366ea8fa078eea6d91427e28503b
[ "BSD-3-Clause" ]
47
2016-07-25T00:48:59.000Z
2021-02-17T09:19:03.000Z
MEX/src/cpp/vision/min_max_filter.hpp
umariqb/3D_Pose_Estimation_CVPR2016
83f6bf36aa68366ea8fa078eea6d91427e28503b
[ "BSD-3-Clause" ]
5
2016-09-17T19:40:46.000Z
2018-11-07T06:49:02.000Z
MEX/src/cpp/vision/min_max_filter.hpp
iqbalu/3D_Pose_Estimation_CVPR2016
83f6bf36aa68366ea8fa078eea6d91427e28503b
[ "BSD-3-Clause" ]
35
2016-07-21T09:13:15.000Z
2019-05-13T14:11:37.000Z
/* * min_max_filter.hpp * * Created on: Oct 6, 2013 * Author: mdantone */ #ifndef MIN_MAX_FILTER_HPP_ #define MIN_MAX_FILTER_HPP_ #include "opencv2/core/core.hpp" namespace vision { class MinMaxFilter { public: static void maxfilt(cv::Mat &src, unsigned int width); static void minfilt(cv::Mat &src, cv::Mat &dst, unsigned int width); static void maxfilt(uchar* data, uchar* maxvalues, unsigned int step, unsigned int size, unsigned int width); static void maxfilt(uchar* data, unsigned int step, unsigned int size, unsigned int width); static void minfilt(uchar* data, uchar* minvalues, unsigned int step, unsigned int size, unsigned int width); static void minfilt(uchar* data, unsigned int step, unsigned int size, unsigned int width); }; } /* namespace vision */ #endif /* MIN_MAX_FILTER_HPP_ */
23.692308
72
0.655844
umariqb
8baafec697dbe26c18f448d174f7e97d7ddba75a
1,163
cpp
C++
150.cpp
pengzhezhe/LeetCode
305ec0c5b4cb5ea7cd244b3308132dee778138bc
[ "Apache-2.0" ]
null
null
null
150.cpp
pengzhezhe/LeetCode
305ec0c5b4cb5ea7cd244b3308132dee778138bc
[ "Apache-2.0" ]
null
null
null
150.cpp
pengzhezhe/LeetCode
305ec0c5b4cb5ea7cd244b3308132dee778138bc
[ "Apache-2.0" ]
null
null
null
// // Created by pzz on 2021/10/30. // #include <iostream> #include <algorithm> #include <vector> #include <stack> using namespace std; class Solution { public: int evalRPN(vector<string> &tokens) { stack<int> stack; for (const string &s: tokens) { if (s == "+" || s == "-" || s == "*" || s == "/") { int num1 = stack.top(); stack.pop(); int num2 = stack.top(); stack.pop(); if (s == "+") { stack.push(num2 + num1); } if (s == "-") { stack.push(num2 - num1); } if (s == "*") { stack.push(num2 * num1); } if (s == "/") { stack.push(num2 / num1); } } else { stack.push(stoi(s)); } } return stack.top(); } }; int main() { vector<string> tokens = {"10", "6", "9", "3", "+", "-11", "*", "/", "*", "17", "+", "5", "+"}; Solution solution; cout << solution.evalRPN(tokens); return 0; }
24.229167
98
0.363715
pengzhezhe
8bb2aa03ed6364ae984e2955f63ce226a55e0d21
1,246
cpp
C++
nd-coursework/books/cpp/FoundationsOfQtDev/Chapter02/listdialog.cpp
crdrisko/nd-grad
f1765e4f24d7a4b1b3a76c64eb8d88bcca0eaa44
[ "MIT" ]
1
2020-09-26T12:38:55.000Z
2020-09-26T12:38:55.000Z
nd-coursework/books/cpp/FoundationsOfQtDev/Chapter02/listdialog.cpp
crdrisko/nd-research
f1765e4f24d7a4b1b3a76c64eb8d88bcca0eaa44
[ "MIT" ]
null
null
null
nd-coursework/books/cpp/FoundationsOfQtDev/Chapter02/listdialog.cpp
crdrisko/nd-research
f1765e4f24d7a4b1b3a76c64eb8d88bcca0eaa44
[ "MIT" ]
null
null
null
#include "listdialog.h" #include "editdialog.h" #include "ui_listdialog.h" // Listing 2-3: Constructor of the ListDialog class ListDialog::ListDialog(QWidget* parent) : QDialog(parent), ui(new Ui::ListDialog) { ui->setupUi(this); connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addItem())); connect(ui->editButton, SIGNAL(clicked()), this, SLOT(editItem())); connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteItem())); } ListDialog::~ListDialog() { delete ui; } // Listing 2-4: Adding a new item to the list void ListDialog::addItem() { EditDialog dlg(this); if (dlg.exec() == DialogCode::Accepted) ui->list->addItem(dlg.name() + " -- " + dlg.number()); } // Listing 2-5: Deleting an item of the list void ListDialog::deleteItem() { delete ui->list->currentItem(); } // Listing 2-6: Editing an item of the list void ListDialog::editItem() { if (!ui->list->currentItem()) return; QStringList parts = ui->list->currentItem()->text().split("--"); EditDialog dlg(this); dlg.setName(parts[0].trimmed()); dlg.setNumber(parts[1].trimmed()); if (dlg.exec() == DialogCode::Accepted) ui->list->currentItem()->setText(dlg.name() + " -- " + dlg.number()); }
27.688889
81
0.645265
crdrisko
8bb37a46d296ac3055a349429e346e10f3abc0d9
3,541
cpp
C++
src/main.cpp
kingsamchen/CPU_Utilization_Plot
d651df76b0e3b556dd2d9cf40304070310ef0578
[ "MIT" ]
1
2019-04-15T13:32:39.000Z
2019-04-15T13:32:39.000Z
src/main.cpp
kingsamchen/CPU_Utilization_Plot
d651df76b0e3b556dd2d9cf40304070310ef0578
[ "MIT" ]
null
null
null
src/main.cpp
kingsamchen/CPU_Utilization_Plot
d651df76b0e3b556dd2d9cf40304070310ef0578
[ "MIT" ]
null
null
null
/* @ Kingsley Chen */ #include <Windows.h> #include <conio.h> #include <process.h> #include <cmath> #include <cstdint> #include <iostream> #include "kbase\command_line.h" #include "kbase\memory\scoped_handle.h" #include "kbase\sys_info.h" const unsigned long kDefaultTimeUnit = 1000; const wchar_t kPlotSwitchName[] = L"plot_type"; const wchar_t kSineCurve[] = L"sine"; const wchar_t kHorizon[] = L"horizon"; using PlotFunc = unsigned int (WINAPI *)(void*); // The time unit corresponds to CPU utilization sample frequency. // The whole utilization curve consists of curve in several time units. void PlotTimeUnit(unsigned long time_unit, double busy_percent) { unsigned long busy_span = static_cast<unsigned long>(time_unit * busy_percent); unsigned long time_unit_begin = GetTickCount(); while (time_unit_begin + busy_span > GetTickCount()) { ; } Sleep(time_unit - busy_span); } unsigned int WINAPI PlotHorizontalLine(void* param) { unsigned long& busy_percent_num = *static_cast<unsigned long*>(param); double busy_percent = static_cast<double>(busy_percent_num) / 100; while (true) { PlotTimeUnit(kDefaultTimeUnit, busy_percent); }; return 0; } unsigned int WINAPI PlotSineCurve(void* dummy) { const double kPi = 3.14; const unsigned long kSineCurveTimeUnit = 500; while (true) { for (double x = 0.0; x < 2 * kPi; x += 0.1) { double busy_percent = std::sin(x) / 2 + 0.5; PlotTimeUnit(kSineCurveTimeUnit, busy_percent); } } return 0; } inline void PrintUsage() { std::cout << "Usage:\nCPU_Utilization_Plot.exe -plot_type=[sinecurve|horizon" " {num, 20 <= num <= 80}]\n" << std::endl; } std::vector<kbase::ScopedSysHandle> SetupThreads(PlotFunc fn, void* param) { std::vector<kbase::ScopedSysHandle> threads; auto core_count = kbase::SysInfo::NumberOfProcessors(); for (size_t i = 0; i < core_count; ++i) { auto handle = _beginthreadex(nullptr, 0, fn, param, CREATE_SUSPENDED, nullptr); threads.emplace_back(reinterpret_cast<HANDLE>(handle)); SetThreadAffinityMask(threads[i].Get(), 1U << i); } return threads; } int main(int argc, char* argv[]) { auto& commandline = kbase::CommandLine::ForCurrentProcess(); std::wstring plot_type; if (!commandline.GetSwitchValue(kPlotSwitchName, &plot_type)) { std::cout << "Invalid instructions!" << std::endl; PrintUsage(); return 1; } PlotFunc plot_fn; unsigned long plot_param = 0; if (plot_type == kHorizon) { auto&& arg_list = commandline.GetParameters(); if (arg_list.empty()) { std::cout << "Invalid instructions!" << std::endl; PrintUsage(); return 1; } plot_fn = PlotHorizontalLine; plot_param = std::stoul(arg_list[0]); if (plot_param < 20 || plot_param > 80) { std::cerr << "Utilization percentage number for horizontal line must " "range from 20 to 80" << std::endl; PrintUsage(); return 1; } } else { plot_fn = PlotSineCurve; } std::vector<kbase::ScopedSysHandle> threads = SetupThreads(plot_fn, &plot_param); std::cout << "Press any key to start if you are ready" << std::endl; _getch(); std::for_each(threads.begin(), threads.end(), ResumeThread); WaitForSingleObject(threads.front(), INFINITE); return 0; }
27.88189
85
0.635414
kingsamchen
8bb72ddf572bf5d942ac7462a4f4888f5d6b2a22
1,879
cpp
C++
OJ/LeetCode/leetcode/problems/283.cpp
ONGOING-Z/DataStructure
9099393d1c7dfabc3e2939586ea6d1d254631eb2
[ "MIT" ]
null
null
null
OJ/LeetCode/leetcode/problems/283.cpp
ONGOING-Z/DataStructure
9099393d1c7dfabc3e2939586ea6d1d254631eb2
[ "MIT" ]
2
2021-10-31T10:05:45.000Z
2022-02-12T15:17:53.000Z
OJ/LeetCode/leetcode/283.cpp
ONGOING-Z/Learn-Algorithm-and-DataStructure
3a512bd83cc6ed5035ac4550da2f511298b947c0
[ "MIT" ]
null
null
null
#include <stdio.h> #include <vector> #include <algorithm> using namespace std; /* Leetcode */ /* Type: array */ /* 题目信息 */ /* *283. Move Zeroes Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: Input: [0,1,0,3,12] Output: [1,3,12,0,0] Note: You must do this in-place without making a copy of the array. Minimize the total number of operations. */ /* my solution */ /* better solution */ // 下边这种做法并没有用到in-place算法,只是另外用了一个数组,虽然通过,但并不适合。 class Solution { public: void moveZeroes(vector<int>& nums) { int len = nums.size(); vector<int> res; // find out the non-zero and the push it to res for (int i = 0; i < len; i++) { if (nums[i] != 0) res.push_back(nums[i]); } printf("res's size = %d\n", res.size()); // find out the zero's freq int zeros = 0; for (int i = 0; i < len; i++) { if (nums[i] == 0) zeros++; } printf("zeros = %d\n", zeros); // push 0 to res while (zeros--) res.push_back(0); // res to nums for (int i = 0; i < len; i++) { nums[i] = res[i]; } } }; // 符合题意的in-place解法 better // ✓ class Solution { public: void moveZeroes(vector<int>& nums) { int lastNonZeroFoundAt = 0; for (int i = 0; i < nums.size(); i++) { // 当前元素不为0,则将当前元素值赋值给最后的0元素位置 if (nums[i] != 0) nums[lastNonZeroFoundAt++] = nums[i]; } for (int i = lastNonZeroFoundAt; i < nums.size(); i++) { nums[i] = 0; } } }; /* 一些总结 */ // 1. 题意: // // 需要注意的点: // 1. 如果没有返回类型的话,代表要在原数组上修改,但是在过程中可以新开一个数组存储,最后在赋值回去。 // 2. // 3.
21.11236
133
0.503459
ONGOING-Z
8bb828f009beb8a5ec87dd3ba0d320694f75d127
909
cpp
C++
NacloEngine/ResourceMesh.cpp
JoanValiente/NacloEngine
44eb9901a9f5337d19f3fe3b5d061099ea4e7fa0
[ "MIT" ]
1
2019-09-09T10:04:14.000Z
2019-09-09T10:04:14.000Z
NacloEngine/ResourceMesh.cpp
JoanValiente/NacloEngine
44eb9901a9f5337d19f3fe3b5d061099ea4e7fa0
[ "MIT" ]
null
null
null
NacloEngine/ResourceMesh.cpp
JoanValiente/NacloEngine
44eb9901a9f5337d19f3fe3b5d061099ea4e7fa0
[ "MIT" ]
null
null
null
#include "ResourceMesh.h" #include "ModuleResources.h" ResourceMesh::ResourceMesh(uint uid, Resource_Type type) : Resource(uid, type) { } ResourceMesh::~ResourceMesh() { } bool ResourceMesh::LoadInMemory() { bool ret = false; glGenBuffers(1, (GLuint*) &(id_vertices)); glBindBuffer(GL_ARRAY_BUFFER, id_vertices); glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 3 * num_vertices, vertices, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glGenBuffers(1, (GLuint*) &(id_indices)); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, id_indices); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint) * num_indices, indices, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glGenBuffers(1, (GLuint*) &(id_texture)); glBindBuffer(GL_ARRAY_BUFFER, id_texture); glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 2 * num_texture, texture, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); return ret; }
26.735294
92
0.770077
JoanValiente
8bbcd31e573b9c6f2f42655f7c6d407c646e2cb3
1,211
cpp
C++
src/vertex.cpp
JamesGriffin/3D-Rasterizer
3a9840845bb92279d0c07fd5197dd9879e97f4ec
[ "MIT" ]
13
2017-11-18T01:05:04.000Z
2021-12-25T10:47:45.000Z
src/vertex.cpp
JamesGriffin/3D-Rasterizer
3a9840845bb92279d0c07fd5197dd9879e97f4ec
[ "MIT" ]
2
2018-07-19T14:09:46.000Z
2021-01-15T10:35:43.000Z
src/vertex.cpp
JamesGriffin/3D-Rasterizer
3a9840845bb92279d0c07fd5197dd9879e97f4ec
[ "MIT" ]
5
2018-03-05T04:40:21.000Z
2021-06-11T03:40:54.000Z
#include "vertex.h" // Represents a vertex in 3D space Vertex::Vertex (Vector4 position, Vector4 normal) : m_position(position), m_normal(normal) {} Vertex::Vertex(float x, float y, float z, float w) { m_position = Vector4(x, y, z, w); m_normal = Vector4(0, 0, 0, 0); } // Perspective divide by w component Vertex Vertex::perspectiveDivide() { float w_inv = 1.0f / getW(); return Vertex( Vector4( getX() * w_inv, getY() * w_inv, getZ() * w_inv, getW() ), m_normal ); } Vector4 Vertex::getPos() { return m_position; } Vector4 Vertex::getNormal() { return m_normal; } Vertex Vertex::transform(Matrix4 m, Matrix4 n) { return Vertex(m.transform(m_position), n.transform(m_normal)); } float Vertex::getX() { return m_position.x; } float Vertex::getY() { return m_position.y; } float Vertex::getZ() { return m_position.z; } float Vertex::getW() { return m_position.w; } void Vertex::setX(float x) { m_position.x = x; } void Vertex::setY(float y) { m_position.y = y; } void Vertex::setZ(float z) { m_position.z = z; } void Vertex::setW(float w) { m_position.w = w; }
17.3
66
0.606936
JamesGriffin
8bc0c28346f9eef89dc210f5af99fe75b093b6e1
420
hpp
C++
sources/cards/lands/Swamp.hpp
angeluriot/Magic_royal
a337ce4ad6c3215bbdec8c376d6e88fe97f48f94
[ "MIT" ]
1
2022-02-02T21:41:59.000Z
2022-02-02T21:41:59.000Z
sources/cards/lands/Swamp.hpp
angeluriot/Magic_royal
a337ce4ad6c3215bbdec8c376d6e88fe97f48f94
[ "MIT" ]
null
null
null
sources/cards/lands/Swamp.hpp
angeluriot/Magic_royal
a337ce4ad6c3215bbdec8c376d6e88fe97f48f94
[ "MIT" ]
2
2022-02-01T12:59:57.000Z
2022-03-05T12:50:27.000Z
#ifndef SWAMP_HPP #define SWAMP_HPP #include "cards/Land.hpp" class Swamp : public Land { public: Swamp(); Swamp(const Swamp& other) = default; ~Swamp(); Swamp& operator=(const Swamp& other) = default; std::string get_full_type() const override; Color get_color() const override; std::string get_name() const override; std::string get_description() const override; Card* clone() const override; }; #endif
17.5
48
0.721429
angeluriot
8bc43125a215bc61387fbefc81c6dd3fcd991128
12,357
cpp
C++
CodeForces-Solution/1545E2.cpp
Tech-Intellegent/CodeForces-Solution
2f291a38b80b8ff2a2595b2e526716468ff26bf8
[ "MIT" ]
1
2022-01-23T07:18:07.000Z
2022-01-23T07:18:07.000Z
CodeForces-Solution/1545E2.cpp
Tech-Intellegent/CodeForces-Solution
2f291a38b80b8ff2a2595b2e526716468ff26bf8
[ "MIT" ]
null
null
null
CodeForces-Solution/1545E2.cpp
Tech-Intellegent/CodeForces-Solution
2f291a38b80b8ff2a2595b2e526716468ff26bf8
[ "MIT" ]
1
2022-02-05T11:53:04.000Z
2022-02-05T11:53:04.000Z
#include <bits/stdc++.h> using namespace std; using ll = long long; using db = long double; // or double, if TL is tight using str = string; // yay python! using pi = pair<int,int>; using pl = pair<ll,ll>; using pd = pair<db,db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; using vd = vector<db>; using vs = vector<str>; using vpi = vector<pi>; using vpl = vector<pl>; using vpd = vector<pd>; #define tcT template<class T #define tcTU tcT, class U // ^ lol this makes everything look weird but I'll try it tcT> using V = vector<T>; tcT, size_t SZ> using AR = array<T,SZ>; tcT> using PR = pair<T,T>; // pairs #define mp make_pair #define f first #define s second // vectors // oops size(x), rbegin(x), rend(x) need C++17 #define sz(x) int((x).size()) #define bg(x) begin(x) #define all(x) bg(x), end(x) #define rall(x) x.rbegin(), x.rend() #define sor(x) sort(all(x)) #define rsz resize #define ins insert #define ft front() #define bk back() #define pb push_back #define eb emplace_back #define pf push_front #define rtn return #define lb lower_bound #define ub upper_bound tcT> int lwb(V<T>& a, const T& b) { return int(lb(all(a),b)-bg(a)); } // loops #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) #define rep(a) F0R(_,a) #define each(a,x) for (auto& a: x) const int MOD = 1e9+7; // 998244353; const int MX = 2e5+5; const ll INF = 1e18; // not too close to LLONG_MAX const db PI = acos((db)-1); const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!! mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); template<class T> using pqg = priority_queue<T,vector<T>,greater<T>>; // bitwise ops // also see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html constexpr int pct(int x) { return __builtin_popcount(x); } // # of bits set constexpr int bits(int x) { // assert(x >= 0); // make C++11 compatible until USACO updates ... return x == 0 ? 0 : 31-__builtin_clz(x); } // floor(log2(x)) constexpr int p2(int x) { return 1<<x; } constexpr int msk2(int x) { return p2(x)-1; } ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down tcT> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } // set a = min(a,b) tcT> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } tcTU> T fstTrue(T lo, T hi, U f) { hi ++; assert(lo <= hi); // assuming f is increasing while (lo < hi) { // find first index such that f is true T mid = lo+(hi-lo)/2; f(mid) ? hi = mid : lo = mid+1; } return lo; } tcTU> T lstTrue(T lo, T hi, U f) { lo --; assert(lo <= hi); // assuming f is decreasing while (lo < hi) { // find first index such that f is true T mid = lo+(hi-lo+1)/2; f(mid) ? lo = mid : hi = mid-1; } return lo; } tcT> void remDup(vector<T>& v) { // sort and remove duplicates sort(all(v)); v.erase(unique(all(v)),end(v)); } tcTU> void erase(T& t, const U& u) { // don't erase auto it = t.find(u); assert(it != end(t)); t.erase(it); } // element that doesn't exist from (multi)set #define tcTUU tcT, class ...U inline namespace Helpers { //////////// is_iterable // https://stackoverflow.com/questions/13830158/check-if-a-variable-type-is-iterable // this gets used only when we can call begin() and end() on that type tcT, class = void> struct is_iterable : false_type {}; tcT> struct is_iterable<T, void_t<decltype(begin(declval<T>())), decltype(end(declval<T>())) > > : true_type {}; tcT> constexpr bool is_iterable_v = is_iterable<T>::value; //////////// is_readable tcT, class = void> struct is_readable : false_type {}; tcT> struct is_readable<T, typename std::enable_if_t< is_same_v<decltype(cin >> declval<T&>()), istream&> > > : true_type {}; tcT> constexpr bool is_readable_v = is_readable<T>::value; //////////// is_printable // // https://nafe.es/posts/2020-02-29-is-printable/ tcT, class = void> struct is_printable : false_type {}; tcT> struct is_printable<T, typename std::enable_if_t< is_same_v<decltype(cout << declval<T>()), ostream&> > > : true_type {}; tcT> constexpr bool is_printable_v = is_printable<T>::value; } inline namespace Input { tcT> constexpr bool needs_input_v = !is_readable_v<T> && is_iterable_v<T>; tcTUU> void re(T& t, U&... u); tcTU> void re(pair<T,U>& p); // pairs // re: read tcT> typename enable_if<is_readable_v<T>,void>::type re(T& x) { cin >> x; } // default tcT> void re(complex<T>& c) { T a,b; re(a,b); c = {a,b}; } // complex tcT> typename enable_if<needs_input_v<T>,void>::type re(T& i); // ex. vectors, arrays tcTU> void re(pair<T,U>& p) { re(p.f,p.s); } tcT> typename enable_if<needs_input_v<T>,void>::type re(T& i) { each(x,i) re(x); } tcTUU> void re(T& t, U&... u) { re(t); re(u...); } // read multiple // rv: resize and read vectors void rv(size_t) {} tcTUU> void rv(size_t N, V<T>& t, U&... u); template<class...U> void rv(size_t, size_t N2, U&... u); tcTUU> void rv(size_t N, V<T>& t, U&... u) { t.rsz(N); re(t); rv(N,u...); } template<class...U> void rv(size_t, size_t N2, U&... u) { rv(N2,u...); } // dumb shortcuts to read in ints void decrement() {} // subtract one from each tcTUU> void decrement(T& t, U&... u) { --t; decrement(u...); } #define ints(...) int __VA_ARGS__; re(__VA_ARGS__); #define int1(...) ints(__VA_ARGS__); decrement(__VA_ARGS__); } inline namespace ToString { tcT> constexpr bool needs_output_v = !is_printable_v<T> && is_iterable_v<T>; // ts: string representation to print tcT> typename enable_if<is_printable_v<T>,str>::type ts(T v) { stringstream ss; ss << fixed << setprecision(15) << v; return ss.str(); } // default tcT> str bit_vec(T t) { // bit vector to string str res = "{"; F0R(i,sz(t)) res += ts(t[i]); res += "}"; return res; } str ts(V<bool> v) { return bit_vec(v); } template<size_t SZ> str ts(bitset<SZ> b) { return bit_vec(b); } // bit vector tcTU> str ts(pair<T,U> p); // pairs tcT> typename enable_if<needs_output_v<T>,str>::type ts(T v); // vectors, arrays tcTU> str ts(pair<T,U> p) { return "("+ts(p.f)+", "+ts(p.s)+")"; } tcT> typename enable_if<is_iterable_v<T>,str>::type ts_sep(T v, str sep) { // convert container to string w/ separator sep bool fst = 1; str res = ""; for (const auto& x: v) { if (!fst) res += sep; fst = 0; res += ts(x); } return res; } tcT> typename enable_if<needs_output_v<T>,str>::type ts(T v) { return "{"+ts_sep(v,", ")+"}"; } // for nested DS template<int, class T> typename enable_if<!needs_output_v<T>,vs>::type ts_lev(const T& v) { return {ts(v)}; } template<int lev, class T> typename enable_if<needs_output_v<T>,vs>::type ts_lev(const T& v) { if (lev == 0 || !sz(v)) return {ts(v)}; vs res; for (const auto& t: v) { if (sz(res)) res.bk += ","; vs tmp = ts_lev<lev-1>(t); res.ins(end(res),all(tmp)); } F0R(i,sz(res)) { str bef = " "; if (i == 0) bef = "{"; res[i] = bef+res[i]; } res.bk += "}"; return res; } } inline namespace Output { template<class T> void pr_sep(ostream& os, str, const T& t) { os << ts(t); } template<class T, class... U> void pr_sep(ostream& os, str sep, const T& t, const U&... u) { pr_sep(os,sep,t); os << sep; pr_sep(os,sep,u...); } // print w/ no spaces template<class ...T> void pr(const T&... t) { pr_sep(cout,"",t...); } // print w/ spaces, end with newline void ps() { cout << "\n"; } template<class ...T> void ps(const T&... t) { pr_sep(cout," ",t...); ps(); } // debug to cerr template<class ...T> void dbg_out(const T&... t) { pr_sep(cerr," | ",t...); cerr << endl; } void loc_info(int line, str names) { cerr << "Line(" << line << ") -> [" << names << "]: "; } template<int lev, class T> void dbgl_out(const T& t) { cerr << "\n\n" << ts_sep(ts_lev<lev>(t),"\n") << "\n" << endl; } #ifdef LOCAL #define dbg(...) loc_info(__LINE__,#__VA_ARGS__), dbg_out(__VA_ARGS__) #define dbgl(lev,x) loc_info(__LINE__,#x), dbgl_out<lev>(x) #else // don't actually submit with this #define dbg(...) 0 #define dbgl(lev,x) 0 #endif } inline namespace FileIO { void setIn(str s) { freopen(s.c_str(),"r",stdin); } void setOut(str s) { freopen(s.c_str(),"w",stdout); } void setIO(str s = "") { cin.tie(0)->sync_with_stdio(0); // unsync C / C++ I/O streams // cin.exceptions(cin.failbit); // throws exception when do smth illegal // ex. try to read letter into int if (sz(s)) setIn(s+".in"), setOut(s+".out"); // for old USACO } } using dpl = deque<pl>; // OK int N,X; // OK map<pl,dpl> ranges; int cur_time; void attempt_add_left(pair<pl,dpl>& p, ll best_left) { ll L = p.f.f; if (!sz(p.s) || p.s.ft.s+(p.s.ft.f+cur_time)-L > best_left) p.s.push_front({L-cur_time,best_left}); } void attempt_add_right(pair<pl,dpl>& p, ll best_right) { ll R = p.f.s; if (!sz(p.s) || p.s.bk.s+R-(p.s.bk.f+cur_time) > best_right) p.s.pb({R-cur_time,best_right}); } void cleanup(pair<pl,dpl>& p) { ll best_right = INF; ll R = p.f.s; while (sz(p.s)) { ll dif = (p.s.bk.f+cur_time)-R; if (dif <= 0) break; best_right = p.s.bk.s+dif; p.s.pop_back(); } attempt_add_right(p,best_right); } map<int,int> start_cnt, end_cnt; void ban(int L, int R) { dbg("BAN",L,R); ++start_cnt[L], ++end_cnt[R]; auto it = ranges.ub({L,INF}); if (it != begin(ranges) && prev(it)->f.s > L) --it; while (it != end(ranges) && it->f.f < R) { pair<pl,dpl> t = *(it++); cleanup(t); ranges.erase(prev(it)); if (t.f.f <= L) { pair<pl,dpl> nt; nt.f = {t.f.f,L}; each(u,t.s) { if (u.f+cur_time <= L) nt.s.pb(u); else { attempt_add_right(nt,u.s+(u.f+cur_time)-L); break; } } ranges[nt.f] = nt.s; } if (R <= t.f.s) { pair<pl,dpl> nt; nt.f = {R,t.f.s}; ll min_lef = INF; each(u,t.s) { if (u.f+cur_time < R) { min_lef = u.s+R-(u.f+cur_time); } else nt.s.pb(u); } attempt_add_left(nt,min_lef); ranges[nt.f] = nt.s; } } } void subtract(map<int,int>& m, int x) { --m[x]; assert(m[x] >= 0); if (m[x] == 0) m.erase(x); } int get_next_start(int L) { auto it = start_cnt.lb(L); if (it == end(start_cnt)) return MOD; return it->f; } int get_prev_end(int R) { auto it = end_cnt.ub(R); if (it == begin(end_cnt)) return -MOD; return prev(it)->f; } dpl merge_deques(dpl l, dpl r) { while (sz(l) && sz(r)) { assert(l.bk.f < r.ft.f); ll dif = r.ft.f-l.bk.f; if (l.bk.s >= r.ft.s+dif) { l.pop_back(); continue; } if (r.ft.s >= l.bk.s+dif) { r.pop_front(); continue; } break; } l.ins(end(l),all(r)); return l; } void revert(int L, int R) { // dbg("REVERT",L,R); subtract(start_cnt,L), subtract(end_cnt,R); int LL = get_next_start(L), RR = get_prev_end(R); // dbg("GOT",L,R,LL,RR); auto it = ranges.ub({L,INF}); bool flag = 0; if (it != begin(ranges) && prev(it)->f.s == L) { pair<pl,dpl> t = *prev(it); ranges.erase(prev(it)); cleanup(t); t.f.s = LL; ranges[t.f] = t.s; flag = (LL >= R); } if (it != end(ranges) && it->f.f == R) { pair<pl,dpl> t = *it; cleanup(t); if (flag) { assert(it != begin(ranges)); ranges.erase(it--); assert(RR <= L); assert(it->f.s == t.f.s); assert(RR == it->f.f); it->s = merge_deques(it->s,t.s); } else { ranges.erase(it); t.f.f = RR; ranges[t.f] = t.s; } } } int main() { setIO(); re(N,X); ranges[{-MOD,MOD}] = {{X,0}}; // OK V<tuple<int,int,int,int>> mod; rep(N) { ints(TL,TR,L,R); --TL, ++TR, --L, ++R; mod.pb({TL,1,L,R}); mod.pb({TR,-1,L,R}); } sor(mod); each(t,mod) { auto [_time, ad, L, R] = t; cur_time = _time; if (ad == 1) ban(L,R); else revert(L,R); } assert(sz(start_cnt) == 0 && sz(end_cnt) == 0); assert(sz(ranges) == 1); V<pair<pl,dpl>> franges(all(ranges)); each(t,franges) cleanup(t); ll ans = INF; each(t,franges[0].s) ckmin(ans,t.s); ps(ans); // you should actually read the stuff at the bottom } /* stuff you should look for * int overflow, array bounds * special cases (n=1?) * do smth instead of nothing and stay organized * WRITE STUFF DOWN * DON'T GET STUCK ON ONE APPROACH */
29.351544
95
0.590596
Tech-Intellegent
8bca5521c02bad6dc700113c1a52db3a22f1ba77
3,157
cc
C++
libs/xml/test-config.cc
sandtreader/obtools
2382e2d90bb62c9665433d6d01bbd31b8ad66641
[ "MIT" ]
null
null
null
libs/xml/test-config.cc
sandtreader/obtools
2382e2d90bb62c9665433d6d01bbd31b8ad66641
[ "MIT" ]
null
null
null
libs/xml/test-config.cc
sandtreader/obtools
2382e2d90bb62c9665433d6d01bbd31b8ad66641
[ "MIT" ]
null
null
null
//========================================================================== // ObTools::XML: test-config.cc // // Test harness for ObTools XML configuration // // Copyright (c) 2017 Paul Clark. All rights reserved // This code comes with NO WARRANTY and is subject to licence agreement //========================================================================== #include "ot-xml.h" #include "ot-file.h" #include "ot-log.h" #include <iostream> #include <gtest/gtest.h> namespace { using namespace std; using namespace ObTools; const auto test_dir = string{"/tmp/ot-config"}; const auto toplevel_config_file = test_dir + "/toplevel.xml"; const auto sub1_config_file = test_dir + "/sub1.xml"; const auto sub2_config_file = test_dir + "/sub2.xml"; const auto toplevel_config = R"( <toplevel> <element attr="foo"/> </toplevel> )"; const auto toplevel_config_with_include = R"( <toplevel> <include file="sub1.xml"/> <element attr="foo"/> </toplevel> )"; const auto toplevel_config_with_pattern = R"( <toplevel> <include file="sub*.xml"/> <element attr="foo"/> </toplevel> )"; const auto sub1_config = R"( <toplevel> <element attr="bar"/> </toplevel> )"; const auto sub2_config = R"( <toplevel> <element id="different" attr="NOTME"/> <element2 attr2="bar2"/> </toplevel> )"; class ConfigurationTest: public ::testing::Test { protected: virtual void SetUp() { File::Directory dir(test_dir); dir.ensure(true); } virtual void TearDown() { File::Directory state(test_dir); state.erase(); } public: ConfigurationTest() {} }; TEST_F(ConfigurationTest, TestReadConfig) { File::Path toplevel_path(toplevel_config_file); toplevel_path.write_all(toplevel_config); Log::Streams log; XML::Configuration config(toplevel_config_file, log.error); ASSERT_TRUE(config.read("toplevel")); EXPECT_EQ("foo", config["element/@attr"]); } TEST_F(ConfigurationTest, TestIncludeSub1Config) { File::Path toplevel_path(toplevel_config_file); toplevel_path.write_all(toplevel_config_with_include); File::Path sub1_path(sub1_config_file); sub1_path.write_all(sub1_config); Log::Streams log; XML::Configuration config(toplevel_config_file, log.error); ASSERT_TRUE(config.read("toplevel")); config.process_includes(); EXPECT_EQ("bar", config["element/@attr"]); } TEST_F(ConfigurationTest, TestIncludePatternConfig) { File::Path toplevel_path(toplevel_config_file); toplevel_path.write_all(toplevel_config_with_pattern); File::Path sub1_path(sub1_config_file); sub1_path.write_all(sub1_config); File::Path sub2_path(sub2_config_file); sub2_path.write_all(sub2_config); Log::Streams log; XML::Configuration config(toplevel_config_file, log.error); ASSERT_TRUE(config.read("toplevel")); config.process_includes(); EXPECT_EQ("bar", config["element/@attr"]); EXPECT_EQ("bar2", config["element2/@attr2"]); } } // anonymous namespace int main(int argc, char **argv) { if (argc > 1 && string(argv[1]) == "-v") { auto chan_out = new Log::StreamChannel{&cout}; Log::logger.connect(chan_out); } ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
23.043796
76
0.682293
sandtreader
8bd1cdb01ca9f674a6e03ec579f70decc0f0639f
4,278
cpp
C++
lib/NetworkManager/NetworkManager.cpp
JDuchniewicz/BIBoP
4a9b59f79ee1f2fd1fd503bb3d6f90a0ba423570
[ "MIT" ]
null
null
null
lib/NetworkManager/NetworkManager.cpp
JDuchniewicz/BIBoP
4a9b59f79ee1f2fd1fd503bb3d6f90a0ba423570
[ "MIT" ]
null
null
null
lib/NetworkManager/NetworkManager.cpp
JDuchniewicz/BIBoP
4a9b59f79ee1f2fd1fd503bb3d6f90a0ba423570
[ "MIT" ]
null
null
null
#include "NetworkManager.h" NetworkManager::NetworkManager(BearSSLClient& sslLambda, MqttClient& mqttClient, Config& config) : sslLambda(sslLambda), mqttClient(mqttClient), m_config(config) { } NetworkManager::~NetworkManager() { } int NetworkManager::init() { if (!ECCX08.begin()) { print("Could not initialize ECCX08!\n"); return -1; } ArduinoBearSSL.onGetTime(NetworkManager::getTime); sslLambda.setEccSlot(0, m_config.certificate); if (WiFi.status() == WL_NO_MODULE) { print("Communication with WiFi module failed!\n"); return -1; } mqttClient.setId("BIBOP0"); mqttClient.onMessage(NetworkManager::onMqttMessageTrampoline); mqttClient.registerOwner(this); mqttClient.setConnectionTimeout(50 * 1000L); // connection timeout? mqttClient.setCleanSession(false); return 0; } void NetworkManager::reconnectWiFi() { while (WiFi.status() != WL_CONNECTED) { print("WiFi is disconected! Reconnecting\n"); connectWiFi(); } } int NetworkManager::postWiFi(Batch& batch) { prepareMessage(batch); publishMessage(MESSAGE_BUFFER); return 0; } void NetworkManager::readWiFi() { if (!mqttClient.connected()) { print("%d", mqttClient.connectError()); connectMqtt(); } mqttClient.poll(); } bool NetworkManager::serverDisconnectedWiFi() { if (!sslLambda.connected()) { sslLambda.stop(); return true; } return false; } //TODO: extend this printing? void NetworkManager::printWifiData() { IPAddress ip = WiFi.localIP(); print("IPAddress: %s\n", ip); // not a string lol } void NetworkManager::printCurrentNet() { print("SSID: %s\n", WiFi.SSID()); } void NetworkManager::connectWiFi() { int status = WL_IDLE_STATUS; while (status != WL_CONNECTED) { print("Attempting to connect to WPA SSID: %s\n", m_config.ssid); status = WiFi.begin(m_config.ssid, m_config.pass); delay(7000); } print("Success!\n"); //printWifiData(); // no need to print it } void NetworkManager::connectMqtt() { print("Attempting connection to MQTT broker: %s \n", m_config.broker); while (!mqttClient.connect(m_config.broker, 8883)) { // failed, retry print("."); delay(1000); } print("You're connected to the MQTT broker\n"); // subscribe to a topic mqttClient.subscribe(m_config.incomingTopic); } void NetworkManager::publishMessage(const char* buffer) { print("Publishing message %s\n", m_config.outgoingTopic); // send message, the Print interface can be used to set the message contents mqttClient.beginMessage(m_config.outgoingTopic, false, 1); //mqttClient.print("{\"data\": \"hello world\"}"); mqttClient.print(buffer); mqttClient.endMessage(); } void NetworkManager::prepareMessage(Batch& batch) { print("preparing message\n"); // we could create it using a library, let's do it by hand // write beginning char* buffer_pos = MESSAGE_BUFFER; uint8_t len = 0; len = sprintf(buffer_pos, "%s", JSON_BEGIN); buffer_pos += len; // write the array body for (uint8_t i = 0; i < INFERENCE_BUFSIZE; ++i) { len = sprintf(buffer_pos, "%lu", batch.ppg_red[batch.start_idx + i]); buffer_pos += len; len = sprintf(buffer_pos, "%s", ", "); buffer_pos += len; } buffer_pos -= 2; // remove last ", " // end the array and add string termination len = sprintf(buffer_pos, "%s", JSON_END); buffer_pos += len; sprintf(buffer_pos, "%s", "\0"); // TO SMALL print buffer for printing via my //print(MESSAGE_BUFFER); } unsigned long NetworkManager::getTime() { return WiFi.getTime(); } void NetworkManager::onMqttMessageTrampoline(void* context, int messageLength) { return reinterpret_cast<NetworkManager*>(context)->onMqttMessage(messageLength); } void NetworkManager::onMqttMessage(int messageLength) { // we received a message, print out the topic and contents print("Received a message with topic '%s', length %d, bytes: \n", mqttClient.messageTopic().c_str(), messageLength); // use the Stream interface to print the contents while (mqttClient.available()) { print("%c", (char)mqttClient.read()); } print("\n"); }
23.766667
161
0.664095
JDuchniewicz
8bd3923a1f206f5181b38bedc643edd41003880e
800
cpp
C++
leetcode/monthly-challenge/2021/06-june/Jump-Game-VI.cpp
leohr/competitive-programming
f97488e0cb777c1df78257ce2644ac4ff8191267
[ "MIT" ]
1
2020-10-08T19:28:40.000Z
2020-10-08T19:28:40.000Z
leetcode/monthly-challenge/2021/06-june/Jump-Game-VI.cpp
leohr/competitive-programming
f97488e0cb777c1df78257ce2644ac4ff8191267
[ "MIT" ]
null
null
null
leetcode/monthly-challenge/2021/06-june/Jump-Game-VI.cpp
leohr/competitive-programming
f97488e0cb777c1df78257ce2644ac4ff8191267
[ "MIT" ]
1
2020-10-24T02:32:27.000Z
2020-10-24T02:32:27.000Z
class Solution { public: int maxResult(vector<int>& nums, int k) { int n = nums.size(); priority_queue<pair<int, int>> q; vector<int> ans(n, -1e9); for (int i = 0; i < n; ++i) { if (i == 0) { ans[i] = nums[i]; q.push({ans[i], i}); } else if (i <= k) { auto top = q.top(); ans[i] = top.first + nums[i]; q.push({ans[i], i}); } else { auto top = q.top(); while (i - top.second > k) { q.pop(); top = q.top(); } ans[i] = top.first + nums[i]; q.push({ans[i], i}); } } return ans[n-1]; } };
29.62963
46
0.32625
leohr
8bd927a52d16e30855525b6dc2926dbcca429807
4,721
cpp
C++
math/polynomial/old/NTT.cpp
searchstar2017/acmtool
03392b8909a3d45f10c2711ca4ad9ba69f64a481
[ "MIT" ]
null
null
null
math/polynomial/old/NTT.cpp
searchstar2017/acmtool
03392b8909a3d45f10c2711ca4ad9ba69f64a481
[ "MIT" ]
null
null
null
math/polynomial/old/NTT.cpp
searchstar2017/acmtool
03392b8909a3d45f10c2711ca4ad9ba69f64a481
[ "MIT" ]
null
null
null
//g = 3 //998244353, img = 86583718 //1004535809 = 479*2^21+1, img = 483363861 //469762049, img = 19610091 //tp == false means NTT^-1 void NTT(int a[], int n, bool tp) { for (int i = 0, j = 0; i < n; ++i) { if (i > j) swap(a[i], a[j]); for (int k = n >> 1; (j ^= k) < k; k >>= 1); } for (int i = 2; i <= n; i <<= 1) { int wn = mpow(3, tp ? (p - 1) / i : p - 1 - (p-1)/i, p); for (int pa = i >> 1, j = 0; j < n; j += i) { for (int w = 1, k = 0; k < pa; ++k, w = (LL)w * wn % p) { int t = (LL)w * a[j + k + pa] % p; a[j + k + pa] = Sub(a[j + k] - t, p); AddMod(a[j + k] += t, p); } } } if (!tp) for (int i = 0, n1 = mpow(n, p-2, p); i < n; ++i) a[i] = (LL)a[i] * n1 % p; } int FindPowOf2(int to) { int n; for (n = 1; n < to; n <<= 1); return n; } void Fill(int a[], int na, int n) { for (; na < n; ++na) a[na] = 0; } //a and b are destroyed //Allow c == a or b void Mul(int c[], int a[], int na, int b[], int nb) { int n = FindPowOf2(na + nb); //in FFT Fill(a, na, n); Fill(b, nb, n); NTT(a, n, true); NTT(b, n, true); for (int i = 0; i < n; ++i) c[i] = (LL)a[i] * b[i] % p; NTT(c, n, false); } //n == 2^k //mod x^n //b != a //Do not need Initialize b //The upper n elements of b is 0 void Inv(int b[], const int a[], int n) { static int t[MAX2N]; if (n == 1) { b[0] = mpow(a[0], p - 2, p); b[1] = 0; //necessary? return; } Inv(b, a, n >> 1); memset(b + n, 0, n * sizeof(b[0])); NTT(b, n << 1, true); memcpy(t, a, n * sizeof(int)); memset(t + n, 0, n * sizeof(int)); NTT(t, n << 1, true); for (int i = 0, r = n << 1; i < r; ++i) b[i] = (LL)b[i] * Sub(2 - (LL)t[i] * b[i] % p, p) % p; NTT(b, n << 1, false); memset(b+n, 0, n * sizeof(int)); } //quo = a / b //Allow quo == a or b //b[0...nb-1] is reversed //quo[i] != 0 if i >= nq void Div(int quo[], int& nq, int a[], int na, int b[], int nb) { static int t[MAX2N]; nq = na - nb + 1; //length of quo reverse(a, a + na); reverse(b, b + nb); int len = FindPowOf2(nq); Fill(b, nb, len); Inv(t, b, len); Fill(a, na, len); Mul(quo, a, len, t, len); reverse(quo, quo + nq); } //quo != a && quo != b //rem != a //Allow rem == b //quo[i] != 0 if i >= nq //len(rem) == nb - 1 void DivMod(int quo[], int& nq, int rem[], const int a[], int na, int b[], int nb) { static int t[MAX2N]; memcpy(t, a, na * sizeof(a[0])); Div(quo, nq, t, na, b, nb); reverse(b, b + nb); //reverse back memcpy(t, quo, nq * sizeof(t[0])); Mul(rem, t, nq, b, nb); for (int i = 0; i < nb - 1; ++i) rem[i] = Sub(a[i] - rem[i], p); } //Allow b == a void Derivation(int b[], int a[], int n) { for (int i = 1; i < n; ++i) b[i-1] = (LL)i * a[i] % p; b[n-1] = 0; } //Allow b == a //mod x ^ n void Integral(int b[], int a[], int n) { for (int i = n - 1; i; --i) b[i] = (LL)a[i-1] * Inv(i, p) % p; b[0] = 0; } //b = ln(a) mod x ^ n //n == 2 ^ k //Allow b == a void ln(int b[], int a[], int n) { static int t[MAX2N]; Inv(t, a, n); Derivation(a, a, n); Mul(a, a, n, t, n); Integral(b, a, n); } //O(nlog n) //If a[0] == 0, then b0 == 1 //n == 2^k //b != a //The upper n elements of b is 0 void exp(int b[], int b0, const int a[], int n) { static int t[MAX2N]; if (1 == n) { b[0] = b0; b[1] = 0; } else { exp(b, b0, a, n >> 1); memcpy(t, b, n * sizeof(b[0])); ln(t, t, n); t[0] = Sub(Add(1 + a[0], p) - t[0], p); for (int i = 1; i < n; ++i) t[i] = Sub(a[i] - t[i], p); Mul(b, b, n, t, n); memset(b + n, 0, n * sizeof(b[0])); } } //pg is the primitive root of p int KthRoot(int x, int k, int p, int pg) { int ret = mpow(pg, BSGS(pg, x, p) / k, p); return min(ret, p - ret); } //Exists b0 such that b0^k = a0 (mod p) //n == 2^kk //b != a void KthRoot(int b[], int a[], int n, int k) { int b0 = KthRoot(a[0], k, p, 3); ln(a, a, n); int tmp = Inv(k, p); for (int i = 0; i < n; ++i) a[i] = (LL)a[i] * tmp % p; exp(b, b0, a, n); } //a[0] != 0 //O(nlgn) //n == 2^kk //b != a void pow(int b[], int a[], int n, int k) { int b0 = mpow(a[0], k, p); ln(a, a, n); for (int i = 0; i < n; ++i) a[i] = (LL)a[i] * k % p; exp(b, b0, a, n); } //Allow a[0] == 0 //Allow n != 2^kk //mod x^na void pow(int a[], int na, int k) { static int t[MAX2N]; int l0; for (l0 = 0; l0 < na && 0 == a[l0]; ++l0); memmove(a, a + l0, (na - l0) * sizeof(a[0])); int n = FindPowOf2(na - l0); //if na == 0, then n == 1 Fill(a, na - l0, n); pow(t, a, n, k); Fill(t, n, na); l0 = min((LL)l0 * k, (LL)na); memset(a, 0, l0 * sizeof(a[0])); memcpy(a + l0, t, (na - l0) * sizeof(a[0])); }
23.843434
84
0.446304
searchstar2017
8be25858f3e7b9b7e9b266288f67868a4b5d33f4
122
hxx
C++
src/Providers/UNIXProviders/MoreRoleInfo/UNIX_MoreRoleInfo_FREEBSD.hxx
brunolauze/openpegasus-providers-old
b00f1aad575bae144b8538bf57ba5fd5582a4ec7
[ "MIT" ]
1
2020-10-12T09:00:09.000Z
2020-10-12T09:00:09.000Z
src/Providers/UNIXProviders/MoreRoleInfo/UNIX_MoreRoleInfo_FREEBSD.hxx
brunolauze/openpegasus-providers-old
b00f1aad575bae144b8538bf57ba5fd5582a4ec7
[ "MIT" ]
null
null
null
src/Providers/UNIXProviders/MoreRoleInfo/UNIX_MoreRoleInfo_FREEBSD.hxx
brunolauze/openpegasus-providers-old
b00f1aad575bae144b8538bf57ba5fd5582a4ec7
[ "MIT" ]
null
null
null
#ifdef PEGASUS_OS_FREEBSD #ifndef __UNIX_MOREROLEINFO_PRIVATE_H #define __UNIX_MOREROLEINFO_PRIVATE_H #endif #endif
10.166667
37
0.844262
brunolauze
8be26060043e9e577dbd7dd61d6427a1eef90c5e
2,555
cpp
C++
gametitle.cpp
Mokona/Caterbuino
d7c0382f6769472584d8c3afb2b673005efa4b32
[ "MIT" ]
null
null
null
gametitle.cpp
Mokona/Caterbuino
d7c0382f6769472584d8c3afb2b673005efa4b32
[ "MIT" ]
null
null
null
gametitle.cpp
Mokona/Caterbuino
d7c0382f6769472584d8c3afb2b673005efa4b32
[ "MIT" ]
null
null
null
#include "gametitle.h" #include "buttonwidget.h" #include "data_title.h" #include "gamecredits.h" #include "gamerunning.h" #include "gamebuino_fix.h" #include <cassert> namespace { uint16_t gameStartSound[] = { 0x0005, 0x178, 0x17A, 0x27C, 0x17E, 0x180, 0x286, 0x188, 0x0000 }; const char* PLAY_TEXT = "PLAY"; ButtonWidget::Parameters startWidgetParameters = { { 25, 47 }, { 5, 52 }, ButtonWidget::BLINK_A, PLAY_TEXT }; const char* CREDITS_TEXT = "CREDITS"; ButtonWidget::Parameters creditWidgetParameters = { { 30, 47 }, { 2, 52 }, ButtonWidget::BLINK_MENU, CREDITS_TEXT }; uint8_t TIME_FOR_ALTERNATE_WIDGET = 50; } GameTitle::GameTitle() : titleImage(new Gamebuino_Meta::Image(getTitleData())) , startGameDisplay(new ButtonWidget(startWidgetParameters)) , goToCreditsDisplay(new ButtonWidget(creditWidgetParameters)) , alternateTimer(TIME_FOR_ALTERNATE_WIDGET) { gb.sound.play(gameStartSound); } void GameTitle::update() { gb.display.drawImage(0, 0, *titleImage); gb.display.setColor(Color::gray); gb.display.setFontSize(1); gb.display.setCursor(64, 59); gb.display.println("v0.9"); widgetUpdateAndDisplay(); if (gb.buttons.pressed(BUTTON_A)) { start_game(); } else if (gb.buttons.pressed(BUTTON_MENU)) { start_credits(); } } void GameTitle::widgetUpdateAndDisplay() { if (alternateTimer == 0) { alternateTimer = TIME_FOR_ALTERNATE_WIDGET; currentWidgetDisplayed = currentWidgetDisplayed == 0 ? 1 : 0; } else { alternateTimer -= 1; } if (currentWidgetDisplayed == 0) { startGameDisplay->update(); startGameDisplay->display(); } else { goToCreditsDisplay->update(); goToCreditsDisplay->display(); } } void GameTitle::start_game() { action = GO_TO_GAME; } void GameTitle::start_credits() { action = GO_TO_CREDITS; } bool GameTitle::finished() { return action != STAY_HERE; } std::unique_ptr<GameState> GameTitle::new_state() { assert(finished()); auto& take_action = action; auto state = [take_action]() -> std::unique_ptr<GameState> { switch (take_action) { case GO_TO_GAME: return std::unique_ptr<GameState>(new GameRunning()); case GO_TO_CREDITS: return std::unique_ptr<GameState>(new GameCredits()); } return {}; }(); action = STAY_HERE; return state; };
22.025862
69
0.631703
Mokona