hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
108
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
b0180077b6f31c48a6686f5e574a09fc4d7de072
577
cpp
C++
code/cpp/StringAnagram.cpp
analgorithmaday/analgorithmaday.github.io
d43f98803bc673f61334bff54eed381426ee902e
[ "MIT" ]
null
null
null
code/cpp/StringAnagram.cpp
analgorithmaday/analgorithmaday.github.io
d43f98803bc673f61334bff54eed381426ee902e
[ "MIT" ]
null
null
null
code/cpp/StringAnagram.cpp
analgorithmaday/analgorithmaday.github.io
d43f98803bc673f61334bff54eed381426ee902e
[ "MIT" ]
null
null
null
bool detect_anagram(char* src, char* anagram) { int isrc=0, iana=0; while(*src != '\0') { char* iter = anagram; while(*iter != '\0' && *src != ' ') { if(*src == *iter) { iana++; break; } iter++; } if(*src != ' ') isrc++; src++; } if(iana == isrc) return true; else return false; } void main() { char *src=strdup("eleven plus two"); char *a = strdup("so plew veluent"); bool st = detect_anagram(src, a); }
19.233333
45
0.410745
analgorithmaday
b01c6c73dd8f078d4ab0b4d34dc115116ace8f4c
2,640
hpp
C++
sal/memory.hpp
svens/sal.lib
8dee6a0ace5a5e4e8616f9cff98ea86ee8c4761c
[ "MIT" ]
3
2017-03-21T20:39:25.000Z
2018-03-27T10:45:45.000Z
sal/memory.hpp
svens/sal.lib
8dee6a0ace5a5e4e8616f9cff98ea86ee8c4761c
[ "MIT" ]
49
2016-04-17T10:48:35.000Z
2018-12-29T10:00:55.000Z
sal/memory.hpp
svens/sal.lib
8dee6a0ace5a5e4e8616f9cff98ea86ee8c4761c
[ "MIT" ]
1
2017-03-21T20:48:24.000Z
2017-03-21T20:48:24.000Z
#pragma once /** * \file sal/memory.hpp * Iterator and memory pointer helpers. */ #include <sal/config.hpp> #include <iterator> #include <memory> __sal_begin namespace __bits { template <typename T> constexpr bool is_const_ref_v = false; template <typename T> constexpr bool is_const_ref_v<const T &> = true; template <typename It> constexpr void ensure_iterator_constraints () noexcept { static_assert( std::is_pod_v<typename std::iterator_traits<It>::value_type>, "expected iterator to point to POD type" ); static_assert( std::is_base_of_v< std::random_access_iterator_tag, typename std::iterator_traits<It>::iterator_category >, "expected random access iterator" ); } // internal helper: silence MSVC silly-warning C4996 (Checked Iterators) template <typename It> inline auto make_output_iterator (It first, It) noexcept { #if defined(_MSC_VER) return stdext::make_unchecked_array_iterator(first); #else return first; #endif } } // namespace __bits /** * Return \a it as pointer casted to uint8_t pointer. \a it can be iterator or * unrelated type of pointer. */ template <typename It> inline auto to_ptr (It it) noexcept { __bits::ensure_iterator_constraints<It>(); if constexpr (__bits::is_const_ref_v<decltype(*it)>) { return reinterpret_cast<const uint8_t *>(std::addressof(*it)); } else { return reinterpret_cast<uint8_t *>(std::addressof(*it)); } } /** * Return \a it as pointer casted to uint8_t pointer. \a it can be iterator or * unrelated type of pointer. */ constexpr std::nullptr_t to_ptr (std::nullptr_t) noexcept { return nullptr; } /** * Return memory region [\a first, \a last) size in bytes. * If \a first > \a last, result is undefined. */ template <typename It> constexpr size_t range_size (It first, It last) noexcept { __bits::ensure_iterator_constraints<It>(); return std::distance(first, last) * sizeof(typename std::iterator_traits<It>::value_type); } /** * Return memory region [\a first, \a last) size in bytes. * If \a first > \a last, result is undefined. */ constexpr size_t range_size (std::nullptr_t, std::nullptr_t) noexcept { return 0; } /** * Return iterator casted to uint8_t pointer to past last item in range * [\a first, \a last). */ template <typename It> inline auto to_end_ptr (It first, It last) noexcept { return to_ptr(first) + range_size(first, last); } /** * Return iterator casted to uint8_t pointer to past last item in range * [\a first, \a last). */ constexpr std::nullptr_t to_end_ptr (std::nullptr_t, std::nullptr_t) noexcept { return nullptr; } __sal_end
20.952381
78
0.708333
svens
b01c7c8ae174460c9de1a7271af2017d1824cfa3
285
hpp
C++
include/cru/parse/Nonterminal.hpp
crupest/cru
3c3a08a02a0f8fc56dc2da3374f025d4fdaf62c5
[ "Apache-2.0" ]
1
2021-09-30T11:43:03.000Z
2021-09-30T11:43:03.000Z
include/cru/parse/Nonterminal.hpp
crupest/cru
3c3a08a02a0f8fc56dc2da3374f025d4fdaf62c5
[ "Apache-2.0" ]
11
2021-08-22T12:55:56.000Z
2022-03-13T15:01:29.000Z
include/cru/parse/Nonterminal.hpp
crupest/cru
3c3a08a02a0f8fc56dc2da3374f025d4fdaf62c5
[ "Apache-2.0" ]
null
null
null
#pragma once #include "Symbol.hpp" namespace cru::parse { class CRU_PARSE_API Nonterminal : public Symbol { public: Nonterminal(Grammar* grammar, String name); CRU_DELETE_COPY(Nonterminal) CRU_DELETE_MOVE(Nonterminal) ~Nonterminal() override; }; } // namespace cru::parse
19
49
0.747368
crupest
b01d33fdb12f244bb0018a7e9dee1924b576cfda
295
hpp
C++
lib/Timing.hpp
CraGL/SubdivisionSkinning
c593a7a4e38a49716e9d3981824871a7b6c29324
[ "Apache-2.0" ]
19
2017-03-29T00:14:00.000Z
2021-11-27T15:44:44.000Z
lib/Timing.hpp
Myzhencai/SubdivisionSkinning
c593a7a4e38a49716e9d3981824871a7b6c29324
[ "Apache-2.0" ]
1
2019-05-08T21:48:11.000Z
2019-05-08T21:48:11.000Z
lib/Timing.hpp
Myzhencai/SubdivisionSkinning
c593a7a4e38a49716e9d3981824871a7b6c29324
[ "Apache-2.0" ]
5
2017-04-23T17:52:44.000Z
2020-06-28T18:00:26.000Z
#ifndef __Timing_hpp__ #define __Timing_hpp__ void tic( const char* label = 0 ) ; void toc( const char* label = 0 ) ; struct Tick { Tick( const char* alabel = 0 ) : label( alabel ) { tic( label ); } ~Tick() { toc( label ); } const char* label; }; #endif /* __Timing_hpp__ */
18.4375
70
0.60339
CraGL
b02162aa82a4900b6ed9d5d2a109dd088a465dc4
945
cpp
C++
Word.cpp
dennistrukhin/C-Virtual-machine
644be1f45c0d2804f93bddbfb4728e3d0c9fee5a
[ "MIT" ]
null
null
null
Word.cpp
dennistrukhin/C-Virtual-machine
644be1f45c0d2804f93bddbfb4728e3d0c9fee5a
[ "MIT" ]
null
null
null
Word.cpp
dennistrukhin/C-Virtual-machine
644be1f45c0d2804f93bddbfb4728e3d0c9fee5a
[ "MIT" ]
null
null
null
// // Created by Dennis Trukhin on 21/04/2018. // #include <iostream> #include "Word.h" Word::Word(const char * word) { for (int i = 0; i < 4; i++) { w[i] = (unsigned char)word[i]; } } Word::Word(const unsigned char * word) { for (int i = 0; i < 4; i++) { w[i] = word[i]; } } unsigned char *Word::getWord() { return w; } void Word::dump() { std::cout << w[0] << w[1] << w[2] << w[3] << ' '; } float Word::asFloat() { float f; unsigned char b[] = {w[3], w[2], w[1], w[0]}; memcpy(&f, &b, sizeof(f)); return f; } int Word::asInt() { int f; unsigned char b[] = {w[3], w[2], w[1], w[0]}; memcpy(&f, &b, sizeof(f)); return f; } unsigned char *Word::asString() { return w; } bool Word::is(unsigned char *c) { for (int i = 0; i < WORD_SIZE; i++) { if (w[i] != c[i]) { return false; } } return true; } Word::Word() = default;
16.875
53
0.479365
dennistrukhin
b021b89a63aebef4408d1605dc318dc4cbe867f1
2,642
cpp
C++
ui/test/fixeditemproxymodeltest.cpp
VITObelgium/cpp-infra
2a95a112439b21ff9125c2e6e29810a418b94a4d
[ "MIT" ]
1
2022-02-23T03:15:54.000Z
2022-02-23T03:15:54.000Z
ui/test/fixeditemproxymodeltest.cpp
VITObelgium/cpp-infra
2a95a112439b21ff9125c2e6e29810a418b94a4d
[ "MIT" ]
null
null
null
ui/test/fixeditemproxymodeltest.cpp
VITObelgium/cpp-infra
2a95a112439b21ff9125c2e6e29810a418b94a4d
[ "MIT" ]
null
null
null
#include "uiinfra/fixeditemproxymodel.h" #include "simpletreemodel.h" #include <gtest/gtest.h> #include <qstandarditemmodel.h> #include <qstringlistmodel.h> void PrintTo(const QString& str, ::std::ostream* os) { *os << str.toStdString(); } namespace inf::ui::test { using namespace testing; class FixedItemProxyModelTest : public Test { protected: FixedItemProxyModelTest() : modelData(QStringLiteral("Level1\tValue1\n" " Level2.1\tValue2.1\n" " Level2.2\tValue2.2\n" " Level3\tValue3.1\n" " Level2.3\tValue2.3\n")) { } QString modelData; }; TEST_F(FixedItemProxyModelTest, listModel) { QStringListModel sourceModel; sourceModel.setStringList({"One", "Two", "Three"}); FixedItemProxyModel proxyModel; proxyModel.setFixedItems({"All"}); proxyModel.setSourceModel(&sourceModel); EXPECT_EQ(4, proxyModel.rowCount()); EXPECT_EQ(QString("All"), proxyModel.index(0, 0).data().toString()); EXPECT_EQ(QString("One"), proxyModel.index(1, 0).data().toString()); EXPECT_EQ(QString("Two"), proxyModel.index(2, 0).data().toString()); EXPECT_EQ(QString("Three"), proxyModel.index(3, 0).data().toString()); } TEST_F(FixedItemProxyModelTest, treeModel) { TreeModel sourceModel(modelData); FixedItemProxyModel proxyModel; proxyModel.setFixedItems({"All", "None"}); proxyModel.setSourceModel(&sourceModel); EXPECT_EQ(3, proxyModel.rowCount()); EXPECT_EQ(QString("All"), proxyModel.index(0, 0).data().toString()); EXPECT_EQ(QString("None"), proxyModel.index(1, 0).data().toString()); EXPECT_EQ(QString("Level1"), proxyModel.index(2, 0).data().toString()); } TEST_F(FixedItemProxyModelTest, treeModelRootIndex) { TreeModel sourceModel(modelData); FixedItemProxyModel proxyModel; proxyModel.setFixedItems({"All"}); proxyModel.setSourceModel(&sourceModel); proxyModel.setRootModelIndex(sourceModel.index(0, 0)); EXPECT_EQ(4, proxyModel.rowCount()); EXPECT_EQ(QString("All"), proxyModel.index(0, 0).data().toString()); EXPECT_EQ(QString("Level2.1"), proxyModel.index(1, 0).data().toString()); EXPECT_EQ(QString("Level2.2"), proxyModel.index(2, 0).data().toString()); EXPECT_EQ(QString("Level2.3"), proxyModel.index(3, 0).data().toString()); EXPECT_EQ(QString("Value2.1"), proxyModel.index(1, 1).data().toString()); EXPECT_EQ(QString("Value2.2"), proxyModel.index(2, 1).data().toString()); EXPECT_EQ(QString("Value2.3"), proxyModel.index(3, 1).data().toString()); } }
32.617284
77
0.663134
VITObelgium
b0246c68a42555ffbf330568d5cb7d0a325f42af
3,471
cc
C++
scene/geometry/triangle.cc
dinowernli/raytracer
b1af14b2d2a02fe679da392aaf25385b69efee1b
[ "MIT" ]
null
null
null
scene/geometry/triangle.cc
dinowernli/raytracer
b1af14b2d2a02fe679da392aaf25385b69efee1b
[ "MIT" ]
null
null
null
scene/geometry/triangle.cc
dinowernli/raytracer
b1af14b2d2a02fe679da392aaf25385b69efee1b
[ "MIT" ]
null
null
null
// The MIT License (MIT) // // Copyright (c) 2015 dinowernli // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. /* * Author: Dino Wernli */ #include "scene/geometry/triangle.h" #include "renderer/intersection_data.h" #include "util/ray.h" Triangle::Triangle(const Point3& c1, const Point3& c2, const Point3& c3, const Material& material, const Vector3* n1, const Vector3* n2, const Vector3* n3) : Element(material, &(new BoundingBox(c1))->Include(c2).Include(c3)) { Vector3 normal = c1.VectorTo(c2).Cross(c1.VectorTo(c3)).Normalized(); vertex1_.reset(new Vertex(c1, n1 == NULL ? normal : n1->Normalized())); vertex2_.reset(new Vertex(c2, n2 == NULL ? normal : n2->Normalized())); vertex3_.reset(new Vertex(c3, n3 == NULL ? normal : n3->Normalized())); } Triangle::Triangle(const Point3* c1, const Point3* c2, const Point3* c3, const Vector3* n1, const Vector3* n2, const Vector3* n3, const Material& material) : Element(material, &(new BoundingBox(*c1))->Include(*c2).Include(*c3)), vertex1_(new Vertex(c1, n1)), vertex2_(new Vertex(c2, n2)), vertex3_(new Vertex(c3, n3)) { } Triangle::~Triangle() { } bool Triangle::Intersect(const Ray& ray, IntersectionData* data) const { Vector3 edge12(vertex1_->point().VectorTo(vertex2_->point())); Vector3 edge13(vertex1_->point().VectorTo(vertex3_->point())); Vector3 dir_cross_first(ray.direction().Cross(edge13)); Scalar determinant = edge12.Dot(dir_cross_first); if (determinant > -EPSILON && determinant < EPSILON) { return false; } Scalar invdet = 1 / determinant; // Compute barycentric u. Vector3 vertex_to_origin(vertex1_->point().VectorTo(ray.origin())); Scalar u = vertex_to_origin.Dot(dir_cross_first) * invdet; if (u < 0 || u > 1) { return false; } // Compute barycentric v. Vector3 plane_normal = vertex_to_origin.Cross(edge12); Scalar v = ray.direction().Dot(plane_normal) * invdet; if (v < 0 || v + u > 1) { return false; } Scalar t = edge13.Dot(plane_normal) * invdet; bool found = ray.InRange(t) && (data == NULL || t < data->t); if (found && data != NULL) { data->set_element(this); data->position = ray.PointAt(t); data->normal = vertex1_->normal() * (1 - u - v) + vertex2_->normal() * u + vertex3_->normal() * v; data->material = &material(); data->t = t; } return found; }
38.566667
81
0.678767
dinowernli
b026fa1f34f46df9c8d3c941550ec74b12d0c415
24
cpp
C++
src/render/Renderer.cpp
Vasile2k/Luminica
13250c6b536b0634e2f4ea95b7b75b0dee18705d
[ "Apache-2.0" ]
null
null
null
src/render/Renderer.cpp
Vasile2k/Luminica
13250c6b536b0634e2f4ea95b7b75b0dee18705d
[ "Apache-2.0" ]
null
null
null
src/render/Renderer.cpp
Vasile2k/Luminica
13250c6b536b0634e2f4ea95b7b75b0dee18705d
[ "Apache-2.0" ]
null
null
null
#include "Renderer.hpp"
12
23
0.75
Vasile2k
b02aca114d2c1bf20028a2f21a6baa3d7cbbe27f
1,489
cpp
C++
gui/macrothread.cpp
fourier/frostbite
47b00c5b93a949300e5b387e38d6ab77afc799d9
[ "MIT" ]
27
2016-03-25T19:15:34.000Z
2021-10-17T14:39:00.000Z
gui/macrothread.cpp
fourier/frostbite
47b00c5b93a949300e5b387e38d6ab77afc799d9
[ "MIT" ]
109
2016-09-02T08:13:58.000Z
2022-03-28T05:45:51.000Z
gui/macrothread.cpp
fourier/frostbite
47b00c5b93a949300e5b387e38d6ab77afc799d9
[ "MIT" ]
20
2016-06-30T15:29:25.000Z
2021-04-05T16:47:17.000Z
#include "macrothread.h" MacroThread::MacroThread() { } void MacroThread::init(QHash<QString, QStringList> macro, int time) { this->abort = false; this->macro = macro; this->sequenceTime = time; if(sequenceTime <= 0) { sequenceTime = 1000; } } void MacroThread::stopThread() { this->abort = true; } void MacroThread::run() { for(int i = 0; i < macro["commands"].size(); i++) { if(!abort) { if(i < macro["actions"].size()) { if(macro["actions"].at(i) == "s") { emit writeCommand(macro["commands"].at(i)); QCoreApplication::processEvents(); msleep(sequenceTime); } else if(macro["actions"].at(i) == "n") { emit writeCommand(macro["commands"].at(i)); } } else { int cursorPos = macro["commands"].at(i).indexOf("@"); if(cursorPos == -1) { emit setText(macro["commands"].at(i)); } else { QString command = macro["commands"].at(i); command.remove(cursorPos, 1); emit setText(command); emit setCursor(cursorPos); } } } } } MacroThread::~MacroThread() { if(!this->wait(1000)) { qWarning("Thread deadlock detected, terminating thread."); this->terminate(); this->wait(); } }
27.574074
69
0.478845
fourier
b02b0406485458343a095d28a429450203bd8fe1
811
cpp
C++
Numbers/powers_of_two.cpp
jahnvisrivastava100/CompetitiveProgrammingQuestionBank
0d72884ea5e0eb674a503b81ab65e444f5175cf4
[ "MIT" ]
931
2020-04-18T11:57:30.000Z
2022-03-31T15:15:39.000Z
Numbers/powers_of_two.cpp
jahnvisrivastava100/CompetitiveProgrammingQuestionBank
0d72884ea5e0eb674a503b81ab65e444f5175cf4
[ "MIT" ]
661
2020-12-13T04:31:48.000Z
2022-03-15T19:11:54.000Z
Numbers/powers_of_two.cpp
Mayuri-cell/CompetitiveProgrammingQuestionBank
eca2257d7da5346f45bdd7a351cc95bde6ed5c7d
[ "MIT" ]
351
2020-08-10T06:49:21.000Z
2022-03-25T04:02:12.000Z
/* Write a Program to find the minimum number of powers (sum of all those numbers) that are required to form the given input number and print those numbers. */ #include<bits/stdc++.h> #include<cmath> using namespace std; int main(int argc, char const *argv[]) { int n = 20,count=0,flag=0; int powers[n],res=0,j,k; for(int i=1;i<=10;i++) { powers[count++]= pow(2,i); } for(j=0;j<count;j++) { for(k=j+1;k<count;k++) { if(powers[j]+powers[k] == n) { res+=2; flag = 1; break; } } if(flag==1) break; } cout<<"Count of numbers required = "<<res<<endl; cout<<"The powers of two are:"<<powers[j]<<" "<<powers[k]; return 0; }
22.527778
89
0.491985
jahnvisrivastava100
b02b5686a6056ba162952d42e3ab0eba21e908e3
220
hpp
C++
mlog/string_builder.hpp
Lowdham/mlog
034134ec2048fb78084f4772275b5f67efeec433
[ "MIT" ]
2
2021-06-19T04:14:14.000Z
2021-08-30T15:39:49.000Z
mlog/string_builder.hpp
Lowdham/mlog
034134ec2048fb78084f4772275b5f67efeec433
[ "MIT" ]
1
2021-06-21T15:58:19.000Z
2021-06-22T02:04:39.000Z
mlog/string_builder.hpp
Lowdham/mlog
034134ec2048fb78084f4772275b5f67efeec433
[ "MIT" ]
null
null
null
// This file is part of mlog #ifndef MLOG_STRING_BUILDER_HPP_ #define MLOG_STRING_BUILDER_HPP_ #include "fwd.hpp" namespace mlog { // class StringBuilder {}; } // namespace mlog #endif // !MLOG_STRING_BUILDER_HPP_
15.714286
36
0.754545
Lowdham
b02c5556d7d1efd00adf3c4153dfdcfa0a4fe6ae
4,212
cpp
C++
tests/wifi_standard/wifi_framework/wifi_manage/wifi_scan/scan_monitor_test.cpp
openharmony-gitee-mirror/communication_wifi
de1ca7ecb2b61d2385f6450fdadab7df9d3a4e37
[ "Apache-2.0" ]
1
2021-12-03T14:28:10.000Z
2021-12-03T14:28:10.000Z
tests/wifi_standard/wifi_framework/wifi_manage/wifi_scan/scan_monitor_test.cpp
openharmony-gitee-mirror/communication_wifi
de1ca7ecb2b61d2385f6450fdadab7df9d3a4e37
[ "Apache-2.0" ]
null
null
null
tests/wifi_standard/wifi_framework/wifi_manage/wifi_scan/scan_monitor_test.cpp
openharmony-gitee-mirror/communication_wifi
de1ca7ecb2b61d2385f6450fdadab7df9d3a4e37
[ "Apache-2.0" ]
1
2021-09-13T11:18:00.000Z
2021-09-13T11:18:00.000Z
/* * Copyright (C) 2021 Huawei Device 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. */ #include "scan_monitor.h" #include "mock_scan_state_machine.h" #include "mock_wifi_supplicant_hal_interface.h" #include <gtest/gtest.h> using ::testing::_; using ::testing::AtLeast; using ::testing::DoAll; using ::testing::Eq; using ::testing::Return; using ::testing::SetArgReferee; using ::testing::StrEq; using ::testing::TypedEq; using ::testing::ext::TestSize; namespace OHOS { namespace Wifi { class ScanMonitorTest : public testing::Test { public: static void SetUpTestCase() {} static void TearDownTestCase() {} void SetUp() override { pScanMonitor = std::make_unique<ScanMonitor>(); pScanStateMachine = std::make_unique<MockScanStateMachine>(); pScanMonitor->SetScanStateMachine(pScanStateMachine.get()); } void TearDown() override { EXPECT_CALL(WifiSupplicantHalInterface::GetInstance(), UnRegisterSupplicantEventCallback()); pScanMonitor.reset(); pScanStateMachine.reset(); } public: std::unique_ptr<ScanMonitor> pScanMonitor; std::unique_ptr<MockScanStateMachine> pScanStateMachine; void InitScanMonitorSuccessTest() { EXPECT_CALL(WifiSupplicantHalInterface::GetInstance(), RegisterSupplicantEventCallback(_)) .WillRepeatedly(Return(WIFI_IDL_OPT_OK)); EXPECT_EQ(pScanMonitor->InitScanMonitor(), true); } void InitScanMonitorFailTest() { EXPECT_CALL(WifiSupplicantHalInterface::GetInstance(), RegisterSupplicantEventCallback(_)) .WillRepeatedly(Return(WIFI_IDL_OPT_FAILED)); EXPECT_EQ(pScanMonitor->InitScanMonitor(), false); } void ReceiveScanEventFromIdlTest() { pScanMonitor->ReceiveScanEventFromIdl(0); } void ProcessReceiveScanEventTest1() { pScanMonitor->ProcessReceiveScanEvent(SINGLE_SCAN_OVER_OK); } void ProcessReceiveScanEventTest2() { pScanMonitor->ProcessReceiveScanEvent(SINGLE_SCAN_FAILED); } void ProcessReceiveScanEventTest3() { pScanMonitor->ProcessReceiveScanEvent(PNO_SCAN_OVER_OK); } void ProcessReceiveScanEventTest4() { pScanMonitor->ProcessReceiveScanEvent(WPA_CB_CONNECTED); } void SendScanInfoEventTest() { pScanMonitor->SendScanInfoEvent(); } void SendPnoScanInfoEventTest() { pScanMonitor->SendPnoScanInfoEvent(); } void SendScanFailedEventTest() { pScanMonitor->SendScanFailedEvent(); } }; HWTEST_F(ScanMonitorTest, InitScanMonitorSuccessTest, TestSize.Level1) { InitScanMonitorSuccessTest(); } HWTEST_F(ScanMonitorTest, InitScanMonitorFailTest, TestSize.Level1) { InitScanMonitorFailTest(); } HWTEST_F(ScanMonitorTest, ReceiveScanEventFromIdlTest, TestSize.Level1) { ReceiveScanEventFromIdlTest(); } HWTEST_F(ScanMonitorTest, ProcessReceiveScanEventTest1, TestSize.Level1) { ProcessReceiveScanEventTest1(); } HWTEST_F(ScanMonitorTest, ProcessReceiveScanEventTest2, TestSize.Level1) { ProcessReceiveScanEventTest2(); } HWTEST_F(ScanMonitorTest, ProcessReceiveScanEventTest3, TestSize.Level1) { ProcessReceiveScanEventTest3(); } HWTEST_F(ScanMonitorTest, ProcessReceiveScanEventTest4, TestSize.Level1) { ProcessReceiveScanEventTest4(); } HWTEST_F(ScanMonitorTest, SendScanInfoEventTest, TestSize.Level1) { SendScanInfoEventTest(); } HWTEST_F(ScanMonitorTest, SendPnoScanInfoEventTest, TestSize.Level1) { SendPnoScanInfoEventTest(); } HWTEST_F(ScanMonitorTest, SendScanFailedEventTest, TestSize.Level1) { SendScanFailedEventTest(); } } // namespace Wifi } // namespace OHOS
26.325
100
0.732431
openharmony-gitee-mirror
b02c890f8b661b9926570d01bfb68d671c4d64e5
17
cpp
C++
misc/per.cpp
dk00/old-stuff
e1184684c85fe9bbd1ceba58b94d4da84c67784e
[ "Unlicense" ]
null
null
null
misc/per.cpp
dk00/old-stuff
e1184684c85fe9bbd1ceba58b94d4da84c67784e
[ "Unlicense" ]
null
null
null
misc/per.cpp
dk00/old-stuff
e1184684c85fe9bbd1ceba58b94d4da84c67784e
[ "Unlicense" ]
null
null
null
#include<cstdio>
8.5
16
0.764706
dk00
b02e04da92fbfad6cc2e8612b93c7612590bc135
279
cpp
C++
old/main.cpp
melkir/AwesomeScheduler
852a11dffc4996dc20bd0ef53143f3145cf37935
[ "MIT" ]
null
null
null
old/main.cpp
melkir/AwesomeScheduler
852a11dffc4996dc20bd0ef53143f3145cf37935
[ "MIT" ]
null
null
null
old/main.cpp
melkir/AwesomeScheduler
852a11dffc4996dc20bd0ef53143f3145cf37935
[ "MIT" ]
null
null
null
#include "Scheduler.h" #include "FCFSStrategy.h" int main() { FCFSStrategy fcfs; Scheduler scheduler(fcfs); scheduler.addProcess("A"); scheduler.addProcess("B"); scheduler.addProcess("C"); scheduler.addProcess("D"); scheduler.run(8); return 0; }
19.928571
30
0.65233
melkir
b0334f9f0fcecb768d17f3bedc232cca2613ad7a
1,558
cpp
C++
C++/Bipartite_Graph.cpp
ayushyado/HACKTOBERFEST2021-2
b63d568fd7f33023ca0b0dbd91325444c70c4d10
[ "MIT" ]
149
2021-09-17T17:11:06.000Z
2021-10-01T17:32:18.000Z
C++/Bipartite_Graph.cpp
ayushyado/HACKTOBERFEST2021-2
b63d568fd7f33023ca0b0dbd91325444c70c4d10
[ "MIT" ]
201
2021-10-30T20:40:01.000Z
2022-03-22T17:26:28.000Z
C++/Bipartite_Graph.cpp
ayushyado/HACKTOBERFEST2021-2
b63d568fd7f33023ca0b0dbd91325444c70c4d10
[ "MIT" ]
410
2021-09-27T03:13:55.000Z
2021-10-01T17:59:42.000Z
// Bipartite Graph // --------------- // You can divide all the vertices of graph in 2 sets // such that all edges of the graph are from set1 to set2 // Two Coloring /// How to flip colors between 1 and 2 ? // Use 3-color // 3-2 = 1 and 3-1 = 2 #include <iostream> #include <vector> using namespace std; bool dfs_helper(vector<int> graph[], int node, int visited[], int parent, int color){ // come to node and assign the color visited[node] = color; // 1 or 2 -- both means visited for(auto nbr: graph[node]){ // Many possibilities if(visited[nbr] == 0){ int subprob = dfs_helper(graph, nbr, visited, node, 3-color); if(subprob == false){ return false; } } else if(nbr != parent and color == visited[nbr]){ return false; } } return true; } // Yes or No, whether graph is Bipartite or Not bool dfs(vector<int> graph[], int N){ // Visited array states : // 0 -> Not visited // 1 -> Color 1 // 2 -> Color 2 int visited[N]; for(int i=0; i<=N; i++){ visited[i] = 0; } int color = 1; int ans = dfs_helper(graph,0,visited,-1, color); for(int i=0; i<N; i++){ cout << i << "->" << visited[i] << "\n"; } return ans; } int main(){ int N, M; cin >> N >> M; vector<int> graph[N]; while(M--){ int x, y; cin >> x >> y; graph[x].push_back(y); graph[y].push_back(x); } // By DFS, coloring the nodes at each step // Current node -> color 1 // Neighbouring nodes -> color 2 if(dfs(graph, N)){ cout << "Yes, its bipartite..\n"; } else{ cout << "No, its not bipartite..\n"; } }
19.475
85
0.587933
ayushyado
b034396b580e32fa8e069f41aeadf742429fa745
536
cpp
C++
CodeForces/Contest/386/G/code.cpp
sjj118/OI-Code
964ea6e799d14010f305c7e4aee269d860a781f7
[ "MIT" ]
null
null
null
CodeForces/Contest/386/G/code.cpp
sjj118/OI-Code
964ea6e799d14010f305c7e4aee269d860a781f7
[ "MIT" ]
null
null
null
CodeForces/Contest/386/G/code.cpp
sjj118/OI-Code
964ea6e799d14010f305c7e4aee269d860a781f7
[ "MIT" ]
null
null
null
#include<iostream> #include<cstdio> #define rg register #define rep(i,x,y) for(rg int i=(x);i<=(y);++i) #define per(i,x,y) for(rg int i=(x);i>=(y);--i) using namespace std; const int N=2e5+10; int n,t,k,a[N],v[N]; int main(){ scanf("%d%d%d",&n,&t,&k); rep(i,2,t+1)scanf("%d",&a[i]); int mink=0,maxk=n-t; a[1]=1; rep(i,2,t+1)mink+=max(0,a[i-1]-a[i]); rep(i,1,t+1)a[i]+=a[i-1]; if(k<mink||k>maxk){puts("-1");return 0;} rep(i,2,t+1){ int p=a[i-1]; per(j,a[i],a[i-1]+1){ printf("%d %d\n",j,p); if(k&&) } } return 0; }
20.615385
47
0.533582
sjj118
b035424cc48f2e0b6b73ed14e5fde247329448fb
645
cpp
C++
src/Text/StringUtils/Base64.cpp
tak2004/RadonFramework
e916627a54a80fac93778d5010c50c09b112259b
[ "Apache-2.0" ]
3
2015-09-15T06:57:50.000Z
2021-03-16T19:05:02.000Z
src/Text/StringUtils/Base64.cpp
tak2004/RadonFramework
e916627a54a80fac93778d5010c50c09b112259b
[ "Apache-2.0" ]
2
2015-09-26T12:41:10.000Z
2015-12-08T08:41:37.000Z
src/Text/StringUtils/Base64.cpp
tak2004/RadonFramework
e916627a54a80fac93778d5010c50c09b112259b
[ "Apache-2.0" ]
1
2015-07-09T02:56:34.000Z
2015-07-09T02:56:34.000Z
#include "RadonFramework/precompiled.hpp" #include "RadonFramework/Text/StringUtils/Base64.hpp" #include "RadonFramework/backend/stringcoders/modp_b64.h" namespace RadonFramework::Text::StringUtils { RF_Type::String Base64Converter::Encode(const RF_Type::String &Source) { std::string str = modp::b64_encode(Source.c_str(), Source.Length()); RF_Type::String result(str.c_str(), str.size()); return result; } RF_Type::String Base64Converter::Decode(const RF_Type::String &Source) { std::string str = modp::b64_decode(Source.c_str(), Source.Length()); RF_Type::String result(str.c_str(), str.size()); return result; } }
30.714286
72
0.733333
tak2004
b0355d27647a3289fe8743a41068b21b77dbed20
2,172
cpp
C++
svc_kube_vision_opencvplus/extras/ImageRegionGraph/flow/util/mr_cbir_create_index_shards.cpp
lucmichalski/kube-vproxy
c7cc0edbcbcd07a48f0fc48b9457eae693b76688
[ "Apache-2.0" ]
3
2018-06-22T07:55:51.000Z
2021-06-21T19:18:16.000Z
svc_kube_vision_opencvplus/extras/ImageRegionGraph/flow/util/mr_cbir_create_index_shards.cpp
lucmichalski/kube-vproxy
c7cc0edbcbcd07a48f0fc48b9457eae693b76688
[ "Apache-2.0" ]
null
null
null
svc_kube_vision_opencvplus/extras/ImageRegionGraph/flow/util/mr_cbir_create_index_shards.cpp
lucmichalski/kube-vproxy
c7cc0edbcbcd07a48f0fc48b9457eae693b76688
[ "Apache-2.0" ]
1
2020-11-04T04:56:50.000Z
2020-11-04T04:56:50.000Z
#include "iw/iw.pb.h" #include "iw/matching/cbir/full/full.h" #include "snap/deluge/deluge.h" #include "snap/google/base/hashutils.h" #include "snap/google/glog/logging.h" using namespace std; using namespace deluge; /* class Mapper : public HadoopPipes::Mapper { public: Mapper(HadoopPipes::TaskContext& context) { JobInfo conf(context); } void map(HadoopPipes::MapContext& context) { iw::ImageFeatures features; CHECK(features.ParseFromString(context.getInputValue())); context.emit(context.getInputKey(), features.SerializeAsString()); } }; */ class Reducer : public HadoopPipes::Reducer { public: Reducer(HadoopPipes::TaskContext& context) : counters_(context ,"iw"), profiler_(context) { JobInfo conf(context); int partition_num = conf.GetIntOrDie("mapred.task.partition"); int estimated_features_per_index = conf.GetIntOrDie("estimated_features_per_index"); flann_params_ = conf.GetProtoOrDie<cbir::FlannParams>("flann_params"); index.StartPreallocate(estimated_features_per_index); std::string work_dir = CleanupMaprPathFormat(conf.GetStringOrDie("mapred.work.output.dir")); index_output_path_ = StringPrintf("%s/index_part_%05d/", work_dir.c_str(), partition_num); } virtual void close() { index.Build(flann_params_); index.Save(index_output_path_); } void reduce(HadoopPipes::ReduceContext& context) { uint64 image_id = KeyToUint64(context.getInputKey()); iw::ImageFeatures features; CHECK(context.nextValue()); CHECK(features.ParseFromString(context.getInputValue())); index.AddPreallocated(image_id, features); CHECK(!context.nextValue()) << "This means your dataset includes duplicate images (hash to same key)"; //while (context.nextValue()){ // counters_.Increment("duplicated_keys"); //} } private: CounterGroup counters_; std::string index_output_path_; cbir::FeatureIndex index; cbir::FlannParams flann_params_; Profiler profiler_; }; int main(int argc, char *argv[]) { google::InstallFailureSignalHandler(); ReaderWriterJob<IdentityMapper, void, ModKeyPartitioner, Reducer> job; return HadoopPipes::runTask(job); }
30.166667
106
0.734807
lucmichalski
b03d8c19200709f779d7f4a6f31f71a3e537453e
1,300
cpp
C++
Vigenere/main.cpp
vbacaksiz/Encryption
ae2168f2fde738570f9aedbb4378600283d49046
[ "MIT" ]
null
null
null
Vigenere/main.cpp
vbacaksiz/Encryption
ae2168f2fde738570f9aedbb4378600283d49046
[ "MIT" ]
null
null
null
Vigenere/main.cpp
vbacaksiz/Encryption
ae2168f2fde738570f9aedbb4378600283d49046
[ "MIT" ]
null
null
null
#include <iostream> #include "vigenere.h" using namespace std; int main() { vigenere k; int choice; cout << "VIGENERE ENCRYPTION & DECRYPTION" << endl; cout << "------------------------------" << endl << endl; do { cout << "Press 1 For Encryption" << endl; cout << "Press 2 For Decryption" << endl; cout << "Press 0 For Exit Program" << endl; cin >> choice; switch (choice) { case 1: { cout << "Press Enter Text For Encryption" << endl; string text; cin >> text; cout << "Please Enter Key Text For Switching" << endl; string key; cin >> key; k.encryption(text, key); } break; case 2: { cout << "Press Enter Encrypted Text For Decryption" << endl; string encryptedText; cin >> encryptedText; cout << "Please Enter Key" << endl; string key; cin >> key; k.decryption(encryptedText, key); } break; case 0: break; default: cout << "Wrong Input!!" << endl << endl; break; } }while (choice != 0); return 0; }
25.490196
72
0.442308
vbacaksiz
b0402173786ab45d7b6d30e8add62bd93b85462d
4,907
cpp
C++
src/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.cpp
pebble2015/cpoi
6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6
[ "Apache-2.0" ]
null
null
null
src/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.cpp
pebble2015/cpoi
6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6
[ "Apache-2.0" ]
null
null
null
src/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.cpp
pebble2015/cpoi
6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6
[ "Apache-2.0" ]
null
null
null
// Generated from /POI/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java #include <org/apache/poi/hssf/extractor/EventBasedExcelExtractor.hpp> #include <java/io/IOException.hpp> #include <java/lang/IllegalStateException.hpp> #include <java/lang/NullPointerException.hpp> #include <java/lang/RuntimeException.hpp> #include <java/lang/String.hpp> #include <java/lang/StringBuffer.hpp> #include <java/lang/StringBuilder.hpp> #include <java/lang/Throwable.hpp> #include <org/apache/poi/POIDocument.hpp> #include <org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.hpp> #include <org/apache/poi/hssf/eventusermodel/HSSFEventFactory.hpp> #include <org/apache/poi/hssf/eventusermodel/HSSFRequest.hpp> #include <org/apache/poi/hssf/extractor/EventBasedExcelExtractor_TextListener.hpp> #include <org/apache/poi/poifs/filesystem/DirectoryNode.hpp> #include <org/apache/poi/poifs/filesystem/POIFSFileSystem.hpp> template<typename T> static T* npc(T* t) { if(!t) throw new ::java::lang::NullPointerException(); return t; } poi::hssf::extractor::EventBasedExcelExtractor::EventBasedExcelExtractor(const ::default_init_tag&) : super(*static_cast< ::default_init_tag* >(0)) { clinit(); } poi::hssf::extractor::EventBasedExcelExtractor::EventBasedExcelExtractor(::poi::poifs::filesystem::DirectoryNode* dir) : EventBasedExcelExtractor(*static_cast< ::default_init_tag* >(0)) { ctor(dir); } poi::hssf::extractor::EventBasedExcelExtractor::EventBasedExcelExtractor(::poi::poifs::filesystem::POIFSFileSystem* fs) : EventBasedExcelExtractor(*static_cast< ::default_init_tag* >(0)) { ctor(fs); } void poi::hssf::extractor::EventBasedExcelExtractor::init() { _includeSheetNames = true; _formulasNotResults = false; } void poi::hssf::extractor::EventBasedExcelExtractor::ctor(::poi::poifs::filesystem::DirectoryNode* dir) { super::ctor(static_cast< ::poi::POIDocument* >(nullptr)); init(); _dir = dir; } void poi::hssf::extractor::EventBasedExcelExtractor::ctor(::poi::poifs::filesystem::POIFSFileSystem* fs) { ctor(npc(fs)->getRoot()); super::setFilesystem(fs); } poi::hpsf::DocumentSummaryInformation* poi::hssf::extractor::EventBasedExcelExtractor::getDocSummaryInformation() { throw new ::java::lang::IllegalStateException(u"Metadata extraction not supported in streaming mode, please use ExcelExtractor"_j); } poi::hpsf::SummaryInformation* poi::hssf::extractor::EventBasedExcelExtractor::getSummaryInformation() { throw new ::java::lang::IllegalStateException(u"Metadata extraction not supported in streaming mode, please use ExcelExtractor"_j); } void poi::hssf::extractor::EventBasedExcelExtractor::setIncludeCellComments(bool includeComments) { throw new ::java::lang::IllegalStateException(u"Comment extraction not supported in streaming mode, please use ExcelExtractor"_j); } void poi::hssf::extractor::EventBasedExcelExtractor::setIncludeHeadersFooters(bool includeHeadersFooters) { throw new ::java::lang::IllegalStateException(u"Header/Footer extraction not supported in streaming mode, please use ExcelExtractor"_j); } void poi::hssf::extractor::EventBasedExcelExtractor::setIncludeSheetNames(bool includeSheetNames) { _includeSheetNames = includeSheetNames; } void poi::hssf::extractor::EventBasedExcelExtractor::setFormulasNotResults(bool formulasNotResults) { _formulasNotResults = formulasNotResults; } java::lang::String* poi::hssf::extractor::EventBasedExcelExtractor::getText() { ::java::lang::String* text = nullptr; try { auto tl = triggerExtraction(); text = npc(npc(tl)->_text)->toString(); if(!npc(text)->endsWith(u"\n"_j)) { text = ::java::lang::StringBuilder().append(text)->append(u"\n"_j)->toString(); } } catch (::java::io::IOException* e) { throw new ::java::lang::RuntimeException(static_cast< ::java::lang::Throwable* >(e)); } return text; } poi::hssf::extractor::EventBasedExcelExtractor_TextListener* poi::hssf::extractor::EventBasedExcelExtractor::triggerExtraction() /* throws(IOException) */ { auto tl = new EventBasedExcelExtractor_TextListener(this); auto ft = new ::poi::hssf::eventusermodel::FormatTrackingHSSFListener(tl); npc(tl)->_ft = ft; auto factory = new ::poi::hssf::eventusermodel::HSSFEventFactory(); auto request = new ::poi::hssf::eventusermodel::HSSFRequest(); npc(request)->addListenerForAllRecords(ft); npc(factory)->processWorkbookEvents(request, _dir); return tl; } extern java::lang::Class *class_(const char16_t *c, int n); java::lang::Class* poi::hssf::extractor::EventBasedExcelExtractor::class_() { static ::java::lang::Class* c = ::class_(u"org.apache.poi.hssf.extractor.EventBasedExcelExtractor", 54); return c; } java::lang::Class* poi::hssf::extractor::EventBasedExcelExtractor::getClass0() { return class_(); }
36.619403
154
0.745058
pebble2015
b0406195430797ea217d148983fe972a1779f69a
2,304
hpp
C++
include/ocpp1_6/messages/GetConfiguration.hpp
EVerest/libocpp
e2378e4fcef88e4be82b057626086c899a186b14
[ "Apache-2.0" ]
9
2022-01-16T05:13:16.000Z
2022-03-18T22:15:16.000Z
include/ocpp1_6/messages/GetConfiguration.hpp
EVerest/libocpp
e2378e4fcef88e4be82b057626086c899a186b14
[ "Apache-2.0" ]
null
null
null
include/ocpp1_6/messages/GetConfiguration.hpp
EVerest/libocpp
e2378e4fcef88e4be82b057626086c899a186b14
[ "Apache-2.0" ]
3
2022-01-20T04:51:01.000Z
2022-03-13T07:16:49.000Z
// SPDX-License-Identifier: Apache-2.0 // Copyright 2020 - 2022 Pionix GmbH and Contributors to EVerest #ifndef OCPP1_6_GETCONFIGURATION_HPP #define OCPP1_6_GETCONFIGURATION_HPP #include <boost/optional.hpp> #include <ocpp1_6/ocpp_types.hpp> #include <ocpp1_6/types.hpp> namespace ocpp1_6 { /// \brief Contains a OCPP 1.6 GetConfiguration message struct GetConfigurationRequest : public Message { boost::optional<std::vector<CiString50Type>> key; /// \brief Provides the type of this GetConfiguration message as a human readable string /// \returns the message type as a human readable string std::string get_type() const; }; /// \brief Conversion from a given GetConfigurationRequest \p k to a given json object \p j void to_json(json& j, const GetConfigurationRequest& k); /// \brief Conversion from a given json object \p j to a given GetConfigurationRequest \p k void from_json(const json& j, GetConfigurationRequest& k); /// \brief Writes the string representation of the given GetConfigurationRequest \p k to the given output stream \p os /// \returns an output stream with the GetConfigurationRequest written to std::ostream& operator<<(std::ostream& os, const GetConfigurationRequest& k); /// \brief Contains a OCPP 1.6 GetConfigurationResponse message struct GetConfigurationResponse : public Message { boost::optional<std::vector<KeyValue>> configurationKey; boost::optional<std::vector<CiString50Type>> unknownKey; /// \brief Provides the type of this GetConfigurationResponse message as a human readable string /// \returns the message type as a human readable string std::string get_type() const; }; /// \brief Conversion from a given GetConfigurationResponse \p k to a given json object \p j void to_json(json& j, const GetConfigurationResponse& k); /// \brief Conversion from a given json object \p j to a given GetConfigurationResponse \p k void from_json(const json& j, GetConfigurationResponse& k); /// \brief Writes the string representation of the given GetConfigurationResponse \p k to the given output stream \p os /// \returns an output stream with the GetConfigurationResponse written to std::ostream& operator<<(std::ostream& os, const GetConfigurationResponse& k); } // namespace ocpp1_6 #endif // OCPP1_6_GETCONFIGURATION_HPP
41.890909
119
0.769097
EVerest
b04080ac7f0f9724f0155e4a6983d13609cc17c4
17,549
cpp
C++
EntityLib/Core/GPUEntityMgr.cpp
Calvin-Ruiz/LaserBombon
404bea5b95393b3d011902a0d1458bd86efdc5a5
[ "MIT" ]
null
null
null
EntityLib/Core/GPUEntityMgr.cpp
Calvin-Ruiz/LaserBombon
404bea5b95393b3d011902a0d1458bd86efdc5a5
[ "MIT" ]
null
null
null
EntityLib/Core/GPUEntityMgr.cpp
Calvin-Ruiz/LaserBombon
404bea5b95393b3d011902a0d1458bd86efdc5a5
[ "MIT" ]
null
null
null
/* ** EPITECH PROJECT, 2020 ** Vulkan-Engine ** File description: ** GPUEntityMgr.cpp */ #include "EntityCore/Core/VulkanMgr.hpp" #include "EntityCore/Core/BufferMgr.hpp" #include "EntityCore/Resource/SetMgr.hpp" #include "EntityCore/Resource/Set.hpp" #include "EntityCore/Resource/PipelineLayout.hpp" #include "EntityCore/Resource/ComputePipeline.hpp" #include "EntityCore/Resource/SyncEvent.hpp" #include "EntityLib.hpp" #include "GPUEntityMgr.hpp" #include <cstring> #include <chrono> GPUEntityMgr::GPUEntityMgr(std::shared_ptr<EntityLib> master) : vkmgr(*VulkanMgr::instance), localBuffer(master->getLocalBuffer()), master(master) { entityMgr = std::make_unique<BufferMgr>(vkmgr, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0, sizeof(EntityData) * END_ALL); entityMgr->setName("Entity datas"); vertexMgr = std::make_unique<BufferMgr>(vkmgr, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 0, sizeof(EntityVertexGroup) * END_ALL); vertexMgr->setName("Entity vertices"); readbackMgr = std::make_unique<BufferMgr>(vkmgr, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, VK_MEMORY_PROPERTY_HOST_CACHED_BIT, sizeof(EntityState) * END_ALL); readbackMgr->setName("ReadBack buffer"); readbackBuffer = readbackMgr->acquireBuffer(sizeof(EntityState) * END_ALL); gpuEntities = entityMgr->acquireBuffer(sizeof(EntityData) * END_ALL); gpuVertices = vertexMgr->acquireBuffer(sizeof(EntityVertexGroup) * END_ALL); readback = (EntityState *) readbackMgr->getPtr(readbackBuffer); computeQueueFamily = vkmgr.acquireQueue(computeQueue, VulkanMgr::QueueType::COMPUTE, "GPUEntityMgr"); if (computeQueueFamily == nullptr) { vkmgr.putLog("GPU not supported (expected 1 graphic and 1 compute queue)", LogType::ERROR); if (master->graphicQueueFamily->compute) { vkmgr.putLog("Unique graphic queue support compute operation, using it (may cause random crash)", LogType::WARNING); computeQueueFamily = master->graphicQueueFamily; computeQueue = master->graphicQueue; } } // if (vkmgr.getComputeQueues().size() > 0) { // computeQueue = vkmgr.getComputeQueues()[0]; // } else if (vkmgr.getGraphicQueues().size() > 1) { // vkmgr.putLog("No dedicated compute queue found, assume graphic queue support compute", LogType::WARNING); // computeQueue = vkmgr.getGraphicQueues()[1]; // } else { // vkmgr.putLog("No dedicated compute queue found, assume graphic queue support compute", LogType::WARNING); // vkmgr.putLog("Only one graphic & compute queue is available", LogType::WARNING); // vkmgr.putLog("Queue submission may conflict", LogType::WARNING); // computeQueue = vkmgr.getGraphicQueues()[0]; // } syncExt = new SyncEvent[2] {{&vkmgr, true}, {&vkmgr, true}}; syncInt = new SyncEvent[4] {{&vkmgr}, {&vkmgr}, {&vkmgr}, {&vkmgr}}; syncExt[0].bufferBarrier(gpuEntities, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR, VK_PIPELINE_STAGE_2_COPY_BIT_KHR, VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR | VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR, VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR); syncExt[1].bufferBarrier(gpuEntities, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR, VK_PIPELINE_STAGE_2_COPY_BIT_KHR, VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR | VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR, VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR); syncInt[0].bufferBarrier(gpuEntities, VK_PIPELINE_STAGE_2_COPY_BIT_KHR, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR, VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR, VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR); syncInt[1].bufferBarrier(gpuEntities, VK_PIPELINE_STAGE_2_COPY_BIT_KHR, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR, VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR, VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR); syncInt[2].bufferBarrier(gpuEntities, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR, VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR, VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR); syncInt[3].bufferBarrier(gpuEntities, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR, VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR, VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR); for (int i = 0; i < 2; ++i) syncExt[i].build(); for (int i = 0; i < 4; ++i) syncInt[i].build(); syncInt[0].combineDstDependencies(syncInt[3]); syncInt[1].combineDstDependencies(syncInt[2]); VkCommandPoolCreateInfo poolInfo {VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, nullptr, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT | VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, computeQueueFamily->id}; vkCreateCommandPool(vkmgr.refDevice, &poolInfo, nullptr, &transferPool); poolInfo.flags = 0; vkCreateCommandPool(vkmgr.refDevice, &poolInfo, nullptr, &computePool); VkCommandBufferAllocateInfo allocInfo {VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, nullptr, transferPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY, 1}; vkAllocateCommandBuffers(vkmgr.refDevice, &allocInfo, cmds); vkAllocateCommandBuffers(vkmgr.refDevice, &allocInfo, cmds + 2); allocInfo.commandPool = computePool; vkAllocateCommandBuffers(vkmgr.refDevice, &allocInfo, cmds + 1); vkAllocateCommandBuffers(vkmgr.refDevice, &allocInfo, cmds + 3); buildCompute(); VkFenceCreateInfo fenceInfo {VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, nullptr, VK_FENCE_CREATE_SIGNALED_BIT}; vkCreateFence(vkmgr.refDevice, &fenceInfo, nullptr, fences); vkCreateFence(vkmgr.refDevice, &fenceInfo, nullptr, fences + 1); } GPUEntityMgr::~GPUEntityMgr() { stop(); vkQueueWaitIdle(computeQueue); vkDestroyCommandPool(vkmgr.refDevice, computePool, nullptr); vkDestroyCommandPool(vkmgr.refDevice, transferPool, nullptr); localBuffer.releaseBuffer(entityPushBuffer); delete[] syncExt; delete[] syncInt; vkDestroyFence(vkmgr.refDevice, fences[0], nullptr); vkDestroyFence(vkmgr.refDevice, fences[1], nullptr); } void GPUEntityMgr::stop() { if (alive) { alive = false; active = true; updater->join(); } } void GPUEntityMgr::init() { entityPushBuffer = localBuffer.acquireBuffer(sizeof(EntityData) * END_ALL); entityPush = (EntityData *) localBuffer.getPtr(entityPushBuffer); } void GPUEntityMgr::buildCompute() { SyncEvent tmpSc; tmpSc.bufferBarrier(readbackBuffer, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR, VK_PIPELINE_STAGE_2_HOST_BIT_KHR, VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR, VK_ACCESS_2_HOST_WRITE_BIT_KHR); tmpSc.build(); setMgr = std::make_unique<SetMgr>(vkmgr, 2, 0, 0, 3); updatePLayout = std::make_unique<PipelineLayout>(vkmgr); collidePLayout = std::make_unique<PipelineLayout>(vkmgr); updatePLayout->setStorageBufferLocation(VK_SHADER_STAGE_COMPUTE_BIT, 0); updatePLayout->buildLayout(); updatePLayout->setStorageBufferLocation(VK_SHADER_STAGE_COMPUTE_BIT, 0); updatePLayout->setStorageBufferLocation(VK_SHADER_STAGE_COMPUTE_BIT, 1); updatePLayout->buildLayout(); updatePLayout->build(); collidePLayout->setGlobalPipelineLayout(updatePLayout.get(), 0); collidePLayout->build(); globalSet = std::make_unique<Set>(vkmgr, *setMgr, updatePLayout.get(), 0); updateSet = std::make_unique<Set>(vkmgr, *setMgr, updatePLayout.get(), 1); globalSet->bindStorageBuffer(gpuEntities, 0, sizeof(EntityData) * END_ALL); updateSet->bindStorageBuffer(gpuVertices, 0, sizeof(EntityVertexGroup) * END_ALL); updateSet->bindStorageBuffer(readbackBuffer, 1, sizeof(EntityState) * END_ALL); ComputePipeline::setShaderDir("./shader/"); updatePipeline = std::make_unique<ComputePipeline>(vkmgr, updatePLayout.get()); updatePipeline->bindShader("update.comp.spv"); updatePipeline->build(); collidePipeline = std::make_unique<ComputePipeline>(vkmgr, collidePLayout.get(), VK_PIPELINE_CREATE_DISPATCH_BASE); collidePipeline->bindShader("collide.comp.spv"); collidePipeline->build(); pcollidePipeline = std::make_unique<ComputePipeline>(vkmgr, collidePLayout.get(), VK_PIPELINE_CREATE_DISPATCH_BASE); pcollidePipeline->bindShader("pcollide.comp.spv"); pcollidePipeline->build(); VkCommandBufferBeginInfo tmp {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, nullptr, 0, nullptr}; for (int i = 0; i < 2; ++i) { cmd = cmds[i * 2 | 1]; vkBeginCommandBuffer(cmd, &tmp); syncInt[i].multiDstDependency(cmd); // Transfer write completion and compute write completion before reading vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pcollidePipeline->get()); vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, collidePLayout->getPipelineLayout(), 0, 1, globalSet->get(), 0, nullptr); vkCmdDispatchBase(cmd, BEG_PLAYER/2, 1, 0, 1, 1, 1); vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, collidePipeline->get()); vkCmdDispatchBase(cmd, BEG_CANDY/2, 0, 0, 256, 1, 1); syncInt[2].placeBarrier(cmd); // Compute read after previous write completion vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, updatePipeline->get()); vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, updatePLayout->getPipelineLayout(), 1, 1, updateSet->get(), 0, nullptr); vkCmdDispatch(cmd, 2, 1, 1); syncInt[i].resetDependency(cmd, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR); syncInt[3 - i].resetDependency(cmd, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR); syncExt[!i].resetDependency(cmd, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR); syncExt[i].srcDependency(cmd); // Transfer write after tmpSc.placeBarrier(cmd); // Host sync syncInt[i | 2].srcDependency(cmd); // Compute write after vkEndCommandBuffer(cmd); } } void GPUEntityMgr::resetAll() { psidx = BEG_PLAYER_SHOOT; csidx = BEG_CANDY_SHOOT; bidx = BEG_BONUS; cidx = BEG_CANDY; if (vertexInitialized) { for (int i = 0; i < END_ALL; ++i) { attachment[i].alive = false; entityPush[i].health = -1; entityPush[i].aliveNow = VK_TRUE; entityPush[i].newlyInserted = VK_FALSE; } } else { for (int i = 0; i < END_ALL; ++i) entityPush[i] = EntityData({0, 0, 0, 0, -1, -1, 0.01, 0.01, 0, 0, 0, 0, VK_FALSE, VK_TRUE}); } // Record a transfer command which reset everything cmd = cmds[frameparity << 1]; vkWaitForFences(vkmgr.refDevice, 1, fences + frameparity, VK_TRUE, UINT32_MAX); vkResetFences(vkmgr.refDevice, 1, fences + frameparity); vkBeginCommandBuffer(cmd, &begInfo); VkBufferCopy tmp = {(VkDeviceSize) entityPushBuffer.offset, 0, END_ALL*sizeof(EntityData)}; vkCmdCopyBuffer(cmd, entityPushBuffer.buffer, gpuEntities.buffer, 1, &tmp); syncInt[frameparity].srcDependency(cmd); if (initDep) { syncInt[3].srcDependency(cmd); // This could fail because the compute stage is unused initDep = false; } vkEndCommandBuffer(cmd); vkQueueSubmit(computeQueue, 1, sinfo + frameparity, fences[frameparity]); frameparity = !frameparity; regionsBase.clear(); if (!vertexInitialized) { vertexInitialized = true; vkQueueWaitIdle(computeQueue); resetAll(); vkQueueWaitIdle(computeQueue); } } void GPUEntityMgr::start(void (*update)(void *, GPUEntityMgr &), void (*updatePlayer)(void *, GPUEntityMgr &), void *data) { if (!alive) { alive = true; updater = std::make_unique<std::thread>(&GPUEntityMgr::mainloop, this, update, updatePlayer, data); } } void GPUEntityMgr::mainloop(void (*update)(void *, GPUEntityMgr &), void (*updatePlayer)(void *, GPUEntityMgr &), void *data) { resetAll(); auto delay = std::chrono::duration<int, std::ratio<1,1000000>>(1000000/100); auto delayOverride = std::chrono::duration<int, std::ratio<1,1000000>>(1000000/1000); bool prevLimit = limit; auto clock = std::chrono::system_clock::now(); int cnt = 0; while (alive) { // vkmgr.putLog(std::string("Compute Cycle ") + std::to_string(cnt++), LogType::INFO); while (!active) { std::this_thread::sleep_for(std::chrono::microseconds(400)); clock = std::chrono::system_clock::now(); } cmd = cmds[frameparity << 1]; regions.resize(regionsBase.size()); memcpy(regions.data(), regionsBase.data(), regionsBase.size() * sizeof(VkBufferCopy)); lastPush = 0; vkWaitForFences(vkmgr.refDevice, 1, fences + frameparity, VK_TRUE, UINT32_MAX); vkResetFences(vkmgr.refDevice, 1, fences + frameparity); vkBeginCommandBuffer(cmd, &begInfo); syncExt[!frameparity].dstDependency(cmd); update(data, *this); // Update game // Record transfer due to local event if (prevLimit != limit) { clock = std::chrono::system_clock::now(); prevLimit = limit; } if (limit) { clock += delay; std::this_thread::sleep_until(clock); } else { clock += delayOverride; std::this_thread::sleep_until(clock); // Don't go over 1000 fps (x10 speed) } // while (!syncExt[!frameparity].isSet()) // std::this_thread::sleep_for(std::chrono::microseconds(400)); updateChanges(); // Read back changes updatePlayer(data, *this); // Update player shield // Record transfer due to GPU event // Write player changes vkCmdCopyBuffer(cmd, entityPushBuffer.buffer, gpuEntities.buffer, regions.size(), regions.data()); syncInt[frameparity].srcDependency(cmd); vkEndCommandBuffer(cmd); vkQueueSubmit(computeQueue, 1, sinfo + frameparity, fences[frameparity]); frameparity = !frameparity; } pidx = 0; } void GPUEntityMgr::updateChanges() { readbackMgr->invalidate(readbackBuffer); nbDead = 0; for (int i = 0; i < END_ALL; ++i) { switch (attachment[i].alive) { case 2: attachment[i].alive = 1; break; case 1: if (readback[i].health < 0) { // vkmgr.putLog("Destroyed " + std::to_string(i), LogType::INFO); attachment[i].alive = false; deadFlags[nbDead].first = i; deadFlags[nbDead++].second = attachment[i].flag; } break; default:; } } psidx = BEG_PLAYER_SHOOT; csidx = BEG_CANDY_SHOOT; bidx = BEG_BONUS; cidx = BEG_CANDY; } EntityData &GPUEntityMgr::pushPlayerShoot(unsigned char flag) { while (psidx < BEG_CANDY_SHOOT) { if (attachment[psidx].alive) { ++psidx; continue; } attachment[psidx].flag = flag; attachment[psidx].alive = 2; pushRegion(psidx); return entityPush[psidx++]; } vkmgr.putLog("Failed to insert player shoot", LogType::WARNING); return deft; } EntityData &GPUEntityMgr::pushCandyShoot(unsigned char flag) { while (csidx < BEG_BONUS) { if (attachment[csidx].alive) { ++csidx; continue; } attachment[csidx].flag = flag; attachment[csidx].alive = 2; pushRegion(csidx); return entityPush[csidx++]; } vkmgr.putLog("Failed to insert candy shoot", LogType::WARNING); return deft; } EntityData &GPUEntityMgr::pushBonus(unsigned char flag) { while (bidx < BEG_CANDY) { if (attachment[bidx].alive) { ++bidx; continue; } attachment[bidx].flag = flag; attachment[bidx].alive = 2; pushRegion(bidx); return entityPush[bidx++]; } vkmgr.putLog("Failed to insert bonus or special candy shoot", LogType::WARNING); return deft; } EntityData &GPUEntityMgr::pushCandy(unsigned char flag) { while (cidx < END_ALL) { if (attachment[cidx].alive) { ++cidx; continue; } attachment[cidx].flag = flag; attachment[cidx].alive = 2; pushRegion(cidx); return entityPush[cidx++]; } vkmgr.putLog("Failed to insert candy", LogType::WARNING); return deft; } EntityData &GPUEntityMgr::pushPlayer(short idx, bool revive) { if (!(pidx & (1 << idx))) { pidx |= (1 << idx); idx |= BEG_PLAYER; regionsBase.push_back({entityPushBuffer.offset + sizeof(EntityData) * idx, sizeof(EntityData) * idx, 5 * sizeof(float)}); regions.push_back({entityPushBuffer.offset + sizeof(EntityData) * idx, sizeof(EntityData) * idx, sizeof(EntityData)}); } idx |= BEG_PLAYER; if (revive) { regions.push_back({entityPushBuffer.offset + sizeof(EntityData) * idx + offsetof(EntityData, aliveNow), sizeof(EntityData) * idx + offsetof(EntityData, aliveNow), sizeof(VkBool32) * 2}); } return entityPush[idx]; } EntityState &GPUEntityMgr::readPlayer(short idx) { return readback[idx | BEG_PLAYER]; } EntityState &GPUEntityMgr::readEntity(short idx) { return readback[idx]; } void GPUEntityMgr::pushRegion(short idx) { if (lastPush + 1 == idx) { regions.back().size += sizeof(EntityData); } else { regions.push_back({entityPushBuffer.offset + idx * sizeof(EntityData), idx * sizeof(EntityData), sizeof(EntityData)}); } lastPush = idx; }
44.997436
240
0.691606
Calvin-Ruiz
b0429a36809a29c3971aff9087508d233c12ffe0
6,861
cpp
C++
cgame/fx_proton.cpp
kugelrund/Elite-Reinforce
a2fe0c0480ff2d9cdc241b9e5416ee7f298f00ca
[ "DOC" ]
10
2017-07-04T14:38:48.000Z
2022-03-08T22:46:39.000Z
cgame/fx_proton.cpp
UberGames/SP-Mod-Source-Code
04e0e618d1ee57a2919f1a852a688c03b1aa155d
[ "DOC" ]
null
null
null
cgame/fx_proton.cpp
UberGames/SP-Mod-Source-Code
04e0e618d1ee57a2919f1a852a688c03b1aa155d
[ "DOC" ]
2
2017-04-23T18:24:44.000Z
2021-11-19T23:27:03.000Z
#include "cg_local.h" #include "FX_Public.h" /* ------------------------- ------------------------- // PROTON GUN ------------------------- ------------------------- */ /* ------------------------- FX_ProtonShockRing ------------------------- */ void FX_ProtonShockRing( vec3_t start, vec3_t end ) { vec3_t shot_dir, org; // Faint shock ring created by shooting..looks like start and end got switched around...sigh VectorSubtract( start, end, shot_dir ); VectorNormalize( shot_dir ); VectorMA( end, 8, shot_dir, org ); FX_AddSprite( start, NULL, NULL, 64.0f, -128.0f, 1.0f, 1.0, 0.0, 0.0, 200, cgs.media.rippleShader ); } /* ------------------------- FX_ProtonShot ------------------------- */ void FX_ProtonShot( vec3_t start, vec3_t end ) { float length, repeat; vec3_t dir; VectorSubtract( end, start, dir ); length = VectorNormalize( dir ); // thin inner line FX_AddLine( end, start, 1.0f, 2.0f, -3.0f, 1.0f, 0.0f, 350.0f, cgs.media.whiteLaserShader ); // thick outer glow FX_AddLine( end, start, 1.0f, 4.0f, 0.0f, 0.4f, 0.0f, 250.0f, cgs.media.whiteLaserShader ); // concentric rings FXCylinder *fx = FX_AddCylinder( start, dir, length, 0, 1.0f, 3.0f, 1.0f, 2.0f, 0.4f, 0.0f, 300, cgs.media.protonBeamShader, 0.5f ); FX_AddSprite( end, NULL, NULL, 5, 0, 1, 0, 0, 0, 400, cgs.media.waterDropShader ); FX_AddSprite( end, NULL, NULL, 3, 0, 1, 0, 0, 0, 400, cgs.media.waterDropShader ); FX_AddSprite( end, NULL, NULL, 2, 0, 1, 0, 0, 0, 400, cgs.media.waterDropShader ); FX_AddSprite( end, NULL, NULL, 1, 0, 1, 0, 0, 0, 400, cgs.media.waterDropShader ); if( fx ) { repeat = length / 12.0f; fx->SetFlags( FXF_WRAP | FXF_STRETCH | FXF_NON_LINEAR_FADE ); fx->SetSTScale( repeat ); } // FX_ProtonShockRing( start, end ); } /* ------------------------- FX_ProtonAltShot ------------------------- */ void FX_ProtonAltShot( vec3_t start, vec3_t end ) { float length = 20; vec3_t white = {1.0,1.0,1.0}; vec3_t dir; FX_AddLine( start, end, 1.0f, 4.0f, -8.0f, 1.0f, 1.0f, white, white, 325.0f, cgs.media.whiteLaserShader ); FX_AddLine( start, end, 1.0f, 2.0f, -1.0f, 1.0f, 0.2f, white, white, 300.0f, cgs.media.whiteLaserShader ); VectorSubtract( end, start, dir ); length = VectorNormalize( dir ); FXCylinder *fx = FX_AddCylinder( start, dir, length, 0, 1, 3, 1, 3, 0.6f, 0.1f, 500 , cgs.media.protonAltBeamShader, 0.2f ); if( fx ) { fx->SetFlags( FXF_WRAP | FXF_STRETCH ); fx->SetSTScale( length / 56.0f ); } fx = FX_AddCylinder( start, dir, length, 0, 2, 5, 2, 5, 0.3f, 0.0, 600, cgs.media.protonAltBeamShader, 0.5f ); if( fx ) { fx->SetFlags( FXF_WRAP | FXF_STRETCH ); fx->SetSTScale( length / 128.0f ); } } /* ------------------------- FX_ProtonExplosion ------------------------- */ void FX_ProtonExplosion( vec3_t end, vec3_t dir ) { vec3_t org; // Move me away from the wall a bit so that I don't z-buffer into it VectorMA( end, 0.5, dir, org ); // Expanding rings // FX_AddQuad( org, dir, NULL, NULL, 1, 24, 0.8f, 0.2f, random() * 360, 360, 0, 400, cgs.media.protonRingShader ); // FX_AddQuad( org, dir, NULL, NULL, 1, 60, 0.8f, 0.2f, random() * 360, -360, 0, 300, cgs.media.protonRingShader ); // Impact effect // FX_AddQuad( org, dir, NULL, NULL, 7, 35, 1.0, 0.0, random() * 360, 0, 0, 500, cgs.media.blueParticleShader ); // FX_AddQuad( org, dir, NULL, NULL, 5, 25, 1.0, 0.0, random() * 360, 0, 0, 420, cgs.media.ltblueParticleShader ); // Test of using the ripple shader...... FX_AddQuad( org, dir, NULL, NULL, 13, 16, 1.0f, 0.1f, random() * 360, 360, 0, 400, cgs.media.rippleShader ); FX_AddQuad( org, dir, NULL, NULL, 9, 20, 0.8f, 0.1f, random() * 360, -360, 0, 300, cgs.media.rippleShader ); FX_AddQuad( org, dir, NULL, NULL, 20, 8, 1.0f, 0.1f, random() * 360, 0, 0, 300, cgs.media.rippleShader ); FX_AddQuad( org, dir, NULL, NULL, 30, -20, 1.0f, 0.8f, random() * 360, 0, 0, 300, cgs.media.waterDropShader ); /* localEntity_t *le; FXTrail *particle; vec3_t direction, new_org; vec3_t velocity = { 0, 0, 8 }; float scale, dscale; int i, numSparks; //Sparks numSparks = 4 + (random() * 4.0f); for ( i = 0; i < numSparks; i++ ) { scale = 0.25f + (random() * 2.0f); dscale = -scale * 0.5f; particle = FX_AddTrail( origin, NULL, NULL, 16.0f, -32.0f, scale, -scale, 1.0f, 1.0f, 0.25f, 2000.0f, cgs.media.sparkShader, rand() & FXF_BOUNCE ); if ( particle == NULL ) return; FXE_Spray( normal, 200, 50, 0.5f, 512, (FXPrimitive *) particle ); } // Smoke puff VectorMA( origin, 8, normal, new_org ); FX_AddSprite( new_org, velocity, NULL, 16.0f, 16.0f, 1.0f, 0.0f, random()*45.0f, 0.0f, 1000.0f, cgs.media.steamShader ); scale = 0.4f + ( random() * 0.2f); //Orient the explosions to face the camera VectorSubtract( cg.refdef.vieworg, origin, direction ); VectorNormalize( direction ); // Add in the explosion and tag it with a light le = CG_MakeExplosion( origin, direction, cgs.media.explosionModel, 6, cgs.media.electricalExplosionSlowShader, 475, qfalse, scale ); le->light = 150; le->refEntity.renderfx |= RF_NOSHADOW; VectorSet( le->lightColor, 0.8f, 0.8f, 1.0f ); // Scorch mark CG_ImpactMark( cgs.media.compressionMarkShader, origin, normal, random()*360, 1,1,1,1, qfalse, 4, qfalse ); CG_ExplosionEffects( origin, 1.0f, 150 ); */ } /* ------------------------- FX_ProtonHit ------------------------- */ void FX_ProtonHit( vec3_t origin ) { FX_AddSprite( origin, NULL, NULL, 32.0f, -128.0f, 1.0f, 1.0f, random()*360, 0.0f, 250.0f, cgs.media.prifleImpactShader ); } /* ------------------------- FX_ProtonAltMiss ------------------------- */ void FX_ProtonAltMiss( vec3_t origin, vec3_t normal ) { vec3_t new_org; vec3_t velocity; float scale, dscale; int i; // Smoke puffs for ( i = 0; i < 8; i++ ) { scale = random() * 12.0f + 4.0f; dscale = random() * 12.0f + 8.0f; VectorMA( origin, random() * 8.0f, normal, new_org ); velocity[0] = normal[0] * crandom() * 24.0f; velocity[1] = normal[1] * crandom() * 24.0f; velocity[2] = normal[2] * ( random() * 24.0f + 8.0f ) + 8.0f; // move mostly up FX_AddSprite( new_org, velocity, NULL, scale, dscale, random() * 0.5f + 0.5f, 0.0f, random() * 45.0f, 0.0f, 800 + random() * 300.0f, cgs.media.steamShader ); } // Scorch mark CG_ImpactMark( cgs.media.bulletmarksShader, origin, normal, random()*360, 1,1,1,1, qfalse, 6, qfalse ); // FX_ProtonHit( origin ); CG_ExplosionEffects( origin, 1.0f, 150 ); }
22.718543
134
0.571491
kugelrund
b04338d5b534abf70639507ffe72bef388bd6b10
2,012
cpp
C++
gtsam/inference/IndexFactor.cpp
sdmiller/gtsam_pcl
1e607bd75090d35e325a8fb37a6c5afe630f1207
[ "BSD-3-Clause" ]
11
2015-02-04T16:41:47.000Z
2021-12-10T07:02:44.000Z
gtsam/inference/IndexFactor.cpp
sdmiller/gtsam_pcl
1e607bd75090d35e325a8fb37a6c5afe630f1207
[ "BSD-3-Clause" ]
null
null
null
gtsam/inference/IndexFactor.cpp
sdmiller/gtsam_pcl
1e607bd75090d35e325a8fb37a6c5afe630f1207
[ "BSD-3-Clause" ]
6
2015-09-10T12:06:08.000Z
2021-12-10T07:02:48.000Z
/* ---------------------------------------------------------------------------- * GTSAM Copyright 2010, Georgia Tech Research Corporation, * Atlanta, Georgia 30332-0415 * All Rights Reserved * Authors: Frank Dellaert, et al. (see THANKS for the full author list) * See LICENSE for the license information * -------------------------------------------------------------------------- */ /** * @file IndexFactor.cpp * @author Richard Roberts * @date Oct 17, 2010 */ #include <gtsam/inference/IndexFactor.h> #include <gtsam/inference/Factor-inl.h> #include <gtsam/inference/IndexConditional.h> using namespace std; namespace gtsam { template class Factor<Index> ; /* ************************************************************************* */ void IndexFactor::assertInvariants() const { Base::assertInvariants(); } /* ************************************************************************* */ IndexFactor::IndexFactor(const IndexConditional& c) : Base(c) { assertInvariants(); } /* ************************************************************************* */ #ifdef TRACK_ELIMINATE boost::shared_ptr<IndexConditional> IndexFactor::eliminateFirst() { boost::shared_ptr<IndexConditional> result(Base::eliminateFirst< IndexConditional>()); assertInvariants(); return result; } /* ************************************************************************* */ boost::shared_ptr<BayesNet<IndexConditional> > IndexFactor::eliminate( size_t nrFrontals) { boost::shared_ptr<BayesNet<IndexConditional> > result(Base::eliminate< IndexConditional>(nrFrontals)); assertInvariants(); return result; } #endif /* ************************************************************************* */ void IndexFactor::permuteWithInverse(const Permutation& inversePermutation) { BOOST_FOREACH(Index& key, keys()) key = inversePermutation[key]; assertInvariants(); } /* ************************************************************************* */ } // gtsam
30.484848
80
0.500994
sdmiller
b04710b459e76e180d6b1076eae57b2ef779063c
483
hpp
C++
contrib/autoboost/autoboost/chrono/chrono.hpp
CaseyCarter/autowiring
48e95a71308318c8ffb7ed1348e034fd9110f70c
[ "Apache-2.0" ]
87
2015-01-18T00:43:06.000Z
2022-02-11T17:40:50.000Z
contrib/autoboost/autoboost/chrono/chrono.hpp
CaseyCarter/autowiring
48e95a71308318c8ffb7ed1348e034fd9110f70c
[ "Apache-2.0" ]
274
2015-01-03T04:50:49.000Z
2021-03-08T09:01:09.000Z
contrib/autoboost/autoboost/chrono/chrono.hpp
CaseyCarter/autowiring
48e95a71308318c8ffb7ed1348e034fd9110f70c
[ "Apache-2.0" ]
15
2015-09-30T20:58:43.000Z
2020-12-19T21:24:56.000Z
// chrono.hpp --------------------------------------------------------------// // Copyright 2009-2011 Vicente J. Botet Escriba // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt #ifndef AUTOBOOST_CHRONO_CHRONO_HPP #define AUTOBOOST_CHRONO_CHRONO_HPP #include <autoboost/chrono/duration.hpp> #include <autoboost/chrono/time_point.hpp> #include <autoboost/chrono/system_clocks.hpp> #endif // AUTOBOOST_CHRONO_CHRONO_HPP
30.1875
80
0.68323
CaseyCarter
b0496ad24efd9ec95a1966b32ddd2b733e835216
1,413
cpp
C++
Active/CodeForces/Count_Subarrays.cpp
pawan-nirpal-031/Algorithms-And-ProblemSolving
24ce9649345dabe7275920f6912e410efc2c8e84
[ "Apache-2.0" ]
2
2021-03-05T08:40:01.000Z
2021-04-25T13:58:42.000Z
Active/Codechef/Count_Subarrays.cpp
pawan-nirpal-031/Algorithms-And-ProblemSolving
24ce9649345dabe7275920f6912e410efc2c8e84
[ "Apache-2.0" ]
null
null
null
Active/Codechef/Count_Subarrays.cpp
pawan-nirpal-031/Algorithms-And-ProblemSolving
24ce9649345dabe7275920f6912e410efc2c8e84
[ "Apache-2.0" ]
null
null
null
// Problem Link : https://www.codechef.com/problems/SUBINC #include <bits/stdc++.h> using namespace std; typedef unsigned long long int ull; typedef long long int ll; typedef long double ld; #define Mod 1000000007 #define Infinity (ll)1e18 #define Append(a) push_back(a) #define Pair(a,b) make_pair(a,b) #define Clear(a) for(ll &x : a){x=0;} #define Point(x) std::fixed<<setprecision(15)<<x #define SetBits(x) __builtin_popcount(x); #define DebugCase(i,x) cout<<"Case #"<<i<<": "<<x<<'\n' #define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define Status(b) (cout<<(b?"YES\n":"NO\n")); #define Print(x) cout<<x #define Input(x) cin>>x /* Problem Statement : Given an array A1,A2,...,AN, count the number of subarrays of array A which are non-decreasing. A subarray A[i,j], where 1≤i≤j≤N is a sequence of integers Ai,Ai+1,...,Aj. A subarray A[i,j] is non-decreasing if Ai≤Ai+1≤Ai+2≤...≤Aj. You have to count the total number of such subarrays. */ void solve(){ int n; cin>>n; ll a[n]; vector<ll>num_of_subarrys_end(n,0); for(ll &x : a) cin>>x; ll ans = num_of_subarrys_end[0] = 1; for(int i =1;i<n;i++){ num_of_subarrys_end[i] = 1 + (a[i]>=a[i-1]?num_of_subarrys_end[i-1]:0); ans+=num_of_subarrys_end[i]; } cout<<ans<<'\n'; } int main(){ FastIO; int t; cin>>t; while(t--) solve(); return 0; } // If Solved Mark (0/1) here => [1]
26.166667
113
0.64402
pawan-nirpal-031
b04b7c7fae4ad1f1dd17bf35259b5dcf0fbe3a52
1,033
cpp
C++
Lab6/timer/timer.cpp
HanlinHu/CS210_LAB_code
c0f2d89cb6b1d2047bd6fea7e2a041660245dc32
[ "MIT" ]
null
null
null
Lab6/timer/timer.cpp
HanlinHu/CS210_LAB_code
c0f2d89cb6b1d2047bd6fea7e2a041660245dc32
[ "MIT" ]
null
null
null
Lab6/timer/timer.cpp
HanlinHu/CS210_LAB_code
c0f2d89cb6b1d2047bd6fea7e2a041660245dc32
[ "MIT" ]
null
null
null
//-------------------------------------------------------------------- // // Laboratory C timer.cpp // // SOLUTION: Implementation of the Timer ADT // // // from "A Laboratory Course in C++ Data Structures" (Roberge,Brandle,Whittington) //-------------------------------------------------------------------- #include <iostream> #include <ctime> #include "timer.h" //-------------------------------------------------------------------- void Timer::start () // Starts the timer. { //startTime = times( NULL ); startTime = clock(); } //-------------------------------------------------------------------- void Timer::stop () // Stops the timer. { //stopTime = times( NULL ); stopTime = clock(); } //-------------------------------------------------------------------- double Timer::getElapsedTime () const // Computes the length of the time interval from startTime to // stopTime (in seconds). { return double ( stopTime - startTime ) / (CLOCKS_PER_SEC) ; }
21.978723
83
0.398838
HanlinHu
b0520e39a141b1abdddddf6aa5ca3457e8914217
5,487
cpp
C++
src/solar/rendering/fonts/font_renderer.cpp
jseward/solar
a0b76e3c945679a8fcb4cc94160298788b96e4a5
[ "MIT" ]
4
2017-04-02T07:56:14.000Z
2021-10-01T18:23:33.000Z
src/solar/rendering/fonts/font_renderer.cpp
jseward/solar
a0b76e3c945679a8fcb4cc94160298788b96e4a5
[ "MIT" ]
null
null
null
src/solar/rendering/fonts/font_renderer.cpp
jseward/solar
a0b76e3c945679a8fcb4cc94160298788b96e4a5
[ "MIT" ]
1
2021-10-01T18:23:38.000Z
2021-10-01T18:23:38.000Z
#include "font_renderer.h" #include "solar/utility/assert.h" #include "solar/utility/verify.h" #include "solar/utility/type_convert.h" #include "solar/resources/resource_system.h" #include "solar/rendering/primatives/prim2d.h" #include "solar/rendering/shaders/shader_program.h" #include "solar/strings/string_marshal.h" #include "solar/math/rectf.h" namespace solar { namespace font_renderer_impl { namespace shader_param_names { static const char* FONT_SCALE = "font_scale"; static const char* TEXTURE_PIXEL_WIDTH = "texture_pixel_width"; static const char* TEXTURE_PIXEL_HEIGHT = "texture_pixel_height"; static const char* DROPSHADOW_OFFSET = "dropshadow_offset"; static const char* DROPSHADOW_MIN_DISTANCE = "dropshadow_min_distance"; static const char* DROPSHADOW_MAX_DISTANCE = "dropshadow_max_distance"; } } font_renderer::font_renderer(render_device& render_device, resource_system& resource_system, prim2d& prim2d, font_renderer_shader_program_provider& shader_program_provider) : _resource_system(resource_system) , _prim2d(prim2d) , _render_device(render_device) , _shader_program_provider(shader_program_provider) { } font_renderer::~font_renderer() { } void font_renderer::setup() { _render_state_block = make_render_state_block_ptr(_render_device, render_state_block_def() .set_depth_write(render_state_depth_write::DISABLED) .set_depth_compare_func(render_state_compare_func::NONE) .set_blend(render_state_blend_type::SRC_ALPHA, render_state_blend_type::INV_SRC_ALPHA)); } void font_renderer::teardown() { _render_state_block.reset(); } void font_renderer::begin_rendering(const rect& viewport_area) { _prim2d.begin_rendering(viewport_area, _shader_program_provider.get_normal_shader_program(), _render_state_block.get()); } void font_renderer::end_rendering() { _prim2d.end_rendering(); } void font_renderer::render(const font_render_params& params) { _line_builder.build_lines(params); if (params._is_dropshadow_enabled) { set_dropshadow_shader(params); render_lines(params, _line_builder.get_lines(), params._dropshadow_def._color); } set_normal_shader(params); render_lines(params, _line_builder.get_lines(), params._color); } int font_renderer::calculate_render_height(const font_render_params& params) { _line_builder.build_lines(params); return float_to_int(_line_builder.get_lines().size() * params._font.get_line_height(params._font_size)); } void font_renderer::render_lines(const font_render_params& params, const std::vector<font_renderer_line>& lines, const color& color) { float scale = params._font.get_scale(params._font_size); float base_line_error = calculate_base_line_error(params._font, scale); for (const auto& line : lines) { float x = line._begin_top_left._x; float y = line._begin_top_left._y; for (unsigned int index = line._begin_text_index; index < line._end_text_index; ++index) { auto glyph = params._font.find_best_glyph(params._text[index]); if (glyph != nullptr) { float offset_x = (glyph->_offset._x * scale); float offset_y = (glyph->_offset._y * scale); float width = (glyph->_size._width * scale); float height = (glyph->_size._height * scale); float right = (x + offset_x + width); float base_line = std::roundf(height + offset_y + base_line_error); _prim2d.set_texture(params._font.get_page_texture(glyph->_page)); _prim2d.render_rect( rect( float_to_int(x + offset_x), float_to_int(y + offset_y), float_to_int(right), float_to_int(y + base_line)), color, glyph->_uvs); x += (glyph->_x_stride * scale); unsigned int next_index = index + 1; if (next_index < line._end_text_index) { x += (glyph->get_kerning_offset(params._text[next_index]) * scale); } } } } } float font_renderer::calculate_base_line_error(const font& font, float scale) const { auto ref_glyph = font.find_best_glyph(L'a'); IF_VERIFY(ref_glyph != nullptr) { float true_base_line = ref_glyph->_size._height * ref_glyph->_offset._y; float scaled_base_line = true_base_line * scale; return (std::roundf(scaled_base_line) - scaled_base_line); } return 0.f; } void font_renderer::set_dropshadow_shader(const font_render_params& params) { auto& program = _shader_program_provider.get_dropshadow_shader_program(); auto pixel_size = params._font.get_page_texture_pixel_size(); program.set_float(font_renderer_impl::shader_param_names::TEXTURE_PIXEL_WIDTH, pixel_size._width); program.set_float(font_renderer_impl::shader_param_names::TEXTURE_PIXEL_HEIGHT, pixel_size._height); program.set_float_array(font_renderer_impl::shader_param_names::DROPSHADOW_OFFSET, params._dropshadow_def._offset.as_raw_float_array(), 2); program.set_float(font_renderer_impl::shader_param_names::DROPSHADOW_MIN_DISTANCE, params._dropshadow_def._min_distance); program.set_float(font_renderer_impl::shader_param_names::DROPSHADOW_MAX_DISTANCE, params._dropshadow_def._max_distance); program.commit_param_changes(); _prim2d.set_shader_program(program); } void font_renderer::set_normal_shader(const font_render_params& params) { auto& program = _shader_program_provider.get_normal_shader_program(); program.set_float(font_renderer_impl::shader_param_names::FONT_SCALE, params._font.get_scale(params._font_size)); program.commit_param_changes(); _prim2d.set_shader_program(program); } }
38.640845
173
0.767815
jseward
b05267c70465a20f74bbaf31e95e91e13ef23c52
4,119
hpp
C++
src/layer/common/split_layer-inl.hpp
pl8787/textnet-release
c85a4162c55b4cfe22eab6f8f0c8b615854f9b8f
[ "Apache-2.0" ]
114
2017-06-14T07:05:31.000Z
2021-06-13T05:30:49.000Z
src/layer/common/split_layer-inl.hpp
pl8787/textnet-release
c85a4162c55b4cfe22eab6f8f0c8b615854f9b8f
[ "Apache-2.0" ]
7
2017-11-17T08:16:55.000Z
2019-10-05T00:09:20.000Z
src/layer/common/split_layer-inl.hpp
pl8787/textnet-release
c85a4162c55b4cfe22eab6f8f0c8b615854f9b8f
[ "Apache-2.0" ]
40
2017-06-15T03:21:10.000Z
2021-10-31T15:03:30.000Z
#ifndef TEXTNET_LAYER_SPLIT_LAYER_INL_HPP_ #define TEXTNET_LAYER_SPLIT_LAYER_INL_HPP_ #include <iostream> #include <fstream> #include <sstream> #include <set> #include <mshadow/tensor.h> #include "../layer.h" #include "../op.h" namespace textnet { namespace layer { template<typename xpu> class SplitLayer : public Layer<xpu>{ public: SplitLayer(LayerType type) { this->layer_type = type; } virtual ~SplitLayer(void) {} virtual int BottomNodeNum() { return 1; } virtual int TopNodeNum() { return 2; } virtual int ParamNodeNum() { return 0; } virtual void Require() { // default value, just set the value you want // require value, set to SettingV(), // it will force custom to set in config Layer<xpu>::Require(); } virtual void SetupLayer(std::map<std::string, SettingV> &setting, const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top, mshadow::Random<xpu> *prnd) { Layer<xpu>::SetupLayer(setting, bottom, top, prnd); utils::Check(bottom.size() == BottomNodeNum(), "SplitLayer:bottom size problem."); utils::Check(top.size() == TopNodeNum(), "SplitLayer:top size problem."); } virtual void Reshape(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top, bool show_info = false) { utils::Check(bottom.size() == BottomNodeNum(), "SplitLayer:bottom size problem."); utils::Check(top.size() == TopNodeNum(), "SplitLayer:top size problem."); nbatch = bottom[0]->data.size(0); doc_count = bottom[0]->data.size(1); doc_len = bottom[0]->data.size(2); feat_size = bottom[0]->data.size(3); top[0]->Resize(nbatch, 1, doc_len, feat_size, true); top[1]->Resize(nbatch, 1, doc_len, feat_size, true); if (show_info) { bottom[0]->PrintShape("bottom0"); top[0]->PrintShape("top0"); top[1]->PrintShape("top1"); } } virtual void CheckReshape(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { // Check for reshape bool need_reshape = false; if (nbatch != bottom[0]->data.size(0)) { need_reshape = true; } // Do reshape if (need_reshape) { this->Reshape(bottom, top); } } virtual void Forward(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { using namespace mshadow::expr; mshadow::Tensor<xpu, 4> bottom_data = bottom[0]->data; mshadow::Tensor<xpu, 2> bottom_len = bottom[0]->length; mshadow::Tensor<xpu, 4> top0_data = top[0]->data; mshadow::Tensor<xpu, 4> top1_data = top[1]->data; mshadow::Tensor<xpu, 2> top0_len = top[0]->length; mshadow::Tensor<xpu, 2> top1_len = top[1]->length; for (int i = 0; i < nbatch; i++) { top0_data[i] = F<op::identity>(bottom_data[i].Slice(0, 1)); top1_data[i] = F<op::identity>(bottom_data[i].Slice(1, 2)); top0_len[i] = F<op::identity>(bottom_len[i].Slice(0, 1)); top1_len[i] = F<op::identity>(bottom_len[i].Slice(1, 2)); } } virtual void Backprop(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { using namespace mshadow::expr; mshadow::Tensor<xpu, 4> bottom_diff = bottom[0]->diff; mshadow::Tensor<xpu, 4> top0_diff = top[0]->diff; mshadow::Tensor<xpu, 4> top1_diff = top[1]->diff; if (this->prop_error[0]) { for (int i = 0; i < nbatch; i++) { bottom_diff[i].Slice(0, 1) += top0_diff[i]; bottom_diff[i].Slice(1, 2) += top1_diff[i]; } } } protected: int nbatch; int doc_count; int doc_len; int feat_size; }; } // namespace layer } // namespace textnet #endif // LAYER_SPLIT_LAYER_INL_HPP_
32.179688
68
0.563729
pl8787
b052ccbe098ca08a99505dd8bd9bc6e07565b83a
25,688
cpp
C++
qtdeclarative/src/quick/scenegraph/qsgdefaultimagenode.cpp
wgnet/wds_qt
8db722fd367d2d0744decf99ac7bafaba8b8a3d3
[ "Apache-2.0" ]
1
2020-04-30T15:47:35.000Z
2020-04-30T15:47:35.000Z
qtdeclarative/src/quick/scenegraph/qsgdefaultimagenode.cpp
wgnet/wds_qt
8db722fd367d2d0744decf99ac7bafaba8b8a3d3
[ "Apache-2.0" ]
null
null
null
qtdeclarative/src/quick/scenegraph/qsgdefaultimagenode.cpp
wgnet/wds_qt
8db722fd367d2d0744decf99ac7bafaba8b8a3d3
[ "Apache-2.0" ]
null
null
null
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtQuick module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** As a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qsgdefaultimagenode_p.h" #include <private/qsgmaterialshader_p.h> #include <QtCore/qvarlengtharray.h> #include <QtCore/qmath.h> #include <QtGui/qopenglfunctions.h> #include <qsgtexturematerial.h> #include <private/qsgtexturematerial_p.h> #include <qsgmaterial.h> QT_BEGIN_NAMESPACE namespace { struct SmoothVertex { float x, y, u, v; float dx, dy, du, dv; }; const QSGGeometry::AttributeSet &smoothAttributeSet() { static QSGGeometry::Attribute data[] = { QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true), QSGGeometry::Attribute::create(1, 2, GL_FLOAT, false), QSGGeometry::Attribute::create(2, 2, GL_FLOAT, false), QSGGeometry::Attribute::create(3, 2, GL_FLOAT, false) }; static QSGGeometry::AttributeSet attrs = { 4, sizeof(SmoothVertex), data }; return attrs; } } class SmoothTextureMaterialShader : public QSGTextureMaterialShader { public: SmoothTextureMaterialShader(); virtual void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect); virtual char const *const *attributeNames() const; protected: virtual void initialize(); int m_pixelSizeLoc; }; QSGSmoothTextureMaterial::QSGSmoothTextureMaterial() { setFlag(RequiresFullMatrixExceptTranslate, true); setFlag(Blending, true); } void QSGSmoothTextureMaterial::setTexture(QSGTexture *texture) { m_texture = texture; } QSGMaterialType *QSGSmoothTextureMaterial::type() const { static QSGMaterialType type; return &type; } QSGMaterialShader *QSGSmoothTextureMaterial::createShader() const { return new SmoothTextureMaterialShader; } SmoothTextureMaterialShader::SmoothTextureMaterialShader() : QSGTextureMaterialShader() { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothtexture.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothtexture.frag")); } void SmoothTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { if (oldEffect == 0) { // The viewport is constant, so set the pixel size uniform only once. QRect r = state.viewportRect(); program()->setUniformValue(m_pixelSizeLoc, 2.0f / r.width(), 2.0f / r.height()); } QSGTextureMaterialShader::updateState(state, newEffect, oldEffect); } char const *const *SmoothTextureMaterialShader::attributeNames() const { static char const *const attributes[] = { "vertex", "multiTexCoord", "vertexOffset", "texCoordOffset", 0 }; return attributes; } void SmoothTextureMaterialShader::initialize() { m_pixelSizeLoc = program()->uniformLocation("pixelSize"); QSGTextureMaterialShader::initialize(); } QSGDefaultImageNode::QSGDefaultImageNode() : m_innerSourceRect(0, 0, 1, 1) , m_subSourceRect(0, 0, 1, 1) , m_antialiasing(false) , m_mirror(false) , m_dirtyGeometry(false) , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) { setMaterial(&m_materialO); setOpaqueMaterial(&m_material); setGeometry(&m_geometry); #ifdef QSG_RUNTIME_DESCRIPTION qsgnode_set_description(this, QLatin1String("image")); #endif } void QSGDefaultImageNode::setTargetRect(const QRectF &rect) { if (rect == m_targetRect) return; m_targetRect = rect; m_dirtyGeometry = true; } void QSGDefaultImageNode::setInnerTargetRect(const QRectF &rect) { if (rect == m_innerTargetRect) return; m_innerTargetRect = rect; m_dirtyGeometry = true; } void QSGDefaultImageNode::setInnerSourceRect(const QRectF &rect) { if (rect == m_innerSourceRect) return; m_innerSourceRect = rect; m_dirtyGeometry = true; } void QSGDefaultImageNode::setSubSourceRect(const QRectF &rect) { if (rect == m_subSourceRect) return; m_subSourceRect = rect; m_dirtyGeometry = true; } void QSGDefaultImageNode::setFiltering(QSGTexture::Filtering filtering) { if (m_material.filtering() == filtering) return; m_material.setFiltering(filtering); m_materialO.setFiltering(filtering); m_smoothMaterial.setFiltering(filtering); markDirty(DirtyMaterial); } void QSGDefaultImageNode::setMipmapFiltering(QSGTexture::Filtering filtering) { if (m_material.mipmapFiltering() == filtering) return; m_material.setMipmapFiltering(filtering); m_materialO.setMipmapFiltering(filtering); m_smoothMaterial.setMipmapFiltering(filtering); markDirty(DirtyMaterial); } void QSGDefaultImageNode::setVerticalWrapMode(QSGTexture::WrapMode wrapMode) { if (m_material.verticalWrapMode() == wrapMode) return; m_material.setVerticalWrapMode(wrapMode); m_materialO.setVerticalWrapMode(wrapMode); m_smoothMaterial.setVerticalWrapMode(wrapMode); markDirty(DirtyMaterial); } void QSGDefaultImageNode::setHorizontalWrapMode(QSGTexture::WrapMode wrapMode) { if (m_material.horizontalWrapMode() == wrapMode) return; m_material.setHorizontalWrapMode(wrapMode); m_materialO.setHorizontalWrapMode(wrapMode); m_smoothMaterial.setHorizontalWrapMode(wrapMode); markDirty(DirtyMaterial); } void QSGDefaultImageNode::setTexture(QSGTexture *texture) { Q_ASSERT(texture); m_material.setTexture(texture); m_materialO.setTexture(texture); m_smoothMaterial.setTexture(texture); m_material.setFlag(QSGMaterial::Blending, texture->hasAlphaChannel()); markDirty(DirtyMaterial); // Because the texture can be a different part of the atlas, we need to update it... m_dirtyGeometry = true; } void QSGDefaultImageNode::setAntialiasing(bool antialiasing) { if (antialiasing == m_antialiasing) return; m_antialiasing = antialiasing; if (m_antialiasing) { setMaterial(&m_smoothMaterial); setOpaqueMaterial(0); setGeometry(new QSGGeometry(smoothAttributeSet(), 0)); setFlag(OwnsGeometry, true); } else { setMaterial(&m_materialO); setOpaqueMaterial(&m_material); setGeometry(&m_geometry); setFlag(OwnsGeometry, false); } m_dirtyGeometry = true; } void QSGDefaultImageNode::setMirror(bool mirror) { if (mirror == m_mirror) return; m_mirror = mirror; m_dirtyGeometry = true; } void QSGDefaultImageNode::update() { if (m_dirtyGeometry) updateGeometry(); } void QSGDefaultImageNode::preprocess() { bool doDirty = false; QSGDynamicTexture *t = qobject_cast<QSGDynamicTexture *>(m_material.texture()); if (t) { doDirty = t->updateTexture(); if (doDirty) updateGeometry(); } bool alpha = m_material.flags() & QSGMaterial::Blending; if (m_material.texture() && alpha != m_material.texture()->hasAlphaChannel()) { m_material.setFlag(QSGMaterial::Blending, !alpha); doDirty = true; } if (doDirty) markDirty(DirtyMaterial); } inline static bool isPowerOfTwo(int x) { // Assumption: x >= 1 return x == (x & -x); } namespace { struct X { float x, tx; }; struct Y { float y, ty; }; } static inline void appendQuad(quint16 **indices, quint16 topLeft, quint16 topRight, quint16 bottomLeft, quint16 bottomRight) { *(*indices)++ = topLeft; *(*indices)++ = bottomLeft; *(*indices)++ = bottomRight; *(*indices)++ = bottomRight; *(*indices)++ = topRight; *(*indices)++ = topLeft; } void QSGDefaultImageNode::updateGeometry() { Q_ASSERT(!m_targetRect.isEmpty()); const QSGTexture *t = m_material.texture(); if (!t) { QSGGeometry *g = geometry(); g->allocate(4); g->setDrawingMode(GL_TRIANGLE_STRIP); memset(g->vertexData(), 0, g->sizeOfVertex() * 4); } else { QRectF sourceRect = t->normalizedTextureSubRect(); QRectF innerSourceRect(sourceRect.x() + m_innerSourceRect.x() * sourceRect.width(), sourceRect.y() + m_innerSourceRect.y() * sourceRect.height(), m_innerSourceRect.width() * sourceRect.width(), m_innerSourceRect.height() * sourceRect.height()); bool hasMargins = m_targetRect != m_innerTargetRect; int floorLeft = qFloor(m_subSourceRect.left()); int ceilRight = qCeil(m_subSourceRect.right()); int floorTop = qFloor(m_subSourceRect.top()); int ceilBottom = qCeil(m_subSourceRect.bottom()); int hTiles = ceilRight - floorLeft; int vTiles = ceilBottom - floorTop; bool hasTiles = hTiles != 1 || vTiles != 1; bool fullTexture = innerSourceRect == QRectF(0, 0, 1, 1); bool wrapSupported = true; QOpenGLContext *ctx = QOpenGLContext::currentContext(); #ifndef QT_OPENGL_ES_2 if (ctx->isOpenGLES()) #endif { bool npotSupported = ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat); QSize size = t->textureSize(); const bool isNpot = !isPowerOfTwo(size.width()) || !isPowerOfTwo(size.height()); wrapSupported = npotSupported || !isNpot; } // An image can be rendered as a single quad if: // - There are no margins, and either: // - the image isn't repeated // - the source rectangle fills the entire texture so that texture wrapping can be used, // and NPOT is supported if (!hasMargins && (!hasTiles || (fullTexture && wrapSupported))) { QRectF sr; if (!fullTexture) { sr = QRectF(innerSourceRect.x() + (m_subSourceRect.left() - floorLeft) * innerSourceRect.width(), innerSourceRect.y() + (m_subSourceRect.top() - floorTop) * innerSourceRect.height(), m_subSourceRect.width() * innerSourceRect.width(), m_subSourceRect.height() * innerSourceRect.height()); } else { sr = QRectF(m_subSourceRect.left() - floorLeft, m_subSourceRect.top() - floorTop, m_subSourceRect.width(), m_subSourceRect.height()); } if (m_mirror) { qreal oldLeft = sr.left(); sr.setLeft(sr.right()); sr.setRight(oldLeft); } if (m_antialiasing) { QSGGeometry *g = geometry(); Q_ASSERT(g != &m_geometry); g->allocate(8, 14); g->setDrawingMode(GL_TRIANGLE_STRIP); SmoothVertex *vertices = reinterpret_cast<SmoothVertex *>(g->vertexData()); float delta = float(qAbs(m_targetRect.width()) < qAbs(m_targetRect.height()) ? m_targetRect.width() : m_targetRect.height()) * 0.5f; float sx = float(sr.width() / m_targetRect.width()); float sy = float(sr.height() / m_targetRect.height()); for (int d = -1; d <= 1; d += 2) { for (int j = 0; j < 2; ++j) { for (int i = 0; i < 2; ++i, ++vertices) { vertices->x = m_targetRect.x() + i * m_targetRect.width(); vertices->y = m_targetRect.y() + j * m_targetRect.height(); vertices->u = sr.x() + i * sr.width(); vertices->v = sr.y() + j * sr.height(); vertices->dx = (i == 0 ? delta : -delta) * d; vertices->dy = (j == 0 ? delta : -delta) * d; vertices->du = (d < 0 ? 0 : vertices->dx * sx); vertices->dv = (d < 0 ? 0 : vertices->dy * sy); } } } Q_ASSERT(vertices - g->vertexCount() == g->vertexData()); static const quint16 indices[] = { 0, 4, 1, 5, 3, 7, 2, 6, 0, 4, 4, 6, 5, 7 }; Q_ASSERT(g->sizeOfIndex() * g->indexCount() == sizeof(indices)); memcpy(g->indexDataAsUShort(), indices, sizeof(indices)); } else { m_geometry.allocate(4); m_geometry.setDrawingMode(GL_TRIANGLE_STRIP); QSGGeometry::updateTexturedRectGeometry(&m_geometry, m_targetRect, sr); } } else { int hCells = hTiles; int vCells = vTiles; if (m_innerTargetRect.width() == 0) hCells = 0; if (m_innerTargetRect.left() != m_targetRect.left()) ++hCells; if (m_innerTargetRect.right() != m_targetRect.right()) ++hCells; if (m_innerTargetRect.height() == 0) vCells = 0; if (m_innerTargetRect.top() != m_targetRect.top()) ++vCells; if (m_innerTargetRect.bottom() != m_targetRect.bottom()) ++vCells; QVarLengthArray<X, 32> xData(2 * hCells); QVarLengthArray<Y, 32> yData(2 * vCells); X *xs = xData.data(); Y *ys = yData.data(); if (m_innerTargetRect.left() != m_targetRect.left()) { xs[0].x = m_targetRect.left(); xs[0].tx = sourceRect.left(); xs[1].x = m_innerTargetRect.left(); xs[1].tx = innerSourceRect.left(); xs += 2; } if (m_innerTargetRect.width() != 0) { xs[0].x = m_innerTargetRect.left(); xs[0].tx = innerSourceRect.x() + (m_subSourceRect.left() - floorLeft) * innerSourceRect.width(); ++xs; float b = m_innerTargetRect.width() / m_subSourceRect.width(); float a = m_innerTargetRect.x() - m_subSourceRect.x() * b; for (int i = floorLeft + 1; i <= ceilRight - 1; ++i) { xs[0].x = xs[1].x = a + b * i; xs[0].tx = innerSourceRect.right(); xs[1].tx = innerSourceRect.left(); xs += 2; } xs[0].x = m_innerTargetRect.right(); xs[0].tx = innerSourceRect.x() + (m_subSourceRect.right() - ceilRight + 1) * innerSourceRect.width(); ++xs; } if (m_innerTargetRect.right() != m_targetRect.right()) { xs[0].x = m_innerTargetRect.right(); xs[0].tx = innerSourceRect.right(); xs[1].x = m_targetRect.right(); xs[1].tx = sourceRect.right(); xs += 2; } Q_ASSERT(xs == xData.data() + xData.size()); if (m_mirror) { float leftPlusRight = m_targetRect.left() + m_targetRect.right(); int count = xData.size(); xs = xData.data(); for (int i = 0; i < count >> 1; ++i) qSwap(xs[i], xs[count - 1 - i]); for (int i = 0; i < count; ++i) xs[i].x = leftPlusRight - xs[i].x; } if (m_innerTargetRect.top() != m_targetRect.top()) { ys[0].y = m_targetRect.top(); ys[0].ty = sourceRect.top(); ys[1].y = m_innerTargetRect.top(); ys[1].ty = innerSourceRect.top(); ys += 2; } if (m_innerTargetRect.height() != 0) { ys[0].y = m_innerTargetRect.top(); ys[0].ty = innerSourceRect.y() + (m_subSourceRect.top() - floorTop) * innerSourceRect.height(); ++ys; float b = m_innerTargetRect.height() / m_subSourceRect.height(); float a = m_innerTargetRect.y() - m_subSourceRect.y() * b; for (int i = floorTop + 1; i <= ceilBottom - 1; ++i) { ys[0].y = ys[1].y = a + b * i; ys[0].ty = innerSourceRect.bottom(); ys[1].ty = innerSourceRect.top(); ys += 2; } ys[0].y = m_innerTargetRect.bottom(); ys[0].ty = innerSourceRect.y() + (m_subSourceRect.bottom() - ceilBottom + 1) * innerSourceRect.height(); ++ys; } if (m_innerTargetRect.bottom() != m_targetRect.bottom()) { ys[0].y = m_innerTargetRect.bottom(); ys[0].ty = innerSourceRect.bottom(); ys[1].y = m_targetRect.bottom(); ys[1].ty = sourceRect.bottom(); ys += 2; } Q_ASSERT(ys == yData.data() + yData.size()); if (m_antialiasing) { QSGGeometry *g = geometry(); Q_ASSERT(g != &m_geometry); g->allocate(hCells * vCells * 4 + (hCells + vCells - 1) * 4, hCells * vCells * 6 + (hCells + vCells) * 12); g->setDrawingMode(GL_TRIANGLES); SmoothVertex *vertices = reinterpret_cast<SmoothVertex *>(g->vertexData()); memset(vertices, 0, g->vertexCount() * g->sizeOfVertex()); quint16 *indices = g->indexDataAsUShort(); // The deltas are how much the fuzziness can reach into the image. // Only the border vertices are moved by the vertex shader, so the fuzziness // can't reach further into the image than the closest interior vertices. float leftDx = xData.at(1).x - xData.at(0).x; float rightDx = xData.at(xData.size() - 1).x - xData.at(xData.size() - 2).x; float topDy = yData.at(1).y - yData.at(0).y; float bottomDy = yData.at(yData.size() - 1).y - yData.at(yData.size() - 2).y; float leftDu = xData.at(1).tx - xData.at(0).tx; float rightDu = xData.at(xData.size() - 1).tx - xData.at(xData.size() - 2).tx; float topDv = yData.at(1).ty - yData.at(0).ty; float bottomDv = yData.at(yData.size() - 1).ty - yData.at(yData.size() - 2).ty; if (hCells == 1) { leftDx = rightDx *= 0.5f; leftDu = rightDu *= 0.5f; } if (vCells == 1) { topDy = bottomDy *= 0.5f; topDv = bottomDv *= 0.5f; } // This delta is how much the fuzziness can reach out from the image. float delta = float(qAbs(m_targetRect.width()) < qAbs(m_targetRect.height()) ? m_targetRect.width() : m_targetRect.height()) * 0.5f; quint16 index = 0; ys = yData.data(); for (int j = 0; j < vCells; ++j, ys += 2) { xs = xData.data(); bool isTop = j == 0; bool isBottom = j == vCells - 1; for (int i = 0; i < hCells; ++i, xs += 2) { bool isLeft = i == 0; bool isRight = i == hCells - 1; SmoothVertex *v = vertices + index; quint16 topLeft = index; for (int k = (isTop || isLeft ? 2 : 1); k--; ++v, ++index) { v->x = xs[0].x; v->u = xs[0].tx; v->y = ys[0].y; v->v = ys[0].ty; } quint16 topRight = index; for (int k = (isTop || isRight ? 2 : 1); k--; ++v, ++index) { v->x = xs[1].x; v->u = xs[1].tx; v->y = ys[0].y; v->v = ys[0].ty; } quint16 bottomLeft = index; for (int k = (isBottom || isLeft ? 2 : 1); k--; ++v, ++index) { v->x = xs[0].x; v->u = xs[0].tx; v->y = ys[1].y; v->v = ys[1].ty; } quint16 bottomRight = index; for (int k = (isBottom || isRight ? 2 : 1); k--; ++v, ++index) { v->x = xs[1].x; v->u = xs[1].tx; v->y = ys[1].y; v->v = ys[1].ty; } appendQuad(&indices, topLeft, topRight, bottomLeft, bottomRight); if (isTop) { vertices[topLeft].dy = vertices[topRight].dy = topDy; vertices[topLeft].dv = vertices[topRight].dv = topDv; vertices[topLeft + 1].dy = vertices[topRight + 1].dy = -delta; appendQuad(&indices, topLeft + 1, topRight + 1, topLeft, topRight); } if (isBottom) { vertices[bottomLeft].dy = vertices[bottomRight].dy = -bottomDy; vertices[bottomLeft].dv = vertices[bottomRight].dv = -bottomDv; vertices[bottomLeft + 1].dy = vertices[bottomRight + 1].dy = delta; appendQuad(&indices, bottomLeft, bottomRight, bottomLeft + 1, bottomRight + 1); } if (isLeft) { vertices[topLeft].dx = vertices[bottomLeft].dx = leftDx; vertices[topLeft].du = vertices[bottomLeft].du = leftDu; vertices[topLeft + 1].dx = vertices[bottomLeft + 1].dx = -delta; appendQuad(&indices, topLeft + 1, topLeft, bottomLeft + 1, bottomLeft); } if (isRight) { vertices[topRight].dx = vertices[bottomRight].dx = -rightDx; vertices[topRight].du = vertices[bottomRight].du = -rightDu; vertices[topRight + 1].dx = vertices[bottomRight + 1].dx = delta; appendQuad(&indices, topRight, topRight + 1, bottomRight, bottomRight + 1); } } } Q_ASSERT(index == g->vertexCount()); Q_ASSERT(indices - g->indexCount() == g->indexData()); } else { m_geometry.allocate(hCells * vCells * 4, hCells * vCells * 6); m_geometry.setDrawingMode(GL_TRIANGLES); QSGGeometry::TexturedPoint2D *vertices = m_geometry.vertexDataAsTexturedPoint2D(); ys = yData.data(); for (int j = 0; j < vCells; ++j, ys += 2) { xs = xData.data(); for (int i = 0; i < hCells; ++i, xs += 2) { vertices[0].x = vertices[2].x = xs[0].x; vertices[0].tx = vertices[2].tx = xs[0].tx; vertices[1].x = vertices[3].x = xs[1].x; vertices[1].tx = vertices[3].tx = xs[1].tx; vertices[0].y = vertices[1].y = ys[0].y; vertices[0].ty = vertices[1].ty = ys[0].ty; vertices[2].y = vertices[3].y = ys[1].y; vertices[2].ty = vertices[3].ty = ys[1].ty; vertices += 4; } } quint16 *indices = m_geometry.indexDataAsUShort(); for (int i = 0; i < 4 * vCells * hCells; i += 4) appendQuad(&indices, i, i + 1, i + 2, i + 3); } } } markDirty(DirtyGeometry); m_dirtyGeometry = false; } QT_END_NAMESPACE
38.570571
123
0.53706
wgnet
b0531130bb331b441af45927d8b8b8af52e452cc
5,174
cpp
C++
source/rho/crypt/tReadableAES.cpp
Rhobota/librho
d540cba6227e15ac6ef3dcb6549ed9557f6fee04
[ "BSD-3-Clause" ]
1
2016-09-22T03:27:33.000Z
2016-09-22T03:27:33.000Z
source/rho/crypt/tReadableAES.cpp
Rhobota/librho
d540cba6227e15ac6ef3dcb6549ed9557f6fee04
[ "BSD-3-Clause" ]
null
null
null
source/rho/crypt/tReadableAES.cpp
Rhobota/librho
d540cba6227e15ac6ef3dcb6549ed9557f6fee04
[ "BSD-3-Clause" ]
null
null
null
#include <rho/crypt/tReadableAES.h> #include <rho/eRho.h> #include <algorithm> #include <cstdlib> namespace rho { namespace crypt { tReadableAES::tReadableAES(iReadable* internalStream, nOperationModeAES opmode, const u8 key[], nKeyLengthAES keylen) : m_stream(internalStream), m_buf(NULL), m_bufSize(0), m_bufUsed(0), m_pos(0), m_seq(0), m_opmode(opmode), m_aes(opmode, key, keylen) { // Check the op mode. if (m_opmode == kOpModeCBC) { m_hasReadInitializationVector = false; } // Alloc the chunk buffer. m_bufSize = 512*AES_BLOCK_SIZE; m_buf = new u8[m_bufSize]; } tReadableAES::~tReadableAES() { delete [] m_buf; m_buf = NULL; m_bufSize = 0; m_bufUsed = 0; m_pos = 0; } i32 tReadableAES::read(u8* buffer, i32 length) { if (length <= 0) throw eInvalidArgument("Stream read/write length must be >0"); if (m_pos >= m_bufUsed) if (! m_refill()) // sets m_pos and m_bufUsed return -1; u32 rem = m_bufUsed - m_pos; if (rem > (u32)length) rem = (u32)length; memcpy(buffer, m_buf+m_pos, rem); m_pos += rem; return (i32)rem; } i32 tReadableAES::readAll(u8* buffer, i32 length) { if (length <= 0) throw eInvalidArgument("Stream read/write length must be >0"); i32 amountRead = 0; while (amountRead < length) { i32 n = read(buffer+amountRead, length-amountRead); if (n <= 0) return (amountRead>0) ? amountRead : n; amountRead += n; } return amountRead; } bool tReadableAES::m_refill() { // Reset indices. m_pos = 0; m_bufUsed = 0; // If in cbc mode and this is the first time m_refill is called, read the // initialization vector off the stream and decrypt it. if (m_opmode == kOpModeCBC && !m_hasReadInitializationVector) { u8 initVectorCt[AES_BLOCK_SIZE]; i32 r = m_stream.readAll(initVectorCt, AES_BLOCK_SIZE); if (r != AES_BLOCK_SIZE) { return (r >= 0); // <-- makes read() give the expected behavior } m_aes.dec(initVectorCt, m_last_ct, 1); m_hasReadInitializationVector = true; } // Read an AES block from the stream. u8 ct[AES_BLOCK_SIZE]; i32 r = m_stream.readAll(ct, AES_BLOCK_SIZE); if (r != AES_BLOCK_SIZE) { return (r >= 0); // <-- makes read() give the expected behavior } // Decrypt the ct buffer into the pt buffer. u8 pt[AES_BLOCK_SIZE]; m_aes.dec(ct, pt, 1, m_last_ct); // Pointer aliasing. u8* buf = m_buf; // We just read the first block (16 bytes) of a chunk from the stream. // This block contains the chunk's length, sequence number, and parity. // Extract the chunk length. u32 chunkLen = 0; chunkLen |= pt[0]; chunkLen <<= 8; chunkLen |= pt[1]; chunkLen <<= 8; chunkLen |= pt[2]; chunkLen <<= 8; chunkLen |= pt[3]; // Extract the sequence number. u64 seq = 0; seq |= pt[ 4]; seq <<= 8; seq |= pt[ 5]; seq <<= 8; seq |= pt[ 6]; seq <<= 8; seq |= pt[ 7]; seq <<= 8; seq |= pt[ 8]; seq <<= 8; seq |= pt[ 9]; seq <<= 8; seq |= pt[10]; seq <<= 8; seq |= pt[11]; // Verify that these values are correct. if (chunkLen <= 16) throw eRuntimeError("This stream is not a valid AES stream. The chunk length is <=16."); if (chunkLen > m_bufSize) throw eRuntimeError("This stream is not a valid AES stream. The chunk length is too large."); if (seq != m_seq) throw eRuntimeError("This stream is not a valid AES stream. The sequence number is not what was expected."); m_seq += chunkLen; // Start the parity check. u8 parity[4] = { 0, 0, 0, 0 }; for (u32 i = 0; i < AES_BLOCK_SIZE; i++) parity[i%4] ^= pt[i]; // Read the rest of the chunk into our buffer. chunkLen -= AES_BLOCK_SIZE; u32 extraBytes = (chunkLen % AES_BLOCK_SIZE); u32 bytesToRead = (extraBytes > 0) ? (chunkLen + (AES_BLOCK_SIZE-extraBytes)) : (chunkLen); r = m_stream.readAll(buf, bytesToRead); if (r < 0 || ((u32)r) != bytesToRead) { return (r >= 0); // <-- makes read() give the expected behavior } // Decrypt the bytes we just read. m_aes.dec(buf, buf, bytesToRead/AES_BLOCK_SIZE, m_last_ct); // Calculate the parity. for (u32 i = 0; i < bytesToRead; i += AES_BLOCK_SIZE) { for (int j = 0; j < AES_BLOCK_SIZE; j++) { parity[(i+j)%4] ^= buf[i+j]; } } // Make sure the parity works out. for (u32 i = chunkLen; i < bytesToRead; i++) parity[i%4] ^= buf[i]; for (u32 i = 0; i < 4; i++) if (parity[i] != 0) throw eRuntimeError("This stream is not a valid AES stream. The parity is broken."); // All must have worked, so set the state up for reading. m_bufUsed = chunkLen; return true; } void tReadableAES::reset() { m_pos = 0; m_bufUsed = 0; m_seq = 0; if (m_opmode == kOpModeCBC) m_hasReadInitializationVector = false; } } // namespace crypt } // namespace rho
26.533333
116
0.587746
Rhobota
b053416c45146f8521086f9776f5ad537888ec50
4,674
cpp
C++
src/Sound/IMA4.cpp
davidschlachter/Pomme
6725e28f1428cf75d22054ff50665edbebee5713
[ "BSL-1.0" ]
37
2020-11-15T14:54:27.000Z
2022-03-22T21:36:54.000Z
src/Sound/IMA4.cpp
davidschlachter/Pomme
6725e28f1428cf75d22054ff50665edbebee5713
[ "BSL-1.0" ]
4
2020-12-19T05:41:40.000Z
2022-01-31T08:59:37.000Z
src/Sound/IMA4.cpp
davidschlachter/Pomme
6725e28f1428cf75d22054ff50665edbebee5713
[ "BSL-1.0" ]
8
2021-01-05T14:36:37.000Z
2022-03-04T19:45:09.000Z
// Adapted from ffmpeg. Look at libavcodec/adpcm{,_data}.{c,h} /* * Portions Copyright (c) 2001-2003 The FFmpeg project * * FFmpeg 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. * * FFmpeg 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 FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "PommeSound.h" #include <vector> #include <cassert> #include <algorithm> const int8_t ff_adpcm_index_table[16] = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8, }; const int16_t ff_adpcm_step_table[89] = { 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 }; struct ADPCMChannelStatus { int predictor; int16_t step_index; int step; }; static inline int sign_extend(int val, unsigned bits) { unsigned shift = 8 * sizeof(int) - bits; union { unsigned u; int s; } v = { (unsigned)val << shift }; return v.s >> shift; } static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus* c, int nibble, int shift) { int step_index; int predictor; int diff, step; step = ff_adpcm_step_table[c->step_index]; step_index = c->step_index + ff_adpcm_index_table[nibble]; step_index = std::clamp(step_index, 0, 88); diff = step >> 3; if (nibble & 4) diff += step; if (nibble & 2) diff += step >> 1; if (nibble & 1) diff += step >> 2; if (nibble & 8) predictor = c->predictor - diff; else predictor = c->predictor + diff; c->predictor = std::clamp(predictor, -32768, 32767); c->step_index = step_index; return c->predictor; } // In QuickTime, IMA is encoded by chunks of 34 bytes (=64 samples). Channel data is interleaved per-chunk. static void DecodeIMA4Chunk( const uint8_t** input, int16_t** output, std::vector<ADPCMChannelStatus>& ctx) { const size_t nChannels = ctx.size(); const unsigned char* in = *input; int16_t* out = *output; for (size_t chan = 0; chan < nChannels; chan++) { ADPCMChannelStatus& cs = ctx[chan]; // Bits 15-7 are the _top_ 9 bits of the 16-bit initial predictor value int predictor = sign_extend((in[0] << 8) | in[1], 16); int step_index = predictor & 0x7F; predictor &= ~0x7F; in += 2; if (cs.step_index == step_index) { int diff = predictor - cs.predictor; if (diff < 0x00) diff = -diff; if (diff > 0x7f) goto update; } else { update: cs.step_index = step_index; cs.predictor = predictor; } if (cs.step_index > 88) throw std::invalid_argument("step_index[chan]>88!"); size_t pos = chan; for (int m = 0; m < 32; m++) { int byte = (uint8_t) (*in++); out[pos] = adpcm_ima_qt_expand_nibble(&cs, byte & 0x0F, 3); pos += nChannels; out[pos] = adpcm_ima_qt_expand_nibble(&cs, byte >> 4, 3); pos += nChannels; } } *input = in; *output += 64 * nChannels; } void Pomme::Sound::IMA4::Decode( const int nChannels, const std::span<const char> input, const std::span<char> output) { if (input.size() % 34 != 0) throw std::invalid_argument("odd input buffer size"); const size_t nChunks = input.size() / (34 * nChannels); const size_t nSamples = 64 * nChunks; if (output.size() != nSamples * nChannels * 2) throw std::invalid_argument("incorrect output size"); const uint8_t* in = reinterpret_cast<const unsigned char*>(input.data()); int16_t* out = reinterpret_cast<int16_t*>(output.data()); std::vector<ADPCMChannelStatus> ctx(nChannels); for (size_t chunk = 0; chunk < nChunks; chunk++) { DecodeIMA4Chunk(&in, &out, ctx); } assert(reinterpret_cast<const char*>(in) == input.data() + input.size()); assert(reinterpret_cast<char*>(out) == output.data() + output.size()); }
28.851852
107
0.647625
davidschlachter
b05728ae2eed9351197d6e300f9c667d53475c61
4,961
cpp
C++
src/hgs-TV/Decomposition/RouteSequenceDecomposition.cpp
alberto-santini/cvrp-decomposition
854d2b5b7cdd51fe4ab46acac7d88dbc7e5bfb88
[ "MIT" ]
null
null
null
src/hgs-TV/Decomposition/RouteSequenceDecomposition.cpp
alberto-santini/cvrp-decomposition
854d2b5b7cdd51fe4ab46acac7d88dbc7e5bfb88
[ "MIT" ]
null
null
null
src/hgs-TV/Decomposition/RouteSequenceDecomposition.cpp
alberto-santini/cvrp-decomposition
854d2b5b7cdd51fe4ab46acac7d88dbc7e5bfb88
[ "MIT" ]
null
null
null
// // Created by alberto on 13/03/19. // #include "RouteSequenceDecomposition.h" namespace genvrp { void RouteSequenceDecomposition::operator()(genvrp::Population& population, const SolverStatus& status) { // If the problem does not have enough individuals, skip decomposition. if(params.data.nbClients <= params.deco.targetMaxSpCustomers) { #ifndef BATCH_MODE std::cout << status.outPrefix << "[Decomposition] Not enough customers for decomposition (" << params.data.nbClients << " < " << params.deco.targetMaxSpCustomers << ")\n"; #endif return; } // Get an elite individual. eliteIndividual.emplace(population.getEliteIndividual(params.deco.eliteFraction)); // Get the subproblems to solve. Method getSubproblems needs to be implemented // by any class deriving from RouteSequenceDecomposition. auto subproblems = getSubproblems(*eliteIndividual, status); #ifndef BATCH_MODE std::cout << status.outPrefix << "[Decomposition] Created " << subproblems.size() << " subproblems.\n"; #endif // Skip if there is only one subproblem. if(subproblems.size() < 2u) { #ifndef BATCH_MODE std::cout << status.outPrefix << "[Decomposition] Not enough subproblems (<2).\n"; #endif return; } // New individual that we want to build starting from the subproblems solutions. auto mpIndividual = Individual{&params}; mpIndividual.routes.clear(); mpIndividual.giantTour.clear(); for(auto& subproblem : subproblems) { const std::optional<Individual> spSolution = subproblem->solve(); if(spSolution) { // Add the partial solution obtained in the subproblem to the complete // solution in the master problem individual. mergeSpSolutionIntoMpIndividual(*spSolution, mpIndividual, *subproblem); } } // Add empty routes in case the number of used vehicles decreased. for(auto r = mpIndividual.routes.size(); r < params.data.nbVehicles; ++r) { mpIndividual.routes.emplace_back(); } // Evaluate the costs of the new MP individual. mpIndividual.evaluateCompleteCost(); #ifndef BATCH_MODE std::cout << status.outPrefix << "[Decomposition] Obtained new solution of cost " << mpIndividual.cost.penalizedCost << "\n"; #endif if(mpIndividual.cost.penalizedCost >= eliteIndividual->cost.penalizedCost) { // New solution worse, or same, than elite starting one. // Because we keep the elite parts if the subproblems did not improve // on them, the new solution is never strictly worse, it can only be // the same as the elite one - in the worse case. params.stats.nSpWorsened += 1u; } else if(mpIndividual.cost.penalizedCost < eliteIndividual->cost.penalizedCost) { // New solution strictly better than elite starting one. params.stats.nSpImproved += 1u; } // Add the new individual to the population. population.addIndividualLS(&mpIndividual, true); } RouteSequenceDecomposition::SPList RouteSequenceDecomposition::getSubproblemsFromRouteIndices(const Individual& mpIndividual, const SolverStatus& status, const std::vector<int>& routeIndices) const { // List where we store the subproblems. auto sps = SPList{}; // Number of customers in the open subproblem. auto currentCustomersInSP = 0; // Indices of routes that go in the open subproblem. auto currentRoutesIds = std::vector<int>{}; for(const auto& i : routeIndices) { const auto& mpRoute = mpIndividual.routes.at(i); if(currentCustomersInSP + mpRoute.size() > params.deco.targetMaxSpCustomers) { // Adding the route would lead to too many customers: "close" the current SP. assert(!currentRoutesIds.empty()); sps.push_back(std::make_unique<SubProblem>(params, mpIndividual, status, currentRoutesIds)); // Reset current customers. currentCustomersInSP = 0; currentRoutesIds.clear(); } // Add the current route to the list of routes going into the current SP. currentRoutesIds.push_back(i); // Increase the number of customers in the open SP accordingly. currentCustomersInSP += mpRoute.size(); } // Check if we left the last subproblem open. In this case, close it. if(!currentRoutesIds.empty()) { sps.push_back(std::make_unique<SubProblem>(params, mpIndividual, status, currentRoutesIds)); } return sps; } } // namespace genvrp
41.689076
157
0.627293
alberto-santini
b057c834a9a81285ef0e662b6decf1a8d9b86531
1,727
cpp
C++
src/prod/test/LinuxRetailTests/FabricRuntime.Test.cpp
vishnuk007/service-fabric
d0afdea185ae932cc3c9eacf179692e6fddbc630
[ "MIT" ]
2,542
2018-03-14T21:56:12.000Z
2019-05-06T01:18:20.000Z
src/prod/test/LinuxRetailTests/FabricRuntime.Test.cpp
vishnuk007/service-fabric
d0afdea185ae932cc3c9eacf179692e6fddbc630
[ "MIT" ]
994
2019-05-07T02:39:30.000Z
2022-03-31T13:23:04.000Z
src/prod/test/LinuxRetailTests/FabricRuntime.Test.cpp
vishnuk007/service-fabric
d0afdea185ae932cc3c9eacf179692e6fddbc630
[ "MIT" ]
300
2018-03-14T21:57:17.000Z
2019-05-06T20:07:00.000Z
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #include "stdafx.h" #include "FabricRuntime.h" #include "FabricRuntime_.h" int TestFabricRuntime () { IID iid; FABRIC_PARTITION_ID pid; FABRIC_URI serviceName; FabricBeginCreateRuntime(iid, nullptr, 0, nullptr, nullptr); FabricEndCreateRuntime(nullptr, nullptr); FabricCreateRuntime(iid, nullptr); FabricBeginGetActivationContext(iid, 0, nullptr, nullptr); FabricEndGetActivationContext(nullptr, nullptr); FabricGetActivationContext(iid, nullptr); FabricRegisterCodePackageHost(nullptr); FabricCreateKeyValueStoreReplica(iid, nullptr, pid, 0, nullptr, (FABRIC_LOCAL_STORE_KIND) 0, nullptr, nullptr, nullptr); FabricCreateKeyValueStoreReplica2(iid, nullptr, pid, 0, nullptr, (FABRIC_LOCAL_STORE_KIND) 0, nullptr, nullptr, nullptr, (FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE) 0, nullptr); FabricCreateKeyValueStoreReplica3(iid, nullptr, pid, 0, nullptr, (FABRIC_LOCAL_STORE_KIND) 0, nullptr, nullptr, nullptr, (FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE) 0, nullptr); FabricCreateKeyValueStoreReplica4(iid, nullptr, pid, 0, serviceName, nullptr, (FABRIC_LOCAL_STORE_KIND) 0, nullptr, nullptr, nullptr, (FABRIC_KEY_VALUE_STORE_NOTIFICATION_MODE) 0, nullptr); FabricCreateKeyValueStoreReplica5(iid, nullptr, pid, 0, serviceName, nullptr, nullptr, (FABRIC_LOCAL_STORE_KIND) 0, nullptr, nullptr, nullptr, nullptr); FabricLoadReplicatorSettings(nullptr, nullptr, nullptr, nullptr); }
59.551724
193
0.727852
vishnuk007
b0597baceedf8ac1132d1d0124598f17e6fa7d0a
28,642
cpp
C++
src/suWireManager.cpp
ALIGN-analoglayout/AnalogDetailedRouter
16cf4b4ec6c6b3d5a87277607064a15d7fb4ad3d
[ "BSD-3-Clause" ]
19
2019-07-17T15:41:35.000Z
2021-12-01T23:57:57.000Z
src/suWireManager.cpp
ALIGN-analoglayout/AnalogDetailedRouter
16cf4b4ec6c6b3d5a87277607064a15d7fb4ad3d
[ "BSD-3-Clause" ]
null
null
null
src/suWireManager.cpp
ALIGN-analoglayout/AnalogDetailedRouter
16cf4b4ec6c6b3d5a87277607064a15d7fb4ad3d
[ "BSD-3-Clause" ]
2
2020-07-28T18:50:39.000Z
2022-01-24T03:13:39.000Z
// see LICENSE //! \author Ryzhenko Nikolai, 10984646, nikolai.v.ryzhenko@intel.com //! \date Mon Oct 16 13:21:31 2017 //! \file suWireManager.cpp //! \brief A collection of methods of the class suWireManager. // std includes #include <algorithm> #include <iostream> #include <map> #include <string> #include <vector> // application includes #include <suAssert.h> #include <suDefine.h> #include <suJournal.h> #include <suTypedefs.h> // other application includes #include <suLayer.h> #include <suLayerManager.h> #include <suNet.h> #include <suSatRouter.h> #include <suStatic.h> #include <suWire.h> // module include #include <suWireManager.h> namespace amsr { // ------------------------------------------------------------ // - // --- Static variables // - // ------------------------------------------------------------ suWireManager * suWireManager::_instance = 0; // ------------------------------------------------------------ // - // --- Special methods // - // ------------------------------------------------------------ //! destructor suWireManager::~suWireManager () { SUINFO(1) << "Delete suWireManager and " << _wires.size() << " wires." << std::endl; sutype::uvi_t numunreleasedwires = 0; for (const auto & iter1 : _wiresPerLayers) { const auto & map1 = iter1; for (const auto & iter2 : map1) { const auto & map2 = iter2.second; for (const auto & iter3 : map2) { const auto & map3 = iter3.second; for (const auto & iter4 : map3) { const sutype::wires_t & wires = iter4.second; if (wires.empty()) continue; // Only suWireManager keeps illegal wires; I have to release such wires here sutype::wires_t wireshardcopy = wires; for (const auto & iter5 : wireshardcopy) { suWire * wire = iter5; if (wire_is_illegal (wire)) { SUASSERT (get_wire_usage (wire) == 1, ""); // if asserts most likely wire here is already dead release_wire (wire); } } // for (const auto & iter5 : wires) { suWire * wire = iter5; //SUINFO(1) << "Found unreleased wire: wire=" << wire->to_str() << std::endl; ++numunreleasedwires; wire->_net = 0; } } } } } if (numunreleasedwires > 0) { SUISSUE("Found unreleased wires") << ": " << numunreleasedwires << std::endl; //SUASSERT (false, ""); } std::sort (_wires.begin(), _wires.end(), suStatic::compare_wires_by_id); for (sutype::uvi_t i=0; i < _wires.size(); ++i) { suWire * wire = _wires[i]; SUASSERT (i == 0 || wire->id() > _wires[i-1]->id(), ""); } sutype::uvi_t numLostWires = 0; for (sutype::uvi_t i=0, k=0; i < _numCreatedWires; ++i) { if (k < _wires.size()) { suWire * wire = _wires[k]; if (wire->id() == (sutype::id_t)i) { delete wire; ++k; continue; } } SUISSUE("Wire has been lost") << ": wire id=" << i << " has been lost" << std::endl; ++numLostWires; } if (numLostWires != 0) { SUINFO(1) << "Lost " << numLostWires << " wires." << std::endl; SUASSERT (false, ""); } } // end of suWireManager::~suWireManager // ------------------------------------------------------------ // - // --- Public static methods // - // ------------------------------------------------------------ // static void suWireManager::delete_instance () { if (suWireManager::_instance) delete suWireManager::_instance; suWireManager::_instance = 0; } // end of suWireManager::delete_instance // ------------------------------------------------------------ // - // --- Public methods // - // ------------------------------------------------------------ // sutype::svi_t suWireManager::get_wire_usage (const suWire * wire) const { SUASSERT (wire, ""); const sutype::id_t id = wire->id(); SUASSERT (id >= 0, ""); SUASSERT (id < (sutype::id_t)_wireUsage.size(), ""); return _wireUsage[id]; } // end of suWireManager::get_wire_usage // bool suWireManager::wire_is_obsolete (const suWire * wire) const { SUASSERT (wire, ""); const sutype::id_t id = wire->id(); SUASSERT (id >= 0, ""); SUASSERT (id < (sutype::id_t)_wireObsolete.size(), ""); return _wireObsolete[id]; } // end of suWireManager::wire_is_obsolete // bool suWireManager::wire_is_illegal (const suWire * wire) const { SUASSERT (wire, ""); const sutype::id_t id = wire->id(); SUASSERT (id >= 0, ""); SUASSERT (id < (sutype::id_t)_wireIllegal.size(), ""); return _wireIllegal[id]; } // end of suWireManager::wire_is_illegal // void suWireManager::mark_wire_as_obsolete (const suWire * wire) { SUASSERT (wire, ""); const sutype::id_t id = wire->id(); SUASSERT (id >= 0, ""); SUASSERT (id < (sutype::id_t)_wireObsolete.size(), ""); SUASSERT (_wireObsolete[id] == false, ""); _wireObsolete[id] = true; } // end of suWireManager::mark_wire_as_obsolete // void suWireManager::mark_wire_as_illegal (const suWire * wire) { SUASSERT (wire, ""); const sutype::id_t id = wire->id(); SUASSERT (id >= 0, ""); SUASSERT (id < (sutype::id_t)_wireIllegal.size(), ""); SUASSERT (_wireIllegal[id] == false, ""); _wireIllegal[id] = true; } // end of suWireManager::mark_wire_as_illegal // void suWireManager::keep_wire_as_illegal_if_it_is_really_illegal (const suWire * wire) { if (wire == 0) return; // do nothing //SUINFO(1) << "keep_wire_as_illegal_if_it_is_really_illegal: " << wire->to_str() << std::endl; if (wire_is_illegal (wire)) return; // do nothing if (wire->satindex() != sutype::UNDEFINED_SAT_INDEX) return; // do nothing; only legal wires can have satindex if (!suSatRouter::instance()->wire_is_legal_slow_check (wire)) { SUASSERT (get_wire_usage (wire) == 1, ""); mark_wire_as_illegal (wire); } } // end of suWireManager::keep_wire_as_illegal_if_it_is_really_illegal // void suWireManager::release_wire (suWire * wire, bool verbose) { // I can release a null wire to simplify a code where this wire is released if (!wire) { return; } release_wire_ (wire, verbose); sutype::svi_t wireusage = get_wire_usage (wire); SUASSERT (wireusage >= 0, ""); if (wireusage == 0) { unregister_wire_ (wire); } } // end of suWireManager::release_wire // suWire * suWireManager::create_wire_from_dcoords (const suNet * net, const suLayer * layer, sutype::dcoord_t x1, sutype::dcoord_t y1, sutype::dcoord_t x2, sutype::dcoord_t y2, sutype::wire_type_t wiretype) { // create seed wire suWire * wire = create_or_reuse_a_wire_ (net, layer); // geometry wire->_rect.xl (std::min (x1, x2)); wire->_rect.yl (std::min (y1, y2)); wire->_rect.xh (std::max (x1, x2)); wire->_rect.yh (std::max (y1, y2)); // type wire->_type = wiretype; return register_or_replace_wire_ (wire); } // end of suWireManager::create_wire_from_dcoords // suWire * suWireManager::create_wire_from_edge_side (const suNet * net, const suLayer * layer, sutype::dcoord_t edgel, sutype::dcoord_t edgeh, sutype::dcoord_t sidel, sutype::dcoord_t sideh, sutype::wire_type_t wiretype) { // checks SUASSERT (edgel <= edgeh, ""); SUASSERT (sidel <= sideh, ""); // create seed wire suWire * wire = create_or_reuse_a_wire_ (net, layer); // geometry wire->_rect.edgel (layer->pgd(), edgel); wire->_rect.edgeh (layer->pgd(), edgeh); wire->_rect.sidel (layer->pgd(), sidel); wire->_rect.sideh (layer->pgd(), sideh); // type wire->_type = wiretype; return register_or_replace_wire_ (wire); } // end of suWireManager::create_wire_from_edge_side // suWire * suWireManager::create_wire_from_wire (const suNet * net, const suWire * refwire, sutype::wire_type_t wiretype) { // create seed wire suWire * wire = create_or_reuse_a_wire_ (net, refwire->layer()); // geometry wire->_rect.copy (refwire->_rect); // type wire->_type = wiretype; return register_or_replace_wire_ (wire); } // end of suWireManager::create_wire_from_wire // suWire * suWireManager::create_wire_from_wire_then_shift (const suNet * net, const suWire * refwire, sutype::dcoord_t dx, sutype::dcoord_t dy, sutype::wire_type_t wiretype) { // create seed wire suWire * wire = create_or_reuse_a_wire_ (net, refwire->layer()); // geometry wire->_rect.copy (refwire->_rect); wire->_rect.shift (dx, dy); // type wire->_type = wiretype; return register_or_replace_wire_ (wire); } // end of suWireManager::create_wire_from_wire_then_shift // void suWireManager::merge_wires (sutype::wires_t & wires) { std::map<sutype::id_t,sutype::wires_t> wiresPerNet; for (const auto & iter : wires) { suWire * wire = iter; const suNet * net = wire->net(); SUASSERT (net, ""); wiresPerNet[net->id()].push_back (wire); } wires.clear(); for (auto & iter1 : wiresPerNet) { sutype::wires_t & netwires = iter1.second; std::map<sutype::id_t,sutype::wires_t> wiresPerLayer; for (const auto & iter2 : netwires) { suWire * wire = iter2; const suLayer * layer = wire->layer(); SUASSERT (layer, ""); wiresPerLayer[layer->pers_id()].push_back (wire); } for (auto & iter2 : wiresPerLayer) { sutype::wires_t & layerwires = iter2.second; merge_wires_ (layerwires); // store back wires.insert (wires.end(), layerwires.begin(), layerwires.end()); } } } // end of suWireManager::merge_wires // void suWireManager::reserve_gid_for_wire (suWire * wire, sutype::id_t gid, bool checkIfPreReserved) { if (checkIfPreReserved) { if (_reservedGids.count (gid) == 0) return; } if (_reservedGids.at (gid) != 0) { SUASSERT (false, "gid=" << gid << " is used for two or even more wires: wire0=" << _reservedGids.at(gid)->to_str() << "; wire1=" << wire->to_str()); } _reservedGids [gid] = wire; } // end of reserve_gid_for_wire // suWire * suWireManager::get_wire_by_reserved_gid (sutype::id_t gid) const { if (_reservedGids.count (gid) == 0) { SUISSUE("Could not get a wire by gid") << ": gid=" << gid << std::endl; //SUASSERT (false, "Could not get a wire by gid=" << gid); return 0; } return _reservedGids.at (gid); } // end of suWireManager::get_wire_by_reserved_gid // void suWireManager::set_permanent_gid (suWire * wire, sutype::id_t gid) { SUASSERT (gid >= 0, ""); SUASSERT (wire->gid() == sutype::UNDEFINED_GLOBAL_ID, "gid=" << gid << "; wire=" << wire->to_str()); if (gid >= (sutype::id_t)_gidToWire.size()) { _gidToWire.resize (gid+1, (suWire*)0); } SUASSERT (_gidToWire [gid] == 0, "Two wires use the same gid=" << gid << ": wire1=" << _gidToWire[gid]->to_str() << "; wire2=" << wire->to_str()); _gidToWire [gid] = wire; wire->_gid = gid; } // end of suWireManager::set_permanent_gid // sutype::wires_t suWireManager::get_wires_by_permanent_gid (const sutype::ids_t & gids, const std::string & msg) const { SUASSERT (!gids.empty(), msg << " has an empty list of wires."); sutype::wires_t wires; std::set<sutype::id_t> usedWireGIDs; bool ok = true; for (const auto & iter1 : gids) { sutype::id_t gid = iter1; if (usedWireGIDs.count (gid) > 0) { SUASSERT (false, "Wire gid=" << gid << " is used more than once in a single" << msg << "; it's better to review the input; it may be a sign of a hidden problem"); continue; } usedWireGIDs.insert (gid); if (gid < 0 || gid >= (sutype::id_t)_gidToWire.size()) { SUISSUE("Could not get a wire by gid") << ": " << gid << " to form a " << msg << std::endl; ok = false; continue; } suWire * wire = _gidToWire [gid]; if (wire == 0) { SUISSUE("Could not get a wire by gid") << ": " << gid << " to form a " << msg << std::endl; ok = false; continue; } if (wire->gid() != gid) { SUISSUE("Could not get a wire by gid") << ": " << gid << " to form a " << msg << std::endl; ok = false; continue; } if (!wire->is (sutype::wt_preroute)) { SUISSUE("Unexpected wire type") << ": " << wire->to_str() << std::endl; SUASSERT (false, ""); ok = false; continue; } wires.push_back (wire); if (wire->net() != wires.front()->net()) { SUISSUE("Wires belong to different nets") << ": Wires of one " << msg << " belong to different nets; wire1=" << wires.front()->to_str() << "; wire2=" << wire->to_str() << std::endl; SUASSERT (false, ""); ok = false; continue; } } if (wires.empty()) { SUISSUE("Cound not get enough wires") << ": to form a " << msg << ". Read messaged above." << std::endl; //SUASSERT (false, ""); ok = false; } std::sort (wires.begin(), wires.end(), suStatic::compare_wires_by_gid); if (0 && !ok) { SUASSERT (false, "Aborted because of errors found above. Read error messages."); } return wires; } // end of suWireManager::get_wires_by_permanent_gid // ------------------------------------------------------------ // - // --- Private static methods // - // ------------------------------------------------------------ // ------------------------------------------------------------ // - // --- Private methods // - // ------------------------------------------------------------ // suWire * suWireManager::create_or_reuse_a_wire_ (const suNet * net, const suLayer * layer) { if (_wires.empty()) { const unsigned num = 1024; for (unsigned n=0; n < num; ++n) { suWire * wire = new suWire (); SUASSERT (wire->id() == (sutype::id_t)_numCreatedWires, ""); ++_numCreatedWires; _wires.push_back (wire); const sutype::id_t id = wire->id(); SUASSERT (id >= 0, ""); // extend vectors for (sutype::id_t k = _wireUsage .size(); k <= id; ++k) { _wireUsage .push_back (0); } for (sutype::id_t k = _wireIllegal .size(); k <= id; ++k) { _wireIllegal .push_back (false); } for (sutype::id_t k = _wireObsolete.size(); k <= id; ++k) { _wireObsolete.push_back (false); } } } SUASSERT (!_wires.empty(), ""); suWire * wire = _wires.back(); _wires.pop_back (); // check SUASSERT (get_wire_usage (wire) == 0, ""); SUASSERT (wire_is_illegal (wire) == false, ""); SUASSERT (wire_is_obsolete (wire) == false, ""); // clean wire->_rect.clear(); wire->_satindex = sutype::UNDEFINED_SAT_INDEX; wire->_gid = sutype::UNDEFINED_GLOBAL_ID; wire->_dir = sutype::wd_any; wire->_type = sutype::wt_undefined; // set wire->_net = net; wire->_layer = layer; // make a record increment_wire_usage (wire); return wire; } // end of suWireManager::create_or_reuse_a_wire_ // void suWireManager::merge_wires_ (sutype::wires_t & wires) { if (wires.size() <= 1) return; while (1) { bool repeat = false; for (sutype::svi_t i=0; i < (sutype::svi_t)wires.size(); ++i) { for (sutype::svi_t k=i+1; k < (sutype::svi_t)wires.size(); ++k) { bool merged = merge_two_wires_if_possible_to_the_first_wire_ (i, k, wires); if (!merged) continue; wires[k] = wires.back(); wires.pop_back(); k = i; repeat = true; } } if (!repeat) break; } } // end of suWireManager::merge_wires_ // bool suWireManager::merge_two_wires_if_possible_to_the_first_wire_ (sutype::svi_t i, sutype::svi_t k, sutype::wires_t & wires) { SUASSERT (i >= 0, ""); SUASSERT (k > i, ""); SUASSERT (i < (sutype::svi_t)wires.size(), ""); SUASSERT (k < (sutype::svi_t)wires.size(), ""); suWire * wire1 = wires[i]; suWire * wire2 = wires[k]; SUASSERT (wire1->net() == wire2->net(), ""); SUASSERT (wire1->layer() == wire2->layer(), ""); // wire1 covers wire2 if (wire1->rect().covers_compeletely (wire2->rect())) { inherit_gid_ (wire1, wire2); release_wire (wire2); return true; } // wire2 covers wire1 if (wire2->rect().covers_compeletely (wire1->rect())) { inherit_gid_ (wire2, wire1); release_wire (wire1); wires[i] = wire2; return true; } sutype::wire_type_t wiretype = sutype::wt_undefined; if (wire1->is (sutype::wt_preroute) || wire2->is (sutype::wt_preroute)) wiretype = sutype::wt_preroute; // merge vertical wires if (wire1->rect().xl() == wire2->rect().xl() && wire1->rect().xh() == wire2->rect().xh() && wire1->rect().distance_to (wire2->rect(), sutype::go_ver) == 0) { sutype::dcoord_t xl = wire1->rect().xl(); sutype::dcoord_t xh = wire1->rect().xh(); sutype::dcoord_t yl = std::min (wire1->rect().yl(), wire2->rect().yl()); sutype::dcoord_t yh = std::max (wire1->rect().yh(), wire2->rect().yh()); suWire * newwire = create_wire_from_dcoords (wire1->net(), wire1->layer(), xl, yl, xh, yh, wiretype); inherit_gid_ (newwire, wire1); inherit_gid_ (newwire, wire2); release_wire (wire1); release_wire (wire2); wires[i] = newwire; return true; } // merge horizontal wires if (wire1->rect().yl() == wire2->rect().yl() && wire1->rect().yh() == wire2->rect().yh() && wire1->rect().distance_to (wire2->rect(), sutype::go_hor) == 0) { sutype::dcoord_t xl = std::min (wire1->rect().xl(), wire2->rect().xl()); sutype::dcoord_t xh = std::max (wire1->rect().xh(), wire2->rect().xh()); sutype::dcoord_t yl = wire1->rect().yl(); sutype::dcoord_t yh = wire1->rect().yh(); suWire * newwire = create_wire_from_dcoords (wire1->net(), wire1->layer(), xl, yl, xh, yh, wiretype); inherit_gid_ (newwire, wire1); inherit_gid_ (newwire, wire2); release_wire (wire1); release_wire (wire2); wires[i] = newwire; return true; } return false; } // end of suWireManager::merge_two_wires_if_possible_to_the_first_wire_ // void suWireManager::unregister_wire_ (suWire * wire0) { const suLayer * layer = wire0->layer(); SUASSERT (layer->pers_id() >= 0 && layer->pers_id() < (sutype::id_t)_wiresPerLayers.size(), ""); sutype::dcoord_t sidel0 = layer->has_pgd() ? wire0->sidel() : wire0->rect().yl(); sutype::dcoord_t sideh0 = layer->has_pgd() ? wire0->sideh() : wire0->rect().yh(); sutype::dcoord_t edgel0 = layer->has_pgd() ? wire0->edgel() : wire0->rect().xl(); sutype::wires_t & wires = _wiresPerLayers [layer->pers_id()][sidel0][sideh0][edgel0]; for (sutype::uvi_t i=0; i < wires.size(); ++i) { suWire * wire1 = wires[i]; if (wire1 != wire0) continue; wires[i] = wires.back(); wires.pop_back(); return; } SUASSERT (false, "Could not unregister a wire: " << wire0->to_str()); } // end of suWireManager::unregister_wire_ // suWire * suWireManager::register_or_replace_wire_ (suWire * wire0, bool replace) { SUASSERT (wire0->_rect.xl() <= wire0->_rect.xh(), ""); SUASSERT (wire0->_rect.yl() <= wire0->_rect.yh(), ""); //SUASSERT (wire0->type() != 0, "It's OK to have wires without any type; but I don't create such wires: " << wire0->to_str()); if (_wiresPerLayers.empty()) { init_wires_per_layers_ (); } const suLayer * layer = wire0->layer(); SUASSERT (layer->pers_id() >= 0 && layer->pers_id() < (sutype::id_t)_wiresPerLayers.size(), ""); sutype::dcoord_t sidel0 = layer->has_pgd() ? wire0->sidel() : wire0->rect().yl(); sutype::dcoord_t sideh0 = layer->has_pgd() ? wire0->sideh() : wire0->rect().yh(); sutype::dcoord_t edgel0 = layer->has_pgd() ? wire0->edgel() : wire0->rect().xl(); sutype::dcoord_t edgeh0 = layer->has_pgd() ? wire0->edgeh() : wire0->rect().xh(); sutype::wires_t & wires = _wiresPerLayers [layer->pers_id()][sidel0][sideh0][edgel0]; if (replace) { for (const auto & iter : wires) { suWire * wire1 = iter; SUASSERT (wire1->layer() == wire0->layer(), ""); if (wire1->_dir != wire0->_dir) continue; if (wire1->_type != wire0->_type) continue; if (wire1->net() != wire0->net()) continue; sutype::dcoord_t edgeh1 = layer->has_pgd() ? wire1->edgeh() : wire1->rect().xh(); if (edgeh1 != edgeh0) continue; // debug if (_debugid >= 0) { if (wire0->id() == _debugid) { SUINFO(1) << "SKIPPED wire0: " << wire0->to_str() << "; REUSED wire1: " << wire1->to_str() << std::endl; } if (wire1->id() == _debugid) { SUINFO(1) << "REUSED wire1: " << wire1->to_str() << "; instead of wire0: " << wire0->to_str() << std::endl; } } // release_wire_ (wire0, true); increment_wire_usage (wire1); return wire1; } } // register wires.push_back (wire0); // debug if (_debugid >= 0) { if (wire0->id() == _debugid) { SUINFO(1) << "REGISTERED a wire: " << wire0->to_str() << std::endl; } } // return wire0; } // suWireManager::register_or_replace_wire_ // void suWireManager::release_wire_ (suWire * wire, bool verbose) { // in this mode, wire is deleted at the end of the flow if (!verbose) { wire->_net = 0; } // clean up a feature decrement_wire_usage_ (wire); sutype::svi_t wireusage = get_wire_usage (wire); SUASSERT (wireusage >= 0, ""); if (wireusage == 0) { // clean up a feature; if (wire->gid() != sutype::UNDEFINED_GLOBAL_ID) { if (verbose) { //SUISSUE("") << "Removed a wire with non-default gid=" << wire->gid() << ": " << wire->to_str() << std::endl; //SUASSERT (wire->gid() != 461904, "Aborted by Nikolai"); } _gidToWire[wire->gid()] = 0; } _wires.push_back (wire); // clean up a feature; release a sat index if (wire->satindex() != sutype::UNDEFINED_SAT_INDEX) { suSatRouter::instance()->unregister_a_sat_wire (wire); } sutype::id_t id = wire->id(); SUASSERT (id >= 0, ""); // clean up a feature SUASSERT (id < (sutype::id_t)_wireObsolete.size(), ""); _wireObsolete[id] = false; // clean up a feature SUASSERT (id < (sutype::id_t)_wireIllegal.size(), ""); _wireIllegal[id] = false; // report if (_debugid >= 0) { if (wire->id() == _debugid) { SUINFO(1) << "RELEASED a wire: " << wire->to_str() << "; #releases=" << _num_releases << std::endl; } } } } // end of suWireManager::release_wire_ // void suWireManager::init_wires_per_layers_ () { SUASSERT (_wiresPerLayers.empty(), ""); const sutype::layers_tc & idToLayer = suLayerManager::instance()->idToLayer(); _wiresPerLayers.resize (idToLayer.size()); } // end of suWireManager::init_wires_per_layers_ // void suWireManager::increment_wire_usage (suWire * wire) { const sutype::id_t id = wire->id(); SUASSERT (id >= 0, ""); SUASSERT (id < (sutype::id_t)_wireUsage.size(), ""); SUASSERT (_wireUsage[id] >= 0, ""); ++_wireUsage[id]; if (_debugid >= 0) { if (wire->id() == _debugid) { SUINFO(1) << "INCREMENTED wire usage: " << wire->to_str() << std::endl; } } } // end of suWireManager::increment_wire_usage // void suWireManager::decrement_wire_usage_ (suWire * wire) { const sutype::id_t id = wire->id(); SUASSERT (id >= 0, ""); SUASSERT (id < (sutype::id_t)_wireUsage.size(), "id=" << id << "; _wireUsage.size()=" << _wireUsage.size()); if (_wireUsage[id] <= 0) { SUISSUE("Released wire is not marked as used") << ": Released wire id=" << id << " is not marked as used." << std::endl; if (std::find (_wires.begin(), _wires.end(), wire) != _wires.end()) { SUISSUE("Wire was already saved in the list of wires") << ": Wire id=" << id << std::endl; } //SUASSERT (false, ""); return; } --_wireUsage [id]; SUASSERT (_wireUsage [id] >= 0, ""); if (_debugid >= 0) { if (wire->id() == _debugid) { SUINFO(1) << "DECREMENTED wire usage: " << wire->to_str() << std::endl; } } } // end of suWireManager::decrement_wire_usage_ // void suWireManager::inherit_gid_ (suWire * wire1, suWire * wire2) { if (wire2->gid() == sutype::UNDEFINED_GLOBAL_ID) return; if (wire1->gid() == sutype::UNDEFINED_GLOBAL_ID) { sutype::id_t gid = wire2->gid(); SUASSERT (_gidToWire[gid] == wire2, ""); wire1->_gid = gid; wire2->_gid = sutype::UNDEFINED_GLOBAL_ID; _gidToWire[gid] = wire1; return; } SUISSUE("Could not inherit GID") << ": Two wires were merged but wire1 gid=" << wire1->gid() << " could not inherit gid=" << wire2->gid() << " of wire2: wire1=" << wire1->to_str() << "; wire2=" << wire2->to_str() << std::endl; } // end of suWireManager::inherit_gid_ } // end of namespace amsr // end of suWireManager.cpp
29.316274
189
0.506075
ALIGN-analoglayout
b059e0fd8d6cff44f05fbfac2706b115433d4d10
324
cpp
C++
0027-Remove-Element/cpp_0027/main.cpp
ooooo-youwillsee/leetcode
07b273f133c8cf755ea40b3ae9df242ce044823c
[ "MIT" ]
12
2020-03-18T14:36:23.000Z
2021-12-19T02:24:33.000Z
0027-Remove-Element/cpp_0027/main.cpp
ooooo-youwillsee/leetcode
07b273f133c8cf755ea40b3ae9df242ce044823c
[ "MIT" ]
null
null
null
0027-Remove-Element/cpp_0027/main.cpp
ooooo-youwillsee/leetcode
07b273f133c8cf755ea40b3ae9df242ce044823c
[ "MIT" ]
null
null
null
#include <iostream> #include "Solution1.h" void test(vector<int> vec, int val) { Solution s; int res = s.removeElement(vec, val); for (int i = 0; i < res; ++i) { cout << vec[i] << " "; } cout << endl; } int main() { test({1}, 1); test({1}, 2); test({3, 2, 2, 3}, 3); return 0; }
18
40
0.484568
ooooo-youwillsee
b05d29bf79f5becd8a33c7ff52e004972fc454ce
3,271
hpp
C++
src/Serialization/OptionalSerialization.hpp
ElSamaritan/blockchain-OLD
ca3422c8873613226db99b7e6735c5ea1fac9f1a
[ "Apache-2.0" ]
null
null
null
src/Serialization/OptionalSerialization.hpp
ElSamaritan/blockchain-OLD
ca3422c8873613226db99b7e6735c5ea1fac9f1a
[ "Apache-2.0" ]
null
null
null
src/Serialization/OptionalSerialization.hpp
ElSamaritan/blockchain-OLD
ca3422c8873613226db99b7e6735c5ea1fac9f1a
[ "Apache-2.0" ]
null
null
null
/* ============================================================================================== * * * * Galaxia Blockchain * * * * ---------------------------------------------------------------------------------------------- * * This file is part of the Xi framework. * * ---------------------------------------------------------------------------------------------- * * * * Copyright 2018-2019 Xi Project Developers <support.xiproject.io> * * * * 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 <https://www.gnu.org/licenses/>. * * * * ============================================================================================== */ #pragma once #include <optional> #include <type_traits> #include <cassert> #include <Xi/ExternalIncludePush.h> #include <boost/utility/value_init.hpp> #include <Xi/ExternalIncludePop.h> #include <Xi/Global.hh> #include "Serialization/ISerializer.h" namespace CryptoNote { template <typename _ValueT> [[nodiscard]] bool serialize(std::optional<_ValueT> &value, Common::StringView name, ISerializer &serializer) { using native_t = typename std::remove_cv_t<_ValueT>; static_assert(std::is_default_constructible_v<native_t>, "optional serialization expects default constructible types"); bool hasValue = value.has_value(); XI_RETURN_EC_IF_NOT(serializer.maybe(hasValue, name), false); if (serializer.isInput()) { if (hasValue) { value.emplace(); return serializer(*value, name); } else { value = std::nullopt; return true; } } else { assert(serializer.isOutput()); if (hasValue) { return serializer(*value, name); } else { return true; } } } } // namespace CryptoNote
48.820896
111
0.404769
ElSamaritan
b05fe81d015b15a01af9f2d262c503a7830c40e1
163
cpp
C++
software/main/main.cpp
PerMalmberg/IO-Card-G3
4a44c8674a88e31d72b4174ca3c24a033a5d6e6f
[ "MIT" ]
5
2019-09-19T01:27:39.000Z
2021-04-17T06:06:55.000Z
software/main/main.cpp
PerMalmberg/IO-Card-G3
4a44c8674a88e31d72b4174ca3c24a033a5d6e6f
[ "MIT" ]
19
2018-10-10T18:32:33.000Z
2022-02-12T19:38:47.000Z
software/main/main.cpp
PerMalmberg/IO-Card-G3
4a44c8674a88e31d72b4174ca3c24a033a5d6e6f
[ "MIT" ]
2
2019-10-13T11:40:50.000Z
2021-04-17T06:06:57.000Z
#include "App.h" #ifdef ESP_PLATFORM extern "C" void app_main() #else int main(int /*argc*/, char** /*argv*/) #endif { g3::App app{}; app.start(); }
12.538462
43
0.576687
PerMalmberg
b063cb22f43a50d261766d5683f084c7254b05e2
108,161
cpp
C++
Source/effects.cpp
pionere/devilutionX
63f8deb298a00b040010fc299c0568eae19522e1
[ "Unlicense" ]
2
2021-02-02T19:27:20.000Z
2022-03-07T16:50:55.000Z
Source/effects.cpp
pionere/devilutionX
63f8deb298a00b040010fc299c0568eae19522e1
[ "Unlicense" ]
null
null
null
Source/effects.cpp
pionere/devilutionX
63f8deb298a00b040010fc299c0568eae19522e1
[ "Unlicense" ]
1
2022-03-07T16:51:16.000Z
2022-03-07T16:51:16.000Z
/** * @file effects.cpp * * Implementation of functions for loading and playing sounds. */ #include "all.h" #ifndef NOSOUND #include <SDL_mixer.h> #include "utils/soundsample.h" #endif DEVILUTION_BEGIN_NAMESPACE int sfxdelay; int sfxdnum; #ifdef NOSOUND const int sgSFXSets[NUM_SFXSets][NUM_CLASSES] = { }; #else /** Specifies the sound file and the playback state of the current sound effect. */ static SFXStruct* sgpStreamSFX = NULL; /** Maps from monster sfx to monster sound letter. */ static const char MonstSndChar[NUM_MON_SFX] = { 'a', 'h', 'd', 's' }; /** List of all sounds, except monsters and music */ SFXStruct sgSFX[] = { // clang-format off //_sfx_id bFlags, pszName, pSnd /*PS_WALK1*/ { sfx_MISC, "Sfx\\Misc\\Walk1.wav", { 0, NULL } }, /*PS_WALK2*/// { sfx_MISC, "Sfx\\Misc\\Walk2.wav", { 0, NULL } }, /*PS_WALK3*/// { sfx_MISC, "Sfx\\Misc\\Walk3.wav", { 0, NULL } }, /*PS_WALK4*/// { sfx_MISC, "Sfx\\Misc\\Walk4.wav", { 0, NULL } }, /*PS_BFIRE*/ { sfx_MISC, "Sfx\\Misc\\BFire.wav", { 0, NULL } }, /*PS_FMAG*/// { sfx_MISC, "Sfx\\Misc\\Fmag.wav", { 0, NULL } }, /*PS_TMAG*/// { sfx_MISC, "Sfx\\Misc\\Tmag.wav", { 0, NULL } }, /*PS_LGHIT*/// { sfx_MISC, "Sfx\\Misc\\Lghit.wav", { 0, NULL } }, /*PS_LGHIT1*/// { sfx_MISC, "Sfx\\Misc\\Lghit1.wav", { 0, NULL } }, /*PS_SWING*/ { sfx_MISC, "Sfx\\Misc\\Swing.wav", { 0, NULL } }, /*PS_SWING2*/ { sfx_MISC, "Sfx\\Misc\\Swing2.wav", { 0, NULL } }, /*PS_DEAD*/ { sfx_MISC, "Sfx\\Misc\\Dead.wav", { 0, NULL } }, // Aaauh... /*IS_STING1*/// { sfx_MISC | sfx_HELLFIRE, "Sfx\\Misc\\Sting1.wav", { 0, NULL } }, /*IS_FBALLBOW*///{ sfx_MISC | sfx_HELLFIRE, "Sfx\\Misc\\FBallBow.wav", { 0, NULL } }, /*IS_QUESTDN*/ { sfx_STREAM, "Sfx\\Misc\\Questdon.wav", { 0, NULL } }, /*IS_ARMRFKD*/// { sfx_MISC, "Sfx\\Items\\Armrfkd.wav", { 0, NULL } }, /*IS_BARLFIRE*/ { sfx_MISC, "Sfx\\Items\\Barlfire.wav", { 0, NULL } }, /*IS_BARREL*/ { sfx_MISC, "Sfx\\Items\\Barrel.wav", { 0, NULL } }, /*IS_POPPOP8*/ { sfx_MISC | sfx_HELLFIRE, "Sfx\\Items\\PodPop8.wav", { 0, NULL } }, /*IS_POPPOP5*/ { sfx_MISC | sfx_HELLFIRE, "Sfx\\Items\\PodPop5.wav", { 0, NULL } }, /*IS_POPPOP3*/ { sfx_MISC | sfx_HELLFIRE, "Sfx\\Items\\UrnPop3.wav", { 0, NULL } }, /*IS_POPPOP2*/ { sfx_MISC | sfx_HELLFIRE, "Sfx\\Items\\UrnPop2.wav", { 0, NULL } }, /*IS_CRCLOS*/ { sfx_MISC | sfx_HELLFIRE, "Sfx\\Items\\Crclos.wav", { 0, NULL } }, /*IS_CROPEN*/ { sfx_MISC | sfx_HELLFIRE, "Sfx\\Items\\Cropen.wav", { 0, NULL } }, /*IS_BHIT*/// { sfx_MISC, "Sfx\\Items\\Bhit.wav", { 0, NULL } }, /*IS_BHIT1*/// { sfx_MISC, "Sfx\\Items\\Bhit1.wav", { 0, NULL } }, /*IS_CHEST*/ { sfx_MISC, "Sfx\\Items\\Chest.wav", { 0, NULL } }, /*IS_DOORCLOS*/ { sfx_MISC, "Sfx\\Items\\Doorclos.wav", { 0, NULL } }, /*IS_DOOROPEN*/ { sfx_MISC, "Sfx\\Items\\Dooropen.wav", { 0, NULL } }, /*IS_FANVL*/ { sfx_MISC, "Sfx\\Items\\Flipanvl.wav", { 0, NULL } }, /*IS_FAXE*/ { sfx_MISC, "Sfx\\Items\\Flipaxe.wav", { 0, NULL } }, /*IS_FBLST*/ { sfx_MISC, "Sfx\\Items\\Flipblst.wav", { 0, NULL } }, /*IS_FBODY*/ { sfx_MISC, "Sfx\\Items\\Flipbody.wav", { 0, NULL } }, /*IS_FBOOK*/ { sfx_MISC, "Sfx\\Items\\Flipbook.wav", { 0, NULL } }, /*IS_FBOW*/ { sfx_MISC, "Sfx\\Items\\Flipbow.wav", { 0, NULL } }, /*IS_FCAP*/ { sfx_MISC, "Sfx\\Items\\Flipcap.wav", { 0, NULL } }, /*IS_FHARM*/ { sfx_MISC, "Sfx\\Items\\Flipharm.wav", { 0, NULL } }, /*IS_FLARM*/ { sfx_MISC, "Sfx\\Items\\Fliplarm.wav", { 0, NULL } }, /*IS_FMAG*/// { sfx_MISC, "Sfx\\Items\\Flipmag.wav", { 0, NULL } }, /*IS_FMAG1*/// { sfx_MISC, "Sfx\\Items\\Flipmag1.wav", { 0, NULL } }, /*IS_FMUSH*/ { sfx_MISC, "Sfx\\Items\\Flipmush.wav", { 0, NULL } }, /*IS_FPOT*/ { sfx_MISC, "Sfx\\Items\\Flippot.wav", { 0, NULL } }, /*IS_FRING*/ { sfx_MISC, "Sfx\\Items\\Flipring.wav", { 0, NULL } }, /*IS_FROCK*/ { sfx_MISC, "Sfx\\Items\\Fliprock.wav", { 0, NULL } }, /*IS_FSCRL*/ { sfx_MISC, "Sfx\\Items\\Flipscrl.wav", { 0, NULL } }, /*IS_FSHLD*/ { sfx_MISC, "Sfx\\Items\\Flipshld.wav", { 0, NULL } }, /*IS_FSIGN*/// { sfx_MISC, "Sfx\\Items\\Flipsign.wav", { 0, NULL } }, /*IS_FSTAF*/ { sfx_MISC, "Sfx\\Items\\Flipstaf.wav", { 0, NULL } }, /*IS_FSWOR*/ { sfx_MISC, "Sfx\\Items\\Flipswor.wav", { 0, NULL } }, /*IS_GOLD*/ { sfx_MISC, "Sfx\\Items\\Gold.wav", { 0, NULL } }, /*IS_HLMTFKD*/// { sfx_MISC, "Sfx\\Items\\Hlmtfkd.wav", { 0, NULL } }, /*IS_IANVL*/ { sfx_MISC, "Sfx\\Items\\Invanvl.wav", { 0, NULL } }, /*IS_IAXE*/ { sfx_MISC, "Sfx\\Items\\Invaxe.wav", { 0, NULL } }, /*IS_IBLST*/ { sfx_MISC, "Sfx\\Items\\Invblst.wav", { 0, NULL } }, /*IS_IBODY*/ { sfx_MISC, "Sfx\\Items\\Invbody.wav", { 0, NULL } }, /*IS_IBOOK*/ { sfx_MISC, "Sfx\\Items\\Invbook.wav", { 0, NULL } }, /*IS_IBOW*/ { sfx_MISC, "Sfx\\Items\\Invbow.wav", { 0, NULL } }, /*IS_ICAP*/ { sfx_MISC, "Sfx\\Items\\Invcap.wav", { 0, NULL } }, /*IS_IGRAB*/ { sfx_MISC, "Sfx\\Items\\Invgrab.wav", { 0, NULL } }, /*IS_IHARM*/ { sfx_MISC, "Sfx\\Items\\Invharm.wav", { 0, NULL } }, /*IS_ILARM*/ { sfx_MISC, "Sfx\\Items\\Invlarm.wav", { 0, NULL } }, /*IS_IMUSH*/ { sfx_MISC, "Sfx\\Items\\Invmush.wav", { 0, NULL } }, /*IS_IPOT*/ { sfx_MISC, "Sfx\\Items\\Invpot.wav", { 0, NULL } }, /*IS_IRING*/ { sfx_MISC, "Sfx\\Items\\Invring.wav", { 0, NULL } }, /*IS_IROCK*/ { sfx_MISC, "Sfx\\Items\\Invrock.wav", { 0, NULL } }, /*IS_ISCROL*/ { sfx_MISC, "Sfx\\Items\\Invscrol.wav", { 0, NULL } }, /*IS_ISHIEL*/ { sfx_MISC, "Sfx\\Items\\Invshiel.wav", { 0, NULL } }, /*IS_ISIGN*/ { sfx_MISC, "Sfx\\Items\\Invsign.wav", { 0, NULL } }, /*IS_ISTAF*/ { sfx_MISC, "Sfx\\Items\\Invstaf.wav", { 0, NULL } }, /*IS_ISWORD*/ { sfx_MISC, "Sfx\\Items\\Invsword.wav", { 0, NULL } }, /*IS_LEVER*/ { sfx_MISC, "Sfx\\Items\\Lever.wav", { 0, NULL } }, /*IS_MAGIC*/ { sfx_MISC, "Sfx\\Items\\Magic.wav", { 0, NULL } }, /*IS_MAGIC1*/ { sfx_MISC, "Sfx\\Items\\Magic1.wav", { 0, NULL } }, /*IS_RBOOK*/ { sfx_MISC, "Sfx\\Items\\Readbook.wav", { 0, NULL } }, /*IS_SARC*/ { sfx_MISC, "Sfx\\Items\\Sarc.wav", { 0, NULL } }, /*IS_SHLDFKD*/// { sfx_MISC, "Sfx\\Items\\Shielfkd.wav", { 0, NULL } }, /*IS_SWRDFKD*/// { sfx_MISC, "Sfx\\Items\\Swrdfkd.wav", { 0, NULL } }, /*IS_TITLEMOV*/ { sfx_UI, "Sfx\\Items\\Titlemov.wav", { 0, NULL } }, /*IS_TITLSLCT*/ { sfx_UI, "Sfx\\Items\\Titlslct.wav", { 0, NULL } }, /*SFX_SILENCE*/ { sfx_UI, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*IS_TRAP*/ { sfx_MISC, "Sfx\\Items\\Trap.wav", { 0, NULL } }, /*IS_CAST1*/// { sfx_MISC, "Sfx\\Misc\\Cast1.wav", { 0, NULL } }, /*IS_CAST10*/// { sfx_MISC, "Sfx\\Misc\\Cast10.wav", { 0, NULL } }, /*IS_CAST12*/// { sfx_MISC, "Sfx\\Misc\\Cast12.wav", { 0, NULL } }, /*IS_CAST2*/ { sfx_MISC, "Sfx\\Misc\\Cast2.wav", { 0, NULL } }, /*IS_CAST3*/// { sfx_MISC, "Sfx\\Misc\\Cast3.wav", { 0, NULL } }, /*IS_CAST4*/ { sfx_MISC, "Sfx\\Misc\\Cast4.wav", { 0, NULL } }, /*IS_CAST5*/// { sfx_MISC, "Sfx\\Misc\\Cast5.wav", { 0, NULL } }, /*IS_CAST6*/ { sfx_MISC, "Sfx\\Misc\\Cast6.wav", { 0, NULL } }, /*IS_CAST7*/// { sfx_MISC, "Sfx\\Misc\\Cast7.wav", { 0, NULL } }, /*IS_CAST8*/ { sfx_MISC, "Sfx\\Misc\\Cast8.wav", { 0, NULL } }, /*IS_CAST9*/// { sfx_MISC, "Sfx\\Misc\\Cast9.wav", { 0, NULL } }, /*LS_HEALING*/// { sfx_MISC, "Sfx\\Misc\\Healing.wav", { 0, NULL } }, /*IS_REPAIR*/ { sfx_MISC, "Sfx\\Misc\\Repair.wav", { 0, NULL } }, /*LS_ACID*/ { sfx_MISC, "Sfx\\Misc\\Acids1.wav", { 0, NULL } }, /*LS_ACIDS*/ { sfx_MISC, "Sfx\\Misc\\Acids2.wav", { 0, NULL } }, /*LS_APOC*/// { sfx_MISC, "Sfx\\Misc\\Apoc.wav", { 0, NULL } }, /*LS_ARROWALL*///{ sfx_MISC, "Sfx\\Misc\\Arrowall.wav", { 0, NULL } }, /*LS_BLODBOIL*///{ sfx_MISC, "Sfx\\Misc\\Bldboil.wav", { 0, NULL } }, /*LS_BLODSTAR*/ { sfx_MISC, "Sfx\\Misc\\Blodstar.wav", { 0, NULL } }, /*LS_BLSIMPT*/// { sfx_MISC, "Sfx\\Misc\\Blsimpt.wav", { 0, NULL } }, /*LS_BONESP*/ { sfx_MISC, "Sfx\\Misc\\Bonesp.wav", { 0, NULL } }, /*LS_BSIMPCT*/// { sfx_MISC, "Sfx\\Misc\\Bsimpct.wav", { 0, NULL } }, /*LS_CALDRON*/ { sfx_MISC, "Sfx\\Misc\\Caldron.wav", { 0, NULL } }, /*LS_CBOLT*/ { sfx_MISC, "Sfx\\Misc\\Cbolt.wav", { 0, NULL } }, /*LS_CHLTNING*///{ sfx_MISC, "Sfx\\Misc\\Chltning.wav", { 0, NULL } }, /*LS_DSERP*/// { sfx_MISC, "Sfx\\Misc\\DSerp.wav", { 0, NULL } }, /*LS_ELECIMP1*/ { sfx_MISC, "Sfx\\Misc\\Elecimp1.wav", { 0, NULL } }, /*LS_ELEMENTL*/ { sfx_MISC, "Sfx\\Misc\\Elementl.wav", { 0, NULL } }, /*LS_ETHEREAL*/ { sfx_MISC, "Sfx\\Misc\\Ethereal.wav", { 0, NULL } }, /*LS_FBALL*/// { sfx_MISC, "Sfx\\Misc\\Fball.wav", { 0, NULL } }, /*LS_FBOLT1*/ { sfx_MISC, "Sfx\\Misc\\Fbolt1.wav", { 0, NULL } }, /*LS_FBOLT2*/// { sfx_MISC, "Sfx\\Misc\\Fbolt2.wav", { 0, NULL } }, /*LS_FIRIMP1*/// { sfx_MISC, "Sfx\\Misc\\Firimp1.wav", { 0, NULL } }, /*LS_FIRIMP2*/ { sfx_MISC, "Sfx\\Misc\\Firimp2.wav", { 0, NULL } }, /*LS_FLAMWAVE*/ { sfx_MISC, "Sfx\\Misc\\Flamwave.wav", { 0, NULL } }, /*LS_FLASH*/// { sfx_MISC, "Sfx\\Misc\\Flash.wav", { 0, NULL } }, /*LS_FOUNTAIN*/ { sfx_MISC, "Sfx\\Misc\\Fountain.wav", { 0, NULL } }, /*LS_GOLUM*/ { sfx_MISC, "Sfx\\Misc\\Golum.wav", { 0, NULL } }, /*LS_GOLUMDED*///{ sfx_MISC, "Sfx\\Misc\\Golumded.wav", { 0, NULL } }, /*LS_GSHRINE*/ { sfx_MISC, "Sfx\\Misc\\Gshrine.wav", { 0, NULL } }, /*LS_GUARD*/ { sfx_MISC, "Sfx\\Misc\\Guard.wav", { 0, NULL } }, /*LS_GUARDLAN*///{ sfx_MISC, "Sfx\\Misc\\Grdlanch.wav", { 0, NULL } }, /*LS_HOLYBOLT*/ { sfx_MISC, "Sfx\\Misc\\Holybolt.wav", { 0, NULL } }, /*LS_HYPER*/// { sfx_MISC, "Sfx\\Misc\\Hyper.wav", { 0, NULL } }, /*LS_INFRAVIS*/ { sfx_MISC, "Sfx\\Misc\\Infravis.wav", { 0, NULL } }, /*LS_INVISIBL*///{ sfx_MISC, "Sfx\\Misc\\Invisibl.wav", { 0, NULL } }, /*LS_INVPOT*/// { sfx_MISC, "Sfx\\Misc\\Invpot.wav", { 0, NULL } }, /*LS_LNING1*/ { sfx_MISC, "Sfx\\Misc\\Lning1.wav", { 0, NULL } }, /*LS_LTNING*/// { sfx_MISC, "Sfx\\Misc\\Ltning.wav", { 0, NULL } }, /*LS_MSHIELD*/ { sfx_MISC, "Sfx\\Misc\\Mshield.wav", { 0, NULL } }, /*LS_NESTXPLD*///{ sfx_MISC | sfx_HELLFIRE, "Sfx\\Misc\\NestXpld.wav", { 0, NULL } }, /*LS_NOVA*/ { sfx_MISC, "Sfx\\Misc\\Nova.wav", { 0, NULL } }, /*LS_PORTAL*/// { sfx_MISC, "Sfx\\Misc\\Portal.wav", { 0, NULL } }, /*LS_PUDDLE*/ { sfx_MISC, "Sfx\\Misc\\Puddle.wav", { 0, NULL } }, /*LS_RESUR*/ { sfx_MISC, "Sfx\\Misc\\Resur.wav", { 0, NULL } }, /*LS_SCURSE*/// { sfx_MISC, "Sfx\\Misc\\Scurse.wav", { 0, NULL } }, /*LS_SCURIMP*/ { sfx_MISC, "Sfx\\Misc\\Scurimp.wav", { 0, NULL } }, /*LS_SENTINEL*/ { sfx_MISC, "Sfx\\Misc\\Sentinel.wav", { 0, NULL } }, /*LS_SHATTER*/// { sfx_MISC, "Sfx\\Misc\\Shatter.wav", { 0, NULL } }, /*LS_SOULFIRE*///{ sfx_MISC, "Sfx\\Misc\\Soulfire.wav", { 0, NULL } }, /*LS_SPOUTLOP*///{ sfx_MISC, "Sfx\\Misc\\Spoutlop.wav", { 0, NULL } }, /*LS_SPOUTSTR*/ { sfx_MISC, "Sfx\\Misc\\Spoutstr.wav", { 0, NULL } }, /*LS_STORM*/// { sfx_MISC, "Sfx\\Misc\\Storm.wav", { 0, NULL } }, /*LS_TRAPDIS*/ { sfx_MISC, "Sfx\\Misc\\Trapdis.wav", { 0, NULL } }, /*LS_TELEPORT*/ { sfx_MISC, "Sfx\\Misc\\Teleport.wav", { 0, NULL } }, /*LS_VTHEFT*/// { sfx_MISC, "Sfx\\Misc\\Vtheft.wav", { 0, NULL } }, /*LS_WALLLOOP*/ { sfx_MISC, "Sfx\\Misc\\Wallloop.wav", { 0, NULL } }, /*LS_WALLSTRT*///{ sfx_MISC, "Sfx\\Misc\\Wallstrt.wav", { 0, NULL } }, /*LS_LMAG*/// { sfx_MISC | sfx_HELLFIRE, "Sfx\\Misc\\LMag.wav", { 0, NULL } }, /*TSFX_BMAID1*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid01.wav", { 0, NULL } }, /*TSFX_BMAID2*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid02.wav", { 0, NULL } }, /*TSFX_BMAID3*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid03.wav", { 0, NULL } }, /*TSFX_BMAID4*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid04.wav", { 0, NULL } }, /*TSFX_BMAID5*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid05.wav", { 0, NULL } }, /*TSFX_BMAID6*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid06.wav", { 0, NULL } }, /*TSFX_BMAID7*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid07.wav", { 0, NULL } }, /*TSFX_BMAID8*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid08.wav", { 0, NULL } }, /*TSFX_BMAID9*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid09.wav", { 0, NULL } }, /*TSFX_BMAID10*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid10.wav", { 0, NULL } }, /*TSFX_BMAID11*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid11.wav", { 0, NULL } }, /*TSFX_BMAID12*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid12.wav", { 0, NULL } }, /*TSFX_BMAID13*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid13.wav", { 0, NULL } }, /*TSFX_BMAID14*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid14.wav", { 0, NULL } }, /*TSFX_BMAID15*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid15.wav", { 0, NULL } }, /*TSFX_BMAID16*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid16.wav", { 0, NULL } }, /*TSFX_BMAID17*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid17.wav", { 0, NULL } }, /*TSFX_BMAID18*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid18.wav", { 0, NULL } }, /*TSFX_BMAID19*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid19.wav", { 0, NULL } }, /*TSFX_BMAID20*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid20.wav", { 0, NULL } }, /*TSFX_BMAID21*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid21.wav", { 0, NULL } }, /*TSFX_BMAID22*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid22.wav", { 0, NULL } }, /*TSFX_BMAID23*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid23.wav", { 0, NULL } }, /*TSFX_BMAID24*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid24.wav", { 0, NULL } }, /*TSFX_BMAID25*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid25.wav", { 0, NULL } }, /*TSFX_BMAID26*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid26.wav", { 0, NULL } }, /*TSFX_BMAID27*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid27.wav", { 0, NULL } }, /*TSFX_BMAID28*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid28.wav", { 0, NULL } }, /*TSFX_BMAID29*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid29.wav", { 0, NULL } }, /*TSFX_BMAID30*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid30.wav", { 0, NULL } }, /*TSFX_BMAID31*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid31.wav", { 0, NULL } }, /*TSFX_BMAID32*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid32.wav", { 0, NULL } }, /*TSFX_BMAID33*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid33.wav", { 0, NULL } }, /*TSFX_BMAID34*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid34.wav", { 0, NULL } }, /*TSFX_BMAID35*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid35.wav", { 0, NULL } }, /*TSFX_BMAID36*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid36.wav", { 0, NULL } }, /*TSFX_BMAID37*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid37.wav", { 0, NULL } }, /*TSFX_BMAID38*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid38.wav", { 0, NULL } }, /*TSFX_BMAID39*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid39.wav", { 0, NULL } }, /*TSFX_BMAID40*/ { sfx_STREAM, "Sfx\\Towners\\Bmaid40.wav", { 0, NULL } }, /*TSFX_SMITH1*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith01.wav", { 0, NULL } }, /*TSFX_SMITH2*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith02.wav", { 0, NULL } }, /*TSFX_SMITH3*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith03.wav", { 0, NULL } }, /*TSFX_SMITH4*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith04.wav", { 0, NULL } }, /*TSFX_SMITH5*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith05.wav", { 0, NULL } }, /*TSFX_SMITH6*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith06.wav", { 0, NULL } }, /*TSFX_SMITH7*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith07.wav", { 0, NULL } }, /*TSFX_SMITH8*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith08.wav", { 0, NULL } }, /*TSFX_SMITH9*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith09.wav", { 0, NULL } }, /*TSFX_SMITH10*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith10.wav", { 0, NULL } }, /*TSFX_SMITH11*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith11.wav", { 0, NULL } }, /*TSFX_SMITH12*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith12.wav", { 0, NULL } }, /*TSFX_SMITH13*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith13.wav", { 0, NULL } }, /*TSFX_SMITH14*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith14.wav", { 0, NULL } }, /*TSFX_SMITH15*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith15.wav", { 0, NULL } }, /*TSFX_SMITH16*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith16.wav", { 0, NULL } }, /*TSFX_SMITH17*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith17.wav", { 0, NULL } }, /*TSFX_SMITH18*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith18.wav", { 0, NULL } }, /*TSFX_SMITH19*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith19.wav", { 0, NULL } }, /*TSFX_SMITH20*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith20.wav", { 0, NULL } }, /*TSFX_SMITH21*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith21.wav", { 0, NULL } }, /*TSFX_SMITH22*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith22.wav", { 0, NULL } }, /*TSFX_SMITH23*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith23.wav", { 0, NULL } }, /*TSFX_SMITH24*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith24.wav", { 0, NULL } }, /*TSFX_SMITH25*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith25.wav", { 0, NULL } }, /*TSFX_SMITH26*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith26.wav", { 0, NULL } }, /*TSFX_SMITH27*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith27.wav", { 0, NULL } }, /*TSFX_SMITH28*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith28.wav", { 0, NULL } }, /*TSFX_SMITH29*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith29.wav", { 0, NULL } }, /*TSFX_SMITH30*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith30.wav", { 0, NULL } }, /*TSFX_SMITH31*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith31.wav", { 0, NULL } }, /*TSFX_SMITH32*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith32.wav", { 0, NULL } }, /*TSFX_SMITH33*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith33.wav", { 0, NULL } }, /*TSFX_SMITH34*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith34.wav", { 0, NULL } }, /*TSFX_SMITH35*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith35.wav", { 0, NULL } }, /*TSFX_SMITH36*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith36.wav", { 0, NULL } }, /*TSFX_SMITH37*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith37.wav", { 0, NULL } }, /*TSFX_SMITH38*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith38.wav", { 0, NULL } }, /*TSFX_SMITH39*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith39.wav", { 0, NULL } }, /*TSFX_SMITH40*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith40.wav", { 0, NULL } }, /*TSFX_SMITH41*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith41.wav", { 0, NULL } }, /*TSFX_SMITH42*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith42.wav", { 0, NULL } }, /*TSFX_SMITH43*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith43.wav", { 0, NULL } }, /*TSFX_SMITH44*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith44.wav", { 0, NULL } }, /*TSFX_SMITH45*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith45.wav", { 0, NULL } }, /*TSFX_SMITH46*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith46.wav", { 0, NULL } }, /*TSFX_SMITH47*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith47.wav", { 0, NULL } }, /*TSFX_SMITH48*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith48.wav", { 0, NULL } }, /*TSFX_SMITH49*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith49.wav", { 0, NULL } }, /*TSFX_SMITH50*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith50.wav", { 0, NULL } }, /*TSFX_SMITH51*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith51.wav", { 0, NULL } }, /*TSFX_SMITH52*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith52.wav", { 0, NULL } }, /*TSFX_SMITH53*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith53.wav", { 0, NULL } }, /*TSFX_SMITH54*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith54.wav", { 0, NULL } }, /*TSFX_SMITH55*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith55.wav", { 0, NULL } }, /*TSFX_SMITH56*/ { sfx_STREAM, "Sfx\\Towners\\Bsmith56.wav", { 0, NULL } }, /*TSFX_COW1*/ { sfx_STREAM, "Sfx\\Towners\\Cow1.wav", { 0, NULL } }, /*TSFX_COW2*/ { sfx_STREAM, "Sfx\\Towners\\Cow2.wav", { 0, NULL } }, /*TSFX_COW3*/// { sfx_MISC, "Sfx\\Towners\\Cow3.wav", { 0, NULL } }, /*TSFX_COW4*/// { sfx_MISC, "Sfx\\Towners\\Cow4.wav", { 0, NULL } }, /*TSFX_COW5*/// { sfx_MISC, "Sfx\\Towners\\Cow5.wav", { 0, NULL } }, /*TSFX_COW6*/// { sfx_MISC, "Sfx\\Towners\\Cow6.wav", { 0, NULL } }, /*TSFX_COW7*/// { sfx_MISC, "Sfx\\Towners\\Cow7.wav", { 0, NULL } }, /*TSFX_COW8*/// { sfx_MISC, "Sfx\\Towners\\Cow8.wav", { 0, NULL } }, /*TSFX_DEADGUY*/ { sfx_STREAM, "Sfx\\Towners\\Deadguy2.wav", { 0, NULL } }, /*TSFX_DRUNK1*/ { sfx_STREAM, "Sfx\\Towners\\Drunk01.wav", { 0, NULL } }, /*TSFX_DRUNK2*/ { sfx_STREAM, "Sfx\\Towners\\Drunk02.wav", { 0, NULL } }, /*TSFX_DRUNK3*/ { sfx_STREAM, "Sfx\\Towners\\Drunk03.wav", { 0, NULL } }, /*TSFX_DRUNK4*/ { sfx_STREAM, "Sfx\\Towners\\Drunk04.wav", { 0, NULL } }, /*TSFX_DRUNK5*/ { sfx_STREAM, "Sfx\\Towners\\Drunk05.wav", { 0, NULL } }, /*TSFX_DRUNK6*/ { sfx_STREAM, "Sfx\\Towners\\Drunk06.wav", { 0, NULL } }, /*TSFX_DRUNK7*/ { sfx_STREAM, "Sfx\\Towners\\Drunk07.wav", { 0, NULL } }, /*TSFX_DRUNK8*/ { sfx_STREAM, "Sfx\\Towners\\Drunk08.wav", { 0, NULL } }, /*TSFX_DRUNK9*/ { sfx_STREAM, "Sfx\\Towners\\Drunk09.wav", { 0, NULL } }, /*TSFX_DRUNK10*/ { sfx_STREAM, "Sfx\\Towners\\Drunk10.wav", { 0, NULL } }, /*TSFX_DRUNK11*/ { sfx_STREAM, "Sfx\\Towners\\Drunk11.wav", { 0, NULL } }, /*TSFX_DRUNK12*/ { sfx_STREAM, "Sfx\\Towners\\Drunk12.wav", { 0, NULL } }, /*TSFX_DRUNK13*/ { sfx_STREAM, "Sfx\\Towners\\Drunk13.wav", { 0, NULL } }, /*TSFX_DRUNK14*/ { sfx_STREAM, "Sfx\\Towners\\Drunk14.wav", { 0, NULL } }, /*TSFX_DRUNK15*/ { sfx_STREAM, "Sfx\\Towners\\Drunk15.wav", { 0, NULL } }, /*TSFX_DRUNK16*/ { sfx_STREAM, "Sfx\\Towners\\Drunk16.wav", { 0, NULL } }, /*TSFX_DRUNK17*/ { sfx_STREAM, "Sfx\\Towners\\Drunk17.wav", { 0, NULL } }, /*TSFX_DRUNK18*/ { sfx_STREAM, "Sfx\\Towners\\Drunk18.wav", { 0, NULL } }, /*TSFX_DRUNK19*/ { sfx_STREAM, "Sfx\\Towners\\Drunk19.wav", { 0, NULL } }, /*TSFX_DRUNK20*/ { sfx_STREAM, "Sfx\\Towners\\Drunk20.wav", { 0, NULL } }, /*TSFX_DRUNK21*/ { sfx_STREAM, "Sfx\\Towners\\Drunk21.wav", { 0, NULL } }, /*TSFX_DRUNK22*/ { sfx_STREAM, "Sfx\\Towners\\Drunk22.wav", { 0, NULL } }, /*TSFX_DRUNK23*/ { sfx_STREAM, "Sfx\\Towners\\Drunk23.wav", { 0, NULL } }, /*TSFX_DRUNK24*/ { sfx_STREAM, "Sfx\\Towners\\Drunk24.wav", { 0, NULL } }, /*TSFX_DRUNK25*/ { sfx_STREAM, "Sfx\\Towners\\Drunk25.wav", { 0, NULL } }, /*TSFX_DRUNK26*/ { sfx_STREAM, "Sfx\\Towners\\Drunk26.wav", { 0, NULL } }, /*TSFX_DRUNK27*/ { sfx_STREAM, "Sfx\\Towners\\Drunk27.wav", { 0, NULL } }, /*TSFX_DRUNK28*/ { sfx_STREAM, "Sfx\\Towners\\Drunk28.wav", { 0, NULL } }, /*TSFX_DRUNK29*/ { sfx_STREAM, "Sfx\\Towners\\Drunk29.wav", { 0, NULL } }, /*TSFX_DRUNK30*/ { sfx_STREAM, "Sfx\\Towners\\Drunk30.wav", { 0, NULL } }, /*TSFX_DRUNK31*/ { sfx_STREAM, "Sfx\\Towners\\Drunk31.wav", { 0, NULL } }, /*TSFX_DRUNK32*/ { sfx_STREAM, "Sfx\\Towners\\Drunk32.wav", { 0, NULL } }, /*TSFX_DRUNK33*/ { sfx_STREAM, "Sfx\\Towners\\Drunk33.wav", { 0, NULL } }, /*TSFX_DRUNK34*/ { sfx_STREAM, "Sfx\\Towners\\Drunk34.wav", { 0, NULL } }, /*TSFX_DRUNK35*/ { sfx_STREAM, "Sfx\\Towners\\Drunk35.wav", { 0, NULL } }, /*TSFX_HEALER1*/ { sfx_STREAM, "Sfx\\Towners\\Healer01.wav", { 0, NULL } }, /*TSFX_HEALER2*/ { sfx_STREAM, "Sfx\\Towners\\Healer02.wav", { 0, NULL } }, /*TSFX_HEALER3*/ { sfx_STREAM, "Sfx\\Towners\\Healer03.wav", { 0, NULL } }, /*TSFX_HEALER4*/ { sfx_STREAM, "Sfx\\Towners\\Healer04.wav", { 0, NULL } }, /*TSFX_HEALER5*/ { sfx_STREAM, "Sfx\\Towners\\Healer05.wav", { 0, NULL } }, /*TSFX_HEALER6*/ { sfx_STREAM, "Sfx\\Towners\\Healer06.wav", { 0, NULL } }, /*TSFX_HEALER7*/ { sfx_STREAM, "Sfx\\Towners\\Healer07.wav", { 0, NULL } }, /*TSFX_HEALER8*/ { sfx_STREAM, "Sfx\\Towners\\Healer08.wav", { 0, NULL } }, /*TSFX_HEALER9*/ { sfx_STREAM, "Sfx\\Towners\\Healer09.wav", { 0, NULL } }, /*TSFX_HEALER10*/{ sfx_STREAM, "Sfx\\Towners\\Healer10.wav", { 0, NULL } }, /*TSFX_HEALER11*/{ sfx_STREAM, "Sfx\\Towners\\Healer11.wav", { 0, NULL } }, /*TSFX_HEALER12*/{ sfx_STREAM, "Sfx\\Towners\\Healer12.wav", { 0, NULL } }, /*TSFX_HEALER13*/{ sfx_STREAM, "Sfx\\Towners\\Healer13.wav", { 0, NULL } }, /*TSFX_HEALER14*/{ sfx_STREAM, "Sfx\\Towners\\Healer14.wav", { 0, NULL } }, /*TSFX_HEALER15*/{ sfx_STREAM, "Sfx\\Towners\\Healer15.wav", { 0, NULL } }, /*TSFX_HEALER16*/{ sfx_STREAM, "Sfx\\Towners\\Healer16.wav", { 0, NULL } }, /*TSFX_HEALER17*/{ sfx_STREAM, "Sfx\\Towners\\Healer17.wav", { 0, NULL } }, /*TSFX_HEALER18*/{ sfx_STREAM, "Sfx\\Towners\\Healer18.wav", { 0, NULL } }, /*TSFX_HEALER19*/{ sfx_STREAM, "Sfx\\Towners\\Healer19.wav", { 0, NULL } }, /*TSFX_HEALER20*/{ sfx_STREAM, "Sfx\\Towners\\Healer20.wav", { 0, NULL } }, /*TSFX_HEALER21*/{ sfx_STREAM, "Sfx\\Towners\\Healer21.wav", { 0, NULL } }, /*TSFX_HEALER22*/{ sfx_STREAM, "Sfx\\Towners\\Healer22.wav", { 0, NULL } }, /*TSFX_HEALER23*/{ sfx_STREAM, "Sfx\\Towners\\Healer23.wav", { 0, NULL } }, /*TSFX_HEALER24*/{ sfx_STREAM, "Sfx\\Towners\\Healer24.wav", { 0, NULL } }, /*TSFX_HEALER25*/{ sfx_STREAM, "Sfx\\Towners\\Healer25.wav", { 0, NULL } }, /*TSFX_HEALER26*/{ sfx_STREAM, "Sfx\\Towners\\Healer26.wav", { 0, NULL } }, /*TSFX_HEALER27*/{ sfx_STREAM, "Sfx\\Towners\\Healer27.wav", { 0, NULL } }, /*TSFX_HEALER28*/{ sfx_STREAM, "Sfx\\Towners\\Healer28.wav", { 0, NULL } }, /*TSFX_HEALER29*/{ sfx_STREAM, "Sfx\\Towners\\Healer29.wav", { 0, NULL } }, /*TSFX_HEALER30*/{ sfx_STREAM, "Sfx\\Towners\\Healer30.wav", { 0, NULL } }, /*TSFX_HEALER31*/{ sfx_STREAM, "Sfx\\Towners\\Healer31.wav", { 0, NULL } }, /*TSFX_HEALER32*/{ sfx_STREAM, "Sfx\\Towners\\Healer32.wav", { 0, NULL } }, /*TSFX_HEALER33*/{ sfx_STREAM, "Sfx\\Towners\\Healer33.wav", { 0, NULL } }, /*TSFX_HEALER34*/{ sfx_STREAM, "Sfx\\Towners\\Healer34.wav", { 0, NULL } }, /*TSFX_HEALER35*/{ sfx_STREAM, "Sfx\\Towners\\Healer35.wav", { 0, NULL } }, /*TSFX_HEALER36*/{ sfx_STREAM, "Sfx\\Towners\\Healer36.wav", { 0, NULL } }, /*TSFX_HEALER37*/{ sfx_STREAM, "Sfx\\Towners\\Healer37.wav", { 0, NULL } }, /*TSFX_HEALER38*/{ sfx_STREAM, "Sfx\\Towners\\Healer38.wav", { 0, NULL } }, /*TSFX_HEALER39*/{ sfx_STREAM, "Sfx\\Towners\\Healer39.wav", { 0, NULL } }, /*TSFX_HEALER40*/{ sfx_STREAM, "Sfx\\Towners\\Healer40.wav", { 0, NULL } }, /*TSFX_HEALER41*/{ sfx_STREAM, "Sfx\\Towners\\Healer41.wav", { 0, NULL } }, /*TSFX_HEALER42*/{ sfx_STREAM, "Sfx\\Towners\\Healer42.wav", { 0, NULL } }, /*TSFX_HEALER43*/{ sfx_STREAM, "Sfx\\Towners\\Healer43.wav", { 0, NULL } }, /*TSFX_HEALER44*/{ sfx_STREAM, "Sfx\\Towners\\Healer44.wav", { 0, NULL } }, /*TSFX_HEALER45*/{ sfx_STREAM, "Sfx\\Towners\\Healer45.wav", { 0, NULL } }, /*TSFX_HEALER46*/{ sfx_STREAM, "Sfx\\Towners\\Healer46.wav", { 0, NULL } }, /*TSFX_HEALER47*/{ sfx_STREAM, "Sfx\\Towners\\Healer47.wav", { 0, NULL } }, /*TSFX_PEGBOY1*/ { sfx_STREAM, "Sfx\\Towners\\Pegboy01.wav", { 0, NULL } }, /*TSFX_PEGBOY2*/ { sfx_STREAM, "Sfx\\Towners\\Pegboy02.wav", { 0, NULL } }, /*TSFX_PEGBOY3*/ { sfx_STREAM, "Sfx\\Towners\\Pegboy03.wav", { 0, NULL } }, /*TSFX_PEGBOY4*/ { sfx_STREAM, "Sfx\\Towners\\Pegboy04.wav", { 0, NULL } }, /*TSFX_PEGBOY5*/ { sfx_STREAM, "Sfx\\Towners\\Pegboy05.wav", { 0, NULL } }, /*TSFX_PEGBOY6*/ { sfx_STREAM, "Sfx\\Towners\\Pegboy06.wav", { 0, NULL } }, /*TSFX_PEGBOY7*/ { sfx_STREAM, "Sfx\\Towners\\Pegboy07.wav", { 0, NULL } }, /*TSFX_PEGBOY8*/ { sfx_STREAM, "Sfx\\Towners\\Pegboy08.wav", { 0, NULL } }, /*TSFX_PEGBOY9*/ { sfx_STREAM, "Sfx\\Towners\\Pegboy09.wav", { 0, NULL } }, /*TSFX_PEGBOY10*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy10.wav", { 0, NULL } }, /*TSFX_PEGBOY11*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy11.wav", { 0, NULL } }, /*TSFX_PEGBOY12*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy12.wav", { 0, NULL } }, /*TSFX_PEGBOY13*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy13.wav", { 0, NULL } }, /*TSFX_PEGBOY14*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy14.wav", { 0, NULL } }, /*TSFX_PEGBOY15*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy15.wav", { 0, NULL } }, /*TSFX_PEGBOY16*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy16.wav", { 0, NULL } }, /*TSFX_PEGBOY17*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy17.wav", { 0, NULL } }, /*TSFX_PEGBOY18*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy18.wav", { 0, NULL } }, /*TSFX_PEGBOY19*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy19.wav", { 0, NULL } }, /*TSFX_PEGBOY20*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy20.wav", { 0, NULL } }, /*TSFX_PEGBOY21*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy21.wav", { 0, NULL } }, /*TSFX_PEGBOY22*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy22.wav", { 0, NULL } }, /*TSFX_PEGBOY23*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy23.wav", { 0, NULL } }, /*TSFX_PEGBOY24*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy24.wav", { 0, NULL } }, /*TSFX_PEGBOY25*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy25.wav", { 0, NULL } }, /*TSFX_PEGBOY26*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy26.wav", { 0, NULL } }, /*TSFX_PEGBOY27*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy27.wav", { 0, NULL } }, /*TSFX_PEGBOY28*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy28.wav", { 0, NULL } }, /*TSFX_PEGBOY29*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy29.wav", { 0, NULL } }, /*TSFX_PEGBOY30*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy30.wav", { 0, NULL } }, /*TSFX_PEGBOY31*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy31.wav", { 0, NULL } }, /*TSFX_PEGBOY32*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy32.wav", { 0, NULL } }, /*TSFX_PEGBOY33*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy33.wav", { 0, NULL } }, /*TSFX_PEGBOY34*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy34.wav", { 0, NULL } }, /*TSFX_PEGBOY35*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy35.wav", { 0, NULL } }, /*TSFX_PEGBOY36*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy36.wav", { 0, NULL } }, /*TSFX_PEGBOY37*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy37.wav", { 0, NULL } }, /*TSFX_PEGBOY38*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy38.wav", { 0, NULL } }, /*TSFX_PEGBOY39*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy39.wav", { 0, NULL } }, /*TSFX_PEGBOY40*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy40.wav", { 0, NULL } }, /*TSFX_PEGBOY41*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy41.wav", { 0, NULL } }, /*TSFX_PEGBOY42*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy42.wav", { 0, NULL } }, /*TSFX_PEGBOY43*/{ sfx_STREAM, "Sfx\\Towners\\Pegboy43.wav", { 0, NULL } }, /*TSFX_PRIEST0*/ { sfx_STREAM, "Sfx\\Towners\\Priest00.wav", { 0, NULL } }, /*TSFX_PRIEST1*/ { sfx_STREAM, "Sfx\\Towners\\Priest01.wav", { 0, NULL } }, /*TSFX_PRIEST2*/ { sfx_STREAM, "Sfx\\Towners\\Priest02.wav", { 0, NULL } }, /*TSFX_PRIEST3*/ { sfx_STREAM, "Sfx\\Towners\\Priest03.wav", { 0, NULL } }, /*TSFX_PRIEST4*/ { sfx_STREAM, "Sfx\\Towners\\Priest04.wav", { 0, NULL } }, /*TSFX_PRIEST5*/ { sfx_STREAM, "Sfx\\Towners\\Priest05.wav", { 0, NULL } }, /*TSFX_PRIEST6*/ { sfx_STREAM, "Sfx\\Towners\\Priest06.wav", { 0, NULL } }, /*TSFX_PRIEST7*/ { sfx_STREAM, "Sfx\\Towners\\Priest07.wav", { 0, NULL } }, /*TSFX_STORY0*/ { sfx_STREAM, "Sfx\\Towners\\Storyt00.wav", { 0, NULL } }, /*TSFX_STORY1*/ { sfx_STREAM, "Sfx\\Towners\\Storyt01.wav", { 0, NULL } }, /*TSFX_STORY2*/ { sfx_STREAM, "Sfx\\Towners\\Storyt02.wav", { 0, NULL } }, /*TSFX_STORY3*/ { sfx_STREAM, "Sfx\\Towners\\Storyt03.wav", { 0, NULL } }, /*TSFX_STORY4*/ { sfx_STREAM, "Sfx\\Towners\\Storyt04.wav", { 0, NULL } }, /*TSFX_STORY5*/ { sfx_STREAM, "Sfx\\Towners\\Storyt05.wav", { 0, NULL } }, /*TSFX_STORY6*/ { sfx_STREAM, "Sfx\\Towners\\Storyt06.wav", { 0, NULL } }, /*TSFX_STORY7*/ { sfx_STREAM, "Sfx\\Towners\\Storyt07.wav", { 0, NULL } }, /*TSFX_STORY8*/ { sfx_STREAM, "Sfx\\Towners\\Storyt08.wav", { 0, NULL } }, /*TSFX_STORY9*/ { sfx_STREAM, "Sfx\\Towners\\Storyt09.wav", { 0, NULL } }, /*TSFX_STORY10*/ { sfx_STREAM, "Sfx\\Towners\\Storyt10.wav", { 0, NULL } }, /*TSFX_STORY11*/ { sfx_STREAM, "Sfx\\Towners\\Storyt11.wav", { 0, NULL } }, /*TSFX_STORY12*/ { sfx_STREAM, "Sfx\\Towners\\Storyt12.wav", { 0, NULL } }, /*TSFX_STORY13*/ { sfx_STREAM, "Sfx\\Towners\\Storyt13.wav", { 0, NULL } }, /*TSFX_STORY14*/ { sfx_STREAM, "Sfx\\Towners\\Storyt14.wav", { 0, NULL } }, /*TSFX_STORY15*/ { sfx_STREAM, "Sfx\\Towners\\Storyt15.wav", { 0, NULL } }, /*TSFX_STORY16*/ { sfx_STREAM, "Sfx\\Towners\\Storyt16.wav", { 0, NULL } }, /*TSFX_STORY17*/ { sfx_STREAM, "Sfx\\Towners\\Storyt17.wav", { 0, NULL } }, /*TSFX_STORY18*/ { sfx_STREAM, "Sfx\\Towners\\Storyt18.wav", { 0, NULL } }, /*TSFX_STORY19*/ { sfx_STREAM, "Sfx\\Towners\\Storyt19.wav", { 0, NULL } }, /*TSFX_STORY20*/ { sfx_STREAM, "Sfx\\Towners\\Storyt20.wav", { 0, NULL } }, /*TSFX_STORY21*/ { sfx_STREAM, "Sfx\\Towners\\Storyt21.wav", { 0, NULL } }, /*TSFX_STORY22*/ { sfx_STREAM, "Sfx\\Towners\\Storyt22.wav", { 0, NULL } }, /*TSFX_STORY23*/ { sfx_STREAM, "Sfx\\Towners\\Storyt23.wav", { 0, NULL } }, /*TSFX_STORY24*/ { sfx_STREAM, "Sfx\\Towners\\Storyt24.wav", { 0, NULL } }, /*TSFX_STORY25*/ { sfx_STREAM, "Sfx\\Towners\\Storyt25.wav", { 0, NULL } }, /*TSFX_STORY26*/ { sfx_STREAM, "Sfx\\Towners\\Storyt26.wav", { 0, NULL } }, /*TSFX_STORY27*/ { sfx_STREAM, "Sfx\\Towners\\Storyt27.wav", { 0, NULL } }, /*TSFX_STORY28*/ { sfx_STREAM, "Sfx\\Towners\\Storyt28.wav", { 0, NULL } }, /*TSFX_STORY29*/ { sfx_STREAM, "Sfx\\Towners\\Storyt29.wav", { 0, NULL } }, /*TSFX_STORY30*/ { sfx_STREAM, "Sfx\\Towners\\Storyt30.wav", { 0, NULL } }, /*TSFX_STORY31*/ { sfx_STREAM, "Sfx\\Towners\\Storyt31.wav", { 0, NULL } }, /*TSFX_STORY32*/ { sfx_STREAM, "Sfx\\Towners\\Storyt32.wav", { 0, NULL } }, /*TSFX_STORY33*/ { sfx_STREAM, "Sfx\\Towners\\Storyt33.wav", { 0, NULL } }, /*TSFX_STORY34*/ { sfx_STREAM, "Sfx\\Towners\\Storyt34.wav", { 0, NULL } }, /*TSFX_STORY35*/ { sfx_STREAM, "Sfx\\Towners\\Storyt35.wav", { 0, NULL } }, /*TSFX_STORY36*/ { sfx_STREAM, "Sfx\\Towners\\Storyt36.wav", { 0, NULL } }, /*TSFX_STORY37*/ { sfx_STREAM, "Sfx\\Towners\\Storyt37.wav", { 0, NULL } }, /*TSFX_STORY38*/ { sfx_STREAM, "Sfx\\Towners\\Storyt38.wav", { 0, NULL } }, /*TSFX_TAVERN0*/ { sfx_STREAM, "Sfx\\Towners\\Tavown00.wav", { 0, NULL } }, /*TSFX_TAVERN1*/ { sfx_STREAM, "Sfx\\Towners\\Tavown01.wav", { 0, NULL } }, /*TSFX_TAVERN2*/ { sfx_STREAM, "Sfx\\Towners\\Tavown02.wav", { 0, NULL } }, /*TSFX_TAVERN3*/ { sfx_STREAM, "Sfx\\Towners\\Tavown03.wav", { 0, NULL } }, /*TSFX_TAVERN4*/ { sfx_STREAM, "Sfx\\Towners\\Tavown04.wav", { 0, NULL } }, /*TSFX_TAVERN5*/ { sfx_STREAM, "Sfx\\Towners\\Tavown05.wav", { 0, NULL } }, /*TSFX_TAVERN6*/ { sfx_STREAM, "Sfx\\Towners\\Tavown06.wav", { 0, NULL } }, /*TSFX_TAVERN7*/ { sfx_STREAM, "Sfx\\Towners\\Tavown07.wav", { 0, NULL } }, /*TSFX_TAVERN8*/ { sfx_STREAM, "Sfx\\Towners\\Tavown08.wav", { 0, NULL } }, /*TSFX_TAVERN9*/ { sfx_STREAM, "Sfx\\Towners\\Tavown09.wav", { 0, NULL } }, /*TSFX_TAVERN10*/{ sfx_STREAM, "Sfx\\Towners\\Tavown10.wav", { 0, NULL } }, /*TSFX_TAVERN11*/{ sfx_STREAM, "Sfx\\Towners\\Tavown11.wav", { 0, NULL } }, /*TSFX_TAVERN12*/{ sfx_STREAM, "Sfx\\Towners\\Tavown12.wav", { 0, NULL } }, /*TSFX_TAVERN13*/{ sfx_STREAM, "Sfx\\Towners\\Tavown13.wav", { 0, NULL } }, /*TSFX_TAVERN14*/{ sfx_STREAM, "Sfx\\Towners\\Tavown14.wav", { 0, NULL } }, /*TSFX_TAVERN15*/{ sfx_STREAM, "Sfx\\Towners\\Tavown15.wav", { 0, NULL } }, /*TSFX_TAVERN16*/{ sfx_STREAM, "Sfx\\Towners\\Tavown16.wav", { 0, NULL } }, /*TSFX_TAVERN17*/{ sfx_STREAM, "Sfx\\Towners\\Tavown17.wav", { 0, NULL } }, /*TSFX_TAVERN18*/{ sfx_STREAM, "Sfx\\Towners\\Tavown18.wav", { 0, NULL } }, /*TSFX_TAVERN19*/{ sfx_STREAM, "Sfx\\Towners\\Tavown19.wav", { 0, NULL } }, /*TSFX_TAVERN20*/{ sfx_STREAM, "Sfx\\Towners\\Tavown20.wav", { 0, NULL } }, /*TSFX_TAVERN21*/{ sfx_STREAM, "Sfx\\Towners\\Tavown21.wav", { 0, NULL } }, /*TSFX_TAVERN22*/{ sfx_STREAM, "Sfx\\Towners\\Tavown22.wav", { 0, NULL } }, /*TSFX_TAVERN23*/{ sfx_STREAM, "Sfx\\Towners\\Tavown23.wav", { 0, NULL } }, /*TSFX_TAVERN24*/{ sfx_STREAM, "Sfx\\Towners\\Tavown24.wav", { 0, NULL } }, /*TSFX_TAVERN25*/{ sfx_STREAM, "Sfx\\Towners\\Tavown25.wav", { 0, NULL } }, /*TSFX_TAVERN26*/{ sfx_STREAM, "Sfx\\Towners\\Tavown26.wav", { 0, NULL } }, /*TSFX_TAVERN27*/{ sfx_STREAM, "Sfx\\Towners\\Tavown27.wav", { 0, NULL } }, /*TSFX_TAVERN28*/{ sfx_STREAM, "Sfx\\Towners\\Tavown28.wav", { 0, NULL } }, /*TSFX_TAVERN29*/{ sfx_STREAM, "Sfx\\Towners\\Tavown29.wav", { 0, NULL } }, /*TSFX_TAVERN30*/{ sfx_STREAM, "Sfx\\Towners\\Tavown30.wav", { 0, NULL } }, /*TSFX_TAVERN31*/{ sfx_STREAM, "Sfx\\Towners\\Tavown31.wav", { 0, NULL } }, /*TSFX_TAVERN32*/{ sfx_STREAM, "Sfx\\Towners\\Tavown32.wav", { 0, NULL } }, /*TSFX_TAVERN33*/{ sfx_STREAM, "Sfx\\Towners\\Tavown33.wav", { 0, NULL } }, /*TSFX_TAVERN34*/{ sfx_STREAM, "Sfx\\Towners\\Tavown34.wav", { 0, NULL } }, /*TSFX_TAVERN35*/{ sfx_STREAM, "Sfx\\Towners\\Tavown35.wav", { 0, NULL } }, /*TSFX_TAVERN36*/{ sfx_STREAM, "Sfx\\Towners\\Tavown36.wav", { 0, NULL } }, /*TSFX_TAVERN37*/{ sfx_STREAM, "Sfx\\Towners\\Tavown37.wav", { 0, NULL } }, /*TSFX_TAVERN38*/{ sfx_STREAM, "Sfx\\Towners\\Tavown38.wav", { 0, NULL } }, /*TSFX_TAVERN39*/{ sfx_STREAM, "Sfx\\Towners\\Tavown39.wav", { 0, NULL } }, /*TSFX_TAVERN40*/{ sfx_STREAM, "Sfx\\Towners\\Tavown40.wav", { 0, NULL } }, /*TSFX_TAVERN41*/{ sfx_STREAM, "Sfx\\Towners\\Tavown41.wav", { 0, NULL } }, /*TSFX_TAVERN42*/{ sfx_STREAM, "Sfx\\Towners\\Tavown42.wav", { 0, NULL } }, /*TSFX_TAVERN43*/{ sfx_STREAM, "Sfx\\Towners\\Tavown43.wav", { 0, NULL } }, /*TSFX_TAVERN44*/{ sfx_STREAM, "Sfx\\Towners\\Tavown44.wav", { 0, NULL } }, /*TSFX_TAVERN45*/{ sfx_STREAM, "Sfx\\Towners\\Tavown45.wav", { 0, NULL } }, /*TSFX_WITCH1*/ { sfx_STREAM, "Sfx\\Towners\\Witch01.wav", { 0, NULL } }, /*TSFX_WITCH2*/ { sfx_STREAM, "Sfx\\Towners\\Witch02.wav", { 0, NULL } }, /*TSFX_WITCH3*/ { sfx_STREAM, "Sfx\\Towners\\Witch03.wav", { 0, NULL } }, /*TSFX_WITCH4*/ { sfx_STREAM, "Sfx\\Towners\\Witch04.wav", { 0, NULL } }, /*TSFX_WITCH5*/ { sfx_STREAM, "Sfx\\Towners\\Witch05.wav", { 0, NULL } }, /*TSFX_WITCH6*/ { sfx_STREAM, "Sfx\\Towners\\Witch06.wav", { 0, NULL } }, /*TSFX_WITCH7*/ { sfx_STREAM, "Sfx\\Towners\\Witch07.wav", { 0, NULL } }, /*TSFX_WITCH8*/ { sfx_STREAM, "Sfx\\Towners\\Witch08.wav", { 0, NULL } }, /*TSFX_WITCH9*/ { sfx_STREAM, "Sfx\\Towners\\Witch09.wav", { 0, NULL } }, /*TSFX_WITCH10*/ { sfx_STREAM, "Sfx\\Towners\\Witch10.wav", { 0, NULL } }, /*TSFX_WITCH11*/ { sfx_STREAM, "Sfx\\Towners\\Witch11.wav", { 0, NULL } }, /*TSFX_WITCH12*/ { sfx_STREAM, "Sfx\\Towners\\Witch12.wav", { 0, NULL } }, /*TSFX_WITCH13*/ { sfx_STREAM, "Sfx\\Towners\\Witch13.wav", { 0, NULL } }, /*TSFX_WITCH14*/ { sfx_STREAM, "Sfx\\Towners\\Witch14.wav", { 0, NULL } }, /*TSFX_WITCH15*/ { sfx_STREAM, "Sfx\\Towners\\Witch15.wav", { 0, NULL } }, /*TSFX_WITCH16*/ { sfx_STREAM, "Sfx\\Towners\\Witch16.wav", { 0, NULL } }, /*TSFX_WITCH17*/ { sfx_STREAM, "Sfx\\Towners\\Witch17.wav", { 0, NULL } }, /*TSFX_WITCH18*/ { sfx_STREAM, "Sfx\\Towners\\Witch18.wav", { 0, NULL } }, /*TSFX_WITCH19*/ { sfx_STREAM, "Sfx\\Towners\\Witch19.wav", { 0, NULL } }, /*TSFX_WITCH20*/ { sfx_STREAM, "Sfx\\Towners\\Witch20.wav", { 0, NULL } }, /*TSFX_WITCH21*/ { sfx_STREAM, "Sfx\\Towners\\Witch21.wav", { 0, NULL } }, /*TSFX_WITCH22*/ { sfx_STREAM, "Sfx\\Towners\\Witch22.wav", { 0, NULL } }, /*TSFX_WITCH23*/ { sfx_STREAM, "Sfx\\Towners\\Witch23.wav", { 0, NULL } }, /*TSFX_WITCH24*/ { sfx_STREAM, "Sfx\\Towners\\Witch24.wav", { 0, NULL } }, /*TSFX_WITCH25*/ { sfx_STREAM, "Sfx\\Towners\\Witch25.wav", { 0, NULL } }, /*TSFX_WITCH26*/ { sfx_STREAM, "Sfx\\Towners\\Witch26.wav", { 0, NULL } }, /*TSFX_WITCH27*/ { sfx_STREAM, "Sfx\\Towners\\Witch27.wav", { 0, NULL } }, /*TSFX_WITCH28*/ { sfx_STREAM, "Sfx\\Towners\\Witch28.wav", { 0, NULL } }, /*TSFX_WITCH29*/ { sfx_STREAM, "Sfx\\Towners\\Witch29.wav", { 0, NULL } }, /*TSFX_WITCH30*/ { sfx_STREAM, "Sfx\\Towners\\Witch30.wav", { 0, NULL } }, /*TSFX_WITCH31*/ { sfx_STREAM, "Sfx\\Towners\\Witch31.wav", { 0, NULL } }, /*TSFX_WITCH32*/ { sfx_STREAM, "Sfx\\Towners\\Witch32.wav", { 0, NULL } }, /*TSFX_WITCH33*/ { sfx_STREAM, "Sfx\\Towners\\Witch33.wav", { 0, NULL } }, /*TSFX_WITCH34*/ { sfx_STREAM, "Sfx\\Towners\\Witch34.wav", { 0, NULL } }, /*TSFX_WITCH35*/ { sfx_STREAM, "Sfx\\Towners\\Witch35.wav", { 0, NULL } }, /*TSFX_WITCH36*/ { sfx_STREAM, "Sfx\\Towners\\Witch36.wav", { 0, NULL } }, /*TSFX_WITCH37*/ { sfx_STREAM, "Sfx\\Towners\\Witch37.wav", { 0, NULL } }, /*TSFX_WITCH38*/ { sfx_STREAM, "Sfx\\Towners\\Witch38.wav", { 0, NULL } }, /*TSFX_WITCH39*/ { sfx_STREAM, "Sfx\\Towners\\Witch39.wav", { 0, NULL } }, /*TSFX_WITCH40*/ { sfx_STREAM, "Sfx\\Towners\\Witch40.wav", { 0, NULL } }, /*TSFX_WITCH41*/ { sfx_STREAM, "Sfx\\Towners\\Witch41.wav", { 0, NULL } }, /*TSFX_WITCH42*/ { sfx_STREAM, "Sfx\\Towners\\Witch42.wav", { 0, NULL } }, /*TSFX_WITCH43*/ { sfx_STREAM, "Sfx\\Towners\\Witch43.wav", { 0, NULL } }, /*TSFX_WITCH44*/ { sfx_STREAM, "Sfx\\Towners\\Witch44.wav", { 0, NULL } }, /*TSFX_WITCH45*/ { sfx_STREAM, "Sfx\\Towners\\Witch45.wav", { 0, NULL } }, /*TSFX_WITCH46*/ { sfx_STREAM, "Sfx\\Towners\\Witch46.wav", { 0, NULL } }, /*TSFX_WITCH47*/ { sfx_STREAM, "Sfx\\Towners\\Witch47.wav", { 0, NULL } }, /*TSFX_WITCH48*/ { sfx_STREAM, "Sfx\\Towners\\Witch48.wav", { 0, NULL } }, /*TSFX_WITCH49*/ { sfx_STREAM, "Sfx\\Towners\\Witch49.wav", { 0, NULL } }, /*TSFX_WITCH50*/ { sfx_STREAM, "Sfx\\Towners\\Witch50.wav", { 0, NULL } }, /*TSFX_WOUND*/ { sfx_STREAM, "Sfx\\Towners\\Wound01.wav", { 0, NULL } }, /*PS_MAGE1*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage01.wav", { 0, NULL } }, /*PS_MAGE2*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage02.wav", { 0, NULL } }, /*PS_MAGE3*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage03.wav", { 0, NULL } }, /*PS_MAGE4*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage04.wav", { 0, NULL } }, /*PS_MAGE5*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage05.wav", { 0, NULL } }, /*PS_MAGE6*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage06.wav", { 0, NULL } }, /*PS_MAGE7*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage07.wav", { 0, NULL } }, /*PS_MAGE8*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage08.wav", { 0, NULL } }, /*PS_MAGE9*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage09.wav", { 0, NULL } }, /*PS_MAGE10*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage10.wav", { 0, NULL } }, /*PS_MAGE11*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage11.wav", { 0, NULL } }, /*PS_MAGE12*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage12.wav", { 0, NULL } }, /*PS_MAGE13*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage13.wav", { 0, NULL } }, // I can not use this yet. /*PS_MAGE14*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage14.wav", { 0, NULL } }, // I can not carry any more /*PS_MAGE15*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage15.wav", { 0, NULL } }, // I have no room. /*PS_MAGE16*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage16.wav", { 0, NULL } }, // Where would I put this? /*PS_MAGE17*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage17.wav", { 0, NULL } }, // No way. /*PS_MAGE18*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage18.wav", { 0, NULL } }, // Not a chance. /*PS_MAGE19*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage19.wav", { 0, NULL } }, /*PS_MAGE20*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage20.wav", { 0, NULL } }, /*PS_MAGE21*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage21.wav", { 0, NULL } }, /*PS_MAGE22*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage22.wav", { 0, NULL } }, /*PS_MAGE23*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage23.wav", { 0, NULL } }, /*PS_MAGE24*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage24.wav", { 0, NULL } }, // I can not open this. Yet. /*PS_MAGE25*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage25.wav", { 0, NULL } }, /*PS_MAGE26*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage26.wav", { 0, NULL } }, /*PS_MAGE27*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage27.wav", { 0, NULL } }, // I can not cast that here. /*PS_MAGE28*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage28.wav", { 0, NULL } }, /*PS_MAGE29*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage29.wav", { 0, NULL } }, /*PS_MAGE30*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage30.wav", { 0, NULL } }, /*PS_MAGE31*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage31.wav", { 0, NULL } }, /*PS_MAGE32*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage32.wav", { 0, NULL } }, /*PS_MAGE33*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage33.wav", { 0, NULL } }, /*PS_MAGE34*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage34.wav", { 0, NULL } }, // I do not have a spell ready. /*PS_MAGE35*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage35.wav", { 0, NULL } }, // Not enough mana. /*PS_MAGE36*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage36.wav", { 0, NULL } }, /*PS_MAGE37*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage37.wav", { 0, NULL } }, /*PS_MAGE38*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage38.wav", { 0, NULL } }, /*PS_MAGE39*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage39.wav", { 0, NULL } }, /*PS_MAGE40*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage40.wav", { 0, NULL } }, /*PS_MAGE41*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage41.wav", { 0, NULL } }, /*PS_MAGE42*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage42.wav", { 0, NULL } }, /*PS_MAGE43*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage43.wav", { 0, NULL } }, /*PS_MAGE44*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage44.wav", { 0, NULL } }, /*PS_MAGE45*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage45.wav", { 0, NULL } }, /*PS_MAGE46*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage46.wav", { 0, NULL } }, /*PS_MAGE47*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage47.wav", { 0, NULL } }, /*PS_MAGE48*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage48.wav", { 0, NULL } }, /*PS_MAGE49*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage49.wav", { 0, NULL } }, /*PS_MAGE50*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage50.wav", { 0, NULL } }, /*PS_MAGE51*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage51.wav", { 0, NULL } }, /*PS_MAGE52*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage52.wav", { 0, NULL } }, /*PS_MAGE53*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage53.wav", { 0, NULL } }, /*PS_MAGE54*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage54.wav", { 0, NULL } }, /*PS_MAGE55*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage55.wav", { 0, NULL } }, /*PS_MAGE56*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage56.wav", { 0, NULL } }, /*PS_MAGE57*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage57.wav", { 0, NULL } }, /*PS_MAGE58*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage58.wav", { 0, NULL } }, /*PS_MAGE59*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage59.wav", { 0, NULL } }, /*PS_MAGE60*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage60.wav", { 0, NULL } }, /*PS_MAGE61*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage61.wav", { 0, NULL } }, /*PS_MAGE62*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage62.wav", { 0, NULL } }, /*PS_MAGE63*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage63.wav", { 0, NULL } }, /*PS_MAGE64*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage64.wav", { 0, NULL } }, /*PS_MAGE65*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage65.wav", { 0, NULL } }, /*PS_MAGE66*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage66.wav", { 0, NULL } }, /*PS_MAGE67*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage67.wav", { 0, NULL } }, /*PS_MAGE68*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage68.wav", { 0, NULL } }, /*PS_MAGE69*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage69.wav", { 0, NULL } }, // Ouhm.. /*PS_MAGE69B*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage69b.wav", { 0, NULL } }, // Umm.. /*PS_MAGE70*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage70.wav", { 0, NULL } }, // Argh... /*PS_MAGE71*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage71.wav", { 0, NULL } }, // Ouah. /*PS_MAGE72*/ { sfx_SORCERER, "Sfx\\Sorceror\\Mage72.wav", { 0, NULL } }, // Huh ah.. /*PS_MAGE73*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage73.wav", { 0, NULL } }, /*PS_MAGE74*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage74.wav", { 0, NULL } }, /*PS_MAGE75*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage75.wav", { 0, NULL } }, /*PS_MAGE76*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage76.wav", { 0, NULL } }, /*PS_MAGE77*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage77.wav", { 0, NULL } }, /*PS_MAGE78*/// { sfx_SORCERER, "Sfx\\Sorceror\\Mage78.wav", { 0, NULL } }, /*PS_MAGE79*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage79.wav", { 0, NULL } }, /*PS_MAGE80*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage80.wav", { 0, NULL } }, /*PS_MAGE81*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage81.wav", { 0, NULL } }, /*PS_MAGE82*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage82.wav", { 0, NULL } }, /*PS_MAGE83*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage83.wav", { 0, NULL } }, /*PS_MAGE84*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage84.wav", { 0, NULL } }, /*PS_MAGE85*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage85.wav", { 0, NULL } }, /*PS_MAGE86*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage86.wav", { 0, NULL } }, /*PS_MAGE87*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage87.wav", { 0, NULL } }, /*PS_MAGE88*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage88.wav", { 0, NULL } }, /*PS_MAGE89*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage89.wav", { 0, NULL } }, /*PS_MAGE90*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage90.wav", { 0, NULL } }, /*PS_MAGE91*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage91.wav", { 0, NULL } }, /*PS_MAGE92*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage92.wav", { 0, NULL } }, /*PS_MAGE93*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage93.wav", { 0, NULL } }, /*PS_MAGE94*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage94.wav", { 0, NULL } }, /*PS_MAGE95*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage95.wav", { 0, NULL } }, /*PS_MAGE96*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage96.wav", { 0, NULL } }, /*PS_MAGE97*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage97.wav", { 0, NULL } }, /*PS_MAGE98*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage98.wav", { 0, NULL } }, /*PS_MAGE99*/ { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage99.wav", { 0, NULL } }, /*PS_MAGE100*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage100.wav", { 0, NULL } }, /*PS_MAGE101*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage101.wav", { 0, NULL } }, /*PS_MAGE102*/// { sfx_STREAM | sfx_SORCERER, "Sfx\\Sorceror\\Mage102.wav", { 0, NULL } }, /*PS_ROGUE1*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue01.wav", { 0, NULL } }, /*PS_ROGUE2*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue02.wav", { 0, NULL } }, /*PS_ROGUE3*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue03.wav", { 0, NULL } }, /*PS_ROGUE4*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue04.wav", { 0, NULL } }, /*PS_ROGUE5*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue05.wav", { 0, NULL } }, /*PS_ROGUE6*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue06.wav", { 0, NULL } }, /*PS_ROGUE7*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue07.wav", { 0, NULL } }, /*PS_ROGUE8*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue08.wav", { 0, NULL } }, /*PS_ROGUE9*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue09.wav", { 0, NULL } }, /*PS_ROGUE10*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue10.wav", { 0, NULL } }, /*PS_ROGUE11*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue11.wav", { 0, NULL } }, /*PS_ROGUE12*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue12.wav", { 0, NULL } }, /*PS_ROGUE13*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue13.wav", { 0, NULL } }, // I can't use this yet. /*PS_ROGUE14*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue14.wav", { 0, NULL } }, // I can't carry any more. /*PS_ROGUE15*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue15.wav", { 0, NULL } }, // I have no room. /*PS_ROGUE16*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue16.wav", { 0, NULL } }, // Now where would I put this? /*PS_ROGUE17*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue17.wav", { 0, NULL } }, // No way... /*PS_ROGUE18*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue18.wav", { 0, NULL } }, // Not a chance /*PS_ROGUE19*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue19.wav", { 0, NULL } }, /*PS_ROGUE20*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue20.wav", { 0, NULL } }, /*PS_ROGUE21*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue21.wav", { 0, NULL } }, /*PS_ROGUE22*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue22.wav", { 0, NULL } }, /*PS_ROGUE23*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue23.wav", { 0, NULL } }, /*PS_ROGUE24*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue24.wav", { 0, NULL } }, // I can't open this. .. Yet. /*PS_ROGUE25*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue25.wav", { 0, NULL } }, /*PS_ROGUE26*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue26.wav", { 0, NULL } }, /*PS_ROGUE27*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue27.wav", { 0, NULL } }, // I can't cast that here. /*PS_ROGUE28*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue28.wav", { 0, NULL } }, /*PS_ROGUE29*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue29.wav", { 0, NULL } }, // That did not do anything. /*PS_ROGUE30*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue30.wav", { 0, NULL } }, /*PS_ROGUE31*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue31.wav", { 0, NULL } }, /*PS_ROGUE32*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue32.wav", { 0, NULL } }, /*PS_ROGUE33*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue33.wav", { 0, NULL } }, /*PS_ROGUE34*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue34.wav", { 0, NULL } }, // I don't have a spell ready. /*PS_ROGUE35*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue35.wav", { 0, NULL } }, // Not enough mana. /*PS_ROGUE36*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue36.wav", { 0, NULL } }, /*PS_ROGUE37*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue37.wav", { 0, NULL } }, /*PS_ROGUE38*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue38.wav", { 0, NULL } }, /*PS_ROGUE39*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue39.wav", { 0, NULL } }, /*PS_ROGUE40*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue40.wav", { 0, NULL } }, /*PS_ROGUE41*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue41.wav", { 0, NULL } }, /*PS_ROGUE42*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue42.wav", { 0, NULL } }, /*PS_ROGUE43*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue43.wav", { 0, NULL } }, /*PS_ROGUE44*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue44.wav", { 0, NULL } }, /*PS_ROGUE45*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue45.wav", { 0, NULL } }, /*PS_ROGUE46*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue46.wav", { 0, NULL } }, // Just what I was looking for. /*PS_ROGUE47*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue47.wav", { 0, NULL } }, /*PS_ROGUE48*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue48.wav", { 0, NULL } }, /*PS_ROGUE49*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue49.wav", { 0, NULL } }, // I'm not thirsty. /*PS_ROGUE50*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue50.wav", { 0, NULL } }, // Hey, I'm no milkmaid. /*PS_ROGUE51*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue51.wav", { 0, NULL } }, /*PS_ROGUE52*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue52.wav", { 0, NULL } }, // Yep, that's a cow, alright. /*PS_ROGUE53*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue53.wav", { 0, NULL } }, /*PS_ROGUE54*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue54.wav", { 0, NULL } }, /*PS_ROGUE55*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue55.wav", { 0, NULL } }, /*PS_ROGUE56*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue56.wav", { 0, NULL } }, /*PS_ROGUE57*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue57.wav", { 0, NULL } }, /*PS_ROGUE58*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue58.wav", { 0, NULL } }, /*PS_ROGUE59*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue59.wav", { 0, NULL } }, /*PS_ROGUE60*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue60.wav", { 0, NULL } }, /*PS_ROGUE61*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue61.wav", { 0, NULL } }, /*PS_ROGUE62*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue62.wav", { 0, NULL } }, /*PS_ROGUE63*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue63.wav", { 0, NULL } }, /*PS_ROGUE64*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue64.wav", { 0, NULL } }, /*PS_ROGUE65*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue65.wav", { 0, NULL } }, /*PS_ROGUE66*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue66.wav", { 0, NULL } }, /*PS_ROGUE67*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue67.wav", { 0, NULL } }, /*PS_ROGUE68*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue68.wav", { 0, NULL } }, /*PS_ROGUE69*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue69.wav", { 0, NULL } }, // Aeh... /*PS_ROGUE69B*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue69b.wav", { 0, NULL } }, // Oah... /*PS_ROGUE70*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue70.wav", { 0, NULL } }, // Ouhuh.. /*PS_ROGUE71*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue71.wav", { 0, NULL } }, // Aaaaauh. /*PS_ROGUE72*/ { sfx_ROGUE, "Sfx\\Rogue\\Rogue72.wav", { 0, NULL } }, // Huuhuhh. /*PS_ROGUE73*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue73.wav", { 0, NULL } }, /*PS_ROGUE74*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue74.wav", { 0, NULL } }, /*PS_ROGUE75*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue75.wav", { 0, NULL } }, /*PS_ROGUE76*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue76.wav", { 0, NULL } }, /*PS_ROGUE77*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue77.wav", { 0, NULL } }, /*PS_ROGUE78*/// { sfx_ROGUE, "Sfx\\Rogue\\Rogue78.wav", { 0, NULL } }, /*PS_ROGUE79*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue79.wav", { 0, NULL } }, /*PS_ROGUE80*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue80.wav", { 0, NULL } }, /*PS_ROGUE81*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue81.wav", { 0, NULL } }, /*PS_ROGUE82*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue82.wav", { 0, NULL } }, /*PS_ROGUE83*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue83.wav", { 0, NULL } }, /*PS_ROGUE84*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue84.wav", { 0, NULL } }, /*PS_ROGUE85*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue85.wav", { 0, NULL } }, /*PS_ROGUE86*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue86.wav", { 0, NULL } }, /*PS_ROGUE87*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue87.wav", { 0, NULL } }, /*PS_ROGUE88*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue88.wav", { 0, NULL } }, /*PS_ROGUE89*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue89.wav", { 0, NULL } }, /*PS_ROGUE90*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue90.wav", { 0, NULL } }, /*PS_ROGUE91*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue91.wav", { 0, NULL } }, /*PS_ROGUE92*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue92.wav", { 0, NULL } }, /*PS_ROGUE93*/// { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue93.wav", { 0, NULL } }, /*PS_ROGUE94*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue94.wav", { 0, NULL } }, /*PS_ROGUE95*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue95.wav", { 0, NULL } }, /*PS_ROGUE96*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue96.wav", { 0, NULL } }, /*PS_ROGUE97*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue97.wav", { 0, NULL } }, /*PS_ROGUE98*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue98.wav", { 0, NULL } }, /*PS_ROGUE99*/ { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue99.wav", { 0, NULL } }, /*PS_ROGUE100*///{ sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue100.wav", { 0, NULL } }, /*PS_ROGUE101*///{ sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue101.wav", { 0, NULL } }, /*PS_ROGUE102*///{ sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue102.wav", { 0, NULL } }, /*PS_WARR1*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior01.wav", { 0, NULL } }, /*PS_WARR2*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior02.wav", { 0, NULL } }, /*PS_WARR3*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior03.wav", { 0, NULL } }, /*PS_WARR4*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior04.wav", { 0, NULL } }, /*PS_WARR5*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior05.wav", { 0, NULL } }, /*PS_WARR6*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior06.wav", { 0, NULL } }, /*PS_WARR7*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior07.wav", { 0, NULL } }, /*PS_WARR8*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior08.wav", { 0, NULL } }, /*PS_WARR9*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior09.wav", { 0, NULL } }, /*PS_WARR10*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior10.wav", { 0, NULL } }, /*PS_WARR11*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior11.wav", { 0, NULL } }, /*PS_WARR12*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior12.wav", { 0, NULL } }, /*PS_WARR13*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior13.wav", { 0, NULL } }, // I can't use this. .. Yet. /*PS_WARR14*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior14.wav", { 0, NULL } }, // I can't carry any more. /*PS_WARR14B*/ { sfx_WARRIOR, "Sfx\\Warrior\\Wario14b.wav", { 0, NULL } }, // I've got to pawn some of this stuff. /*PS_WARR14C*/ { sfx_WARRIOR, "Sfx\\Warrior\\Wario14c.wav", { 0, NULL } }, // Too much baggage. /*PS_WARR15*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior15.wav", { 0, NULL } }, /*PS_WARR15B*/// { sfx_WARRIOR, "Sfx\\Warrior\\Wario15b.wav", { 0, NULL } }, /*PS_WARR15C*/// { sfx_WARRIOR, "Sfx\\Warrior\\Wario15c.wav", { 0, NULL } }, /*PS_WARR16*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior16.wav", { 0, NULL } }, // Where would I put this? /*PS_WARR16B*/// { sfx_WARRIOR, "Sfx\\Warrior\\Wario16b.wav", { 0, NULL } }, // Where you want me to put this? /*PS_WARR16C*/// { sfx_WARRIOR, "Sfx\\Warrior\\Wario16c.wav", { 0, NULL } }, // What am I a pack rat? /*PS_WARR17*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior17.wav", { 0, NULL } }, /*PS_WARR18*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior18.wav", { 0, NULL } }, /*PS_WARR19*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior19.wav", { 0, NULL } }, /*PS_WARR20*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior20.wav", { 0, NULL } }, /*PS_WARR21*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior21.wav", { 0, NULL } }, /*PS_WARR22*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior22.wav", { 0, NULL } }, /*PS_WARR23*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior23.wav", { 0, NULL } }, /*PS_WARR24*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior24.wav", { 0, NULL } }, // I can not open this. Yet. /*PS_WARR25*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior25.wav", { 0, NULL } }, /*PS_WARR26*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior26.wav", { 0, NULL } }, /*PS_WARR27*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior27.wav", { 0, NULL } }, // I can't cast that here. /*PS_WARR28*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior28.wav", { 0, NULL } }, /*PS_WARR29*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior29.wav", { 0, NULL } }, /*PS_WARR30*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior30.wav", { 0, NULL } }, /*PS_WARR31*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior31.wav", { 0, NULL } }, /*PS_WARR32*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior32.wav", { 0, NULL } }, /*PS_WARR33*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior33.wav", { 0, NULL } }, /*PS_WARR34*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior34.wav", { 0, NULL } }, // I don't have a spell ready. /*PS_WARR35*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior35.wav", { 0, NULL } }, // Not enough mana. /*PS_WARR36*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior36.wav", { 0, NULL } }, /*PS_WARR37*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior37.wav", { 0, NULL } }, /*PS_WARR38*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior38.wav", { 0, NULL } }, /*PS_WARR39*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior39.wav", { 0, NULL } }, /*PS_WARR40*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior40.wav", { 0, NULL } }, /*PS_WARR41*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior41.wav", { 0, NULL } }, /*PS_WARR42*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior42.wav", { 0, NULL } }, /*PS_WARR43*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior43.wav", { 0, NULL } }, /*PS_WARR44*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior44.wav", { 0, NULL } }, /*PS_WARR45*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior45.wav", { 0, NULL } }, /*PS_WARR46*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior46.wav", { 0, NULL } }, /*PS_WARR47*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior47.wav", { 0, NULL } }, /*PS_WARR48*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior48.wav", { 0, NULL } }, /*PS_WARR49*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior49.wav", { 0, NULL } }, /*PS_WARR50*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior50.wav", { 0, NULL } }, /*PS_WARR51*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior51.wav", { 0, NULL } }, /*PS_WARR52*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior52.wav", { 0, NULL } }, /*PS_WARR53*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior53.wav", { 0, NULL } }, /*PS_WARR54*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior54.wav", { 0, NULL } }, /*PS_WARR55*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior55.wav", { 0, NULL } }, /*PS_WARR56*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior56.wav", { 0, NULL } }, /*PS_WARR57*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior57.wav", { 0, NULL } }, /*PS_WARR58*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior58.wav", { 0, NULL } }, /*PS_WARR59*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior59.wav", { 0, NULL } }, /*PS_WARR60*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior60.wav", { 0, NULL } }, /*PS_WARR61*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior61.wav", { 0, NULL } }, /*PS_WARR62*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior62.wav", { 0, NULL } }, /*PS_WARR63*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior63.wav", { 0, NULL } }, /*PS_WARR64*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior64.wav", { 0, NULL } }, /*PS_WARR65*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior65.wav", { 0, NULL } }, /*PS_WARR66*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior66.wav", { 0, NULL } }, /*PS_WARR67*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior67.wav", { 0, NULL } }, /*PS_WARR68*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior68.wav", { 0, NULL } }, /*PS_WARR69*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior69.wav", { 0, NULL } }, // Ahh.. /*PS_WARR69B*/ { sfx_WARRIOR, "Sfx\\Warrior\\Wario69b.wav", { 0, NULL } }, // Ouh... /*PS_WARR70*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior70.wav", { 0, NULL } }, // Ouah.. /*PS_WARR71*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior71.wav", { 0, NULL } }, // Auuahh.. /*PS_WARR72*/ { sfx_WARRIOR, "Sfx\\Warrior\\Warior72.wav", { 0, NULL } }, // Huhhuhh. /*PS_WARR73*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior73.wav", { 0, NULL } }, /*PS_WARR74*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior74.wav", { 0, NULL } }, /*PS_WARR75*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior75.wav", { 0, NULL } }, /*PS_WARR76*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior76.wav", { 0, NULL } }, /*PS_WARR77*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior77.wav", { 0, NULL } }, /*PS_WARR78*/// { sfx_WARRIOR, "Sfx\\Warrior\\Warior78.wav", { 0, NULL } }, /*PS_WARR79*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior79.wav", { 0, NULL } }, /*PS_WARR80*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior80.wav", { 0, NULL } }, /*PS_WARR81*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior81.wav", { 0, NULL } }, /*PS_WARR82*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior82.wav", { 0, NULL } }, /*PS_WARR83*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior83.wav", { 0, NULL } }, /*PS_WARR84*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior84.wav", { 0, NULL } }, /*PS_WARR85*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior85.wav", { 0, NULL } }, /*PS_WARR86*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior86.wav", { 0, NULL } }, /*PS_WARR87*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior87.wav", { 0, NULL } }, /*PS_WARR88*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior88.wav", { 0, NULL } }, /*PS_WARR89*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior89.wav", { 0, NULL } }, /*PS_WARR90*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior90.wav", { 0, NULL } }, /*PS_WARR91*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior91.wav", { 0, NULL } }, /*PS_WARR92*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior92.wav", { 0, NULL } }, /*PS_WARR93*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior93.wav", { 0, NULL } }, /*PS_WARR94*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior94.wav", { 0, NULL } }, /*PS_WARR95*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior95.wav", { 0, NULL } }, /*PS_WARR95B*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95b.wav", { 0, NULL } }, /*PS_WARR95C*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95c.wav", { 0, NULL } }, /*PS_WARR95D*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95d.wav", { 0, NULL } }, /*PS_WARR95E*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95e.wav", { 0, NULL } }, /*PS_WARR95F*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95f.wav", { 0, NULL } }, /*PS_WARR96B*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario96b.wav", { 0, NULL } }, /*PS_WARR97*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario97.wav", { 0, NULL } }, /*PS_WARR98*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario98.wav", { 0, NULL } }, /*PS_WARR99*/ { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior99.wav", { 0, NULL } }, /*PS_WARR100*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario100.wav", { 0, NULL } }, /*PS_WARR101*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario101.wav", { 0, NULL } }, /*PS_WARR102*/// { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario102.wav", { 0, NULL } }, /*PS_MONK1*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk01.wav", { 0, NULL } }, /*PS_MONK2*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK3*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK4*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK5*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK6*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK7*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK8*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk08.wav", { 0, NULL } }, /*PS_MONK9*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk09.wav", { 0, NULL } }, /*PS_MONK10*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk10.wav", { 0, NULL } }, /*PS_MONK11*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk11.wav", { 0, NULL } }, /*PS_MONK12*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk12.wav", { 0, NULL } }, /*PS_MONK13*/ { sfx_MONK, "Sfx\\Monk\\Monk13.wav", { 0, NULL } }, // I can not use this. yet. /*PS_MONK14*/ { sfx_MONK, "Sfx\\Monk\\Monk14.wav", { 0, NULL } }, // I can not carry any more. /*PS_MONK15*/ { sfx_MONK, "Sfx\\Monk\\Monk15.wav", { 0, NULL } }, // I have no room. /*PS_MONK16*/ { sfx_MONK, "Sfx\\Monk\\Monk16.wav", { 0, NULL } }, // Where would I put this? /*PS_MONK17*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK18*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK19*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK20*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK21*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK22*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK23*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK24*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk24.wav", { 0, NULL } }, // I can not open this. .. Yet. /*PS_MONK25*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK26*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK27*/ { sfx_MONK, "Sfx\\Monk\\Monk27.wav", { 0, NULL } }, // I can not cast that here. /*PS_MONK28*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK29*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk29.wav", { 0, NULL } }, /*PS_MONK30*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK31*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK32*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK33*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK34*/ { sfx_MONK, "Sfx\\Monk\\Monk34.wav", { 0, NULL } }, // I do not have a spell ready. /*PS_MONK35*/ { sfx_MONK, "Sfx\\Monk\\Monk35.wav", { 0, NULL } }, // Not enough mana. /*PS_MONK36*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK37*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK38*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK39*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK40*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK41*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK42*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK43*/// { sfx_MONK, "Sfx\\Monk\\Monk43.wav", { 0, NULL } }, /*PS_MONK44*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK45*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK46*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk46.wav", { 0, NULL } }, /*PS_MONK47*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK48*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK49*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk49.wav", { 0, NULL } }, /*PS_MONK50*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk50.wav", { 0, NULL } }, /*PS_MONK51*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK52*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk52.wav", { 0, NULL } }, /*PS_MONK53*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK54*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk54.wav", { 0, NULL } }, /*PS_MONK55*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk55.wav", { 0, NULL } }, /*PS_MONK56*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk56.wav", { 0, NULL } }, /*PS_MONK57*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK58*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK59*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK60*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK61*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk61.wav", { 0, NULL } }, /*PS_MONK62*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk62.wav", { 0, NULL } }, /*PS_MONK63*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK64*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK65*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK66*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK67*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK68*/ { sfx_MONK, "Sfx\\Monk\\Monk68.wav", { 0, NULL } }, /*PS_MONK69*/ { sfx_MONK, "Sfx\\Monk\\Monk69.wav", { 0, NULL } }, // Umm.. /*PS_MONK69B*/ { sfx_MONK, "Sfx\\Monk\\Monk69b.wav", { 0, NULL } }, // Ouch.. /*PS_MONK70*/ { sfx_MONK, "Sfx\\Monk\\Monk70.wav", { 0, NULL } }, // Oahhahh. /*PS_MONK71*/ { sfx_MONK, "Sfx\\Monk\\Monk71.wav", { 0, NULL } }, // Oaah ah. /*PS_MONK72*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK73*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK74*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK75*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK76*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK77*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK78*/// { sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK79*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk79.wav", { 0, NULL } }, /*PS_MONK80*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk80.wav", { 0, NULL } }, /*PS_MONK81*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK82*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk82.wav", { 0, NULL } }, /*PS_MONK83*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk83.wav", { 0, NULL } }, /*PS_MONK84*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK85*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK86*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK87*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk87.wav", { 0, NULL } }, /*PS_MONK88*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk88.wav", { 0, NULL } }, /*PS_MONK89*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk89.wav", { 0, NULL } }, /*PS_MONK90*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK91*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk91.wav", { 0, NULL } }, /*PS_MONK92*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk92.wav", { 0, NULL } }, /*PS_MONK93*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK94*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk94.wav", { 0, NULL } }, /*PS_MONK95*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk95.wav", { 0, NULL } }, /*PS_MONK96*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk96.wav", { 0, NULL } }, /*PS_MONK97*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk97.wav", { 0, NULL } }, /*PS_MONK98*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk98.wav", { 0, NULL } }, /*PS_MONK99*/ { sfx_STREAM | sfx_MONK, "Sfx\\Monk\\Monk99.wav", { 0, NULL } }, /*PS_MONK100*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK101*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_MONK102*/// { sfx_STREAM | sfx_MONK, "Sfx\\Misc\\blank.wav", { 0, NULL } }, /*PS_NAR1*/ { sfx_STREAM, "Sfx\\Narrator\\Nar01.wav", { 0, NULL } }, /*PS_NAR2*/ { sfx_STREAM, "Sfx\\Narrator\\Nar02.wav", { 0, NULL } }, /*PS_NAR3*/ { sfx_STREAM, "Sfx\\Narrator\\Nar03.wav", { 0, NULL } }, /*PS_NAR4*/ { sfx_STREAM, "Sfx\\Narrator\\Nar04.wav", { 0, NULL } }, /*PS_NAR5*/ { sfx_STREAM, "Sfx\\Narrator\\Nar05.wav", { 0, NULL } }, /*PS_NAR6*/ { sfx_STREAM, "Sfx\\Narrator\\Nar06.wav", { 0, NULL } }, /*PS_NAR7*/ { sfx_STREAM, "Sfx\\Narrator\\Nar07.wav", { 0, NULL } }, /*PS_NAR8*/ { sfx_STREAM, "Sfx\\Narrator\\Nar08.wav", { 0, NULL } }, /*PS_NAR9*/ { sfx_STREAM, "Sfx\\Narrator\\Nar09.wav", { 0, NULL } }, /*PS_DIABLVLINT*/{ sfx_STREAM, "Sfx\\Misc\\Lvl16int.wav", { 0, NULL } }, /*USFX_CLEAVER*/ { sfx_STREAM, "Sfx\\Monsters\\Butcher.wav", { 0, NULL } }, /*USFX_GARBUD1*/ { sfx_STREAM, "Sfx\\Monsters\\Garbud01.wav", { 0, NULL } }, /*USFX_GARBUD2*/ { sfx_STREAM, "Sfx\\Monsters\\Garbud02.wav", { 0, NULL } }, /*USFX_GARBUD3*/ { sfx_STREAM, "Sfx\\Monsters\\Garbud03.wav", { 0, NULL } }, /*USFX_GARBUD4*/ { sfx_STREAM, "Sfx\\Monsters\\Garbud04.wav", { 0, NULL } }, /*USFX_IZUAL1*///{ sfx_STREAM, "Sfx\\Monsters\\Izual01.wav", { 0, NULL } }, /*USFX_LACH1*/ { sfx_STREAM, "Sfx\\Monsters\\Lach01.wav", { 0, NULL } }, /*USFX_LACH2*/ { sfx_STREAM, "Sfx\\Monsters\\Lach02.wav", { 0, NULL } }, /*USFX_LACH3*/ { sfx_STREAM, "Sfx\\Monsters\\Lach03.wav", { 0, NULL } }, /*USFX_LAZ1*/ { sfx_STREAM, "Sfx\\Monsters\\Laz01.wav", { 0, NULL } }, /*USFX_LAZ2*/ { sfx_STREAM, "Sfx\\Monsters\\Laz02.wav", { 0, NULL } }, /*USFX_SKING1*/ { sfx_STREAM, "Sfx\\Monsters\\Sking01.wav", { 0, NULL } }, /*USFX_SNOT1*/ { sfx_STREAM, "Sfx\\Monsters\\Snot01.wav", { 0, NULL } }, /*USFX_SNOT2*/ { sfx_STREAM, "Sfx\\Monsters\\Snot02.wav", { 0, NULL } }, /*USFX_SNOT3*/ { sfx_STREAM, "Sfx\\Monsters\\Snot03.wav", { 0, NULL } }, /*USFX_WARLRD1*/ { sfx_STREAM, "Sfx\\Monsters\\Warlrd01.wav", { 0, NULL } }, /*USFX_WLOCK1*/ { sfx_STREAM, "Sfx\\Monsters\\Wlock01.wav", { 0, NULL } }, /*USFX_ZHAR1*/ { sfx_STREAM, "Sfx\\Monsters\\Zhar01.wav", { 0, NULL } }, /*USFX_ZHAR2*/ { sfx_STREAM, "Sfx\\Monsters\\Zhar02.wav", { 0, NULL } }, /*USFX_DIABLOD*/ { sfx_STREAM, "Sfx\\Monsters\\DiabloD.wav", { 0, NULL } }, /*TSFX_FARMER1*/ { sfx_STREAM, "Sfx\\Hellfire\\Farmer1.wav", { 0, NULL } }, /*TSFX_FARMER2*/ { sfx_STREAM, "Sfx\\Hellfire\\Farmer2.wav", { 0, NULL } }, /*TSFX_FARMER2A*/{ sfx_STREAM, "Sfx\\Hellfire\\Farmer2A.wav", { 0, NULL } }, /*TSFX_FARMER3*/ { sfx_STREAM, "Sfx\\Hellfire\\Farmer3.wav", { 0, NULL } }, /*TSFX_FARMER4*/ { sfx_STREAM, "Sfx\\Hellfire\\Farmer4.wav", { 0, NULL } }, /*TSFX_FARMER5*/ { sfx_STREAM, "Sfx\\Hellfire\\Farmer5.wav", { 0, NULL } }, /*TSFX_FARMER6*/ { sfx_STREAM, "Sfx\\Hellfire\\Farmer6.wav", { 0, NULL } }, /*TSFX_FARMER7*/ { sfx_STREAM, "Sfx\\Hellfire\\Farmer7.wav", { 0, NULL } }, /*TSFX_FARMER8*/ { sfx_STREAM, "Sfx\\Hellfire\\Farmer8.wav", { 0, NULL } }, /*TSFX_FARMER9*/ { sfx_STREAM, "Sfx\\Hellfire\\Farmer9.wav", { 0, NULL } }, /*TSFX_TEDDYBR1*/{ sfx_STREAM, "Sfx\\Hellfire\\TEDDYBR1.wav", { 0, NULL } }, /*TSFX_TEDDYBR2*/{ sfx_STREAM, "Sfx\\Hellfire\\TEDDYBR2.wav", { 0, NULL } }, /*TSFX_TEDDYBR3*/{ sfx_STREAM, "Sfx\\Hellfire\\TEDDYBR3.wav", { 0, NULL } }, /*TSFX_TEDDYBR4*/{ sfx_STREAM, "Sfx\\Hellfire\\TEDDYBR4.wav", { 0, NULL } }, /*USFX_DEFILER1*///{ sfx_STREAM, "Sfx\\Hellfire\\DEFILER1.wav", { 0, NULL } }, /*USFX_DEFILER2*///{ sfx_STREAM, "Sfx\\Hellfire\\DEFILER2.wav", { 0, NULL } }, /*USFX_DEFILER3*///{ sfx_STREAM, "Sfx\\Hellfire\\DEFILER3.wav", { 0, NULL } }, /*USFX_DEFILER4*///{ sfx_STREAM, "Sfx\\Hellfire\\DEFILER4.wav", { 0, NULL } }, /*USFX_DEFILER8*/{ sfx_STREAM, "Sfx\\Hellfire\\DEFILER8.wav", { 0, NULL } }, /*USFX_DEFILER6*/{ sfx_STREAM, "Sfx\\Hellfire\\DEFILER6.wav", { 0, NULL } }, /*USFX_DEFILER7*/{ sfx_STREAM, "Sfx\\Hellfire\\DEFILER7.wav", { 0, NULL } }, /*USFX_NAKRUL1*///{ sfx_STREAM, "Sfx\\Hellfire\\NAKRUL1.wav", { 0, NULL } }, /*USFX_NAKRUL2*///{ sfx_STREAM, "Sfx\\Hellfire\\NAKRUL2.wav", { 0, NULL } }, /*USFX_NAKRUL3*///{ sfx_STREAM, "Sfx\\Hellfire\\NAKRUL3.wav", { 0, NULL } }, /*USFX_NAKRUL4*/ { sfx_STREAM, "Sfx\\Hellfire\\NAKRUL4.wav", { 0, NULL } }, /*USFX_NAKRUL5*/ { sfx_STREAM, "Sfx\\Hellfire\\NAKRUL5.wav", { 0, NULL } }, /*USFX_NAKRUL6*/ { sfx_STREAM, "Sfx\\Hellfire\\NAKRUL6.wav", { 0, NULL } }, /*PS_NARATR3*/// { sfx_STREAM, "Sfx\\Hellfire\\NARATR3.wav", { 0, NULL } }, /*TSFX_COWSUT1*/ { sfx_STREAM, "Sfx\\Hellfire\\COWSUT1.wav", { 0, NULL } }, /*TSFX_COWSUT2*/ { sfx_STREAM, "Sfx\\Hellfire\\COWSUT2.wav", { 0, NULL } }, /*TSFX_COWSUT3*/ { sfx_STREAM, "Sfx\\Hellfire\\COWSUT3.wav", { 0, NULL } }, /*TSFX_COWSUT4*/ { sfx_STREAM, "Sfx\\Hellfire\\COWSUT4.wav", { 0, NULL } }, /*TSFX_COWSUT4A*/{ sfx_STREAM, "Sfx\\Hellfire\\COWSUT4A.wav", { 0, NULL } }, /*TSFX_COWSUT5*/ { sfx_STREAM, "Sfx\\Hellfire\\COWSUT5.wav", { 0, NULL } }, /*TSFX_COWSUT6*/ { sfx_STREAM, "Sfx\\Hellfire\\COWSUT6.wav", { 0, NULL } }, /*TSFX_COWSUT7*/ { sfx_STREAM, "Sfx\\Hellfire\\COWSUT7.wav", { 0, NULL } }, /*TSFX_COWSUT8*/ { sfx_STREAM, "Sfx\\Hellfire\\COWSUT8.wav", { 0, NULL } }, /*TSFX_COWSUT9*/ { sfx_STREAM, "Sfx\\Hellfire\\COWSUT9.wav", { 0, NULL } }, /*TSFX_COWSUT10*/{ sfx_STREAM, "Sfx\\Hellfire\\COWSUT10.wav", { 0, NULL } }, /*TSFX_COWSUT11*/{ sfx_STREAM, "Sfx\\Hellfire\\COWSUT11.wav", { 0, NULL } }, /*TSFX_COWSUT12*/{ sfx_STREAM, "Sfx\\Hellfire\\COWSUT12.wav", { 0, NULL } }, /*USFX_SKLJRN1*///{ sfx_STREAM, "Sfx\\Hellfire\\Skljrn1.wav", { 0, NULL } }, /*PS_NARATR6*/ { sfx_STREAM, "Sfx\\Hellfire\\Naratr6.wav", { 0, NULL } }, /*PS_NARATR7*/ { sfx_STREAM, "Sfx\\Hellfire\\Naratr7.wav", { 0, NULL } }, /*PS_NARATR8*/ { sfx_STREAM, "Sfx\\Hellfire\\Naratr8.wav", { 0, NULL } }, /*PS_NARATR5*/ { sfx_STREAM, "Sfx\\Hellfire\\Naratr5.wav", { 0, NULL } }, /*PS_NARATR9*/ { sfx_STREAM, "Sfx\\Hellfire\\Naratr9.wav", { 0, NULL } }, /*PS_NARATR4*/ { sfx_STREAM, "Sfx\\Hellfire\\Naratr4.wav", { 0, NULL } }, /*TSFX_TRADER1*///{ sfx_STREAM, "Sfx\\Hellfire\\TRADER1.wav", { 0, NULL } }, // clang-format on }; const int sgSFXSets[NUM_SFXSets][NUM_CLASSES] { // clang-format off #ifdef HELLFIRE { sfx_WARRIOR, sfx_ROGUE, sfx_SORCERER, sfx_MONK, sfx_ROGUE, sfx_WARRIOR }, { PS_WARR1, PS_ROGUE1, PS_MAGE1, PS_MONK1, PS_ROGUE1, PS_WARR1 }, { PS_WARR8, PS_ROGUE8, PS_MAGE8, PS_MONK8, PS_ROGUE8, PS_WARR8 }, { PS_WARR9, PS_ROGUE9, PS_MAGE9, PS_MONK9, PS_ROGUE9, PS_WARR9 }, { PS_WARR10, PS_ROGUE10, PS_MAGE10, PS_MONK10, PS_ROGUE10, PS_WARR10 }, { PS_WARR11, PS_ROGUE11, PS_MAGE11, PS_MONK11, PS_ROGUE11, PS_WARR11 }, { PS_WARR12, PS_ROGUE12, PS_MAGE12, PS_MONK12, PS_ROGUE12, PS_WARR12 }, { PS_WARR13, PS_ROGUE13, PS_MAGE13, PS_MONK13, PS_ROGUE13, PS_WARR13 }, { PS_WARR14, PS_ROGUE14, PS_MAGE14, PS_MONK14, PS_ROGUE14, PS_WARR14 }, //{ PS_WARR16, PS_ROGUE16, PS_MAGE16, PS_MONK16, PS_ROGUE16, PS_WARR16 }, { PS_WARR24, PS_ROGUE24, PS_MAGE24, PS_MONK24, PS_ROGUE24, PS_WARR24 }, { PS_WARR27, PS_ROGUE27, PS_MAGE27, PS_MONK27, PS_ROGUE27, PS_WARR27 }, { PS_WARR29, PS_ROGUE29, PS_MAGE29, PS_MONK29, PS_ROGUE29, PS_WARR29 }, { PS_WARR34, PS_ROGUE34, PS_MAGE34, PS_MONK34, PS_ROGUE34, PS_WARR34 }, { PS_WARR35, PS_ROGUE35, PS_MAGE35, PS_MONK35, PS_ROGUE35, PS_WARR35 }, { PS_WARR46, PS_ROGUE46, PS_MAGE46, PS_MONK46, PS_ROGUE46, PS_WARR46 }, { PS_WARR54, PS_ROGUE54, PS_MAGE54, PS_MONK54, PS_ROGUE54, PS_WARR54 }, { PS_WARR55, PS_ROGUE55, PS_MAGE55, PS_MONK55, PS_ROGUE55, PS_WARR55 }, { PS_WARR56, PS_ROGUE56, PS_MAGE56, PS_MONK56, PS_ROGUE56, PS_WARR56 }, { PS_WARR61, PS_ROGUE61, PS_MAGE61, PS_MONK61, PS_ROGUE61, PS_WARR61 }, { PS_WARR62, PS_ROGUE62, PS_MAGE62, PS_MONK62, PS_ROGUE62, PS_WARR62 }, { PS_WARR68, PS_ROGUE68, PS_MAGE68, PS_MONK68, PS_ROGUE68, PS_WARR68 }, { PS_WARR69, PS_ROGUE69, PS_MAGE69, PS_MONK69, PS_ROGUE69, PS_WARR69 }, { PS_WARR70, PS_ROGUE70, PS_MAGE70, PS_MONK70, PS_ROGUE70, PS_WARR70 }, { PS_DEAD, PS_ROGUE71, PS_MAGE71, PS_MONK71, PS_ROGUE71, PS_WARR71 }, // BUGFIX: should use `PS_WARR71` like other classes { PS_WARR72, PS_ROGUE72, PS_MAGE72, PS_MAGE72, PS_ROGUE72, PS_WARR72 }, // BUGFIX: should be PS_MONK72, but it is blank... { PS_WARR79, PS_ROGUE79, PS_MAGE79, PS_MONK79, PS_ROGUE79, PS_WARR79 }, { PS_WARR80, PS_ROGUE80, PS_MAGE80, PS_MONK80, PS_ROGUE80, PS_WARR80 }, { PS_WARR82, PS_ROGUE82, PS_MAGE82, PS_MONK82, PS_ROGUE82, PS_WARR82 }, { PS_WARR83, PS_ROGUE83, PS_MAGE83, PS_MONK83, PS_ROGUE83, PS_WARR83 }, { PS_WARR87, PS_ROGUE87, PS_MAGE87, PS_MONK87, PS_ROGUE87, PS_WARR87 }, { PS_WARR88, PS_ROGUE88, PS_MAGE88, PS_MONK88, PS_ROGUE88, PS_WARR88 }, { PS_WARR89, PS_ROGUE89, PS_MAGE89, PS_MONK89, PS_ROGUE89, PS_WARR89 }, { PS_WARR91, PS_ROGUE91, PS_MAGE91, PS_MONK91, PS_ROGUE91, PS_WARR91 }, { PS_WARR92, PS_ROGUE92, PS_MAGE92, PS_MONK92, PS_ROGUE92, PS_WARR92 }, { PS_WARR94, PS_ROGUE94, PS_MAGE94, PS_MONK94, PS_ROGUE94, PS_WARR94 }, { PS_WARR95, PS_ROGUE95, PS_MAGE95, PS_MONK95, PS_ROGUE95, PS_WARR95 }, { PS_WARR96B,PS_ROGUE96, PS_MAGE96, PS_MONK96, PS_ROGUE96, PS_WARR96B}, { PS_WARR97, PS_ROGUE97, PS_MAGE97, PS_MONK97, PS_ROGUE97, PS_WARR97 }, { PS_WARR98, PS_ROGUE98, PS_MAGE98, PS_MONK98, PS_ROGUE98, PS_WARR98 }, { PS_WARR99, PS_ROGUE99, PS_MAGE99, PS_MONK99, PS_ROGUE99, PS_WARR99 }, #else { sfx_WARRIOR, sfx_ROGUE, sfx_SORCERER }, { PS_WARR1, PS_ROGUE1, PS_MAGE1 }, { PS_WARR8, PS_ROGUE8, PS_MAGE8 }, { PS_WARR9, PS_ROGUE9, PS_MAGE9 }, { PS_WARR10, PS_ROGUE10, PS_MAGE10 }, { PS_WARR11, PS_ROGUE11, PS_MAGE11 }, { PS_WARR12, PS_ROGUE12, PS_MAGE12 }, { PS_WARR13, PS_ROGUE13, PS_MAGE13 }, { PS_WARR14, PS_ROGUE14, PS_MAGE14 }, //{ PS_WARR16, PS_ROGUE16, PS_MAGE16 }, { PS_WARR24, PS_ROGUE24, PS_MAGE24 }, { PS_WARR27, PS_ROGUE27, PS_MAGE27 }, { PS_WARR29, PS_ROGUE29, PS_MAGE29 }, { PS_WARR34, PS_ROGUE34, PS_MAGE34 }, { PS_WARR35, PS_ROGUE35, PS_MAGE35 }, { PS_WARR46, PS_ROGUE46, PS_MAGE46 }, { PS_WARR54, PS_ROGUE54, PS_MAGE54 }, { PS_WARR55, PS_ROGUE55, PS_MAGE55 }, { PS_WARR56, PS_ROGUE56, PS_MAGE56 }, { PS_WARR61, PS_ROGUE61, PS_MAGE61 }, { PS_WARR62, PS_ROGUE62, PS_MAGE62 }, { PS_WARR68, PS_ROGUE68, PS_MAGE68 }, { PS_WARR69, PS_ROGUE69, PS_MAGE69 }, { PS_WARR70, PS_ROGUE70, PS_MAGE70 }, { PS_DEAD, PS_ROGUE71, PS_MAGE71 }, // BUGFIX: should use `PS_WARR71` like other classes { PS_WARR72, PS_ROGUE72, PS_MAGE72 }, { PS_WARR79, PS_ROGUE79, PS_MAGE79 }, { PS_WARR80, PS_ROGUE80, PS_MAGE80 }, { PS_WARR82, PS_ROGUE82, PS_MAGE82 }, { PS_WARR83, PS_ROGUE83, PS_MAGE83 }, { PS_WARR87, PS_ROGUE87, PS_MAGE87 }, { PS_WARR88, PS_ROGUE88, PS_MAGE88 }, { PS_WARR89, PS_ROGUE89, PS_MAGE89 }, { PS_WARR91, PS_ROGUE91, PS_MAGE91 }, { PS_WARR92, PS_ROGUE92, PS_MAGE92 }, { PS_WARR94, PS_ROGUE94, PS_MAGE94 }, { PS_WARR95, PS_ROGUE95, PS_MAGE95 }, { PS_WARR96B,PS_ROGUE96, PS_MAGE96 }, { PS_WARR97, PS_ROGUE97, PS_MAGE97 }, { PS_WARR98, PS_ROGUE98, PS_MAGE98 }, { PS_WARR99, PS_ROGUE99, PS_MAGE99 }, #endif // clang-format on }; bool effect_is_playing(int nSFX) { SFXStruct* sfx = &sgSFX[nSFX]; if (sfx->bFlags & sfx_STREAM) return sfx == sgpStreamSFX; return sfx->pSnd.IsPlaying(); } void stream_stop() { if (sgpStreamSFX != NULL) { Mix_HaltChannel(SFX_STREAM_CHANNEL); sgpStreamSFX->pSnd.Release(); sgpStreamSFX = NULL; } } static void stream_play(SFXStruct* pSFX, int lVolume, int lPan) { // assert(pSFX != NULL); // assert(pSFX->bFlags & sfx_STREAM); // assert(pSFX->pSnd != NULL); if (pSFX == sgpStreamSFX) return; stream_stop(); sgpStreamSFX = pSFX; sound_stream(pSFX->pszName, &pSFX->pSnd, lVolume, lPan); } static void stream_update() { if (sgpStreamSFX != NULL && !sgpStreamSFX->pSnd.IsPlaying()) { stream_stop(); } } void InitMonsterSND(int midx) { char name[MAX_PATH]; int i, n, j; MapMonData* cmon; const MonsterData* mdata; const MonFileData* mfdata; assert(gbSndInited); cmon = &mapMonTypes[midx]; mdata = &monsterdata[cmon->cmType]; mfdata = &monfiledata[mdata->moFileNum]; static_assert((int)MS_SPECIAL + 1 == NUM_MON_SFX, "InitMonsterSND requires MS_SPECIAL at the end of the enum."); n = mfdata->moSndSpecial ? NUM_MON_SFX : MS_SPECIAL; for (i = 0; i < n; i++) { for (j = 0; j < lengthof(cmon->cmSnds[i]); j++) { snprintf(name, sizeof(name), mfdata->moSndFile, MonstSndChar[i], j + 1); assert(!cmon->cmSnds[i][j].IsLoaded()); sound_file_load(name, &cmon->cmSnds[i][j]); assert(cmon->cmSnds[i][j].IsLoaded()); } } } void FreeMonsterSnd() { MapMonData* cmon; int i, j, k; cmon = mapMonTypes; for (i = 0; i < nummtypes; i++, cmon++) { for (j = 0; j < NUM_MON_SFX; ++j) { for (k = 0; k < lengthof(cmon->cmSnds[j]); ++k) { //if (cmon->cmSnds[j][k].IsLoaded()) cmon->cmSnds[j][k].Release(); } } } } static bool calc_snd_position(int x, int y, int* plVolume, int* plPan) { int pan, volume; x -= myplr._px; y -= myplr._py; pan = (x - y); *plPan = pan; if (abs(pan) > SFX_DIST_MAX) return false; volume = std::max(abs(x), abs(y)); if (volume >= SFX_DIST_MAX) return false; static_assert(((VOLUME_MAX - VOLUME_MIN) % SFX_DIST_MAX) == 0, "Volume calculation in calc_snd_position requires matching VOLUME_MIN/MAX and SFX_DIST_MAX values."); static_assert(((((VOLUME_MAX - VOLUME_MIN) / SFX_DIST_MAX)) & ((VOLUME_MAX - VOLUME_MIN) / SFX_DIST_MAX - 1)) == 0, "Volume calculation in calc_snd_position is no longer optimal for performance."); volume *= (VOLUME_MAX - VOLUME_MIN) / SFX_DIST_MAX; *plVolume = VOLUME_MAX - volume; return true; } static void PlaySFX_priv(int psfx, bool loc, int x, int y) { int lPan, lVolume; SFXStruct* pSFX; if (!gbSoundOn || gbLvlLoad != 0) return; lPan = 0; lVolume = VOLUME_MAX; if (loc && !calc_snd_position(x, y, &lVolume, &lPan)) { return; } pSFX = &sgSFX[psfx]; /* not necessary, since non-streamed sfx should be loaded at this time streams are loaded in stream_play if (!pSFX->pSnd.IsLoaded()) { sound_file_load(pSFX->pszName, &pSFX->pSnd); // assert(pSFX->pSnd.IsLoaded()); }*/ if (pSFX->bFlags & sfx_STREAM) { stream_play(pSFX, lVolume, lPan); return; } assert(pSFX->pSnd.IsLoaded()); if (!(pSFX->bFlags & sfx_MISC) && pSFX->pSnd.IsPlaying()) { return; } sound_play(&pSFX->pSnd, lVolume, lPan); } void PlayEffect(int mnum, int mode) { MonsterStruct* mon; int sndIdx, lVolume, lPan; SoundSample* snd; sndIdx = random_(164, lengthof(mapMonTypes[0].cmSnds[0])); if (!gbSoundOn || gbLvlLoad != 0) return; mon = &monsters[mnum]; snd = &mapMonTypes[mon->_mMTidx].cmSnds[mode][sndIdx]; assert(snd->IsLoaded()); if (snd->IsPlaying()) { return; } if (!calc_snd_position(mon->_mx, mon->_my, &lVolume, &lPan)) return; sound_play(snd, lVolume, lPan); } void PlaySFX(int psfx, int rndCnt) { if (rndCnt != 1) psfx += random_(165, rndCnt); PlaySFX_priv(psfx, false, 0, 0); } void PlaySfxLoc(int psfx, int x, int y, int rndCnt) { if (rndCnt != 1) psfx += random_(165, rndCnt); //if (psfx <= PS_WALK4 && psfx >= PS_WALK1) { if (psfx == PS_WALK1) { sgSFX[psfx].pSnd.nextTc = 0; } PlaySFX_priv(psfx, true, x, y); } void sound_stop() { Mix_HaltChannel(-1); } void sound_pause(bool pause) { if (pause) Mix_Pause(-1); else Mix_Resume(-1); } void sound_update() { assert(gbSndInited); stream_update(); } static void priv_sound_free(BYTE bLoadMask) { int i; for (i = 0; i < lengthof(sgSFX); i++) { if (/*sgSFX[i].pSnd.IsLoaded() &&*/ (sgSFX[i].bFlags & bLoadMask)) { sgSFX[i].pSnd.Release(); } } } static void priv_sound_init(BYTE bLoadMask) { int i; assert(gbSndInited); for (i = 0; i < lengthof(sgSFX); i++) { if ((sgSFX[i].bFlags & bLoadMask) != sgSFX[i].bFlags) { continue; } assert(!sgSFX[i].pSnd.IsLoaded()); sound_file_load(sgSFX[i].pszName, &sgSFX[i].pSnd); } } void InitGameEffects() { #ifdef HELLFIRE BYTE mask = sfx_MISC | sfx_HELLFIRE; #else BYTE mask = sfx_MISC; #endif if (IsLocalGame) { mask |= sgSFXSets[SFXS_MASK][myplr._pClass]; } else { mask |= sfx_WARRIOR | sfx_ROGUE | sfx_SORCERER; #ifdef HELLFIRE mask |= sfx_MONK; #endif } priv_sound_init(mask); } void InitUiEffects() { priv_sound_init(sfx_UI); } void FreeGameEffects() { priv_sound_free(~(sfx_UI | sfx_STREAM)); } void FreeUiEffects() { priv_sound_free(sfx_UI); } #endif // NOSOUND DEVILUTION_END_NAMESPACE
76.492928
199
0.520271
pionere
b0651453fd9df482a581f72eafbbe880196c8d91
733
cpp
C++
src/DNNLab/FrameNotes.cpp
Qt-Widgets/BeeDNN
a117d5a1d990df3bc04a469b1b335cdd1add55df
[ "MIT" ]
1
2021-01-10T06:38:52.000Z
2021-01-10T06:38:52.000Z
src/DNNLab/FrameNotes.cpp
Qt-Widgets/BeeDNN
a117d5a1d990df3bc04a469b1b335cdd1add55df
[ "MIT" ]
null
null
null
src/DNNLab/FrameNotes.cpp
Qt-Widgets/BeeDNN
a117d5a1d990df3bc04a469b1b335cdd1add55df
[ "MIT" ]
null
null
null
#include "FrameNotes.h" #include "ui_FrameNotes.h" #include "mainwindow.h" FrameNotes::FrameNotes(QWidget *parent) : QFrame(parent), ui(new Ui::FrameNotes) { _bLock=true; _pMainWindow=nullptr; ui->setupUi(this); _bLock=false; } FrameNotes::~FrameNotes() { delete ui; } string FrameNotes::text() const { return ui->leNotes->toPlainText().toStdString(); } void FrameNotes::setText(const string &sText) { _bLock=true; ui->leNotes->setPlainText(sText.c_str()); _bLock=false; } void FrameNotes::set_main_window(MainWindow* pMainWindow) { _pMainWindow=pMainWindow; } void FrameNotes::on_leNotes_textChanged() { if(_bLock) return; _pMainWindow->model_changed(this); }
16.288889
57
0.686221
Qt-Widgets
b0662e859010c6d24d33cd4faa9606e4548b2351
8,240
cpp
C++
cpptester/readData.cpp
ABC-iRobotics/RelaxedUnscentedTransformation
b0e2dc4d484f998fad84796d639af68b5ebdfbbc
[ "MIT" ]
null
null
null
cpptester/readData.cpp
ABC-iRobotics/RelaxedUnscentedTransformation
b0e2dc4d484f998fad84796d639af68b5ebdfbbc
[ "MIT" ]
null
null
null
cpptester/readData.cpp
ABC-iRobotics/RelaxedUnscentedTransformation
b0e2dc4d484f998fad84796d639af68b5ebdfbbc
[ "MIT" ]
null
null
null
#include "readData.h" #include <fstream> #include <string> #include <algorithm> Barcodes readBarcodes() { Barcodes out; // File pointer std::fstream fin; // Open an existing file fin.open(std::string(DATASET_PATH) + "SLAM_dataset/Barcodes.dat", std::ios::in); if (!fin) std::logic_error("File not found"); // Read first 4 comment rows { std::string word; getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); } // Get Barcodes { //first five are robots std::string word; for (int i = 0; i < 5; i++) getline(fin, word, '\n'); } { while (!fin.eof()) { std::string word; int n = -1; while (n == -1) { try { getline(fin, word, ' '); while (word.size() == 0 || word[0] == ' ' || word[0] == '\t') getline(fin, word, ' '); n = stoi(word); } catch (...) { n = -1; } } n = stoi(word); //std::cout << "n: " << n << std::endl; int barcode = -1; while (barcode == -1) { try { getline(fin, word, ' '); while (word.size() == 0 || word[0] == ' ' || word[0] == '\t') getline(fin, word, ' '); barcode = stoi(word); } catch (...) { barcode = -1; } } //std::cout << "barcode: " << barcode << std::endl; getline(fin, word, '\n'); out.insert({ n,barcode }); } } fin.close(); return out; } bool doesContain(const Barcodes& codes, int value) { return std::find_if(codes.begin(), codes.end(), [value](const auto& mo) {return mo.second == value; }) != codes.end(); } MeasurmentList ReadMeasurmentList(long time_start_sec, long time_start_msec, double duration_sec, const Barcodes& codes) { MeasurmentList out; // File pointer std::fstream fin; // Open an existing file fin.open(std::string(DATASET_PATH) + "SLAM_dataset/Robot1_Measurement.dat", std::ios::in); if (!fin) std::logic_error("File not found"); // Read first 4 comment rows { std::string word; getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); } // Get data { while (!fin.eof()) { std::string word; // t0 long t0 = -1; while (t0 == -1) { try { getline(fin, word, '.'); while (word.size() == 0 || word[0] == ' ' || word[0] == '\t') getline(fin, word, ' '); t0 = stol(word); } catch (...) { t0 = -1; } } // t1 getline(fin, word, ' '); double t1 = double(stol(word)) / pow(10,word.length()); // barcode int barcode = -1; while (barcode == -1) { try { getline(fin, word, ' '); while (word.size() == 0 || word[0] == ' ' || word[0] == '\t') getline(fin, word, ' '); barcode = stol(word); } catch (...) { barcode = -1; } } // R double R = -1; while (R == -1) { try { getline(fin, word, ' '); while (word.size() == 0 || word[0] == ' ' || word[0] == '\t') getline(fin, word, ' '); R = stod(word); } catch (...) { R = -1; } } // phi double phi = -1; while (phi == -1) { try { getline(fin, word, ' '); while (word.size() == 0 || word[0] == ' ' || word[0] == '\t') getline(fin, word, ' '); phi = stod(word); } catch (...) { phi = -1; } } getline(fin, word, '\n'); t0 -= time_start_sec; t1 -= double(time_start_msec) / 1000.; double t = t0 + t1; if (t>=0 && t< duration_sec && doesContain(codes, barcode)) out.push_back({ t,barcode,R,phi }); } } fin.close(); return out; } OdometryData ReadOdometryData(long time_start_sec, long time_start_msec, double duration_sec) { OdometryData out; // File pointer std::fstream fin; // Open an existing file fin.open(std::string(DATASET_PATH) + "SLAM_dataset/Robot1_Odometry.dat", std::ios::in); if (!fin) std::logic_error("File not found"); // Read first 4 comment rows { std::string word; getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); } // Get data { while (!fin.eof()) { std::string word; // t0 long t0 = -1; while (t0 == -1) { try { getline(fin, word, '.'); t0 = stol(word); } catch (...) { t0 = -1; } } // t1 getline(fin, word, ' '); double t1 = double(stol(word)) / pow(10, word.length()); // v double v = -1; while (v == -1) { try { getline(fin, word, ' '); while (word.size()==0 || word[0]==' ' || word[0] == '\t') getline(fin, word, ' '); v = std::stod(word); } catch (...) { v = -1; } } // R double omega = -1; while (omega == -1) { try { getline(fin, word, ' '); while (word.size() == 0 || word[0] == ' ' || word[0] == '\t') getline(fin, word, ' '); omega = stod(word); } catch (...) { omega = -1; } } getline(fin, word, '\n'); t0 -= time_start_sec; t1 -= double(time_start_msec) / 1000.; double t = t0 + t1; if (t >= 0 && t < duration_sec) out.push_back({ t,v,omega }); } } fin.close(); return out; } void ConvertGroundTruthData(long time_start_sec, long time_start_msec, double duration_sec) { // open output file std::fstream fout; fout.open(std::string(DATASET_PATH) + "groundtruth.m", std::ios::out | std::ios::trunc); // write path into the output file { // Open an existing file std::fstream fin; fin.open(std::string(DATASET_PATH) + "SLAM_dataset/Robot1_Groundtruth.dat", std::ios::in); if (!fin) std::logic_error("File not found"); // Read first 4 comment rows { std::string word; getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); } // Get data { fout << "path_groundtruth_t_x_y_phi = [ "; bool firstline = true; while (!fin.eof()) { std::string word; // t0 long t0 = -1; while (t0 == -1) { try { getline(fin, word, '.'); t0 = stol(word); } catch (...) { t0 = -1; } } // t1 getline(fin, word, ' '); double t1 = double(stol(word)) / pow(10, word.length()); double vk[3]; // x,y,phi for (int i = 0; i < 3; i++) { double v = -1; while (v == -1) { try { getline(fin, word, ' '); while (word.size() == 0 || word[0] == ' ' || word[0] == '\t') getline(fin, word, ' '); v = std::stod(word); } catch (...) { v = -1; } } vk[i] = v; } getline(fin, word, '\n'); t0 -= time_start_sec; t1 -= double(time_start_msec) / 1000.; double t = t0 + t1; if (t >= 0 && t < duration_sec) { if (!firstline) fout << "; "; else firstline = false; fout << t << " "; for (int i = 0; i < 3; i++) fout << vk[i] << " "; fout << "...\n"; } } fout << "];\n"; } fin.close(); } // Write landmark ground truth into the file { // Open an existing file std::fstream fin; fin.open(std::string(DATASET_PATH) + "SLAM_dataset/Landmark_Groundtruth.dat", std::ios::in); if (!fin) std::logic_error("File not found"); // Read first 4 comment rows { std::string word; getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); getline(fin, word, '\n'); } // Get data { int n = 1; while (!fin.eof()) { std::string word; // t0 int ID = -1; while (ID == -1) { getline(fin, word, ' '); try { ID = stol(word); } catch (...) { ID = -1; } } fout << "ID{" << n << "} = " << ID << ";\n"; // x,y for (int j = 0; j < 2; j++) { if (j == 0) fout << "r{" << n << "} = [ "; if (j == 1) fout << "Sr{" << n << "} = [ "; for (int i = 0; i < 2; i++) { double v = -1; while (v == -1) { try { getline(fin, word, ' '); while (word.size() == 0 || word[0] == ' ' || word[0] == '\t') getline(fin, word, ' '); v = std::stod(word); } catch (...) { v = -1; } } fout << v << " "; } fout << "];\n"; } getline(fin, word, '\n'); n++; } } fin.close(); } fout.close(); }
22.27027
123
0.486408
ABC-iRobotics
b067b0b09e46cb29511d2a5542cf1a25897280b0
428
cpp
C++
solutions-LUOGU/P5714.cpp
Ki-Seki/solutions
e4329712d664180d850e0a48d7d0f637215f13d0
[ "MIT" ]
1
2022-02-26T10:33:24.000Z
2022-02-26T10:33:24.000Z
solutions-LUOGU/P5714.cpp
Ki-Seki/solutions
e4329712d664180d850e0a48d7d0f637215f13d0
[ "MIT" ]
null
null
null
solutions-LUOGU/P5714.cpp
Ki-Seki/solutions
e4329712d664180d850e0a48d7d0f637215f13d0
[ "MIT" ]
1
2021-12-01T14:54:33.000Z
2021-12-01T14:54:33.000Z
#include <iostream> using namespace std; float getBMI(float weight, float height); int main() { float m, h, bmi; cin >> m >> h; bmi = getBMI(m, h); if (bmi<18.5) { cout << "Underweight"; } else if (bmi>=18.5 && bmi<24) { cout << "Normal"; } else { cout << bmi << endl << "Overweight"; } return 0; } float getBMI(float weight, float height) { float bmi; bmi = weight / (height * height); return bmi; }
12.969697
41
0.586449
Ki-Seki
b06affa1b763067421762b4fa6fd97c34aedff68
2,944
hpp
C++
include/NP-Engine/Container/Container.hpp
naphipps/NP-Engine
0cac8b2d5e76c839b96f2061bf57434bdc37915e
[ "MIT" ]
null
null
null
include/NP-Engine/Container/Container.hpp
naphipps/NP-Engine
0cac8b2d5e76c839b96f2061bf57434bdc37915e
[ "MIT" ]
null
null
null
include/NP-Engine/Container/Container.hpp
naphipps/NP-Engine
0cac8b2d5e76c839b96f2061bf57434bdc37915e
[ "MIT" ]
null
null
null
//##===----------------------------------------------------------------------===##// // // Author: Nathan Phipps 12/30/20 // //##===----------------------------------------------------------------------===##// #ifndef NP_ENGINE_CONTAINER_HPP #define NP_ENGINE_CONTAINER_HPP #include "NP-Engine/Foundation/Foundation.hpp" #include "NP-Engine/Memory/Memory.hpp" #include <utility> //pair #include <array> #include <deque> #include <queue> #include <stack> #include <vector> #include <list> #include <forward_list> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <initializer_list> namespace np::container { template <class T> using init_list = ::std::initializer_list<T>; template <class T, siz SIZE> using array = ::std::array<T, SIZE>; template <class T> using vector = ::std::vector<T, memory::StdAllocator<T>>; template <class T> using deque = ::std::deque<T, memory::StdAllocator<T>>; template <class T, class Container = container::deque<T>> using stack = ::std::stack<T, Container>; template <class T, class Container = container::deque<T>> using queue = ::std::queue<T, Container>; template <class T, class Container = container::vector<T>, class Compare = ::std::less<typename Container::value_type>> using pqueue = ::std::priority_queue<T, Container, Compare>; template <class T> using flist = ::std::forward_list<T, memory::StdAllocator<T>>; template <class T> using list = ::std::list<T, memory::StdAllocator<T>>; template <class Key, class Compare = ::std::less<Key>> using oset = ::std::set<Key, Compare, memory::StdAllocator<Key>>; template <class Key, class Hash = ::std::hash<Key>, class KeyEqualTo = ::std::equal_to<Key>> using uset = ::std::unordered_set<Key, Hash, KeyEqualTo, memory::StdAllocator<Key>>; template <class Key, class T, class Compare = ::std::less<Key>> using omap = ::std::map<Key, T, Compare, memory::StdAllocator<::std::pair<const Key, T>>>; template <class Key, class T, class Hash = ::std::hash<Key>, class KeyEqualTo = ::std::equal_to<Key>> using umap = ::std::unordered_map<Key, T, Hash, KeyEqualTo, memory::StdAllocator<::std::pair<const Key, T>>>; template <class Key, class Compare = ::std::less<Key>> using omset = ::std::multiset<Key, Compare, memory::StdAllocator<Key>>; template <class Key, class Hash = ::std::hash<Key>, class KeyEqualTo = ::std::equal_to<Key>> using umset = ::std::unordered_multiset<Key, Hash, KeyEqualTo, memory::StdAllocator<Key>>; template <class Key, class T, class Compare = ::std::less<Key>> using ommap = ::std::multimap<Key, T, Compare, memory::StdAllocator<::std::pair<const Key, T>>>; template <class Key, class T, class Hash = ::std::hash<Key>, class KeyEqualTo = ::std::equal_to<Key>> using ummap = ::std::unordered_multimap<Key, T, Hash, KeyEqualTo, memory::StdAllocator<::std::pair<const Key, T>>>; } // namespace np::container #endif /* NP_ENGINE_CONTAINER_HPP */
35.46988
120
0.659647
naphipps
b06d44c38dbbaa6bca171c07e8bdd6e79daf24bf
693
cpp
C++
UVA/vol-001/161.cpp
arash16/prays
0fe6bb2fa008b8fc46c80b01729f68308114020d
[ "MIT" ]
3
2017-05-12T14:45:37.000Z
2020-01-18T16:51:25.000Z
UVA/vol-001/161.cpp
arash16/prays
0fe6bb2fa008b8fc46c80b01729f68308114020d
[ "MIT" ]
null
null
null
UVA/vol-001/161.cpp
arash16/prays
0fe6bb2fa008b8fc46c80b01729f68308114020d
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int main() { int X[143], n; while (cin >> X[0] && X[0]) { for (n=1; cin>>X[n] && X[n]; ++n); int Y[20000] = {}; for (int i=0; i<n; ++i) { int p = X[i] << 1; for (int j=0; j<=18000; j+=p) ++Y[j], --Y[j+X[i]-5]; } int s = 0, c = 0; for (int i=0; i<=18000; ++i) if (Y[i]) { s += Y[i]; if (s == n && ++c==2) { printf("%02d:%02d:%02d\n", i/3600, (i/60)%60, i%60); goto fin; } } cout << "Signals fail to synchronise in 5 hours\n"; fin:; } }
23.1
68
0.337662
arash16
b07320facb9ebf1254f7d54daedd88912fd9a4b7
3,192
cpp
C++
c714.cpp
puyuliao/ZJ-d879
bead48e0a500f21bc78f745992f137706d15abf8
[ "MIT" ]
null
null
null
c714.cpp
puyuliao/ZJ-d879
bead48e0a500f21bc78f745992f137706d15abf8
[ "MIT" ]
null
null
null
c714.cpp
puyuliao/ZJ-d879
bead48e0a500f21bc78f745992f137706d15abf8
[ "MIT" ]
null
null
null
#include<bits/stdc++.h> #include<stdint.h> using namespace std; #define IOS {cin.tie(0);ios_base::sync_with_stdio(false);} #define N 50006 #define int int64_t const int INF = 1e6; struct treap{ treap *l,*r; int key,pri,sz,data,keytag,datatag; treap(int _k,int _d):key(_k),data(_d),sz(1),pri(rand()),keytag(0),datatag(0),l(NULL),r(NULL){} treap(){} void push(){ if(keytag){ if(l) l->key += keytag, l->keytag += keytag; if(r) r->key += keytag, r->keytag += keytag; keytag = 0; } if(datatag){ if(l) l->data += datatag, l->datatag += datatag; if(r) r->data += datatag, r->datatag += datatag; datatag = 0; } } void pull(){ sz = 1; if(l) sz += l->sz; if(r) sz += r->sz; } }mem[N]; int memcnt = 0; treap *make(int k,int d){ mem[memcnt] = treap(k,d); return &mem[memcnt++]; } int size(treap *t){ if(t) { t->push(); return t->sz; } return 0; } treap *merge(treap *a,treap *b){ if(!a) return b; if(!b) return a; a->push(); b->push(); if(a->pri < b->pri){ a->r = merge(a->r,b); a->pull(); return a; } b->l = merge(a,b->l); b->pull(); return b; } void splitbykey(treap *t,int k,treap*&a,treap*&b){ if(!t) return a=b=NULL,void(); t->push(); if(t->key <= k){ a = t; splitbykey(t->r,k,a->r,b); a->pull(); return; } b = t; splitbykey(t->l,k,a,b->l); b->pull(); } void splitbysize(treap *t,int k,treap*&a,treap*&b){ if(!t) return a=b=NULL,void(); t->push(); if(size(t->l) < k){ a = t; splitbysize(t->r,k - size(t->l) - 1,a->r,b); a->pull(); return; } b = t; splitbysize(t->l,k,a,b->l); b->pull(); } treap *t = NULL, *tl, *tr,*tt; void addkey(int k){ if(t) t->key += k, t->keytag += k; } void adddata(int k){ if(t) t->data += k, t->datatag += k; } void insert(int k,int d){ splitbykey(t,k-1,tl,tr); t = make(k,d); while(tr){ splitbysize(tr,1,tt,tr); if(tt->data >= d) continue; else{ if(tt->key != t->key) t = merge(tl,merge(t,merge(tt,tr))); else t = merge(tl,merge(tt,tr)); return; } } t = merge(tl,t); return; } int getdp(int k){ splitbykey(t,k-1,t,tr); splitbysize(t,size(t)-1,tl,t); if(t == NULL){ cout << "GG"; } int r = t->data; t = merge(tl,merge(t,tr)); return r; } int l[N],r[N],v[N],w[N],in[N]; int cnt; void dfs(int x){ if(!x) return; dfs(l[x]); in[++cnt] = x; dfs(r[x]); } void print(treap *tt){ if(!tt) return; print(tt->l); cout << tt->key << ' ' << tt->keytag << ' ' << tt->data << ' ' << tt->datatag << ' ' << tt->sz << '\n'; print(tt->r); } int32_t main() { srand(time(NULL)); IOS; int T,n; cin >> T; while(T--){ t = NULL; memcnt = cnt = 0; cin >> n; for(int i=1;i<=n;i++) cin >> l[i] >> r[i]; for(int i=1;i<=n;i++) cin >> v[i]; for(int i=1;i<=n;i++) cin >> w[i]; dfs(1); insert(-INF,0); for(int j=1;j<=n;j++){ int i = in[j]; int rr = getdp(v[i]); addkey(1); adddata(w[i]); insert(v[i],rr); //print(t); //cout << j << ' ' << i << ' ' << getdp(INF) << '\n'; } cout << getdp(INF) << '\n'; } return 0; }
18.136364
105
0.492794
puyuliao
b0779c39639ae49c1c46c9ebd987f2a97dc44316
2,407
hxx
C++
base/fs/utils/tree/tree.hxx
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
base/fs/utils/tree/tree.hxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
base/fs/utils/tree/tree.hxx
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
/*++ Copyright (c) 1991 Microsoft Corporation Module Name: tree.hxx Abstract: This module contains the definition of the TREE class. The TREE class implements a tree utility functionally compatible with the DOS 5 tree utility. This utility displays the directory structure of a path or drive. Usage: TREE [drive:][path] [/F] [/A] [/?] /F Display the names of files in each directory. /A Uses ASCII instead of extended characters. /? Displays a help message. Author: Jaime F. Sasson - jaimes - 13-May-1991 Environment: ULIB, User Mode --*/ #if ! defined( _TREE_ ) #define _TREE_ #include "object.hxx" #include "keyboard.hxx" #include "program.hxx" DECLARE_CLASS( TREE ); class TREE : public PROGRAM { public: DECLARE_CONSTRUCTOR( TREE ); NONVIRTUAL BOOLEAN Initialize ( ); NONVIRTUAL BOOLEAN DisplayName ( IN PCFSNODE Fsn, IN PCWSTRING String ); NONVIRTUAL VOID DisplayVolumeInfo ( ); NONVIRTUAL BOOLEAN ExamineDirectory( IN PCFSN_DIRECTORY Directory, IN PCWSTRING String ); NONVIRTUAL PFSN_DIRECTORY GetInitialDirectory( ) CONST; NONVIRTUAL VOID Terminate( ); private: PSTREAM _StandardOutput; FLAG_ARGUMENT _FlagDisplayFiles; FLAG_ARGUMENT _FlagUseAsciiCharacters; FLAG_ARGUMENT _FlagDisplayHelp; PFSN_DIRECTORY _InitialDirectory; FSN_FILTER _FsnFilterDirectory; FSN_FILTER _FsnFilterFile; STREAM_MESSAGE _Message; DSTRING _StringForDirectory; DSTRING _StringForLastDirectory; DSTRING _StringForFile; DSTRING _StringForFileNoDirectory; DSTRING _EndOfLineString; PWSTRING _VolumeName; VOL_SERIAL_NUMBER _SerialNumber; BOOLEAN _FlagAtLeastOneSubdir; BOOLEAN _FlagPathSupplied; }; INLINE PFSN_DIRECTORY TREE::GetInitialDirectory( ) CONST /*++ Routine Description: Returns to the caller a pointer to the fsnode corresponding to the directory to be used as the root of the tree. Arguments: None. Return Value: PFSN_DIRECTORY - Pointer to the fsnode that describes the starting directory. --*/ { return( _InitialDirectory ); } #endif // _TREE_
15.33121
68
0.647279
npocmaka
b07c8b0a4d0120da4ca1e2aa96d7354d71d976a1
13,738
cpp
C++
src/pc_renderer.cpp
dooglz/Celestial-Drift
8ffcd6765d8e2a70cba502f78ebee432d85f3fee
[ "MIT" ]
null
null
null
src/pc_renderer.cpp
dooglz/Celestial-Drift
8ffcd6765d8e2a70cba502f78ebee432d85f3fee
[ "MIT" ]
null
null
null
src/pc_renderer.cpp
dooglz/Celestial-Drift
8ffcd6765d8e2a70cba502f78ebee432d85f3fee
[ "MIT" ]
null
null
null
#include "pc_renderer.h" #include "GL/glew.h" #include "TextureManager.h" #include "common.h" #include "component_camera.h" #include "glm/glm.hpp" #include "mesh.h" #include "pc_shaderprogram.h" #include "renderer.h" #include "resource.h" #include <glm/gtc/type_ptr.hpp> #include <glm/gtx/transform.hpp> glm::mat4 PC_Renderer::vp_; static glm::mat4 ps_; static glm::mat4 vps_; std::vector<std::pair<const glm::vec3, const glm::vec4>> PC_Renderer::linebuffer; void CheckGL() { GLenum err; while ((err = glGetError()) != GL_NO_ERROR) { printf("An OGL error has occured: %u\n", err); } } void PC_Renderer::PostRender() { ProcessLines(); }; bool PC_Renderer::Init() { CheckGL(); // preload basic shaders Storage<ShaderProgram>::Get("basic"); CheckGL(); glViewport(0, 0, DEFAULT_RESOLUTION); CheckGL(); glDepthFunc(GL_LESS); CheckGL(); glEnable(GL_DEPTH_TEST); CheckGL(); ResetProjectionMatrix(); CheckGL(); return false; } bool PC_Renderer::Shutdown() { return false; } void PC_Renderer::DrawCross(const glm::vec3 &p1, const float size, const glm::vec4 &col) { DrawLine(p1 + glm::vec3(size, 0, 0), p1 - glm::vec3(size, 0, 0), col, col); DrawLine(p1 + glm::vec3(0, size, 0), p1 - glm::vec3(0, size, 0), col, col); DrawLine(p1 + glm::vec3(0, 0, size), p1 - glm::vec3(0, 0, size), col, col); } void PC_Renderer::DrawLine(const glm::vec3 &p1, const glm::vec3 &p2, const glm::vec4 &col1, const glm::vec4 &col2) { linebuffer.push_back(std::make_pair(p1, col1)); linebuffer.push_back(std::make_pair(p2, col2)); } void PC_Renderer::SetProjectionMAtrix(const glm::mat4 &vm) { ps_ = vm; } void PC_Renderer::ResetProjectionMatrix() { ps_ = glm::perspective(glm::radians(45.0f), (float)DEFAULT_RESOLUTION_X / (float)DEFAULT_RESOLUTION_Y, 0.1f, 1000.0f); } void PC_Renderer::SetViewMatrix(const glm::mat4 &vpm) { glm::mat4 Projection = vp_ = ps_ * vpm; vps_ = vpm; vps_[3] = glm::vec4(0, 0, 0, 1); vps_ = ps_ * vps_; } void PC_Renderer::RenderMesh(const Mesh &m, const mat4 &modelMatrix) { glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); CheckGL(); std::string shadername = "basic"; if (m.shaderPref != "") { shadername = m.shaderPref; if (Storage<ShaderProgram>::Get(shadername) == nullptr) { LOG(logWARNING) << "Can't find shader " << shadername << " for model"; shadername = "basic"; } } const auto prog = Storage<ShaderProgram>::Get(shadername)->program; glUseProgram(prog); CheckGL(); GLint vpIn = glGetUniformLocation(prog, "viewprojection"); GLint mvpIn = glGetUniformLocation(prog, "modelprojection"); GLint invmvpIn = glGetUniformLocation(prog, "invMvp"); CheckGL(); glUniformMatrix4fv(vpIn, 1, false, glm::value_ptr(vp_)); glUniformMatrix4fv(mvpIn, 1, false, glm::value_ptr(modelMatrix)); if (invmvpIn != -1) { mat4 inv = inverse(vp_ * modelMatrix); glUniformMatrix4fv(invmvpIn, 1, false, glm::value_ptr(inv)); } CheckGL(); // Bind to VAO glBindVertexArray(m.gVAO); glBindBuffer(GL_ARRAY_BUFFER, m.gVBO); if (m.hasIndicies) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m.gIBO); } // DRAW if (m.line == true) { if (m.strip == true) { if (m.hasIndicies) { glDrawElements(GL_LINE_STRIP, (GLsizei)m.indices.size(), GL_UNSIGNED_INT, (void *)0); } else { glDrawArrays(GL_LINE_STRIP, 0, m.numVerts); } } else { if (m.hasIndicies) { glDrawElements(GL_LINES, (GLsizei)m.indices.size(), GL_UNSIGNED_INT, (void *)0); } else { glDrawArrays(GL_LINES, 0, m.numVerts); } } } else { if (m.fan == true) { if (m.hasIndicies) { glDrawElements(GL_TRIANGLE_FAN, (GLsizei)m.indices.size(), GL_UNSIGNED_INT, (void *)0); } else { glDrawArrays(GL_TRIANGLE_FAN, 0, m.numVerts); } } else if (m.strip == true) { if (m.hasIndicies) { glDrawElements(GL_TRIANGLE_STRIP, (GLsizei)m.indices.size(), GL_UNSIGNED_INT, (void *)0); } else { glDrawArrays(GL_TRIANGLE_STRIP, 0, m.numVerts); } } else { if (m.hasIndicies) { glDrawElements(GL_TRIANGLES, (GLsizei)m.indices.size(), GL_UNSIGNED_INT, (void *)0); } else { glDrawArrays(GL_TRIANGLES, 0, m.numVerts); } } } glBindBuffer(GL_ARRAY_BUFFER, NULL); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, NULL); glBindVertexArray(0); glUseProgram(NULL); } void PC_Renderer::BindTexture(const unsigned int texID, const unsigned int texUnit, const std::string &shadername) { const auto prog = Storage<ShaderProgram>::Get(shadername)->program; glUseProgram(prog); CheckGL(); glActiveTexture(GL_TEXTURE0 + texUnit); TextureManager::Inst()->BindTexture(texID); GLint texuniform = glGetUniformLocation(prog, ("texture" + std::to_string(texUnit)).c_str()); glUniform1i(texuniform, 0 + texUnit); CheckGL(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // CLAMP_TO_EDGE ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // CLAMP_TO_EDGE ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } static GLuint tex_cube; GLuint sbox_vao; GLuint sbox_vbo; void PC_Renderer::CreateSkybox(const std::string (&imgs)[6]) { // generate a cube-map texture to hold all the sides glActiveTexture(GL_TEXTURE0); glGenTextures(1, &tex_cube); glBindTexture(GL_TEXTURE_CUBE_MAP, tex_cube); const int sides[] = {GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_X}; for (size_t i = 0; i < 6; i++) { TextureManager::Inst()->LoadTexture(imgs[i].c_str(), 0, false, sides[i]); } // format cube map texture glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); float points[] = {-10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, -10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, -10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, 10.0f, -10.0f, 10.0f, 10.0f, -10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, 10.0f, -10.0f, 10.0f, 10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, -10.0f, 10.0f, -10.0f, -10.0f, -10.0f, -10.0f, 10.0f, 10.0f, -10.0f, 10.0f}; glGenBuffers(1, &sbox_vbo); glBindBuffer(GL_ARRAY_BUFFER, sbox_vbo); glBufferData(GL_ARRAY_BUFFER, 3 * 36 * sizeof(float), &points, GL_STATIC_DRAW); glGenVertexArrays(1, &sbox_vao); glBindVertexArray(sbox_vao); glEnableVertexAttribArray(0); glBindBuffer(GL_ARRAY_BUFFER, sbox_vbo); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL); glBindBuffer(GL_ARRAY_BUFFER, NULL); glBindVertexArray(NULL); // glBindBuffer(GL_ARRAY_BUFFER, 0); // glBindVertexArray(0); } void PC_Renderer::RenderSkybox() { const auto prog = Storage<ShaderProgram>::Get("skybox"); if (prog == nullptr) { LOG(logWARNING) << "Can't find shader skybox for model"; return; } glUseProgram(prog->program); CheckGL(); const auto t = glGetUniformLocation(prog->program, "PV"); if (t != -1) { glUniformMatrix4fv(t, 1, GL_FALSE, glm::value_ptr(vps_)); } else { // BAAH } CheckGL(); GLint OldDepthFuncMode; glGetIntegerv(GL_DEPTH_FUNC, &OldDepthFuncMode); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_DST_COLOR); CheckGL(); glDisable(GL_CULL_FACE); glDepthFunc(GL_LEQUAL); // glDepthMask(GL_FALSE); // glDepthFunc(GL_LESS); CheckGL(); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_CUBE_MAP, tex_cube); glBindBuffer(GL_ARRAY_BUFFER, sbox_vbo); glBindVertexArray(sbox_vao); glDrawArrays(GL_TRIANGLES, 0, 36); CheckGL(); glEnable(GL_CULL_FACE); glDepthFunc(OldDepthFuncMode); CheckGL(); glUseProgram(0); } void PC_Renderer::LoadMesh(Mesh *msh) { if (msh->loadedLocal) { return; } assert(msh->loadedMain); // Generate VAO glGenVertexArrays(1, &msh->gVAO); // Bind VAO glBindVertexArray(msh->gVAO); { // Vertex // Generate VBO glGenBuffers(1, &(msh->gVBO)); // Bind VBO glBindBuffer(GL_ARRAY_BUFFER, (msh->gVBO)); // put the data in it glBufferData(GL_ARRAY_BUFFER, msh->vertexData.size() * sizeof(vec3), &msh->vertexData[0], GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, // index 3, // size GL_FLOAT, // type GL_FALSE, // normalised sizeof(vec3), // stride NULL // pointer/offset ); CheckGL(); } if (msh->hasColours) { // colours data // Generate VBO glGenBuffers(1, &(msh->gCOLOURBO)); // Bind VBO glBindBuffer(GL_ARRAY_BUFFER, (msh->gCOLOURBO)); // put the data in it glBufferData(GL_ARRAY_BUFFER, msh->colours.size() * sizeof(unsigned int), &msh->colours[0], GL_STATIC_DRAW); glEnableVertexAttribArray(1); glVertexAttribPointer(1, // index 4, // size GL_UNSIGNED_BYTE, // type GL_TRUE, // normalised sizeof(unsigned int), // stride NULL // pointer/offset ); glBindBuffer(GL_ARRAY_BUFFER, NULL); CheckGL(); } if (msh->hasUvs) { // Generate BO glGenBuffers(1, &(msh->gUVBO)); // Bind VBO glBindBuffer(GL_ARRAY_BUFFER, (msh->gUVBO)); // put the data in it glBufferData(GL_ARRAY_BUFFER, msh->uvs.size() * sizeof(vec2), &msh->uvs[0], GL_STATIC_DRAW); glEnableVertexAttribArray(2); glVertexAttribPointer(2, // index 2, // size GL_FLOAT, // type GL_FALSE, // normalised sizeof(vec2), // stride NULL // pointer/offset ); glBindBuffer(GL_ARRAY_BUFFER, NULL); CheckGL(); } if (msh->hasIndicies) { glGenBuffers(1, &(msh->gIBO)); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, msh->gIBO); glBufferData(GL_ELEMENT_ARRAY_BUFFER, msh->indices.size() * sizeof(uint32_t), &msh->indices[0], GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, NULL); CheckGL(); } // Unblind VAO glBindVertexArray(NULL); CheckGL(); msh->loadedLocal = true; } void PC_Renderer::ClearColour(glm::vec4 c) { glClearColor(c.x, c.y, c.z, c.w); glClearDepth(1.0); } void PC_Renderer::ClearFrame() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } void PC_Renderer::ProcessLines() { if (linebuffer.size() < 1) { return; } // Generate VAO unsigned int vao; glGenVertexArrays(1, &vao); CheckGL(); // Bind VAO glBindVertexArray(vao); CheckGL(); // Generate VBO unsigned int vbo; glGenBuffers(1, &vbo); CheckGL(); // Bind VBO glBindBuffer(GL_ARRAY_BUFFER, vbo); CheckGL(); // put the data in it glBufferData(GL_ARRAY_BUFFER, linebuffer.size() * sizeof(float) * 7, &linebuffer[0], GL_STATIC_DRAW); CheckGL(); glEnableVertexAttribArray(0); glVertexAttribPointer(0, // index 3, // size GL_FLOAT, // type GL_FALSE, // normalised sizeof(float) * 7, // stride NULL // pointer/offset ); CheckGL(); glEnableVertexAttribArray(1); glVertexAttribPointer(1, // index 4, // size GL_FLOAT, // type GL_TRUE, // normalised sizeof(float) * 7, // stride (GLvoid *)(sizeof(float) * 3) // pointer/offset ); CheckGL(); if (Storage<ShaderProgram>::Get("basic") == nullptr) { LOG(logWARNING) << "Can't find shader basic for lines"; } const auto prog = Storage<ShaderProgram>::Get("basic")->program; glUseProgram(prog); CheckGL(); // get shader input indexes GLint vpIn = glGetUniformLocation(prog, "viewprojection"); GLint mvpIn = glGetUniformLocation(prog, "modelprojection"); CheckGL(); // Send MVP glUniformMatrix4fv(vpIn, 1, false, glm::value_ptr(vp_)); glUniformMatrix4fv(mvpIn, 1, false, glm::value_ptr(glm::mat4(1.0f))); CheckGL(); glDisable(GL_DEPTH_TEST); glDrawArrays(GL_LINES, 0, linebuffer.size()); CheckGL(); glDeleteBuffers(1, &vbo); glDeleteVertexArrays(1, &vao); glBindVertexArray(NULL); CheckGL(); linebuffer.clear(); }
31.800926
120
0.619522
dooglz
b07e5865ef27ca55b469403c571687d533dadca5
44,877
cpp
C++
source/bckgrnd.cpp
ToonTalk/desktop-toontalk
781b9fa035304b93b015447f1c7773b07e912eb2
[ "BSD-3-Clause" ]
4
2015-10-30T15:50:32.000Z
2019-11-26T23:26:50.000Z
source/bckgrnd.cpp
ToonTalk/desktop-toontalk
781b9fa035304b93b015447f1c7773b07e912eb2
[ "BSD-3-Clause" ]
null
null
null
source/bckgrnd.cpp
ToonTalk/desktop-toontalk
781b9fa035304b93b015447f1c7773b07e912eb2
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 1992-2005. Ken Kahn, Animated Programs, All rights reserved. #if !defined(__TT_DEFS_H) #include "defs.h" #endif #if !defined(__TT_GLOBALS_H) #include "globals.h" #endif #if !defined(__TT_STRINGS_H) #include "strings.h" #endif #if !defined(__TT_SPRITE_H) #include "sprite.h" #endif #if !defined(__TT_SPRITES_H) #include "sprites.h" #endif #if !defined(__TT_SCREEN_H) #include "screen.h" #endif #if !defined(__TT_WINMAIN_H) #include "winmain.h" #endif #if !defined(__TT_PICTURE_H) #include "picture.h" #endif #if !defined(__TT_HELP_H) #include "help.h" #endif #if !defined(__TT_UTILS_H) #include "utils.h" #endif #if !defined(__TT_CITY_H) #include "city.h" #endif #if !defined(__TT_TOOLS_H) #include "tools.h" #endif #if !defined(__TT_BCKGRND_H) #include "bckgrnd.h" #endif #if !defined(__TT_MARTIAN_H) #include "martian.h" #endif #ifdef _DEBUG // new on 160103 to debug leaks #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #if TT_DEBUG_ON long background_counter = 1; #endif #if !defined(__TT_PRGRMMR_H) #include "prgrmmr.h" #endif //Backgrounds::Backgrounds(Background *background, Backgrounds *backgrounds) : // new on 090804 // first(background), // next(backgrounds) { //}; // //Backgrounds::~Backgrounds() { // delete first; // if (next != NULL) { // delete next; // }; //}; Background::Background() : items(NULL), screen_count(0), postponed_removals(NULL), ref_count(1), // changed to 1 from 0 on 230103 deletion_pending_flag(FALSE) { #if TT_DEBUG_ON debug_counter = background_counter++; if (-tt_debug_target == debug_counter) { log("Creating debug target background."); }; prepared_for_deletion = FALSE; #endif }; #if TT_DEBUG_ON Background::~Background() { if (!prepared_for_deletion) { say_error("Deleting a background without preparing it first."); }; }; #endif void Background::prepare_for_deletion() { #if TT_DEBUG_ON if (debug_counter == -tt_debug_target) { log("Preparing background debug target for deletion."); }; if (prepared_for_deletion) { say_error("Destroying a destroyed background."); }; prepared_for_deletion = TRUE; if (tt_debug_mode == 90400) { return; }; #endif // save in case called recursively (e.g. pictures with backgrounds...) UnwindProtect<Background *> set(tt_deleting_background,this); // just used to catch errors if (items != NULL) { Sprites *remaining = items; while (remaining != NULL) { Sprite *sprite = remaining->first(); if (!tt_resetting_or_destroying_city) sprite->set_background(NULL,TRUE); // moved here so that anything that is a part of this that is not ok_to_delete will stop pointing to this // tt_resetting_or_destroying_city was tt_shutting_down prior to 250903 but can cause memory errors while resetting during time travel if (!sprite->slated_for_deletion()) { // something else will destroy it sprite->destroy(); // if (!sprite->prepared_for_deletion()) { // protected -- probably by ref_count // sprite->recursively_set_background(NULL); // }; // } else { // sprite->recursively_set_background(NULL); }; remaining->set_first(NULL); remaining = remaining->rest(); }; delete items; items = NULL; // new on 280803 so this can be reset }; }; void Background::destroy() { #if TT_DEBUG_ON //if (ref_count > 1) { // no longer anomolous as 090804 since may still be deleted by bird // tt_error_file() << "Destroying background whose ref count is " << ref_count << endl; //}; if (tt_debug_mode == 1717) { tt_error_file() << "Background deleted. " << debug_counter << endl; }; if (debug_counter == -tt_debug_target) { log("Destroying debug background."); }; if (tt_debug_mode == 90400) { if (prepared_for_deletion) { say_error("Destroying a destroyed background."); }; prepared_for_deletion = TRUE; return; }; #endif // if (decrement_ref_count()) { // conditional new on 090804 -- not so good because circular references are common (bird's return floor) tt_screen->background_being_destroyed(this); // new on 200901 // this way prepare_for_deletion's calls to virtuals works prepare_for_deletion(); // delete this; // replaced by the following on 090804 // tt_backgrounds_to_delete_next_frame = new Backgrounds(this,tt_backgrounds_to_delete_next_frame); if (decrement_ref_count()) { delete this; } else { deletion_pending_flag = TRUE; // new on 090804 -- not clear this is useful }; // }; }; boolean Background::decrement_ref_count() { if (ref_count == 0) { #if TT_DEBUG_ON if (!tt_resetting_or_destroying_city) { debug_this(); }; #endif return(TRUE); // warn since shouldn't really happen? }; ref_count--; if (ref_count == 0) { deletion_pending_flag = TRUE; // new on 220103 since this is better than the old ok_to_delete() scheme return(TRUE); } else { return(FALSE); }; }; void Background::add_items(Sprites *items, boolean give_priority, boolean change_priority, boolean warn) { Sprites *remaining = items; while (remaining != NULL) { add_item(remaining->first(),give_priority,change_priority,warn); remaining = remaining->rest(); }; }; void Background::reset_items(Sprites *new_items) { // abstracted on 070203 destroy_sprites(items); // new on 070103 items = new_items; Sprites *remaining = items; while (remaining != NULL) { remaining->first()->Sprite::set_background(this,TRUE); // Sprite:: new on 190903 since things like Robot::set_background just do too much remaining = remaining->rest(); }; }; void Background::just_add_items(Sprites *new_items, boolean add_to_screen_too) { // new on 240203 if (items == NULL) { items = new_items; } else { Sprites *last = items->last_cons(); last->set_rest(new_items); }; Sprites *remaining = new_items; while (remaining != NULL) { Sprite *sprite = remaining->first(); sprite->set_background(this,TRUE); // Sprite:: new on 190903 since things like Robot::set_background just do too much // removed Sprite:: on 121703 since otherwise can have saved robots waiting on a nest not work as a team until reset if (add_to_screen_too) { tt_screen->add(sprite); }; remaining = remaining->rest(); }; }; void Background::add_copy_of_items(Sprites *items, boolean give_priority, boolean change_priority, boolean warn) { Sprites *remaining = items; while (remaining != NULL) { add_item(remaining->first()->copy(),give_priority,change_priority,warn); remaining = remaining->rest(); }; }; boolean Background::add_item(Sprite *sprite, boolean , boolean , boolean warn) { #if TT_CAREFUL if (sprite == NULL) { say_error(_T("ToonTalk confused and tried to add the NULL item to a background.")); return(FALSE); }; if (sprite->pointer_to_leader() != NULL && !about_to_quit()) { say_error(_T("Trying to add a part of something to a background.")); return(FALSE); }; // if (sprite->pointer_to_background() != NULL && // sprite->pointer_to_background() != this) { // if (tt_user_is_debugger) { // say("ToonTalk trying to put something on a background while it is on another."); // }; // sprite->remove_from_floor(FALSE); // }; #endif #if TT_DEBUG_ON if (prepared_for_deletion) { // typically when tt_debug_mode == 90400 say_error("Using a destroyed background."); }; if (sprite->debug_counter == tt_debug_target) { tt_error_file() << "Debug target being added to floor #" << debug_counter << endl; } else if ((sprite->prepared_for_deletion() || sprite->deleted()) && !about_to_quit()) { say_error("Trying to add a deleted (or prepared for deletion) item to a background",FALSE); return(FALSE); } else if (tt_debug_target == -debug_counter) { log("Adding item to debug target background."); }; #endif if (postponed_removals != NULL) { boolean postponed; postponed_removals = postponed_removals->remove(sprite,&postponed); if (postponed) { if (sprite->pointer_to_leader() == NULL) { sprite->set_background(this,TRUE); }; return(TRUE); // leave it there }; }; boolean ok; if (items == NULL) { items = new Sprites(sprite); ok = TRUE; } else { ok = items->insert_at_end_if_not_member(sprite); #if TT_DEBUG_ON if (!ok && warn) { // && tt_user_is_debugger say_error(IDS_ADD_TO_BACKGROUND_ALREADY_THERE); }; #endif }; if (//ok && // somehow this is false but sprite doesn't know its background sprite->pointer_to_leader() == NULL) { sprite->set_background(this,TRUE); // for some crazy reason substituted warn for TRUE on 110100 - restored on 200100 }; return(ok); }; boolean Background::has_item(Sprite *sprite) { #if TT_DEBUG_ON if (prepared_for_deletion) { // typically when tt_debug_mode == 90400 say_error("Using a destroyed background."); }; #endif return(items != NULL && items->member_cons(sprite) != NULL && (postponed_removals == NULL || postponed_removals->member_cons(sprite) == NULL)); }; boolean Background::remove_item(Sprite *sprite, boolean report_problems, boolean , boolean reset_background) { #if TT_DEBUG_ON if (sprite->debug_counter == tt_debug_target) { tt_error_file() << "Debug target being removed from floor #" << debug_counter << endl; }; if (prepared_for_deletion) { // typically when tt_debug_mode == 90400 say_error("Using a destroyed background."); }; #endif boolean found = FALSE; if (items != NULL) { items = items->remove(sprite,&found); #if TT_DEBUG_ON if (report_problems && !found) { // && tt_user_is_debugger) { say_error(_T("Warning: ToonTalk just tried to remove something from a background it wasn't in.")); }; } else if (report_problems) { // && tt_user_is_debugger) { say_error(_T("Warning: ToonTalk just tried to remove something from an empty background.")); #endif }; if (reset_background && //found && -- sometimes wrong... sprite->pointer_to_leader() == NULL) { sprite->set_background(NULL,TRUE,report_problems); }; return(found); }; void Background::remove_all() { #if TT_DEBUG_ON if (prepared_for_deletion) { // typically when tt_debug_mode == 90400 say_error("Using a destroyed background."); }; #endif if (items != NULL) { if (tt_log_version_number >= 22) { Sprites *remaining = items; while (remaining != NULL) { if (!tt_resetting_or_destroying_city && remaining->first() != NULL) { // tt_resetting_or_destroying_city was tt_shutting_down prior to 250903 // but can cause memory errors while resetting during time travel // if (remaining->first()->deleted) { // conditional is a temporary hack on 070400 // log("debug this"); // } else { remaining->first()->set_background(NULL,TRUE); // }; }; remaining->set_first(NULL); remaining = remaining->rest(); }; delete items; items = NULL; // replaced below with above on 060400 to set_background to NULL } else { items->remove_all(); delete items; items = NULL; }; }; }; void Background::set_initial_items(Sprites *list) { if (items != NULL) { items->stop_all(TRUE); // moved here on 260301 so the robots are stopped first - since they might for example put working cubby on the floor Sprites *remaining = items; while (remaining != NULL) { Sprite *sprite = remaining->first(); // sprite->stop_all(TRUE); // new on 231000 since might be a running robot (e.g. from a previous puzzle) sprite->remove_from_floor(FALSE); // new on 211200 sprite->set_background(NULL,TRUE,FALSE); // added FALSE on 200400 sprite->destroy(); // new on 240101 remaining = remaining->rest(); }; just_destroy_list(items); // this replaces the following as of 240101 since list of items can be altered // items->destroy_all(); // destroy sprites first // delete items; // items = NULL; }; // items = list; Sprites *remaining = list; while (remaining != NULL) { add_item(remaining->first(),FALSE,TRUE); // this updates priorities correctly remaining = remaining->rest(); }; }; #if TT_XML void Background::top_level_xml(xml_document *document, xml_element *parent) { // abstracted on 040803 and moved from City xml_element *background_element = create_xml_element(xml_tag(),document); add_xml(background_element,document); xml_append_child(background_element,document); release_current_element_sprite_table(); // new on 071103 so if saving stuff on the floor twice in a row no references remain between them // return(background_element); }; boolean Background::handle_xml(string file_name) { // new on 041102 #if TT_DEBUG_ON // for now - conditionalize later... DWORD start = timeGetTime(); #endif boolean result = handle_xml(document_from_file(file_name)); #if TT_DEBUG_ON tt_error_file() << "Took " << (timeGetTime()-start) << "ms to process " << file_name << endl; #endif return(result); }; boolean Background::handle_xml(xml_document *document) { // new interface as of 090103 if (document != NULL) { // boolean result = xml_entity(document,this); xml_node *background_element = first_node_that_is_an_element(document); if (background_element == NULL) return(FALSE); // warn?? if (tag_token(background_element) == NOTHING_TAG) { // shouldn't some of this move up to City? if (current_house_counter() == 0 && !any_trucks_outside()) { // condition new on 120603 -- second condition new on 130205 tt_city->build_initial_houses(); }; int initial_time = xml_get_attribute_int(background_element,L"Time",min_long); if (initial_time == min_long) { // should be true prior to 040805 when even "Nothing" had a few attributes return(TRUE); // new on 120103 - nothing there so nothing to do }; }; // need to do the following before loading everything -- for cities yes but really for floors too?? // int current_frame_number = tt_frame_number; tt_initial_current_time = xml_get_attribute_int(background_element,L"Time",tt_current_time); // was tt_initial_current_time prior to 080103 - restored 140703 tt_frame_number = xml_get_attribute_int(background_element,L"FrameNumber",tt_frame_number); // commented out on 200304 since this gave the wrong frame number on replay // if (tt_current_log_segment == 1) { // on 240803 changed from tt_frame_number != current_frame_number -- // initial value is 0 so not clear this accomplishes anything // tt_frame_number--; // since will be incremented before used - new on 230803 // } else { tt_current_time = tt_initial_current_time; // new on 310803 // }; tt_still_frame_count += tt_frame_number; // commented out the following on 090403 since cities should set the language // restored on 170105 -- but changed tt_language to tt_xml_language_index // removed (NaturalLanguage) on 091205 since obsolete tt_xml_language_index = xml_get_attribute_int(background_element,L"Language",tt_language); #if TT_NO_ROBOT_TRAINING // new on 091205 -- use the language of the saved city -- if string library exists if (tt_xml_language_index < LANGUAGE_COUNT) { char library_file_name[MAX_PATH]; strcpy(library_file_name,country_codes[tt_xml_language_index]); strcat(library_file_name,AC(IDC_STRING_DLL_SUFFIX)); FileNameStatus name_status; string full_file_name = existing_file_name(name_status,library_file_name); if (full_file_name != NULL) { set_language((NaturalLanguage) tt_xml_language_index); set_country_code(country_codes[tt_language],FALSE); unload_string_library(); load_string_library(FALSE); delete [] full_file_name; }; }; #endif tt_xml_version_number = xml_get_attribute_int(background_element,L"Version",tt_xml_version_number); // new on 180103 // boolean result = xml_entity(background_element,this); set_xml_after_titles(document); // background_element); // new on 070103 - updated 120103 // document->Release(); return(TRUE); } else { return(FALSE); }; }; void Background::set_xml_after_titles(xml_document *node) { // by default load it now xml_entity(node,this); }; void Background::add_xml_attributes(xml_element *element, xml_document *document) { // abstracted on 040805 xml_set_attribute(element,L"Language",(int) tt_language); xml_set_attribute(element,L"Version",xml_version_number); // new on 180103 xml_set_attribute(element,L"Time",tt_current_time); // rewritten on 161102 xml_set_attribute(element,L"FrameNumber",tt_frame_number); // new on 161102 //#if TT_DEBUG_ON commented out 290505 if (tt_saved_city_file_name_when_demo_ends == NULL) // new on 150505 so file compare (fc) doesn't complain about this difference //#endif xml_set_attribute(element,L"CreatedUsing",C(IDS_TOONTALK_VERSION_NUMBER)); // new on 050903 }; void Background::add_xml(xml_element *element, xml_document *document) { // new on 171102 add_xml_attributes(element,document); Sprites *all_items = items; // new on 030805 #if TT_CALL_FOR_MARTY if (tt_call_for_marty != NULL && tt_martian != NULL) { // new on 030805 all_items = new Sprites(tt_martian,all_items); }; #endif if (all_items != NULL) { // what about postponed_removals?? xml_element *inside_element = create_xml_element(L"Inside",document); if (tt_dump_reason == DUMPING_TO_CLIPBOARD) { xml_set_attribute(inside_element,L"TopLevel",1); // new on 110803 }; all_items->add_xml(inside_element,document,NULL,TRUE); // want geometry xml_append_child(inside_element,element); // moved here on 190804 if (all_items != items) { // tt_martian added all_items->set_first(NULL); all_items->set_rest(NULL); delete all_items; }; }; }; boolean Background::handle_xml_tag(Tag tag, xml_node *node) { // new on 161102 switch (tag) { case INSIDE_TAG: { Sprites *sprites = xml_load_sprites(node); #if TT_CALL_FOR_MARTY if (sprites != NULL && sprites->first() == tt_martian) { Sprites *remaining = sprites->rest(); sprites->set_first(NULL); sprites->set_rest(NULL); delete sprites; sprites = remaining; }; #endif just_add_items(sprites); // rewritten on 100803 since this also sets background pointer of each sprite //if (items == NULL) { // items = xml_load_sprites(node); //} else { // Sprites *last = items->last_cons(); // last->set_rest(xml_load_sprites(node)); //}; return(TRUE); // this was missing prior to 100803! }; // on 240203 rewrote below as above so that items are combined rather than destroyed // (e.g. a room gets a door and decoration and then more items) // case INSIDE_TAG: { //destroy_sprites(items); // new on 070103 // items = xml_load_sprites(node); // return(TRUE); // }; case CITY_TAG: // added NOTHING_TAG on 040805 case NOTHING_TAG:{ // e.g. from entire document being processed in process_xml_after_titles - new on 120103 allocate_serial_numbers(node); // new on 190103 UnwindProtect<boolean> set(tt_loading_a_city,TRUE); // new on 170403 -- was ordinary assignment prior to 140105 but can be called recursively now UnwindProtect<boolean> save(tt_loading_is_ok_to_abort); // new on 200105 if (!time_travel_enabled() && !replaying()) { tt_loading_is_ok_to_abort = TRUE; }; boolean result = xml_entity(node,this); // tt_loading_a_city = FALSE; return(result); }; case NO_MORE_TAGS: return(TRUE); default: log("Unrecognized XML tag loading a background (e.g. a city)",FALSE,TRUE); tt_error_file() << (int) tag << " is the tag's value." << endl; return(TRUE); }; }; #endif void Background::dump_to_clipboard() { // bytes buffer, long buffer_size) { if (tt_dump_as_xml) { // new on 040803 to dump floors, houses, and cities to the clipboard UnwindProtect<DumpReason> set(tt_dump_reason,DUMPING_TO_CLIPBOARD); if (on_the_floor() && !on_the_ground()) { tt_main_window->add_to_clipboard(xml_global_handle()); } else { if (in_the_room()) { House *house = pointer_to_house(); if (house == NULL) { // what?? log("Room has no house!"); } else { tt_main_window->add_to_clipboard(house->xml_global_handle()); }; } else { tt_main_window->add_to_clipboard(tt_city->xml_global_handle()); }; }; return; }; string suffix; // = ""; SpriteType type; #if TT_NEW_IO output_string_stream stream; #else long buffer_size = max_encoding_buffer_size; // was max_background_dump_size prior to 170101 string buffer = new char[buffer_size]; output_string_stream stream(buffer,buffer_size); #endif // even though dump of background takes care of background type token now // do this again for backwards compatibility starting with version 8 if (on_the_floor() && !on_the_ground()) { suffix = "_floor"; stream.put((char) WHOLE_FLOOR); type = WHOLE_FLOOR; // } else if (inside_a_house()) { // stream.put((char) WHOLE_HOUSE); // if (top_level) write_cookie(stream); if (tt_dumping_background == NULL) tt_dumping_background = this; // doesn't :dump below do this fine now?? dump_started(); dump(stream,TRUE); // added on 150499 dump(stream); dump_ended(); tt_dumping_background = NULL; } else if (in_the_room()) { // new on 030200 suffix = "_house"; stream.put((char) WHOLE_HOUSE); // maybe should be called whole_house type = WHOLE_HOUSE; House *house = pointer_to_house(); if (house == NULL) { // what?? log("Room has no house!"); } else { if (tt_dumping_background == NULL) tt_dumping_background = this; // doesn't :dump below do this fine now?? dump_started(); house->dump(stream,TRUE); // new on 170101 to prepare things first house->dump(stream,FALSE); dump_ended(); tt_dumping_background = NULL; }; } else { // on the ground suffix = "_city"; stream.put((char) WHOLE_CITY); type = WHOLE_CITY; tt_city->dump_to_stream(stream); // not clear if this works since could be binary/ascii confusion - noted on 100603 }; // if (top_level) release_sprites_being_dumped(); // if (top_level) { //#if TT_32 // HGLOBAL encoding_handle = uuencode(stream.STR,stream.LENGTH,TRUE); //#else buffer_size = stream.pcount(); HGLOBAL encoding_handle = uuencode(buffer,buffer_size,type); delete [] buffer; //#endif tt_main_window->add_to_clipboard(encoding_handle,suffix); // }; }; void Background::dump(output_stream &stream, boolean just_prepare) { if (items != NULL) { // Sprites *sorted_items = sort_items(items); // commented out on 210100 since robots now save links to working cubby //flag saved_dumping_to_clipboard = tt_dumping_to_clipboard; //tt_dumping_to_clipboard = TRUE; UnwindProtect<DumpReason> set(tt_dump_reason,DUMPING_TO_CLIPBOARD); // restoration looks like it was missing prior to 080803 UnwindProtect<Background *> save(tt_dumping_background);// is this useful?? won't it be NULL or unchanged if (tt_dumping_background == NULL) tt_dumping_background = this; // if dumping entire city don't reset this dump_started(); if (tt_dumping_background == this) { // not part of a bigger dump (e.g. city) items->dump(stream,TRUE,just_prepare,FALSE,not_friend_of_tooly); // new on 010200 } else { items->dump(stream,TRUE,just_prepare); }; stream.put((unsigned char) END_OF_LIST_MARKER); // tt_dumping_to_clipboard = saved_dumping_to_clipboard; // sorted_items->remove_all(); // delete sorted_items; dump_ended(); // if (saved_tt_dumping_background == NULL) release_sprites_being_dumped(); // was a top level dump }; }; void Background::shift_all(city_coordinate delta_x, city_coordinate delta_y) { if (items != NULL) items->shift_all(delta_x,delta_y); }; //#if TT_DEBUG_ON //void Background::display_debug_info() { // tt_error_file() << "Visible_Background::update_display on frame " << tt_frame_number << " at time " << tt_current_time << endl; // Sprites *remaining = items; // while (remaining != NULL) { // remaining->first()->display_debug_info(tt_error_file(),1); // remaining = remaining->rest(); // }; //}; //#endif void Background::finish_instantly() { // new on 030903 if (items != NULL) { tt_finish_all_animations = TRUE; items->finish_instantly(); }; }; boolean Background::in_the_room_with_programmer() { // new on 020205 return(in_the_room() && (tt_programmer->pointer_to_room() == pointer_to_room() || tt_log_version_number < 70)); }; //void Background::destroy(Sprite *sprite) { // // by default delete it next frame // tt_deleted_sprites = new Sprites(sprite,tt_deleted_sprites); //}; Visible_Background::Visible_Background() : Background(), // screen(screen), leaders(NULL), updating_items(FALSE), clean(FALSE), current_priority(max_long-100), // to avoid conflict with stacks containment_active(FALSE) { }; void Visible_Background::prepare_for_deletion() { #if TT_DEBUG_ON if (-tt_debug_target == debug_counter) { log("Preparing to delete target background."); }; #endif if (postponed_removals != NULL) remove_postponed_removals(); // Background *saved_tt_deleting_background = tt_deleting_background; // tt_deleting_background = this; // just used to catch errors if (leaders != NULL) { // why is this conditional??? if (!tt_resetting_or_destroying_city) { // tt_resetting_or_destroying_city was tt_shutting_down prior to 250903 but can cause memory errors while resetting during time travel // Sprites *remaining = leaders; // while (remaining != NULL) { // Sprites *saved_remaining = remaining->rest(); // remaining->first()->no_floor(); // was set_background(NULL) but that triggered stuff // remaining = saved_remaining; // }; } else { leaders->remove_all(); delete leaders; }; leaders = NULL; // new on 280803 so this can be reset }; Background::prepare_for_deletion(); // tt_deleting_background = saved_tt_deleting_background; }; // Background takes care of this now // if (items != NULL) { // delete items; // }; // if (leaders != NULL && tt_shutting_down) { // leaders->remove_all(); // delete leaders; // }; // if (tt_backgrounds_still_animating != NULL) { // tt_backgrounds_still_animating->remove(this); // if there // }; void Visible_Background::now_on_screen() { if (items != NULL) { items->add_all_to_screen(); }; }; void Visible_Background::give_item_priority(Sprite *sprite) { // changing priority unncessarily invalidates cache so check first if (tt_screen->camera_status() == CAMERA_IN_FRONT && !sprite->priority_fixed()) { sprite->update_priority(); } else if (current_priority+1 != sprite->priority()) { sprite->set_priority(current_priority--); }; if (current_priority < 1) current_priority = max_long-100; // so nothing gets on top of hand etc }; void Visible_Background::set_current_priority_if_lower(long new_priority) { if (new_priority < 10000) { return; // new on 021199 since otherwise things float above the hand }; if (new_priority < current_priority) { current_priority = new_priority; }; }; void Visible_Background::bring_to_top(Sprite *sprite) { Sprites *followers = sprite->pointer_to_followers(); while (followers != NULL) { followers->first()->set_priority(current_priority--); followers = followers->rest(); }; sprite->set_priority(current_priority--); if (current_priority < 1) current_priority = max_long-100; // so nothing gets on top of hand etc }; boolean Visible_Background::add_item(Sprite *sprite, boolean give_priority, boolean change_priority, boolean warn) { if (!on_the_floor() && tt_screen->camera_status() == CAMERA_IN_FRONT && !sprite->priority_fixed()) { // first conjunct added on 150600 since puzzles are loaded while you are outside // but items belong on the floor sprite->update_priority(); } else if (give_priority) { // give priority even if already added if (!sprite->graspable() || (sprite->infinite_stack() && sprite->pointer_to_leader() == NULL)) { // new on 111204 so glued things are below even Tooly -- on 121204 added infinite stacks on the floor as well sprite->set_priority(max_long); } else { sprite->set_priority(current_priority--); if (current_priority < 1) current_priority = max_long-100; // so nothing gets on top of hand etc }; } else if (change_priority && current_priority >= sprite->priority()) { current_priority = sprite->priority()-1; if (current_priority < 1) current_priority = max_long-100; // so nothing gets on top of hand etc }; if (Background::add_item(sprite,give_priority,change_priority,warn)) { // set_background should do the following // if (sprite->pointer_to_followers() != NULL) { // add_leader(sprite); // }; if (showing_on_a_screen()) { // screen != NULL) { tt_screen->add(sprite); // sprite->add_outside_followers_to_screen(); // not needed since screen::add takes care of this }; if (sprite->cached()) sprite->recursively_reset_cache_status(); //#if TT_DEBUG_ON // if (!showing_on_a_screen() && tt_screen->showing(sprite)) { // say("Somehow ToonTalk has something on the screen but it is on a background that isn't.",4); // }; //#endif return(TRUE); }; return(FALSE); }; boolean Visible_Background::remove_item(Sprite *sprite, boolean report_problems, boolean remove_from_screen, boolean reset_background) { boolean removed; if (updating_items) { // postpone removal if (has_item(sprite)) { #if TT_DEBUG_ON if (sprite->debug_counter == tt_debug_target) { log(_T("Postponing of remove_item of debug target.")); }; #endif postponed_removals = new Sprites(sprite,postponed_removals); removed = TRUE; } else { removed = FALSE; // not there }; // on 310399 moved the following from "has_item" branch above // can cause crashes when floor is destroyed before an item that was there (e.g. top pages of notebook) if (reset_background) { sprite->set_background(NULL,TRUE,report_problems); }; } else { removed = Background::remove_item(sprite,report_problems, remove_from_screen,reset_background); }; if (remove_from_screen && showing_on_a_screen()) { // screen != NULL && tt_screen->remove(sprite); if (!sprite->followers_completely_inside()) { Sprites *remaining = sprite->pointer_to_followers(); while (remaining != NULL) { if (!remaining->first()->screen_updates()) { tt_screen->remove(remaining->first()); }; remaining = remaining->rest(); }; }; }; // if (removed && sprite->pointer_to_followers() != NULL) { // recursively_remove_leader(sprite); // }; return(removed); }; boolean Visible_Background::display_region() { return(FALSE); }; // do nothing by default void Visible_Background::remove_postponed_removals() { Sprites *saved_postponed_removals = postponed_removals; postponed_removals = NULL; Sprites *remaining = postponed_removals; while (remaining != NULL) { Background::remove_item(remaining->first(),TRUE,FALSE,FALSE); remaining->set_first(NULL); // done with it remaining = remaining->rest(); }; delete saved_postponed_removals; }; boolean Visible_Background::update_display(TTRegion *) { #if TT_DEBUG_ON if (tt_debug_mode == 50) { int item_count = 0; if (items != NULL) item_count = items->length(); tt_error_file() << "Visible_Background has " << item_count << " items." << endl; }; #endif if (items != NULL) { // all may be in vacuum if (postponed_removals != NULL) remove_postponed_removals(); updating_items = TRUE; if (!items->update_display(TRUE,containment_region,containment_active)) { // problem with first element // items->first()->destroy(); // commented out since can be damaged so crashes deleting it #if TT_DEBUG_ON say_error(_T("Update display found a bad item and spliced it out.")); #endif items = items->rest(); }; updating_items = FALSE; if (postponed_removals != NULL) { Sprites *remaining = postponed_removals; Sprites *saved_postponed_removals = postponed_removals; postponed_removals = NULL; while (remaining != NULL) { Background::remove_item(remaining->first(),FALSE,FALSE,FALSE); // maybe first arg should be TRUE and track down warnings remaining->set_first(NULL); // done with it remaining = remaining->rest(); }; delete saved_postponed_removals; }; }; if (!clean) { clean = TRUE; return(FALSE); }; return(TRUE); }; void Visible_Background::remove_all() { if (showing_on_a_screen()) { // screen != NULL) { Sprites *remaining = items; while (remaining != NULL) { tt_screen->remove(remaining->first()); // remaining->set_first(NULL); remaining = remaining->rest(); }; }; Background::remove_all(); // delete items; // items = NULL; leaders = NULL; }; void Visible_Background::recursively_add_leader(Sprite *item, boolean warn) { add_leader(item,warn); Sprites *remaining = item->pointer_to_followers(); while (remaining != NULL) { Sprite *sprite = remaining->first(); if (sprite->pointer_to_followers() != NULL) { recursively_add_leader(sprite,warn); }; remaining = remaining->rest(); }; }; void Visible_Background::add_leader(Sprite *leader, boolean warn) { #if TT_DEBUG_ON if (tt_debug_target == leader->debug_counter) { log(_T("Adding debug target as leader.")); }; if (warn && leader->pointer_to_leader() != NULL && leaders != NULL && leaders->member_cons(leader->pointer_to_leader()) == NULL) { log("Didn't know that the leader of a leader is a leader.",FALSE,TRUE); debug_this(); }; #endif if (leaders == NULL) { leaders = new Leaders(leader,leaders); } else { // put at end because this might // be called while propagating changes leaders->insert_at_end_if_not_member(leader); }; }; void Visible_Background::recursively_remove_leader(Sprite *item, boolean warn) { remove_leader(item,warn); Sprites *remaining = item->pointer_to_followers(); while (remaining != NULL) { Sprite *sprite = remaining->first(); if (sprite->pointer_to_followers() != NULL) { recursively_remove_leader(sprite,warn); }; remaining = remaining->rest(); }; }; void Visible_Background::remove_leader(Sprite *leader, boolean warn) { #if TT_DEBUG_ON if (tt_debug_target == leader->debug_counter) { tt_error_file() << "Removing debug target as leader." << endl; }; #endif if (leaders != NULL) { #if TT_DEBUG_ON boolean found; leaders = leaders->remove(leader,&found); if (warn && !found) { // tt_error_file() << "Removing leader from floor that didn't know it was" << endl; say_error(IDS_REMOVE_PART_BUT_NO_PARTS); }; #else leaders = leaders->remove(leader); #endif } else if (warn) { // && tt_user_is_debugger) { // tt_error_file() << "Removing leader from floor that didn't know it was" << endl; say_error(IDS_REMOVE_PART_BUT_NO_PARTS); }; }; void Visible_Background::propagate_changes() { // if (leaders != NULL) { // leaders->propagate_changes(); // }; // re-written so no risk of stack overflow Leaders *remaining = leaders; while (remaining != NULL) { // save it in case following changes things Leaders *next_remaining = (Leaders *) remaining->rest(); if (remaining->first()->pointer_to_background() == this) { // condition new on 090105 since Logotron bug error 19.2 had an example // where an earlier update removed this as well (time_travel2 segment 28) remaining->propagate_changes(); }; remaining = next_remaining; }; remaining = leaders; while (remaining != NULL) { Sprite *sprite = remaining->first(); // conditional added below on 070200 for robustness if (sprite != NULL) sprite->set_changes_propagated(FALSE); // until next round remaining = (Leaders *) remaining->rest(); }; }; boolean Visible_Background::known_leader(Sprite *item) { if (leaders == NULL) return(FALSE); return(leaders->member_cons(item) != NULL); }; millisecond Visible_Background::default_duration(millisecond the_default_duration) { if (tt_finish_all_animations) return(0); if (showing_on_a_screen()) { if (in_the_room()) return(the_default_duration/room_speedup); return(the_default_duration); }; return(0); }; #if TT_XML void Visible_Background::add_xml_attributes(xml_element *element, xml_document *document) { // abstracted on 040805 // current_priority?? -- asked 181102 -- and finally answered on 031103 - and containment_active needs to be saved too // xml_set_attribute(element,L"Z",current_priority); // makes more sense here but floor::xml takes care of this // flag clean : 1; // only used within a cycle if (!containment_active) { // normally is TRUE xml_set_attribute(element,L"ContainmentInactive",1); }; xml_set_attribute(element,L"ContainmentRegionMinX",containment_region.min_x); xml_set_attribute(element,L"ContainmentRegionMaxX",containment_region.max_x); xml_set_attribute(element,L"ContainmentRegionMinY",containment_region.min_y); xml_set_attribute(element,L"ContainmentRegionMaxY",containment_region.max_y); Background::add_xml_attributes(element,document); }; // commented out on 040805 since nothing left to do and the above does what it used to do //void Visible_Background::add_xml(xml_element *element, xml_document *document) { //// if (entity_type() != WHOLE_FLOOR) { // conditional new on 090404 since floor now calls this but doesn't want the following // Background::add_xml(element,document); // missing from 3.22 - 031103 //// }; //}; boolean Visible_Background::handle_xml_tag(Tag tag, xml_node *node) { if (tag == NO_MORE_TAGS) { containment_active = !xml_get_attribute_int(node,L"ContainmentInactive",0); // prior to 210404 was !containment_active //if (tt_log_version_number < 42 && !containment_active && ok_to_fix_containment_active()) { // shouldn't have been inactivated // containment_active = TRUE; // new on 080404 //}; containment_region.min_x = xml_get_attribute_int(node,L"ContainmentRegionMinX",containment_region.min_x); containment_region.max_x = xml_get_attribute_int(node,L"ContainmentRegionMaxX",containment_region.max_x); containment_region.min_y = xml_get_attribute_int(node,L"ContainmentRegionMinY",containment_region.min_y); containment_region.max_y = xml_get_attribute_int(node,L"ContainmentRegionMaxY",containment_region.max_y); }; return(Background::handle_xml_tag(tag,node)); }; #endif //Room *Under_Sprite_Background::pointer_to_room() { // return(sprite_on_top->pointer_to_background()->pointer_to_room()); //}; //boolean Backside_Background::remove_item(Sprite *sprite, boolean report_problems, // boolean remove_from_screen, // boolean reset_background) { // if (picture != NULL) { // picture->remove_flipped_follower(sprite); // }; // return (Background::remove_item(sprite,report_problems,remove_from_screen,reset_background)); //}; Room *Backside_Background::pointer_to_room() { Background *picture_background = picture->pointer_to_background(); if (picture_background == NULL) { // e.g. picture might be in vacuum return(NULL); } else { return(picture_background->pointer_to_room()); }; }; Titles_Background::Titles_Background(short int image_index) : Visible_Background(), text(NULL), text2(NULL), clean(TRUE), image_index(image_index), y_offset_percent(0), text_color(tt_black) { }; void Titles_Background::prepare_for_deletion() { if (text != NULL) delete [] text; if (text2 != NULL) delete [] text2; Visible_Background::prepare_for_deletion(); }; boolean Titles_Background::display_region() { background(image_index)->display(); if ((tt_win31j && image_index == THOUGHT_BUBBLE_BACKGROUND) || text == NULL) return(FALSE); // seems to fix a loading problem (WinG/Win3.1J) clean = TRUE; // until text is changed int text_length = _tcslen(text); city_coordinate character_width,character_height,ulx,uly; if (image_index == OPENING_TITLE_BACKGROUND) { character_width = tile_width/2; // was (3*tile_width)/5; character_height = (3*tile_height)/2; uly = ideal_screen_height-tile_height/2; // was 18*tile_height if (tt_language == BRITISH) { // new on 151204 uly -= 17*tile_height/4; // just below the second title (intelligent modelling ...) }; uly -= (y_offset_percent*ideal_screen_height)/100; BEGIN_GDI city_coordinate extent = tt_screen->get_extent(text,text_length, character_width,character_height,TRUE,FALSE,FALSE); ulx = (ideal_screen_width-extent)/2; tt_screen->text_out(text,text_length, ulx,uly, character_width,character_height,TRUE); if (text2 != NULL) { text_length = _tcslen(text2); extent = tt_screen->get_extent(text2,text_length, character_width,character_height,TRUE,FALSE,FALSE); ulx = (ideal_screen_width-extent)/2; uly -= character_height; tt_screen->text_out(text2,text_length, ulx,uly, character_width,character_height,TRUE); }; END_GDI } else { character_width = (3*tile_width)/5; // was (2*tile_width)/3; character_height = tile_height*2; ulx = tile_width; uly = 18*tile_height-(y_offset_percent*ideal_screen_height)/100; city_coordinate text_width = 18*tile_width; city_coordinate text_height = 16*tile_height; BEGIN_GDI tt_screen->place_text(text,text_length, ulx,uly, text_width,text_height, character_width,character_height, OK_TO_BREAK_SENTENCES,FALSE,FALSE,0,0,tt_colors[text_color]); END_GDI }; return(FALSE); }; /* for (int i = 0;;i++) { // assumes that it ends with a . or ! followed by 0 string terminator if (((text[i] == '.' || text[i] == '!') && (text[i+1] == ' ' || text[i+1] == 0 )) || text[i] == '\r') { int length = i-offset+1; int length_to_print = length; if (text[i] == '\r') { length_to_print--; }; tt_screen->place_text(text+offset,length_to_print, ulx,uly, text_width,text_height, character_width,character_height, TRUE,FALSE,0,0,text_color); i++; if (text[i] == 0) return(FALSE); if (text[i] == ' ') i++; // skip over blanks if (text[i] == ' ') i++; offset = i; // I can't make sense of the following // length = (3*length)/4; // most characters aren't full width // uly -= (1+((length*character_width)/text_width))*character_height; uly -= character_height; }; }; */ void Titles_Background::set_text(const_string new_text) { if (text != NULL) delete [] text; text = copy_string(new_text); clean = FALSE; }; void Titles_Background::set_text2(const_string new_text) { if (text2 != NULL) delete [] text2; text2 = copy_string(new_text); clean = FALSE; }; boolean Titles_Background::update_display(TTRegion *region) { if (!clean) { clean = TRUE; Visible_Background::update_display(region); return(FALSE); }; return(Visible_Background::update_display(region)); }; boolean Backside_Background::remove_item(Sprite *sprite, boolean report_problems, boolean remove_from_screen, boolean reset_background) { if (picture != NULL && (sprite->pointer_to_leader() == NULL || sprite->pointer_to_leader() == picture)) { // added possibility that sprite consider the picture as a leader on 090699 // top level item on back of picture picture->remove_flipped_follower(sprite); report_problems = FALSE; // new on 190902 -- better to just return?? }; // // added on 1/9/99 // Background *picture_background = sprite->pointer_to_background(); // if (picture_background != NULL) { // Picture *subpicture = pointer_to_picture(); // if (subpicture != NULL) subpicture->remove_flipped_follower(sprite); // }; return(Background::remove_item(sprite,report_problems,remove_from_screen,reset_background)); }; /* Visible_Backgrounds::~Visible_Backgrounds() { // only deletes the list not the members if (next != NULL) delete next; }; void Visible_Backgrounds::remove(Visible_Background *removing) { if (background == removing) { background = NULL; } else if (next != NULL) { next->remove(removing); }; }; */ //obsolete /* Visible_Backgrounds *Visible_Backgrounds::animate_though_offscreen() { if (background != NULL && background->animate_though_offscreen()) { if (next != NULL) { next = next->animate_though_offscreen(); }; return(this); } else { // splice this guy out since nothing left to animate Visible_Backgrounds *saved_next = next; next = NULL; delete this; if (saved_next == NULL) { return(NULL); } else { return(saved_next->animate_though_offscreen()); }; }; }; */
35.41989
143
0.696949
ToonTalk
b0800c3f7028c8a89ef7473dc5cd100fbeba9c84
5,258
cpp
C++
app/main.cpp
VBot2410/A_Star_3D
9755e14f5fe963bf48610d6dc8915b9f5a4009c8
[ "MIT" ]
3
2017-10-11T01:14:44.000Z
2018-07-08T16:45:00.000Z
app/main.cpp
VBot2410/A_Star_3D
9755e14f5fe963bf48610d6dc8915b9f5a4009c8
[ "MIT" ]
null
null
null
app/main.cpp
VBot2410/A_Star_3D
9755e14f5fe963bf48610d6dc8915b9f5a4009c8
[ "MIT" ]
1
2021-09-24T16:34:15.000Z
2021-09-24T16:34:15.000Z
/** * @file main.cpp * @brief This project builds a discrete 3-D map from environment information * and Implements the A* algorithm to plan the path from Start to Goal Point. * * @author Vaibhav Bhilare * @copyright 2017, Vaibhav Bhilare * * MIT License * Copyright (c) 2017 Vaibhav Bhilare * * 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. */ /** --Includes--*/ #include <iostream> #include <vector> #include <cmath> #include "../include/Planner.h" #include "../include/Build_Map.h" /** * @brief main method * * Takes the World Boundary and Obstacle Data. Sends them to Build a Discrete * 3-D Map. This map is sent to the planner which then plans the path from * Start to Goal point using A* Planner. * * @return 0 */ int main() { /** * Initialize the x,y,z resolution values. * Initialize the Margin Value for Robot Dimensions. * Initialize the World Boundary and Obstacles. */ double xy_res = 0.25; ///< Initialize the x,y resolution. double z_res = 0.25; ///< Initialize the z resolution. double margin = 0.2; ///< Initialize the margin value for robot dimensions. /** Initialize the World Boundary in * {xmin,ymin,zmin,xmax,ymax,zmax} format. */ std::vector<double> Boundary = { 0.0, -5.0, 0.0, 10.0, 20.0, 6.0 }; /** Initialize the Obstacles in {xmin,ymin,zmin,xmax,ymax,zmax} format. */ std::vector<std::vector<double>> Obstacle = { { 0.0, 2.0, 0.0, 10.0, 2.5, 1.5 }, { 0.0, 2.0, 4.5, 10.0, 2.5, 6.0 }, { 0.0, 2.0, 1.5, 3.0, 2.5, 4.5 } }; /** Create an Instance of the Build_Map Class named Map. */ Build_Map Map = Build_Map(Boundary, xy_res, z_res, margin); /** Store the Discretized World Dimensions in World. */ std::vector<int> World = Map.World_Dimensions(); /** Create an Instance of the Planner Class named Plan. */ Planner Plan = Planner({ World[0], World[1], World[2] }); /** Add the nodes inside Obstacles to Collision List. */ for (const std::vector<double> &v : Obstacle) { std::vector<int> Obstacle_Extrema = Map.Build_Obstacle(v); for (int Counter_X = Obstacle_Extrema[0]; Counter_X != Obstacle_Extrema[3]; Counter_X++) { for (int Counter_Y = Obstacle_Extrema[1]; Counter_Y != Obstacle_Extrema[4]; Counter_Y++) { for (int Counter_Z = Obstacle_Extrema[2]; Counter_Z != Obstacle_Extrema[5]; Counter_Z++) { Plan.Add_Collision({ Counter_X, Counter_Y, Counter_Z }); } } } } /** Set Heuristic Function to Euclidean or Manhattan (Default Euclidean). */ Plan.Set_Heuristic(Planner::Manhattan); std::cout << "Calculating Shortest Path ... \n"; std::vector<double> Start = { 0, 0.5, 3 }; ///< Initialize Start Point. std::vector<double> Goal = { 3.9, 6.4, 0 }; ///< Initialize Goal Point. /** Check whether the Start or Goal points lie outside the World. */ if ((Start[0] < Boundary[0] || Start[0] > Boundary[3]) || (Start[1] < Boundary[1] || Start[1] > Boundary[4]) || (Start[2] < Boundary[2] || Start[2] > Boundary[5])) { std::cout << "Start Point Lies Out of Workspace."; } else if ((Goal[0] < Boundary[0] || Goal[0] > Boundary[3]) || (Goal[1] < Boundary[1] || Goal[1] > Boundary[4]) || (Goal[2] < Boundary[2] || Goal[2] > Boundary[5])) { std::cout << "Goal Point Lies Out of Workspace."; } else { /** If Start and Goal Points are inside the world, find their positions * in the discretized world. */ std::vector<int> Start_Node = Map.Build_Node(Start); std::vector<int> Goal_Node = Map.Build_Node(Goal); /** Plan the Path from Start to Goal using findPath. * Get the value in path. */ auto path = Plan.findPath({ Start_Node[0], Start_Node[1], Start_Node[2] }, { Goal_Node[0], Goal_Node[1], Goal_Node[2] }); /** Print the Path */ std::cout << "X\tY\tZ\n"; for (auto& coordinate : path) { std::vector<int> Discrete_Node = { coordinate.x, coordinate.y, coordinate .z }; std::vector<double> Coordinates = Map.Get_Coordinate(Discrete_Node); std::cout << Coordinates[0] << "\t" << Coordinates[1] << "\t" << Coordinates[2] << "\n"; } } return 0; ///< Return 0. }
40.446154
81
0.648726
VBot2410
b0861b473d7b00a4491ca233c198d8aabad6c667
70
cpp
C++
CppMemento/examples/RADIX_SORT/radix_sort.cpp
andrasigneczi/cpp_lang_taining
1198df6a896d0f6fce281e069abba88ef40598fc
[ "Apache-2.0" ]
null
null
null
CppMemento/examples/RADIX_SORT/radix_sort.cpp
andrasigneczi/cpp_lang_taining
1198df6a896d0f6fce281e069abba88ef40598fc
[ "Apache-2.0" ]
null
null
null
CppMemento/examples/RADIX_SORT/radix_sort.cpp
andrasigneczi/cpp_lang_taining
1198df6a896d0f6fce281e069abba88ef40598fc
[ "Apache-2.0" ]
null
null
null
#include "radix_sort.h" void radixSort(std::vector<int>& v) { }
11.666667
37
0.628571
andrasigneczi
b0892f6b2203b7e1f058e1016ae14e2afc100cf4
8,601
cc
C++
mysql-server/router/src/router/tests/issues/test_bug24909259.cc
silenc3502/MYSQL-Arch-Doc-Summary
fcc6bb65f72a385b9f56debc9b2c00cee5914bae
[ "MIT" ]
null
null
null
mysql-server/router/src/router/tests/issues/test_bug24909259.cc
silenc3502/MYSQL-Arch-Doc-Summary
fcc6bb65f72a385b9f56debc9b2c00cee5914bae
[ "MIT" ]
null
null
null
mysql-server/router/src/router/tests/issues/test_bug24909259.cc
silenc3502/MYSQL-Arch-Doc-Summary
fcc6bb65f72a385b9f56debc9b2c00cee5914bae
[ "MIT" ]
null
null
null
/* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the Free Software Foundation. This program is also distributed with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in included license documentation. The authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have included with MySQL. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** * BUG24909259 ROUTER IS NOT ABLE TO CONNECT TO M/C AFTER BOOSTRAPPED WITH DIR & * NAME OPTIONS * */ #include <gtest/gtest_prod.h> #include <fstream> #include <stdexcept> #include <string> #include <gmock/gmock.h> #include "dim.h" #include "keyring/keyring_manager.h" #include "keyring/keyring_memory.h" #include "mysql/harness/config_parser.h" #include "mysqlrouter/utils.h" #include "random_generator.h" #include "router_app.h" #include "router_test_helpers.h" static mysql_harness::Path g_origin; static std::string kTestKRFile = "tkeyfile"; static std::string kTestKRFile2 = "tkeyfile2"; static struct Initter { Initter() { tmpdir_ = mysql_harness::get_tmp_dir(); kTestKRFile = tmpdir_ + "/" + kTestKRFile; kTestKRFile2 = tmpdir_ + "/" + kTestKRFile2; } ~Initter() { mysql_harness::delete_dir_recursive(tmpdir_); } private: std::string tmpdir_; } init; static std::string kTestKey = "mykey"; static std::string my_prompt_password(const std::string &, int *num_password_prompts) { *num_password_prompts = *num_password_prompts + 1; return kTestKey; } static void create_keyfile(const std::string &path) { mysql_harness::delete_file(path); mysql_harness::delete_file(path + ".master"); mysql_harness::init_keyring(path, path + ".master", true); mysql_harness::reset_keyring(); } static void create_keyfile_withkey(const std::string &path, const std::string &key) { mysql_harness::delete_file(path); mysql_harness::init_keyring_with_key(path, key, true); mysql_harness::reset_keyring(); } TEST(Bug24909259, init_tests) { mysql_harness::DIM::instance().set_RandomGenerator( []() { static mysql_harness::FakeRandomGenerator rg; return &rg; }, [](mysql_harness::RandomGeneratorInterface *) {} // don't delete our static! ); } // bug#24909259 TEST(Bug24909259, PasswordPrompt_plain) { create_keyfile(kTestKRFile); create_keyfile_withkey(kTestKRFile2, kTestKey); int num_password_prompts = 0; mysqlrouter::set_prompt_password( [&num_password_prompts](const std::string &prompt) { return my_prompt_password(prompt, &num_password_prompts); }); // metadata_cache mysql_harness::reset_keyring(); EXPECT_TRUE(mysql_harness::get_keyring() == nullptr); { MySQLRouter router; mysql_harness::Config config(router.get_default_paths(g_origin), mysql_harness::Config::allow_keys); std::stringstream ss("[metadata_cache]\n"); config.read(ss); router.init_keyring(config); EXPECT_TRUE(mysql_harness::get_keyring() == nullptr); EXPECT_EQ(0, num_password_prompts); } mysql_harness::reset_keyring(); EXPECT_TRUE(mysql_harness::get_keyring() == nullptr); { MySQLRouter router; mysql_harness::Config config(router.get_default_paths(g_origin), mysql_harness::Config::allow_keys); std::stringstream ss("[metadata_cache]\nuser=foo\n"); config.read(ss); try { router.init_keyring(config); FAIL() << "expected std::runtime_error, got no exception"; } catch (const std::runtime_error &) { // ok } catch (const std::exception &e) { FAIL() << "expected std::runtime_error, got " << typeid(e).name() << ": " << e.what(); } EXPECT_EQ(1, num_password_prompts); EXPECT_TRUE(mysql_harness::get_keyring() == nullptr); } mysql_harness::reset_keyring(); { MySQLRouter router; mysql_harness::Config config(router.get_default_paths(g_origin), mysql_harness::Config::allow_keys); std::stringstream ss("[DEFAULT]\nkeyring_path=" + kTestKRFile2 + "\n[metadata_cache]\nuser=foo\n"); config.read(ss); router.init_keyring(config); EXPECT_EQ(2, num_password_prompts); EXPECT_TRUE(mysql_harness::get_keyring() != nullptr); } mysql_harness::reset_keyring(); { // this one should succeed completely MySQLRouter router; mysql_harness::Config config(router.get_default_paths(g_origin), mysql_harness::Config::allow_keys); std::stringstream ss("[DEFAULT]\nkeyring_path=" + kTestKRFile + "\nmaster_key_path=" + kTestKRFile + ".master\n[metadata_cache]\nuser=foo\n"); config.read(ss); router.init_keyring(config); EXPECT_TRUE(mysql_harness::get_keyring() != nullptr); EXPECT_EQ(2, num_password_prompts); } mysql_harness::reset_keyring(); } TEST(Bug24909259, PasswordPrompt_keyed) { create_keyfile(kTestKRFile); create_keyfile_withkey(kTestKRFile2, kTestKey); int num_password_prompts = 0; mysqlrouter::set_prompt_password( [&num_password_prompts](const std::string &prompt) { return my_prompt_password(prompt, &num_password_prompts); }); // metadata_cache mysql_harness::reset_keyring(); EXPECT_TRUE(mysql_harness::get_keyring() == nullptr); { MySQLRouter router; mysql_harness::Config config(router.get_default_paths(g_origin), mysql_harness::Config::allow_keys); std::stringstream ss("[metadata_cache:foo]\n"); config.read(ss); router.init_keyring(config); EXPECT_TRUE(mysql_harness::get_keyring() == nullptr); EXPECT_EQ(0, num_password_prompts); } mysql_harness::reset_keyring(); EXPECT_TRUE(mysql_harness::get_keyring() == nullptr); { MySQLRouter router; mysql_harness::Config config(router.get_default_paths(g_origin), mysql_harness::Config::allow_keys); std::stringstream ss("[metadata_cache:foo]\nuser=foo\n"); config.read(ss); try { router.init_keyring(config); FAIL() << "expected std::runtime_error, got no exception"; } catch (const std::runtime_error &) { // ok } catch (const std::exception &e) { FAIL() << "expected std::runtime_error, got " << typeid(e).name() << ": " << e.what(); } EXPECT_EQ(1, num_password_prompts); EXPECT_TRUE(mysql_harness::get_keyring() == nullptr); } mysql_harness::reset_keyring(); { MySQLRouter router; mysql_harness::Config config(router.get_default_paths(g_origin), mysql_harness::Config::allow_keys); std::stringstream ss("[DEFAULT]\nkeyring_path=" + kTestKRFile2 + "\n[metadata_cache:foo]\nuser=foo\n"); config.read(ss); router.init_keyring(config); EXPECT_EQ(2, num_password_prompts); EXPECT_TRUE(mysql_harness::get_keyring() != nullptr); } mysql_harness::reset_keyring(); { // this one should succeed completely MySQLRouter router; mysql_harness::Config config(router.get_default_paths(g_origin), mysql_harness::Config::allow_keys); std::stringstream ss("[DEFAULT]\nkeyring_path=" + kTestKRFile + "\nmaster_key_path=" + kTestKRFile + ".master\n[metadata_cache:foo]\nuser=foo\n"); config.read(ss); router.init_keyring(config); EXPECT_TRUE(mysql_harness::get_keyring() != nullptr); EXPECT_EQ(2, num_password_prompts); } mysql_harness::reset_keyring(); } int main(int argc, char *argv[]) { g_origin = mysql_harness::Path(argv[0]).dirname(); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
33.337209
80
0.67434
silenc3502
b08d744f3c24e3b86f5c9657adb051c635e8bfcf
1,343
cpp
C++
aws-cpp-sdk-iot/source/model/FleetMetricNameAndArn.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-02-12T08:09:30.000Z
2022-02-12T08:09:30.000Z
aws-cpp-sdk-iot/source/model/FleetMetricNameAndArn.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-01-03T23:59:37.000Z
2022-01-03T23:59:37.000Z
aws-cpp-sdk-iot/source/model/FleetMetricNameAndArn.cpp
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/iot/model/FleetMetricNameAndArn.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace IoT { namespace Model { FleetMetricNameAndArn::FleetMetricNameAndArn() : m_metricNameHasBeenSet(false), m_metricArnHasBeenSet(false) { } FleetMetricNameAndArn::FleetMetricNameAndArn(JsonView jsonValue) : m_metricNameHasBeenSet(false), m_metricArnHasBeenSet(false) { *this = jsonValue; } FleetMetricNameAndArn& FleetMetricNameAndArn::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("metricName")) { m_metricName = jsonValue.GetString("metricName"); m_metricNameHasBeenSet = true; } if(jsonValue.ValueExists("metricArn")) { m_metricArn = jsonValue.GetString("metricArn"); m_metricArnHasBeenSet = true; } return *this; } JsonValue FleetMetricNameAndArn::Jsonize() const { JsonValue payload; if(m_metricNameHasBeenSet) { payload.WithString("metricName", m_metricName); } if(m_metricArnHasBeenSet) { payload.WithString("metricArn", m_metricArn); } return payload; } } // namespace Model } // namespace IoT } // namespace Aws
17.906667
76
0.730454
perfectrecall
b08f5b84f7b9677ce9ac7e504b16496d7946fa4f
2,631
hpp
C++
rmf_traffic/include/rmf_traffic/agv/LaneClosure.hpp
0to1/rmf_traffic
0e641f779e9c7e6d69c316e905df5a51a2c124e1
[ "Apache-2.0" ]
10
2021-04-14T07:01:56.000Z
2022-02-21T02:26:58.000Z
rmf_traffic/include/rmf_traffic/agv/LaneClosure.hpp
0to1/rmf_traffic
0e641f779e9c7e6d69c316e905df5a51a2c124e1
[ "Apache-2.0" ]
63
2021-03-10T06:06:13.000Z
2022-03-25T08:47:07.000Z
rmf_traffic/include/rmf_traffic/agv/LaneClosure.hpp
0to1/rmf_traffic
0e641f779e9c7e6d69c316e905df5a51a2c124e1
[ "Apache-2.0" ]
10
2021-03-17T02:52:14.000Z
2022-02-21T02:27:02.000Z
/* * Copyright (C) 2021 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef RMF_TRAFFIC__AGV__LANECLOSURE_HPP #define RMF_TRAFFIC__AGV__LANECLOSURE_HPP #include <utility> #include <rmf_utils/impl_ptr.hpp> namespace rmf_traffic { namespace agv { //============================================================================== /// This class describes the closure status of lanes in a Graph, i.e. whether a /// lane is open or closed. Open lanes can be used by the planner to reach a /// goal. The planner will not expand down a lane that is closed. class LaneClosure { public: /// Default constructor. /// /// By default, all lanes are open. LaneClosure(); /// Check whether the lane corresponding to the given index is open. /// /// \param[in] lane /// The index for the lane of interest bool is_open(std::size_t lane) const; /// Check whether the lane corresponding to the given index is closed. /// /// \param[in] lane /// The index for the lane of interest bool is_closed(std::size_t lane) const; /// Set the lane corresponding to the given index to be open. /// /// \param[in] lane /// The index for the opening lane LaneClosure& open(std::size_t lane); /// Set the lane corresponding to the given index to be closed. /// /// \param[in] lane /// The index for the closing lane LaneClosure& close(std::size_t lane); /// Get an integer that uniquely describes the overall closure status of the /// graph lanes. std::size_t hash() const; /// Equality comparison operator bool operator==(const LaneClosure& other) const; class Implementation; private: rmf_utils::impl_ptr<Implementation> _pimpl; }; } // namespace agv } // namespace rmf_traffic namespace std { //============================================================================== template<> struct hash<rmf_traffic::agv::LaneClosure> { std::size_t operator()( const rmf_traffic::agv::LaneClosure& closure) const noexcept { return closure.hash(); } }; } // namespace std #endif // RMF_TRAFFIC__AGV__LANECLOSURE_HPP
27.694737
80
0.666287
0to1
b093bf85c00e5c421189ecb090f653605be700a0
4,477
cpp
C++
mail/Email.cpp
phiwen96/SocketsServer
eeff4347f0fc31c5081b7f3f59b3c201f6a4f4e7
[ "Apache-2.0" ]
null
null
null
mail/Email.cpp
phiwen96/SocketsServer
eeff4347f0fc31c5081b7f3f59b3c201f6a4f4e7
[ "Apache-2.0" ]
null
null
null
mail/Email.cpp
phiwen96/SocketsServer
eeff4347f0fc31c5081b7f3f59b3c201f6a4f4e7
[ "Apache-2.0" ]
null
null
null
#include "Email.hpp" void sendEmail() { CURL *curl; CURLcode res = CURLE_OK; struct curl_slist *recipients = NULL; struct upload_status upload_ctx; upload_ctx.lines_read = 0; curl = curl_easy_init(); if(curl) { /* Set username and password */ curl_easy_setopt(curl, CURLOPT_USERNAME, "user"); curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret"); /* This is the URL for your mailserver. Note the use of port 587 here, * instead of the normal SMTP port (25). Port 587 is commonly used for * secure mail submission (see RFC4403), but you should use whatever * matches your server configuration. */ // curl_easy_setopt(curl, CURLOPT_URL, "smtp://mainserver.example.net:587"); curl_easy_setopt(curl, CURLOPT_URL, "smtp://92.34.145.157:54003"); /* In this example, we'll start with a plain text connection, and upgrade * to Transport Layer Security (TLS) using the STARTTLS command. Be careful * of using CURLUSESSL_TRY here, because if TLS upgrade fails, the transfer * will continue anyway - see the security discussion in the libcurl * tutorial for more details. */ curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); /* If your server doesn't have a valid certificate, then you can disable * part of the Transport Layer Security protection by setting the * CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST options to 0 (false). * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); * curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); * That is, in general, a bad idea. It is still better than sending your * authentication details in plain text though. Instead, you should get * the issuer certificate (or the host certificate if the certificate is * self-signed) and add it to the set of certificates that are known to * libcurl using CURLOPT_CAINFO and/or CURLOPT_CAPATH. See docs/SSLCERTS * for more information. */ curl_easy_setopt(curl, CURLOPT_CAINFO, "/path/to/certificate.pem"); /* Note that this option isn't strictly required, omitting it will result * in libcurl sending the MAIL FROM command with empty sender data. All * autoresponses should have an empty reverse-path, and should be directed * to the address in the reverse-path which triggered them. Otherwise, * they could cause an endless loop. See RFC 5321 Section 4.5.5 for more * details. */ curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM); /* Add two recipients, in this particular case they correspond to the * To: and Cc: addressees in the header, but they could be any kind of * recipient. */ recipients = curl_slist_append(recipients, TO); recipients = curl_slist_append(recipients, CC); curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); /* We're using a callback function to specify the payload (the headers and * body of the message). You could just use the CURLOPT_READDATA option to * specify a FILE pointer to read from. */ curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source); curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); /* Since the traffic will be encrypted, it is very useful to turn on debug * information within libcurl to see what is happening during the transfer. */ curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); /* Send the message */ res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); /* Free the list of recipients */ curl_slist_free_all(recipients); /* Always cleanup */ curl_easy_cleanup(curl); } }
49.197802
87
0.601296
phiwen96
b093e01c59186885e11ef283c5de787fe460355f
8,509
cpp
C++
plugins/nonpersistent_voxel_layer.cpp
SteveMacenski/non-persistent-voxel-layer
b09cf66faf8424c6245334b78605d58a2cf95da6
[ "BSD-3-Clause" ]
null
null
null
plugins/nonpersistent_voxel_layer.cpp
SteveMacenski/non-persistent-voxel-layer
b09cf66faf8424c6245334b78605d58a2cf95da6
[ "BSD-3-Clause" ]
null
null
null
plugins/nonpersistent_voxel_layer.cpp
SteveMacenski/non-persistent-voxel-layer
b09cf66faf8424c6245334b78605d58a2cf95da6
[ "BSD-3-Clause" ]
null
null
null
/********************************************************************* * * Software License Agreement (BSD License) * * Copyright (c) 2008, 2013, Willow Garage, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of Willow Garage, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * Author: Eitan Marder-Eppstein * David V. Lu!! * Steve Macenski *********************************************************************/ #include <sensor_msgs/point_cloud2_iterator.hpp> #include <vector> #include "nonpersistent_voxel_layer/nonpersistent_voxel_layer.hpp" #define VOXEL_BITS 16 using nav2_costmap_2d::NO_INFORMATION; using nav2_costmap_2d::LETHAL_OBSTACLE; using nav2_costmap_2d::FREE_SPACE; using nav2_costmap_2d::ObservationBuffer; using nav2_costmap_2d::Observation; namespace nav2_costmap_2d { void NonPersistentVoxelLayer::onInitialize() { auto node = node_.lock(); clock_ = node->get_clock(); ObstacleLayer::onInitialize(); footprint_clearing_enabled_ = node->get_parameter( name_ + ".footprint_clearing_enabled").as_bool(); enabled_ = node->get_parameter(name_ + ".enabled").as_bool(); max_obstacle_height_ = node->get_parameter( name_ + ".max_obstacle_height").as_double(); combination_method_ = node->get_parameter( name_ + ".combination_method").as_int(); size_z_ = node->declare_parameter(name_ + ".z_voxels", 16); origin_z_ = node->declare_parameter(name_ + ".origin_z", 16.0); z_resolution_ = node->declare_parameter( name_ + ".z_resolution", 0.05); unknown_threshold_ = node->declare_parameter( name_ + ".unknown_threshold", 15) + (VOXEL_BITS - size_z_); mark_threshold_ = node->declare_parameter( name_ + ".mark_threshold", 0); publish_voxel_ = node->declare_parameter( name_ + ".publish_voxel_map", false); if (publish_voxel_) { voxel_pub_ = rclcpp_node_->create_publisher<nav2_msgs::msg::VoxelGrid>( "voxel_grid", rclcpp::QoS(1)); } matchSize(); } NonPersistentVoxelLayer::~NonPersistentVoxelLayer() { } void NonPersistentVoxelLayer::updateFootprint( double robot_x, double robot_y, double robot_yaw, double * min_x, double * min_y, double * max_x, double * max_y) { if (!footprint_clearing_enabled_) { return; } transformFootprint(robot_x, robot_y, robot_yaw, getFootprint(), transformed_footprint_); for (unsigned int i = 0; i < transformed_footprint_.size(); i++) { touch(transformed_footprint_[i].x, transformed_footprint_[i].y, min_x, min_y, max_x, max_y); } setConvexPolygonCost(transformed_footprint_, nav2_costmap_2d::FREE_SPACE); } void NonPersistentVoxelLayer::matchSize() { ObstacleLayer::matchSize(); voxel_grid_.resize(size_x_, size_y_, size_z_); } void NonPersistentVoxelLayer::reset() { deactivate(); resetMaps(); voxel_grid_.reset(); activate(); } void NonPersistentVoxelLayer::resetMaps() { Costmap2D::resetMaps(); voxel_grid_.reset(); } void NonPersistentVoxelLayer::updateBounds( double robot_x, double robot_y, double robot_yaw, double * min_x, double * min_y, double * max_x, double * max_y) { // update origin information for rolling costmap publication if (rolling_window_) { updateOrigin(robot_x - getSizeInMetersX() / 2, robot_y - getSizeInMetersY() / 2); } // reset maps each iteration resetMaps(); // if not enabled, stop here if (!enabled_) { return; } // get the maximum sized window required to operate useExtraBounds(min_x, min_y, max_x, max_y); // get the marking observations bool current = true; std::vector<Observation> observations; current = getMarkingObservations(observations) && current; // update the global current status current_ = current; // place the new obstacles into a priority queue... each with a priority of zero to begin with for (std::vector<Observation>::const_iterator it = observations.begin(); it != observations.end(); ++it) { const Observation & obs = *it; double sq_obstacle_range = obs.obstacle_max_range_ * obs.obstacle_max_range_; sensor_msgs::PointCloud2ConstIterator<float> it_x(*obs.cloud_, "x"); sensor_msgs::PointCloud2ConstIterator<float> it_y(*obs.cloud_, "y"); sensor_msgs::PointCloud2ConstIterator<float> it_z(*obs.cloud_, "z"); for (; it_x != it_x.end(); ++it_x, ++it_y, ++it_z) { // if the obstacle is too high or too far away from the robot we won't add it if (*it_z > max_obstacle_height_) { continue; } // compute the squared distance from the hitpoint to the pointcloud's origin double sq_dist = (*it_x - obs.origin_.x) * (*it_x - obs.origin_.x) + (*it_y - obs.origin_.y) * (*it_y - obs.origin_.y) + (*it_z - obs.origin_.z) * (*it_z - obs.origin_.z); // if the point is far enough away... we won't consider it if (sq_dist >= sq_obstacle_range) { continue; } // now we need to compute the map coordinates for the observation unsigned int mx, my, mz; if (*it_z < origin_z_) { if (!worldToMap3D(*it_x, *it_y, origin_z_, mx, my, mz)) { continue; } } else if (!worldToMap3D(*it_x, *it_y, *it_z, mx, my, mz)) { continue; } // mark the cell in the voxel grid and check if we should also mark it in the costmap if (voxel_grid_.markVoxelInMap(mx, my, mz, mark_threshold_)) { unsigned int index = getIndex(mx, my); costmap_[index] = LETHAL_OBSTACLE; touch(static_cast<double>(*it_x), static_cast<double>(*it_y), min_x, min_y, max_x, max_y); } } } if (publish_voxel_) { nav2_msgs::msg::VoxelGrid grid_msg; unsigned int size = voxel_grid_.sizeX() * voxel_grid_.sizeY(); grid_msg.size_x = voxel_grid_.sizeX(); grid_msg.size_y = voxel_grid_.sizeY(); grid_msg.size_z = voxel_grid_.sizeZ(); grid_msg.data.resize(size); memcpy(&grid_msg.data[0], voxel_grid_.getData(), size * sizeof(unsigned int)); grid_msg.origin.x = origin_x_; grid_msg.origin.y = origin_y_; grid_msg.origin.z = origin_z_; grid_msg.resolutions.x = resolution_; grid_msg.resolutions.y = resolution_; grid_msg.resolutions.z = z_resolution_; grid_msg.header.frame_id = global_frame_; grid_msg.header.stamp = clock_->now(); voxel_pub_->publish(grid_msg); } updateFootprint(robot_x, robot_y, robot_yaw, min_x, min_y, max_x, max_y); } void NonPersistentVoxelLayer::updateOrigin( double new_origin_x, double new_origin_y) { // project the new origin into the grid int cell_ox, cell_oy; cell_ox = static_cast<int>((new_origin_x - origin_x_) / resolution_); cell_oy = static_cast<int>((new_origin_y - origin_y_) / resolution_); // update the origin with the appropriate world coordinates origin_x_ = origin_x_ + cell_ox * resolution_; origin_y_ = origin_y_ + cell_oy * resolution_; } } // namespace nav2_costmap_2d #include "pluginlib/class_list_macros.hpp" PLUGINLIB_EXPORT_CLASS(nav2_costmap_2d::NonPersistentVoxelLayer, nav2_costmap_2d::Layer)
33.632411
96
0.695146
SteveMacenski
b094644630701c8cefb6af63fb6367e20850660d
1,878
cpp
C++
theory/burrows_wheeler/bw_matching.cpp
ideahitme/coursera
af44c8d817481d4f9025205284f109d95a9bb45d
[ "MIT" ]
null
null
null
theory/burrows_wheeler/bw_matching.cpp
ideahitme/coursera
af44c8d817481d4f9025205284f109d95a9bb45d
[ "MIT" ]
null
null
null
theory/burrows_wheeler/bw_matching.cpp
ideahitme/coursera
af44c8d817481d4f9025205284f109d95a9bb45d
[ "MIT" ]
null
null
null
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; struct t{ int l_index; //index in bwt string int f_index; //index in suffix array t(int f_index): f_index(f_index) {}; }; inline int con(char x){ if (x == '$') return 0; if (x == 'A') return 1; if (x == 'C') return 2; if (x == 'G') return 3; if (x == 'T') return 4; return -1; } int bw_matching( const string &x, const string &y, const vector<int> &last_to_first, const string &p, const vector<vector<int>> &count, const vector<int> &first ) { int n = x.length(); int m = p.length(); int cur_match = m - 1; int l = 0; int r = n - 1; while(l <= r){ if (cur_match == -1) break; char chr = p[cur_match]; int ind = con(chr); int f_ind = first[ind]; if (f_ind == -1) return 0; if (l > 0) l = f_ind + count[ind][l-1]; else l = f_ind; r = f_ind + count[ind][r]-1; cur_match--; } return r - l + 1; } int main(int argc, char const *argv[]) { string x; cin >> x; string y = x; sort(y.begin(), y.end()); vector<int> last_to_first(x.length(), -1); vector<vector<t>> c(5); vector<int> _c(5, 0); vector<vector<int>> count(5, vector<int>(x.length(), 0)); vector<int> first(5, -1); for(int i = 0; i < y.length(); i++){ char chr = y[i]; int ind = con(chr); if (first[ind] == -1) first[ind] = i; c[ind].push_back(t(i)); } for(int i = 0; i < x.length(); i++){ char chr = x[i]; int ind = con(chr); for(int j = 0; j < 5; j++){ if (j == ind) count[j][i] = (i == 0) ? 1: count[j][i-1]+1; else count[j][i] = (i == 0) ? 0: count[j][i-1]; } last_to_first[i] = c[ind][_c[ind]].f_index; c[ind][_c[ind]].l_index = i; _c[ind]++; } int t; cin >> t; for(int i = 0; i < t; i++){ string p; cin >> p; int occ = bw_matching(x, y, last_to_first, p, count, first); cout << occ << " "; } cout << endl; return 0; }
20.866667
62
0.554846
ideahitme
b09645265b8e106645b7463c776a0713265b8a92
2,527
hpp
C++
src/camera.hpp
DeNiCoN/ComputerGraphicsLabs
ca02ea69b8dbc2ebeef1068779a0802babc95302
[ "Unlicense" ]
null
null
null
src/camera.hpp
DeNiCoN/ComputerGraphicsLabs
ca02ea69b8dbc2ebeef1068779a0802babc95302
[ "Unlicense" ]
null
null
null
src/camera.hpp
DeNiCoN/ComputerGraphicsLabs
ca02ea69b8dbc2ebeef1068779a0802babc95302
[ "Unlicense" ]
null
null
null
#pragma once #include <glm/glm.hpp> #include <glm/gtx/transform.hpp> #include <array> #include <string_view> #include <algorithm> #include <ranges> namespace Projection { enum Projection { ORTHO, PERSPECTIVE }; const std::array projectionStrings { "Ortho", "Perspective" }; inline const char* ToString(Projection proj) { std::size_t value = static_cast<std::size_t>(proj); assert(value < projectionStrings.size()); return projectionStrings[value]; } inline Projection FromString(std::string_view sv) { auto it = std::ranges::find(projectionStrings, sv); assert(it != projectionStrings.end()); return static_cast<Projection>( std::distance(projectionStrings.begin(), it)); } } class Camera { public: const glm::mat4& GetProjection() const { return m_proj; } glm::mat4 GetView() const { glm::vec3 posT = transform * glm::vec4(position, 1.f); glm::vec3 dirT = transform * glm::vec4(direction, 0.f); glm::vec3 upT = transform * glm::vec4(0.f, 1.f, 0.f, 0.f); auto look = glm::lookAt(posT, posT + dirT, upT); return glm::scale(glm::identity<glm::mat4>(), {scale, scale, scale}) * look; } glm::vec3 direction = {0.f, 0.f, 1.f}; glm::vec3 position = {0.f, 0.f, 0.f}; float scale = 1.f; void SetOrtho(float width, float height, unsigned depth) { m_proj = glm::ortho(-width/2.f, width/2.f, -height/2.f, height/2.f, 0.f, depth/1.f); m_proj[1][1] = -m_proj[1][1]; m_projectionType = Projection::ORTHO; } void SetPerspective(float fov, float aspect, float near, float far) { m_proj = glm::perspective(fov, aspect, near, far); m_proj[1][1] = -m_proj[1][1]; m_projectionType = Projection::PERSPECTIVE; } Projection::Projection GetProjectionType() const { return m_projectionType; } void SetViewport(int width, int height) { if (GetProjectionType() == Projection::PERSPECTIVE) { SetPerspective(m_fov, width / static_cast<float>(height), 0.01f, 100.f); } else if (GetProjectionType() == Projection::ORTHO) { SetOrtho(width/100.f, height/100.f, 100.f); } } float m_fov = 2.f; glm::mat4 transform = glm::identity<glm::mat4>(); private: Projection::Projection m_projectionType = Projection::ORTHO; glm::mat4 m_proj = glm::identity<glm::mat4>(); };
25.785714
84
0.600712
DeNiCoN
b096e0545c390475f280c8363919f9ef6c5e33bc
1,326
cpp
C++
mao_protocol_stack/protocol/udp.cpp
MaoJianwei/Mao_Protocol_Stack
0c26cb35e61d131985acd0882d60ccc3e815a149
[ "Apache-2.0" ]
null
null
null
mao_protocol_stack/protocol/udp.cpp
MaoJianwei/Mao_Protocol_Stack
0c26cb35e61d131985acd0882d60ccc3e815a149
[ "Apache-2.0" ]
null
null
null
mao_protocol_stack/protocol/udp.cpp
MaoJianwei/Mao_Protocol_Stack
0c26cb35e61d131985acd0882d60ccc3e815a149
[ "Apache-2.0" ]
null
null
null
// // Created by root on 19-4-17. // #include <cstdio> #include <cstring> #include <netinet/in.h> #include "udp.h" #include "ethernet.h" #include "ipv4.h" udp::udp(unsigned char *packet) { unsigned int first; memcpy(&first, packet + ethernet::HEADER_LENGTH + ipv4::HEADER_LENGTH, 4); first = ntohl(first); src = (first >> 16) & 0xFFFF; dst = first & 0xFFFF; unsigned int second; memcpy(&second, packet + ethernet::HEADER_LENGTH + ipv4::HEADER_LENGTH + 4, 4); second = ntohl(second); length = (second >> 16) & 0xFFFF; checksum = second & 0xFFFF; } char *udp::toString() { char *summary = new char[1024]{0}; sprintf(summary, " src=%u, dst=%u, length=%u, checksum=%u\n", src, dst, length, checksum); return summary; } unsigned short udp::getSrc() const { return src; } unsigned short udp::getDst() const { return dst; } unsigned short udp::getLength() const { return length; } unsigned short udp::getChecksum() const { return checksum; } void udp::setSrc(unsigned short src) { udp::src = src; } void udp::setDst(unsigned short dst) { udp::dst = dst; } void udp::setLength(unsigned short length) { udp::length = length; } void udp::setChecksum(unsigned short checksum) { udp::checksum = checksum; }
19.217391
83
0.625943
MaoJianwei
b09728396bb1450cde6cf358f7e52e438bc5f736
2,157
cpp
C++
node-llvm/value.cpp
carlosalberto/echo-js
1d92b782cf0465321635242138a1d8c902b5ebb2
[ "MIT" ]
null
null
null
node-llvm/value.cpp
carlosalberto/echo-js
1d92b782cf0465321635242138a1d8c902b5ebb2
[ "MIT" ]
null
null
null
node-llvm/value.cpp
carlosalberto/echo-js
1d92b782cf0465321635242138a1d8c902b5ebb2
[ "MIT" ]
null
null
null
#include "node-llvm.h" #include "value.h" using namespace node; using namespace v8; namespace jsllvm { void Value::Init(Handle<Object> target) { HandleScope scope; Local<FunctionTemplate> t = FunctionTemplate::New(New); s_ct = Persistent<FunctionTemplate>::New(t); s_ct->InstanceTemplate()->SetInternalFieldCount(1); s_ct->SetClassName(String::NewSymbol("Value")); NODE_SET_PROTOTYPE_METHOD (s_ct, "dump", Value::Dump); NODE_SET_PROTOTYPE_METHOD (s_ct, "setName", Value::SetName); NODE_SET_PROTOTYPE_METHOD (s_ct, "toString", Value::ToString); s_func = Persistent<Function>::New(s_ct->GetFunction()); target->Set(String::NewSymbol("Value"), s_func); } Value::Value(llvm::Value *llvm_val) : llvm_val(llvm_val) { } Value::Value() : llvm_val(NULL) { } Value::~Value() { } Handle<v8::Value> Value::New(llvm::Value *llvm_val) { HandleScope scope; Local<Object> new_instance = Value::s_func->NewInstance(); Value* new_val = new Value(llvm_val); new_val->Wrap(new_instance); return scope.Close(new_instance); } Handle< ::v8::Value> Value::New(const Arguments& args) { HandleScope scope; Value* val = new Value(); val->Wrap(args.This()); return args.This(); } Handle< ::v8::Value> Value::Dump(const Arguments& args) { HandleScope scope; Value* val = ObjectWrap::Unwrap<Value>(args.This()); val->llvm_val->dump(); return scope.Close(Undefined()); } Handle< ::v8::Value> Value::SetName(const Arguments& args) { HandleScope scope; Value* val = ObjectWrap::Unwrap<Value>(args.This()); REQ_UTF8_ARG (0, name); val->llvm_val->setName(*name); return scope.Close(Undefined()); } Handle< ::v8::Value> Value::ToString(const Arguments& args) { HandleScope scope; Value* val = ObjectWrap::Unwrap<Value>(args.This()); std::string str; llvm::raw_string_ostream str_ostream(str); val->llvm_val->print(str_ostream); return scope.Close(String::New(trim(str_ostream.str()).c_str())); } Persistent<FunctionTemplate> Value::s_ct; Persistent<Function> Value::s_func; };
23.703297
69
0.662031
carlosalberto
b0975cc86125fc253cf28d7cd36406647a43be04
2,073
hpp
C++
bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/PrivateHeaders/ReceiveTransportWrapper.hpp
VLprojects/mediaborsch-client-swift
34cc664b0f2c95e769fa0d7df01a219bba43ff4f
[ "MIT" ]
null
null
null
bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/PrivateHeaders/ReceiveTransportWrapper.hpp
VLprojects/mediaborsch-client-swift
34cc664b0f2c95e769fa0d7df01a219bba43ff4f
[ "MIT" ]
null
null
null
bin/Mediasoup.xcframework/ios-arm64_x86_64-simulator/Mediasoup.framework/PrivateHeaders/ReceiveTransportWrapper.hpp
VLprojects/mediaborsch-client-swift
34cc664b0f2c95e769fa0d7df01a219bba43ff4f
[ "MIT" ]
null
null
null
#ifndef ReceiveTransportWrapper_h #define ReceiveTransportWrapper_h #import <Foundation/Foundation.h> #import "MediasoupClientMediaKind.h" #ifdef __cplusplus namespace mediasoupclient { class RecvTransport; } class ReceiveTransportListenerAdapter; #endif @class ConsumerWrapper; @class RTCPeerConnectionFactory; @protocol ReceiveTransportWrapperDelegate; typedef NS_ENUM(NSInteger, RTCIceTransportPolicy); @interface ReceiveTransportWrapper : NSObject @property(nonatomic, nullable, weak) id<ReceiveTransportWrapperDelegate> delegate; @property(nonatomic, nonnull, readonly, getter = id) NSString *id; @property(nonatomic, readonly, getter = closed) BOOL closed; @property(nonatomic, nonnull, readonly, getter = connectionState) NSString *connectionState; @property(nonatomic, nonnull, readonly, getter = appData) NSString *appData; @property(nonatomic, nonnull, readonly, getter = stats) NSString *stats; #ifdef __cplusplus - (instancetype _Nullable)initWithTransport:(mediasoupclient::RecvTransport *_Nonnull)transport pcFactory:(RTCPeerConnectionFactory *_Nonnull)pcFactory listenerAdapter:(ReceiveTransportListenerAdapter *_Nonnull)listenerAdapter; #endif - (void)close; - (void)restartICE:(NSString *_Nonnull)iceParameters error:(out NSError *__autoreleasing _Nullable *_Nullable)error __attribute__((swift_error(nonnull_error))); - (void)updateICEServers:(NSString *_Nonnull)iceServers error:(out NSError *__autoreleasing _Nullable *_Nullable)error __attribute__((swift_error(nonnull_error))); - (void)updateICETransportPolicy:(RTCIceTransportPolicy)iceTransportPolicy error:(out NSError *__autoreleasing _Nullable *_Nullable)error __attribute__((swift_error(nonnull_error))); - (ConsumerWrapper *_Nullable)createConsumerWithId:(NSString *_Nonnull)consumerId producerId:(NSString *_Nonnull)producerId kind:(MediasoupClientMediaKind _Nonnull)kind rtpParameters:(NSString *_Nonnull)rtpParameters appData:(NSString *_Nullable)appData error:(out NSError *__autoreleasing _Nullable *_Nullable)error; @end #endif /* ReceiveTransportWrapper_h */
35.135593
95
0.826339
VLprojects
b09865ad533c07e5d1ddc2b35144a0f361e03072
1,726
cpp
C++
Unity/vr_arm_ctrl/Library/PackageCache/com.unity.xr.openxr@1.3.1/MockRuntime/Native~/openxr_loader/mock_loader.cpp
BigMeatBaoZi/SDM5002
52d60368f3c638d36f63de9e88cca5144b5021a5
[ "MIT" ]
null
null
null
Unity/vr_arm_ctrl/Library/PackageCache/com.unity.xr.openxr@1.3.1/MockRuntime/Native~/openxr_loader/mock_loader.cpp
BigMeatBaoZi/SDM5002
52d60368f3c638d36f63de9e88cca5144b5021a5
[ "MIT" ]
null
null
null
Unity/vr_arm_ctrl/Library/PackageCache/com.unity.xr.openxr@1.3.1/MockRuntime/Native~/openxr_loader/mock_loader.cpp
BigMeatBaoZi/SDM5002
52d60368f3c638d36f63de9e88cca5144b5021a5
[ "MIT" ]
2
2022-03-14T00:37:10.000Z
2022-03-14T02:31:38.000Z
#ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif // !WIN32_LEAN_AND_MEAN #include <d3d11.h> #include <d3d12.h> #include <windows.h> #endif #include <vulkan/vulkan.h> #define XR_NO_PROTOTYPES #include "XR/IUnityXRTrace.h" #include "openxr/openxr.h" #include "openxr/openxr_platform.h" #include "plugin_load.h" #include <openxr/loader_interfaces.h> #include <openxr/openxr_reflection.h> struct IUnityXRTrace; extern IUnityXRTrace* s_Trace; IUnityXRTrace* s_Trace = nullptr; extern "C" XrResult UNITY_INTERFACE_EXPORT XRAPI_PTR xrGetInstanceProcAddr(XrInstance instance, const char* name, PFN_xrVoidFunction* function); PluginHandle s_PluginHandle = nullptr; PFN_xrGetInstanceProcAddr s_GetInstanceProcAddr = nullptr; static bool LoadMockRuntime() { if (nullptr != s_GetInstanceProcAddr) return true; s_PluginHandle = Plugin_LoadLibrary("mock_runtime"); if (nullptr == s_PluginHandle) return false; s_GetInstanceProcAddr = (PFN_xrGetInstanceProcAddr)Plugin_GetSymbol(s_PluginHandle, "xrGetInstanceProcAddr"); return nullptr != s_GetInstanceProcAddr; } extern "C" XrResult UNITY_INTERFACE_EXPORT XRAPI_PTR xrGetInstanceProcAddr(XrInstance instance, const char* name, PFN_xrVoidFunction* function) { if (!LoadMockRuntime()) return XR_ERROR_RUNTIME_FAILURE; return s_GetInstanceProcAddr(instance, name, function); } extern "C" void UNITY_INTERFACE_EXPORT XRAPI_PTR SetXRTrace(IUnityXRTrace* trace) { if (!LoadMockRuntime()) return; typedef void (*PFN_SetXRTrace)(IUnityXRTrace * trace); PFN_SetXRTrace set = (PFN_SetXRTrace)Plugin_GetSymbol(s_PluginHandle, "SetXRTrace"); if (set != nullptr) set(trace); }
27.83871
144
0.76883
BigMeatBaoZi
b09cff5b9f8737287234d92fa91d38eae16f9201
2,107
cpp
C++
src/prod/src/Hosting2/GetNetworkDeployedPackagesReply.cpp
gridgentoo/ServiceFabricAzure
c3e7a07617e852322d73e6cc9819d266146866a4
[ "MIT" ]
2,542
2018-03-14T21:56:12.000Z
2019-05-06T01:18:20.000Z
src/prod/src/Hosting2/GetNetworkDeployedPackagesReply.cpp
gridgentoo/ServiceFabricAzure
c3e7a07617e852322d73e6cc9819d266146866a4
[ "MIT" ]
994
2019-05-07T02:39:30.000Z
2022-03-31T13:23:04.000Z
src/prod/src/Hosting2/GetNetworkDeployedPackagesReply.cpp
gridgentoo/ServiceFabricAzure
c3e7a07617e852322d73e6cc9819d266146866a4
[ "MIT" ]
300
2018-03-14T21:57:17.000Z
2019-05-06T20:07:00.000Z
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #include "stdafx.h" using namespace std; using namespace Common; using namespace ServiceModel; using namespace Hosting2; GetNetworkDeployedPackagesReply::GetNetworkDeployedPackagesReply() : networkDeployedPackages_(), codePackageInstanceIdentifierContainerInfoMap_() { } GetNetworkDeployedPackagesReply::GetNetworkDeployedPackagesReply( std::map<std::wstring, std::vector<std::wstring>> const & networkDeployedPackages, std::map<std::wstring, std::wstring> const & codePackageInstanceIdentifierContainerInfoMap) : networkDeployedPackages_(networkDeployedPackages), codePackageInstanceIdentifierContainerInfoMap_(codePackageInstanceIdentifierContainerInfoMap) { } void GetNetworkDeployedPackagesReply::WriteTo(TextWriter & w, FormatOptions const &) const { w.Write("GetNetworkDeployedPackagesReply { "); for (auto const & network : networkDeployedPackages_) { wstring networkName; wstring servicePackageId; StringUtility::SplitOnce(network.first, networkName, servicePackageId, L","); w.Write("NetworkName = {0} ", networkName); w.Write("ServicePackageId = {0} ", servicePackageId); w.Write("CodePackageNames { "); for (auto const & cp : network.second) { w.Write("CodePackageName = {0} ", cp); } w.Write("} "); } for (auto const & cp : codePackageInstanceIdentifierContainerInfoMap_) { wstring codePackageInstanceIdentifier; wstring containerId; StringUtility::SplitOnce(cp.first, codePackageInstanceIdentifier, containerId, L","); w.Write("CodePackageInstanceIdentifier = {0} ", codePackageInstanceIdentifier); w.Write("ContainerId = {0} ", containerId); w.Write("ContainerAddress = {0} ", cp.second); } w.Write("}"); }
36.327586
98
0.671096
gridgentoo
b09e5ae6e606fa911a52ef9c93db843e9eb5fc28
842
cpp
C++
cpp/Frustrated_coder_2.cpp
Razdeep/Hackerearth-Solutions
af37a2f8271c11ca5ed7ab7a8b1a1ff3436f0ea0
[ "MIT" ]
null
null
null
cpp/Frustrated_coder_2.cpp
Razdeep/Hackerearth-Solutions
af37a2f8271c11ca5ed7ab7a8b1a1ff3436f0ea0
[ "MIT" ]
null
null
null
cpp/Frustrated_coder_2.cpp
Razdeep/Hackerearth-Solutions
af37a2f8271c11ca5ed7ab7a8b1a1ff3436f0ea0
[ "MIT" ]
null
null
null
// https://www.hackerearth.com/practice/data-structures/stacks/basics-of-stacks/practice-problems/algorithm/sniper-shooting/description/ // More efficient version of the previous code #include<bits/stdc++.h> #define MAX 1003 using namespace std; typedef long long ll; int main() { ll N,temp; vector<ll> line; cin>>N; vector<ll> freq(MAX,0); for(ll i=0;i<N;i++) { scanf("%lld",&temp); freq[temp]++; } // Killing men for(ll i=1;i<MAX;i++) { ll availBullets=freq[i]; for(ll j=i-1;j>=1 && availBullets>0;j--) { ll hereBullets=min(availBullets,freq[j]); freq[j]-=hereBullets; availBullets-=hereBullets; } } ll sum=0; for(ll i=1;i<freq.size();i++) sum+=(i*freq[i]); cout<<sum<<endl; return 0; }
23.388889
136
0.566508
Razdeep
b09ead2a75fb0c63ed992c9f5df2cded5e5afb2c
7,944
cpp
C++
ESPSloeber/BathFanControl/Configuration.cpp
theater/House
7220f3d89d6de6a809fa36121dc28754feaf6bc0
[ "MIT" ]
null
null
null
ESPSloeber/BathFanControl/Configuration.cpp
theater/House
7220f3d89d6de6a809fa36121dc28754feaf6bc0
[ "MIT" ]
null
null
null
ESPSloeber/BathFanControl/Configuration.cpp
theater/House
7220f3d89d6de6a809fa36121dc28754feaf6bc0
[ "MIT" ]
null
null
null
/* * Configuration.cpp * * Created on: Oct 25, 2019 * Author: theater */ #include "Configuration.h" void Configuration::print() { Serial.println("###########################################"); String simulated = isSimulated ? "true" : "false"; Serial.printf("Simulated=%s \n", simulated.c_str()); Serial.printf("Configuration serial number=%d \n", serialNumber); Serial.println("###########################################"); Serial.printf("SSID=%s \n", ssid.c_str()); Serial.printf("SSID Password=%s \n", ssidPassword.c_str()); Serial.println("###########################################"); Serial.printf("MQTT Server/port=%s:%d \n", mqttServerAddress.toString().c_str(), mqttPort); Serial.printf("MQTT Client name=%s \n", mqttClientName.c_str()); Serial.printf("Fan speed topic=%s \n", fanSpeedMqttTopic.c_str()); Serial.printf("Mirror heating topic=%s \n", mirrorHeatingMqttTopic.c_str()); Serial.printf("Humidity topic=%s \n", humidityMqttTopic.c_str()); Serial.printf("Temperature topic=%s \n", temperatureMqttTopic.c_str()); Serial.printf("Mode topic=%s \n", modeMqttTopic.c_str()); Serial.printf("Desired humidity topic=%s \n", desiredHumidityMqttTopic.c_str()); Serial.println("###########################################"); Serial.printf("Current mode=%d \n", mode); Serial.printf("Desired humidity=%d%% \n", desiredHumidity); Serial.printf("High speed humidity threshold=%d%% \n", highSpeedThresholdDelta); Serial.printf("Humidity threshold tolerance=%d \n", humidityTolerance); Serial.printf("Sensors refresh interval=%dms \n", sensorsUpdateReocurrenceIntervalMillis); Serial.printf("Temperature correction=%d \n", temperatureCorrection); Serial.printf("Humidity Correction=%d \n", humidityCorrection); } void Configuration::updateValue(String * configProperty, String value, String parameterName) { if (!value.equals("") && !value.equals("********")) { *configProperty = value; Serial.printf("Parameter %s updated to: %s\n", parameterName.c_str(), value.c_str()); } else { Serial.printf("Received empty response for parameter %s. Will skip update.\n", parameterName.c_str()); } } void Configuration::updateValue(int * configProperty, String value, String parameterName) { if (!value.equals("") && !value.equals("********")) { *configProperty = value.toInt(); Serial.printf("Parameter %s updated to: %d\n", parameterName.c_str(), *configProperty); } else { Serial.printf("Received empty response for parameter %s. Will skip update.\n", parameterName.c_str()); } } void Configuration::updateValue(bool * configProperty, String value, String parameterName) { if (value.equals("on")) { *configProperty = true; } else { *configProperty = false; } Serial.printf("Parameter %s updated to: %s\n", parameterName.c_str(), *configProperty ? "true" : "false"); } void Configuration::loadEprom() { int nextAddress = STARTING_ADDRESS; Serial.printf("Loading config from EPROM...\nStarting with address=%d. Serial number before load=%d\n", nextAddress, serialNumber); EEPROM.begin(512); int memSerialNumber; memSerialNumber = EEPROM.get(nextAddress, memSerialNumber); Serial.printf("Loaded serial number from EPROM=%d\n", memSerialNumber); if (memSerialNumber == serialNumber) { nextAddress+=sizeof(memSerialNumber); ssid = getStringEprom(&nextAddress); ssidPassword = getStringEprom(&nextAddress); mqttServerAddress.fromString(getStringEprom(&nextAddress)); mqttClientName = getStringEprom(&nextAddress); fanSpeedMqttTopic = getStringEprom(&nextAddress); mirrorHeatingMqttTopic = getStringEprom(&nextAddress); humidityMqttTopic = getStringEprom(&nextAddress); temperatureMqttTopic = getStringEprom(&nextAddress); modeMqttTopic = getStringEprom(&nextAddress); desiredHumidityMqttTopic = getStringEprom(&nextAddress); Serial.printf("Finished loading strings. Last address=%d\n", nextAddress); isSimulated = EEPROM.get(nextAddress += sizeof(isSimulated), isSimulated); mode = EEPROM.get(nextAddress += sizeof(mode), mode); mqttPort = EEPROM.get(nextAddress += sizeof(mqttPort), mqttPort); desiredHumidity = EEPROM.get(nextAddress += sizeof(desiredHumidity), desiredHumidity); highSpeedThresholdDelta = EEPROM.get(nextAddress += sizeof(highSpeedThresholdDelta), highSpeedThresholdDelta); sensorsUpdateReocurrenceIntervalMillis = EEPROM.get(nextAddress += sizeof(sensorsUpdateReocurrenceIntervalMillis), sensorsUpdateReocurrenceIntervalMillis); temperatureCorrection = EEPROM.get(nextAddress += sizeof(temperatureCorrection), temperatureCorrection); humidityCorrection = EEPROM.get(nextAddress += sizeof(humidityCorrection), humidityCorrection); humidityTolerance = EEPROM.get(nextAddress += sizeof(humidityTolerance), humidityTolerance); Serial.printf("Finished loading primitives. Last address=%d\n", nextAddress); } else { Serial.printf("Configuration serial number from EPROM not equal to expected. Default values will be used. Value expected=%d, Value in EPROM=%d\n", this->serialNumber, memSerialNumber); } print(); } void Configuration::saveEprom() { int nextAddress = STARTING_ADDRESS; Serial.printf("Saving config from EPROM...\nStarting with address=%d.\n", nextAddress); EEPROM.begin(512); Serial.printf("Before writing configuration serial number. Address=%d, serial number=%d",nextAddress, serialNumber); EEPROM.put(nextAddress, serialNumber); nextAddress+=sizeof(serialNumber); putStringEprom(&nextAddress, ssid); putStringEprom(&nextAddress, ssidPassword); putStringEprom(&nextAddress, mqttServerAddress.toString()); putStringEprom(&nextAddress, mqttClientName); putStringEprom(&nextAddress, fanSpeedMqttTopic); putStringEprom(&nextAddress, mirrorHeatingMqttTopic); putStringEprom(&nextAddress, humidityMqttTopic); putStringEprom(&nextAddress, temperatureMqttTopic); putStringEprom(&nextAddress, modeMqttTopic); putStringEprom(&nextAddress, desiredHumidityMqttTopic); Serial.printf("Finished saving strings. Last address=%d\n", nextAddress); EEPROM.put(nextAddress += sizeof(isSimulated), isSimulated); EEPROM.put(nextAddress += sizeof(mode), mode); EEPROM.put(nextAddress += sizeof(mqttPort), mqttPort); EEPROM.put(nextAddress += sizeof(desiredHumidity), desiredHumidity); EEPROM.put(nextAddress += sizeof(highSpeedThresholdDelta), highSpeedThresholdDelta); EEPROM.put(nextAddress += sizeof(sensorsUpdateReocurrenceIntervalMillis), sensorsUpdateReocurrenceIntervalMillis); EEPROM.put(nextAddress += sizeof(temperatureCorrection), temperatureCorrection); EEPROM.put(nextAddress += sizeof(humidityCorrection), humidityCorrection); EEPROM.put(nextAddress += sizeof(humidityTolerance), humidityTolerance); Serial.printf("Finished saving primitives. Last address=%d\n", nextAddress); EEPROM.commit(); Serial.printf("EPROM used=%d bytes\n", nextAddress); } void Configuration::putStringEprom(int *address, String property) { int length = property.length(); Serial.printf("Property %s / length=%d\n", property.c_str(), length); EEPROM.put(*address, length); *address += sizeof(length); for (int i = 0; i < length; i++) { EEPROM.write(*address + i, property[i]); } EEPROM.write(*address + length, '\0'); *address += length + 1; Serial.printf("Next address = %d\n", *address); } String Configuration::getStringEprom(int *address) { int length = EEPROM.get(*address, length); *address += sizeof(length); Serial.printf("Property length=%d, next address=%d\n", length, *address); char tempArr[100]; Serial.print("Starting EEPROM read. Characters="); unsigned char tempChar; for (int i = 0; i < length; i++) { tempChar = EEPROM.read(*address + i); tempArr[i] = tempChar; Serial.printf("%c", tempArr[i]); } tempArr[length] = '\0'; *address += length + 1; return String(tempArr); }
46.186047
187
0.715005
theater
b09fb659708b35048eb68528549ff9167f2b9a84
785
hpp
C++
src/kcount/kcount-gpu/hashutil.hpp
xiamaz/ipuma
f8bc8ac24a5c282cf8c2003cb32bc21c1cb386e2
[ "BSD-3-Clause-LBNL" ]
null
null
null
src/kcount/kcount-gpu/hashutil.hpp
xiamaz/ipuma
f8bc8ac24a5c282cf8c2003cb32bc21c1cb386e2
[ "BSD-3-Clause-LBNL" ]
null
null
null
src/kcount/kcount-gpu/hashutil.hpp
xiamaz/ipuma
f8bc8ac24a5c282cf8c2003cb32bc21c1cb386e2
[ "BSD-3-Clause-LBNL" ]
null
null
null
#pragma once /* * ============================================================================ * * Authors: Prashant Pandey <ppandey@cs.stonybrook.edu> * Rob Johnson <robj@vmware.com> * * ============================================================================ */ #ifndef _HASHUTIL_CUH_ #define _HASHUTIL_CUH_ #include <sys/types.h> #include <stdlib.h> #include <stdint.h> __host__ __device__ uint64_t MurmurHash64B(const void* key, int len, unsigned int seed); __host__ __device__ uint64_t MurmurHash64A(const void* key, int len, unsigned int seed); __host__ __device__ uint64_t hash_64(uint64_t key, uint64_t mask); __host__ __device__ uint64_t hash_64i(uint64_t key, uint64_t mask); #endif // #ifndef _HASHUTIL_H_
30.192308
89
0.56051
xiamaz
b0a22f165833945ec40edefad837f9c08a1a1122
322,731
cpp
C++
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_sysadmin_asic_errors_ael.cpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
17
2016-12-02T05:45:49.000Z
2022-02-10T19:32:54.000Z
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_sysadmin_asic_errors_ael.cpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
2
2017-03-27T15:22:38.000Z
2019-11-05T08:30:16.000Z
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_sysadmin_asic_errors_ael.cpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
11
2016-12-02T05:45:52.000Z
2019-11-07T08:28:17.000Z
#include <sstream> #include <iostream> #include <ydk/entity_util.hpp> #include "bundle_info.hpp" #include "generated_entity_lookup.hpp" #include "Cisco_IOS_XR_sysadmin_asic_errors_ael.hpp" using namespace ydk; namespace cisco_ios_xr { namespace Cisco_IOS_XR_sysadmin_asic_errors_ael { AsicErrors::AsicErrors() : device_name{YType::str, "device-name"} , instance(this, {"instance_num"}) , show_all_instances(std::make_shared<AsicErrors::ShowAllInstances>()) { show_all_instances->parent = this; yang_name = "asic-errors"; yang_parent_name = "Cisco-IOS-XR-sysadmin-asic-errors-ael"; is_top_level_class = true; has_list_ancestor = false; } AsicErrors::~AsicErrors() { } bool AsicErrors::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<instance.len(); index++) { if(instance[index]->has_data()) return true; } return device_name.is_set || (show_all_instances != nullptr && show_all_instances->has_data()); } bool AsicErrors::has_operation() const { for (std::size_t index=0; index<instance.len(); index++) { if(instance[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(device_name.yfilter) || (show_all_instances != nullptr && show_all_instances->has_operation()); } std::string AsicErrors::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "Cisco-IOS-XR-sysadmin-asic-errors-ael:asic-errors"; ADD_KEY_TOKEN(device_name, "device-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (device_name.is_set || is_set(device_name.yfilter)) leaf_name_data.push_back(device_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "instance") { auto ent_ = std::make_shared<AsicErrors::Instance>(); ent_->parent = this; instance.append(ent_); return ent_; } if(child_yang_name == "show-all-instances") { if(show_all_instances == nullptr) { show_all_instances = std::make_shared<AsicErrors::ShowAllInstances>(); } return show_all_instances; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : instance.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } if(show_all_instances != nullptr) { _children["show-all-instances"] = show_all_instances; } return _children; } void AsicErrors::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "device-name") { device_name = value; device_name.value_namespace = name_space; device_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "device-name") { device_name.yfilter = yfilter; } } std::shared_ptr<ydk::Entity> AsicErrors::clone_ptr() const { return std::make_shared<AsicErrors>(); } std::string AsicErrors::get_bundle_yang_models_location() const { return ydk_cisco_ios_xr_models_path; } std::string AsicErrors::get_bundle_name() const { return "cisco_ios_xr"; } augment_capabilities_function AsicErrors::get_augment_capabilities_function() const { return cisco_ios_xr_augment_lookup_tables; } std::map<std::pair<std::string, std::string>, std::string> AsicErrors::get_namespace_identity_lookup() const { return cisco_ios_xr_namespace_identity_lookup; } bool AsicErrors::has_leaf_or_child_of_name(const std::string & name) const { if(name == "instance" || name == "show-all-instances" || name == "device-name") return true; return false; } AsicErrors::Instance::Instance() : instance_num{YType::uint32, "instance-num"} , sbe(std::make_shared<AsicErrors::Instance::Sbe>()) , mbe(std::make_shared<AsicErrors::Instance::Mbe>()) , parity(std::make_shared<AsicErrors::Instance::Parity>()) , generic(std::make_shared<AsicErrors::Instance::Generic>()) , crc(std::make_shared<AsicErrors::Instance::Crc>()) , reset(std::make_shared<AsicErrors::Instance::Reset>()) , barrier(std::make_shared<AsicErrors::Instance::Barrier>()) , unexpected(std::make_shared<AsicErrors::Instance::Unexpected>()) , link(std::make_shared<AsicErrors::Instance::Link>()) , oor_thresh(std::make_shared<AsicErrors::Instance::OorThresh>()) , bp(std::make_shared<AsicErrors::Instance::Bp>()) , io(std::make_shared<AsicErrors::Instance::Io>()) , ucode(std::make_shared<AsicErrors::Instance::Ucode>()) , config(std::make_shared<AsicErrors::Instance::Config>()) , indirect(std::make_shared<AsicErrors::Instance::Indirect>()) , nonerr(std::make_shared<AsicErrors::Instance::Nonerr>()) , summary(std::make_shared<AsicErrors::Instance::Summary>()) , all(std::make_shared<AsicErrors::Instance::All>()) { sbe->parent = this; mbe->parent = this; parity->parent = this; generic->parent = this; crc->parent = this; reset->parent = this; barrier->parent = this; unexpected->parent = this; link->parent = this; oor_thresh->parent = this; bp->parent = this; io->parent = this; ucode->parent = this; config->parent = this; indirect->parent = this; nonerr->parent = this; summary->parent = this; all->parent = this; yang_name = "instance"; yang_parent_name = "asic-errors"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::~Instance() { } bool AsicErrors::Instance::has_data() const { if (is_presence_container) return true; return instance_num.is_set || (sbe != nullptr && sbe->has_data()) || (mbe != nullptr && mbe->has_data()) || (parity != nullptr && parity->has_data()) || (generic != nullptr && generic->has_data()) || (crc != nullptr && crc->has_data()) || (reset != nullptr && reset->has_data()) || (barrier != nullptr && barrier->has_data()) || (unexpected != nullptr && unexpected->has_data()) || (link != nullptr && link->has_data()) || (oor_thresh != nullptr && oor_thresh->has_data()) || (bp != nullptr && bp->has_data()) || (io != nullptr && io->has_data()) || (ucode != nullptr && ucode->has_data()) || (config != nullptr && config->has_data()) || (indirect != nullptr && indirect->has_data()) || (nonerr != nullptr && nonerr->has_data()) || (summary != nullptr && summary->has_data()) || (all != nullptr && all->has_data()); } bool AsicErrors::Instance::has_operation() const { return is_set(yfilter) || ydk::is_set(instance_num.yfilter) || (sbe != nullptr && sbe->has_operation()) || (mbe != nullptr && mbe->has_operation()) || (parity != nullptr && parity->has_operation()) || (generic != nullptr && generic->has_operation()) || (crc != nullptr && crc->has_operation()) || (reset != nullptr && reset->has_operation()) || (barrier != nullptr && barrier->has_operation()) || (unexpected != nullptr && unexpected->has_operation()) || (link != nullptr && link->has_operation()) || (oor_thresh != nullptr && oor_thresh->has_operation()) || (bp != nullptr && bp->has_operation()) || (io != nullptr && io->has_operation()) || (ucode != nullptr && ucode->has_operation()) || (config != nullptr && config->has_operation()) || (indirect != nullptr && indirect->has_operation()) || (nonerr != nullptr && nonerr->has_operation()) || (summary != nullptr && summary->has_operation()) || (all != nullptr && all->has_operation()); } std::string AsicErrors::Instance::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "instance"; ADD_KEY_TOKEN(instance_num, "instance-num"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (instance_num.is_set || is_set(instance_num.yfilter)) leaf_name_data.push_back(instance_num.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "sbe") { if(sbe == nullptr) { sbe = std::make_shared<AsicErrors::Instance::Sbe>(); } return sbe; } if(child_yang_name == "mbe") { if(mbe == nullptr) { mbe = std::make_shared<AsicErrors::Instance::Mbe>(); } return mbe; } if(child_yang_name == "parity") { if(parity == nullptr) { parity = std::make_shared<AsicErrors::Instance::Parity>(); } return parity; } if(child_yang_name == "generic") { if(generic == nullptr) { generic = std::make_shared<AsicErrors::Instance::Generic>(); } return generic; } if(child_yang_name == "crc") { if(crc == nullptr) { crc = std::make_shared<AsicErrors::Instance::Crc>(); } return crc; } if(child_yang_name == "reset") { if(reset == nullptr) { reset = std::make_shared<AsicErrors::Instance::Reset>(); } return reset; } if(child_yang_name == "barrier") { if(barrier == nullptr) { barrier = std::make_shared<AsicErrors::Instance::Barrier>(); } return barrier; } if(child_yang_name == "unexpected") { if(unexpected == nullptr) { unexpected = std::make_shared<AsicErrors::Instance::Unexpected>(); } return unexpected; } if(child_yang_name == "link") { if(link == nullptr) { link = std::make_shared<AsicErrors::Instance::Link>(); } return link; } if(child_yang_name == "oor-thresh") { if(oor_thresh == nullptr) { oor_thresh = std::make_shared<AsicErrors::Instance::OorThresh>(); } return oor_thresh; } if(child_yang_name == "bp") { if(bp == nullptr) { bp = std::make_shared<AsicErrors::Instance::Bp>(); } return bp; } if(child_yang_name == "io") { if(io == nullptr) { io = std::make_shared<AsicErrors::Instance::Io>(); } return io; } if(child_yang_name == "ucode") { if(ucode == nullptr) { ucode = std::make_shared<AsicErrors::Instance::Ucode>(); } return ucode; } if(child_yang_name == "config") { if(config == nullptr) { config = std::make_shared<AsicErrors::Instance::Config>(); } return config; } if(child_yang_name == "indirect") { if(indirect == nullptr) { indirect = std::make_shared<AsicErrors::Instance::Indirect>(); } return indirect; } if(child_yang_name == "nonerr") { if(nonerr == nullptr) { nonerr = std::make_shared<AsicErrors::Instance::Nonerr>(); } return nonerr; } if(child_yang_name == "summary") { if(summary == nullptr) { summary = std::make_shared<AsicErrors::Instance::Summary>(); } return summary; } if(child_yang_name == "all") { if(all == nullptr) { all = std::make_shared<AsicErrors::Instance::All>(); } return all; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(sbe != nullptr) { _children["sbe"] = sbe; } if(mbe != nullptr) { _children["mbe"] = mbe; } if(parity != nullptr) { _children["parity"] = parity; } if(generic != nullptr) { _children["generic"] = generic; } if(crc != nullptr) { _children["crc"] = crc; } if(reset != nullptr) { _children["reset"] = reset; } if(barrier != nullptr) { _children["barrier"] = barrier; } if(unexpected != nullptr) { _children["unexpected"] = unexpected; } if(link != nullptr) { _children["link"] = link; } if(oor_thresh != nullptr) { _children["oor-thresh"] = oor_thresh; } if(bp != nullptr) { _children["bp"] = bp; } if(io != nullptr) { _children["io"] = io; } if(ucode != nullptr) { _children["ucode"] = ucode; } if(config != nullptr) { _children["config"] = config; } if(indirect != nullptr) { _children["indirect"] = indirect; } if(nonerr != nullptr) { _children["nonerr"] = nonerr; } if(summary != nullptr) { _children["summary"] = summary; } if(all != nullptr) { _children["all"] = all; } return _children; } void AsicErrors::Instance::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "instance-num") { instance_num = value; instance_num.value_namespace = name_space; instance_num.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "instance-num") { instance_num.yfilter = yfilter; } } bool AsicErrors::Instance::has_leaf_or_child_of_name(const std::string & name) const { if(name == "sbe" || name == "mbe" || name == "parity" || name == "generic" || name == "crc" || name == "reset" || name == "barrier" || name == "unexpected" || name == "link" || name == "oor-thresh" || name == "bp" || name == "io" || name == "ucode" || name == "config" || name == "indirect" || name == "nonerr" || name == "summary" || name == "all" || name == "instance-num") return true; return false; } AsicErrors::Instance::Sbe::Sbe() : location(this, {"location_name"}) { yang_name = "sbe"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Sbe::~Sbe() { } bool AsicErrors::Instance::Sbe::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Sbe::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Sbe::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "sbe"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Sbe::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Sbe::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Sbe::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Sbe::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Sbe::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Sbe::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Sbe::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Sbe::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "sbe"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Sbe::Location::~Location() { } bool AsicErrors::Instance::Sbe::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Sbe::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Sbe::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Sbe::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Sbe::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Sbe::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Sbe::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Sbe::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Sbe::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Sbe::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Sbe::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Sbe::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Sbe::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Sbe::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Sbe::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Sbe::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Sbe::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Sbe::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Sbe::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Sbe::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Sbe::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Mbe::Mbe() : location(this, {"location_name"}) { yang_name = "mbe"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Mbe::~Mbe() { } bool AsicErrors::Instance::Mbe::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Mbe::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Mbe::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "mbe"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Mbe::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Mbe::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Mbe::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Mbe::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Mbe::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Mbe::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Mbe::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Mbe::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "mbe"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Mbe::Location::~Location() { } bool AsicErrors::Instance::Mbe::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Mbe::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Mbe::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Mbe::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Mbe::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Mbe::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Mbe::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Mbe::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Mbe::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Mbe::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Mbe::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Mbe::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Mbe::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Mbe::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Mbe::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Mbe::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Mbe::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Mbe::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Mbe::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Mbe::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Mbe::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Parity::Parity() : location(this, {"location_name"}) { yang_name = "parity"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Parity::~Parity() { } bool AsicErrors::Instance::Parity::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Parity::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Parity::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "parity"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Parity::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Parity::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Parity::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Parity::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Parity::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Parity::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Parity::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Parity::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "parity"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Parity::Location::~Location() { } bool AsicErrors::Instance::Parity::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Parity::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Parity::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Parity::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Parity::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Parity::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Parity::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Parity::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Parity::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Parity::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Parity::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Parity::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Parity::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Parity::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Parity::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Parity::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Parity::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Parity::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Parity::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Parity::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Parity::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Generic::Generic() : location(this, {"location_name"}) { yang_name = "generic"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Generic::~Generic() { } bool AsicErrors::Instance::Generic::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Generic::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Generic::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "generic"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Generic::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Generic::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Generic::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Generic::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Generic::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Generic::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Generic::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Generic::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "generic"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Generic::Location::~Location() { } bool AsicErrors::Instance::Generic::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Generic::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Generic::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Generic::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Generic::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Generic::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Generic::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Generic::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Generic::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Generic::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Generic::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Generic::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Generic::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Generic::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Generic::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Generic::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Generic::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Generic::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Generic::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Generic::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Generic::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Crc::Crc() : location(this, {"location_name"}) { yang_name = "crc"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Crc::~Crc() { } bool AsicErrors::Instance::Crc::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Crc::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Crc::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "crc"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Crc::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Crc::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Crc::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Crc::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Crc::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Crc::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Crc::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Crc::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "crc"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Crc::Location::~Location() { } bool AsicErrors::Instance::Crc::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Crc::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Crc::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Crc::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Crc::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Crc::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Crc::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Crc::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Crc::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Crc::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Crc::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Crc::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Crc::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Crc::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Crc::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Crc::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Crc::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Crc::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Crc::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Crc::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Crc::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Reset::Reset() : location(this, {"location_name"}) { yang_name = "reset"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Reset::~Reset() { } bool AsicErrors::Instance::Reset::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Reset::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Reset::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "reset"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Reset::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Reset::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Reset::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Reset::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Reset::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Reset::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Reset::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Reset::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "reset"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Reset::Location::~Location() { } bool AsicErrors::Instance::Reset::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Reset::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Reset::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Reset::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Reset::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Reset::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Reset::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Reset::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Reset::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Reset::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Reset::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Reset::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Reset::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Reset::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Reset::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Reset::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Reset::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Reset::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Reset::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Reset::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Reset::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Barrier::Barrier() : location(this, {"location_name"}) { yang_name = "barrier"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Barrier::~Barrier() { } bool AsicErrors::Instance::Barrier::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Barrier::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Barrier::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "barrier"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Barrier::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Barrier::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Barrier::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Barrier::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Barrier::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Barrier::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Barrier::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Barrier::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "barrier"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Barrier::Location::~Location() { } bool AsicErrors::Instance::Barrier::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Barrier::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Barrier::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Barrier::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Barrier::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Barrier::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Barrier::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Barrier::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Barrier::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Barrier::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Barrier::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Barrier::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Barrier::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Barrier::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Barrier::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Barrier::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Barrier::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Barrier::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Barrier::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Barrier::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Barrier::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Unexpected::Unexpected() : location(this, {"location_name"}) { yang_name = "unexpected"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Unexpected::~Unexpected() { } bool AsicErrors::Instance::Unexpected::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Unexpected::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Unexpected::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "unexpected"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Unexpected::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Unexpected::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Unexpected::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Unexpected::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Unexpected::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Unexpected::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Unexpected::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Unexpected::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "unexpected"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Unexpected::Location::~Location() { } bool AsicErrors::Instance::Unexpected::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Unexpected::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Unexpected::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Unexpected::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Unexpected::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Unexpected::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Unexpected::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Unexpected::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Unexpected::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Unexpected::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Unexpected::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Unexpected::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Unexpected::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Unexpected::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Unexpected::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Unexpected::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Unexpected::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Unexpected::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Unexpected::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Unexpected::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Unexpected::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Link::Link() : location(this, {"location_name"}) { yang_name = "link"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Link::~Link() { } bool AsicErrors::Instance::Link::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Link::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Link::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "link"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Link::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Link::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Link::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Link::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Link::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Link::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Link::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Link::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "link"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Link::Location::~Location() { } bool AsicErrors::Instance::Link::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Link::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Link::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Link::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Link::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Link::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Link::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Link::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Link::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Link::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Link::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Link::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Link::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Link::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Link::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Link::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Link::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Link::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Link::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Link::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Link::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::OorThresh::OorThresh() : location(this, {"location_name"}) { yang_name = "oor-thresh"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::OorThresh::~OorThresh() { } bool AsicErrors::Instance::OorThresh::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::OorThresh::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::OorThresh::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "oor-thresh"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::OorThresh::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::OorThresh::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::OorThresh::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::OorThresh::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::OorThresh::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::OorThresh::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::OorThresh::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::OorThresh::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "oor-thresh"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::OorThresh::Location::~Location() { } bool AsicErrors::Instance::OorThresh::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::OorThresh::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::OorThresh::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::OorThresh::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::OorThresh::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::OorThresh::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::OorThresh::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::OorThresh::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::OorThresh::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::OorThresh::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::OorThresh::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::OorThresh::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::OorThresh::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::OorThresh::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::OorThresh::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::OorThresh::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::OorThresh::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::OorThresh::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::OorThresh::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::OorThresh::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::OorThresh::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Bp::Bp() : location(this, {"location_name"}) { yang_name = "bp"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Bp::~Bp() { } bool AsicErrors::Instance::Bp::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Bp::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Bp::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "bp"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Bp::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Bp::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Bp::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Bp::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Bp::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Bp::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Bp::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Bp::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "bp"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Bp::Location::~Location() { } bool AsicErrors::Instance::Bp::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Bp::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Bp::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Bp::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Bp::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Bp::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Bp::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Bp::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Bp::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Bp::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Bp::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Bp::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Bp::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Bp::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Bp::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Bp::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Bp::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Bp::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Bp::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Bp::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Bp::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Io::Io() : location(this, {"location_name"}) { yang_name = "io"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Io::~Io() { } bool AsicErrors::Instance::Io::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Io::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Io::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "io"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Io::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Io::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Io::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Io::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Io::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Io::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Io::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Io::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "io"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Io::Location::~Location() { } bool AsicErrors::Instance::Io::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Io::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Io::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Io::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Io::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Io::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Io::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Io::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Io::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Io::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Io::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Io::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Io::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Io::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Io::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Io::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Io::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Io::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Io::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Io::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Io::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Ucode::Ucode() : location(this, {"location_name"}) { yang_name = "ucode"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Ucode::~Ucode() { } bool AsicErrors::Instance::Ucode::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Ucode::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Ucode::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ucode"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Ucode::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Ucode::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Ucode::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Ucode::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Ucode::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Ucode::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Ucode::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Ucode::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "ucode"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Ucode::Location::~Location() { } bool AsicErrors::Instance::Ucode::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Ucode::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Ucode::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Ucode::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Ucode::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Ucode::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Ucode::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Ucode::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Ucode::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Ucode::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Ucode::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Ucode::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Ucode::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Ucode::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Ucode::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Ucode::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Ucode::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Ucode::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Ucode::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Ucode::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Ucode::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Config::Config() : location(this, {"location_name"}) { yang_name = "config"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Config::~Config() { } bool AsicErrors::Instance::Config::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Config::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Config::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "config"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Config::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Config::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Config::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Config::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Config::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Config::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Config::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Config::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "config"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Config::Location::~Location() { } bool AsicErrors::Instance::Config::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Config::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Config::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Config::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Config::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Config::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Config::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Config::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Config::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Config::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Config::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Config::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Config::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Config::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Config::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Config::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Config::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Config::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Config::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Config::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Config::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Indirect::Indirect() : location(this, {"location_name"}) { yang_name = "indirect"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Indirect::~Indirect() { } bool AsicErrors::Instance::Indirect::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Indirect::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Indirect::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "indirect"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Indirect::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Indirect::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Indirect::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Indirect::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Indirect::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Indirect::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Indirect::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Indirect::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "indirect"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Indirect::Location::~Location() { } bool AsicErrors::Instance::Indirect::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Indirect::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Indirect::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Indirect::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Indirect::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Indirect::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Indirect::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Indirect::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Indirect::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Indirect::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Indirect::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Indirect::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Indirect::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Indirect::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Indirect::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Indirect::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Indirect::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Indirect::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Indirect::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Indirect::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Indirect::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Nonerr::Nonerr() : location(this, {"location_name"}) { yang_name = "nonerr"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Nonerr::~Nonerr() { } bool AsicErrors::Instance::Nonerr::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Nonerr::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Nonerr::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "nonerr"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Nonerr::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Nonerr::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Nonerr::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Nonerr::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Nonerr::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Nonerr::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Nonerr::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Nonerr::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "nonerr"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Nonerr::Location::~Location() { } bool AsicErrors::Instance::Nonerr::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Nonerr::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Nonerr::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Nonerr::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Nonerr::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Nonerr::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Nonerr::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Nonerr::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Nonerr::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Nonerr::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Nonerr::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Nonerr::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Nonerr::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Nonerr::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Nonerr::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Nonerr::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Nonerr::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Nonerr::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Nonerr::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Nonerr::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Nonerr::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::Summary::Summary() : location(this, {"location_name"}) { yang_name = "summary"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Summary::~Summary() { } bool AsicErrors::Instance::Summary::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::Summary::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::Summary::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "summary"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Summary::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Summary::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::Summary::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Summary::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Summary::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::Summary::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::Summary::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::Summary::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "summary"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Summary::Location::~Location() { } bool AsicErrors::Instance::Summary::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::Summary::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::Summary::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Summary::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Summary::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::Summary::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Summary::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::Summary::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Summary::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::Summary::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::Summary::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::Summary::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::Summary::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::Summary::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::Summary::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::Summary::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::Summary::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::Summary::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::Summary::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::Summary::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::Summary::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::All::All() : history(std::make_shared<AsicErrors::Instance::All::History>()) , location(this, {"location_name"}) { history->parent = this; yang_name = "all"; yang_parent_name = "instance"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::All::~All() { } bool AsicErrors::Instance::All::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return (history != nullptr && history->has_data()); } bool AsicErrors::Instance::All::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter) || (history != nullptr && history->has_operation()); } std::string AsicErrors::Instance::All::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "all"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::All::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::All::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "history") { if(history == nullptr) { history = std::make_shared<AsicErrors::Instance::All::History>(); } return history; } if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::All::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::All::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(history != nullptr) { _children["history"] = history; } count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::All::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::All::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::All::has_leaf_or_child_of_name(const std::string & name) const { if(name == "history" || name == "location") return true; return false; } AsicErrors::Instance::All::History::History() : location(this, {"location_name"}) { yang_name = "history"; yang_parent_name = "all"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::All::History::~History() { } bool AsicErrors::Instance::All::History::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::Instance::All::History::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::Instance::All::History::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "history"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::All::History::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::All::History::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::Instance::All::History::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::All::History::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::All::History::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::Instance::All::History::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::Instance::All::History::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::Instance::All::History::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "history"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::All::History::Location::~Location() { } bool AsicErrors::Instance::All::History::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::All::History::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::All::History::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::All::History::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::All::History::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::All::History::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::All::History::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::All::History::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::All::History::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::All::History::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::All::History::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::All::History::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::All::History::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::All::History::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::All::History::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::All::History::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::All::History::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::All::History::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::All::History::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::All::History::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::All::History::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::Instance::All::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "all"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::All::Location::~Location() { } bool AsicErrors::Instance::All::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::Instance::All::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::Instance::All::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::All::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::All::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::Instance::All::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::All::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::Instance::All::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::All::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::Instance::All::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::Instance::All::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::Instance::All::Location::LogLst::~LogLst() { } bool AsicErrors::Instance::All::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::Instance::All::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::Instance::All::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::Instance::All::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::Instance::All::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::Instance::All::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::Instance::All::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::Instance::All::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::Instance::All::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::ShowAllInstances() : sbe(std::make_shared<AsicErrors::ShowAllInstances::Sbe>()) , mbe(std::make_shared<AsicErrors::ShowAllInstances::Mbe>()) , parity(std::make_shared<AsicErrors::ShowAllInstances::Parity>()) , generic(std::make_shared<AsicErrors::ShowAllInstances::Generic>()) , crc(std::make_shared<AsicErrors::ShowAllInstances::Crc>()) , reset(std::make_shared<AsicErrors::ShowAllInstances::Reset>()) , barrier(std::make_shared<AsicErrors::ShowAllInstances::Barrier>()) , unexpected(std::make_shared<AsicErrors::ShowAllInstances::Unexpected>()) , link(std::make_shared<AsicErrors::ShowAllInstances::Link>()) , oor_thresh(std::make_shared<AsicErrors::ShowAllInstances::OorThresh>()) , bp(std::make_shared<AsicErrors::ShowAllInstances::Bp>()) , io(std::make_shared<AsicErrors::ShowAllInstances::Io>()) , ucode(std::make_shared<AsicErrors::ShowAllInstances::Ucode>()) , config(std::make_shared<AsicErrors::ShowAllInstances::Config>()) , indirect(std::make_shared<AsicErrors::ShowAllInstances::Indirect>()) , nonerr(std::make_shared<AsicErrors::ShowAllInstances::Nonerr>()) , summary(std::make_shared<AsicErrors::ShowAllInstances::Summary>()) , all(std::make_shared<AsicErrors::ShowAllInstances::All>()) { sbe->parent = this; mbe->parent = this; parity->parent = this; generic->parent = this; crc->parent = this; reset->parent = this; barrier->parent = this; unexpected->parent = this; link->parent = this; oor_thresh->parent = this; bp->parent = this; io->parent = this; ucode->parent = this; config->parent = this; indirect->parent = this; nonerr->parent = this; summary->parent = this; all->parent = this; yang_name = "show-all-instances"; yang_parent_name = "asic-errors"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::~ShowAllInstances() { } bool AsicErrors::ShowAllInstances::has_data() const { if (is_presence_container) return true; return (sbe != nullptr && sbe->has_data()) || (mbe != nullptr && mbe->has_data()) || (parity != nullptr && parity->has_data()) || (generic != nullptr && generic->has_data()) || (crc != nullptr && crc->has_data()) || (reset != nullptr && reset->has_data()) || (barrier != nullptr && barrier->has_data()) || (unexpected != nullptr && unexpected->has_data()) || (link != nullptr && link->has_data()) || (oor_thresh != nullptr && oor_thresh->has_data()) || (bp != nullptr && bp->has_data()) || (io != nullptr && io->has_data()) || (ucode != nullptr && ucode->has_data()) || (config != nullptr && config->has_data()) || (indirect != nullptr && indirect->has_data()) || (nonerr != nullptr && nonerr->has_data()) || (summary != nullptr && summary->has_data()) || (all != nullptr && all->has_data()); } bool AsicErrors::ShowAllInstances::has_operation() const { return is_set(yfilter) || (sbe != nullptr && sbe->has_operation()) || (mbe != nullptr && mbe->has_operation()) || (parity != nullptr && parity->has_operation()) || (generic != nullptr && generic->has_operation()) || (crc != nullptr && crc->has_operation()) || (reset != nullptr && reset->has_operation()) || (barrier != nullptr && barrier->has_operation()) || (unexpected != nullptr && unexpected->has_operation()) || (link != nullptr && link->has_operation()) || (oor_thresh != nullptr && oor_thresh->has_operation()) || (bp != nullptr && bp->has_operation()) || (io != nullptr && io->has_operation()) || (ucode != nullptr && ucode->has_operation()) || (config != nullptr && config->has_operation()) || (indirect != nullptr && indirect->has_operation()) || (nonerr != nullptr && nonerr->has_operation()) || (summary != nullptr && summary->has_operation()) || (all != nullptr && all->has_operation()); } std::string AsicErrors::ShowAllInstances::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "show-all-instances"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "sbe") { if(sbe == nullptr) { sbe = std::make_shared<AsicErrors::ShowAllInstances::Sbe>(); } return sbe; } if(child_yang_name == "mbe") { if(mbe == nullptr) { mbe = std::make_shared<AsicErrors::ShowAllInstances::Mbe>(); } return mbe; } if(child_yang_name == "parity") { if(parity == nullptr) { parity = std::make_shared<AsicErrors::ShowAllInstances::Parity>(); } return parity; } if(child_yang_name == "generic") { if(generic == nullptr) { generic = std::make_shared<AsicErrors::ShowAllInstances::Generic>(); } return generic; } if(child_yang_name == "crc") { if(crc == nullptr) { crc = std::make_shared<AsicErrors::ShowAllInstances::Crc>(); } return crc; } if(child_yang_name == "reset") { if(reset == nullptr) { reset = std::make_shared<AsicErrors::ShowAllInstances::Reset>(); } return reset; } if(child_yang_name == "barrier") { if(barrier == nullptr) { barrier = std::make_shared<AsicErrors::ShowAllInstances::Barrier>(); } return barrier; } if(child_yang_name == "unexpected") { if(unexpected == nullptr) { unexpected = std::make_shared<AsicErrors::ShowAllInstances::Unexpected>(); } return unexpected; } if(child_yang_name == "link") { if(link == nullptr) { link = std::make_shared<AsicErrors::ShowAllInstances::Link>(); } return link; } if(child_yang_name == "oor-thresh") { if(oor_thresh == nullptr) { oor_thresh = std::make_shared<AsicErrors::ShowAllInstances::OorThresh>(); } return oor_thresh; } if(child_yang_name == "bp") { if(bp == nullptr) { bp = std::make_shared<AsicErrors::ShowAllInstances::Bp>(); } return bp; } if(child_yang_name == "io") { if(io == nullptr) { io = std::make_shared<AsicErrors::ShowAllInstances::Io>(); } return io; } if(child_yang_name == "ucode") { if(ucode == nullptr) { ucode = std::make_shared<AsicErrors::ShowAllInstances::Ucode>(); } return ucode; } if(child_yang_name == "config") { if(config == nullptr) { config = std::make_shared<AsicErrors::ShowAllInstances::Config>(); } return config; } if(child_yang_name == "indirect") { if(indirect == nullptr) { indirect = std::make_shared<AsicErrors::ShowAllInstances::Indirect>(); } return indirect; } if(child_yang_name == "nonerr") { if(nonerr == nullptr) { nonerr = std::make_shared<AsicErrors::ShowAllInstances::Nonerr>(); } return nonerr; } if(child_yang_name == "summary") { if(summary == nullptr) { summary = std::make_shared<AsicErrors::ShowAllInstances::Summary>(); } return summary; } if(child_yang_name == "all") { if(all == nullptr) { all = std::make_shared<AsicErrors::ShowAllInstances::All>(); } return all; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(sbe != nullptr) { _children["sbe"] = sbe; } if(mbe != nullptr) { _children["mbe"] = mbe; } if(parity != nullptr) { _children["parity"] = parity; } if(generic != nullptr) { _children["generic"] = generic; } if(crc != nullptr) { _children["crc"] = crc; } if(reset != nullptr) { _children["reset"] = reset; } if(barrier != nullptr) { _children["barrier"] = barrier; } if(unexpected != nullptr) { _children["unexpected"] = unexpected; } if(link != nullptr) { _children["link"] = link; } if(oor_thresh != nullptr) { _children["oor-thresh"] = oor_thresh; } if(bp != nullptr) { _children["bp"] = bp; } if(io != nullptr) { _children["io"] = io; } if(ucode != nullptr) { _children["ucode"] = ucode; } if(config != nullptr) { _children["config"] = config; } if(indirect != nullptr) { _children["indirect"] = indirect; } if(nonerr != nullptr) { _children["nonerr"] = nonerr; } if(summary != nullptr) { _children["summary"] = summary; } if(all != nullptr) { _children["all"] = all; } return _children; } void AsicErrors::ShowAllInstances::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::has_leaf_or_child_of_name(const std::string & name) const { if(name == "sbe" || name == "mbe" || name == "parity" || name == "generic" || name == "crc" || name == "reset" || name == "barrier" || name == "unexpected" || name == "link" || name == "oor-thresh" || name == "bp" || name == "io" || name == "ucode" || name == "config" || name == "indirect" || name == "nonerr" || name == "summary" || name == "all") return true; return false; } AsicErrors::ShowAllInstances::Sbe::Sbe() : location(this, {"location_name"}) { yang_name = "sbe"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Sbe::~Sbe() { } bool AsicErrors::ShowAllInstances::Sbe::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Sbe::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Sbe::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "sbe"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Sbe::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Sbe::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Sbe::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Sbe::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Sbe::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Sbe::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Sbe::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Sbe::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "sbe"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Sbe::Location::~Location() { } bool AsicErrors::ShowAllInstances::Sbe::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Sbe::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Sbe::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Sbe::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Sbe::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Sbe::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Sbe::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Sbe::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Sbe::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Sbe::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Sbe::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Sbe::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Sbe::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Sbe::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Sbe::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Sbe::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Sbe::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Sbe::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Sbe::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Sbe::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Sbe::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Mbe::Mbe() : location(this, {"location_name"}) { yang_name = "mbe"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Mbe::~Mbe() { } bool AsicErrors::ShowAllInstances::Mbe::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Mbe::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Mbe::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "mbe"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Mbe::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Mbe::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Mbe::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Mbe::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Mbe::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Mbe::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Mbe::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Mbe::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "mbe"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Mbe::Location::~Location() { } bool AsicErrors::ShowAllInstances::Mbe::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Mbe::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Mbe::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Mbe::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Mbe::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Mbe::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Mbe::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Mbe::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Mbe::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Mbe::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Mbe::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Mbe::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Mbe::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Mbe::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Mbe::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Mbe::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Mbe::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Mbe::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Mbe::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Mbe::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Mbe::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Parity::Parity() : location(this, {"location_name"}) { yang_name = "parity"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Parity::~Parity() { } bool AsicErrors::ShowAllInstances::Parity::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Parity::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Parity::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "parity"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Parity::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Parity::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Parity::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Parity::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Parity::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Parity::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Parity::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Parity::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "parity"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Parity::Location::~Location() { } bool AsicErrors::ShowAllInstances::Parity::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Parity::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Parity::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Parity::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Parity::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Parity::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Parity::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Parity::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Parity::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Parity::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Parity::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Parity::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Parity::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Parity::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Parity::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Parity::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Parity::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Parity::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Parity::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Parity::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Parity::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Generic::Generic() : location(this, {"location_name"}) { yang_name = "generic"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Generic::~Generic() { } bool AsicErrors::ShowAllInstances::Generic::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Generic::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Generic::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "generic"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Generic::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Generic::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Generic::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Generic::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Generic::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Generic::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Generic::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Generic::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "generic"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Generic::Location::~Location() { } bool AsicErrors::ShowAllInstances::Generic::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Generic::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Generic::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Generic::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Generic::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Generic::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Generic::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Generic::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Generic::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Generic::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Generic::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Generic::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Generic::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Generic::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Generic::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Generic::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Generic::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Generic::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Generic::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Generic::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Generic::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Crc::Crc() : location(this, {"location_name"}) { yang_name = "crc"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Crc::~Crc() { } bool AsicErrors::ShowAllInstances::Crc::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Crc::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Crc::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "crc"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Crc::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Crc::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Crc::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Crc::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Crc::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Crc::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Crc::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Crc::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "crc"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Crc::Location::~Location() { } bool AsicErrors::ShowAllInstances::Crc::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Crc::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Crc::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Crc::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Crc::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Crc::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Crc::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Crc::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Crc::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Crc::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Crc::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Crc::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Crc::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Crc::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Crc::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Crc::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Crc::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Crc::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Crc::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Crc::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Crc::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Reset::Reset() : location(this, {"location_name"}) { yang_name = "reset"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Reset::~Reset() { } bool AsicErrors::ShowAllInstances::Reset::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Reset::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Reset::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "reset"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Reset::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Reset::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Reset::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Reset::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Reset::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Reset::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Reset::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Reset::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "reset"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Reset::Location::~Location() { } bool AsicErrors::ShowAllInstances::Reset::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Reset::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Reset::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Reset::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Reset::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Reset::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Reset::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Reset::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Reset::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Reset::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Reset::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Reset::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Reset::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Reset::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Reset::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Reset::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Reset::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Reset::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Reset::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Reset::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Reset::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Barrier::Barrier() : location(this, {"location_name"}) { yang_name = "barrier"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Barrier::~Barrier() { } bool AsicErrors::ShowAllInstances::Barrier::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Barrier::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Barrier::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "barrier"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Barrier::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Barrier::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Barrier::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Barrier::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Barrier::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Barrier::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Barrier::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Barrier::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "barrier"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Barrier::Location::~Location() { } bool AsicErrors::ShowAllInstances::Barrier::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Barrier::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Barrier::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Barrier::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Barrier::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Barrier::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Barrier::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Barrier::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Barrier::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Barrier::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Barrier::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Barrier::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Barrier::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Barrier::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Barrier::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Barrier::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Barrier::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Barrier::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Barrier::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Barrier::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Barrier::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Unexpected::Unexpected() : location(this, {"location_name"}) { yang_name = "unexpected"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Unexpected::~Unexpected() { } bool AsicErrors::ShowAllInstances::Unexpected::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Unexpected::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Unexpected::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "unexpected"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Unexpected::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Unexpected::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Unexpected::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Unexpected::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Unexpected::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Unexpected::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Unexpected::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Unexpected::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "unexpected"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Unexpected::Location::~Location() { } bool AsicErrors::ShowAllInstances::Unexpected::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Unexpected::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Unexpected::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Unexpected::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Unexpected::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Unexpected::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Unexpected::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Unexpected::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Unexpected::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Unexpected::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Unexpected::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Link::Link() : location(this, {"location_name"}) { yang_name = "link"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Link::~Link() { } bool AsicErrors::ShowAllInstances::Link::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Link::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Link::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "link"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Link::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Link::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Link::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Link::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Link::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Link::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Link::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Link::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "link"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Link::Location::~Location() { } bool AsicErrors::ShowAllInstances::Link::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Link::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Link::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Link::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Link::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Link::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Link::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Link::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Link::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Link::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Link::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Link::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Link::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Link::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Link::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Link::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Link::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Link::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Link::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Link::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Link::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::OorThresh::OorThresh() : location(this, {"location_name"}) { yang_name = "oor-thresh"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::OorThresh::~OorThresh() { } bool AsicErrors::ShowAllInstances::OorThresh::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::OorThresh::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::OorThresh::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "oor-thresh"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::OorThresh::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::OorThresh::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::OorThresh::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::OorThresh::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::OorThresh::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::OorThresh::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::OorThresh::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::OorThresh::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "oor-thresh"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::OorThresh::Location::~Location() { } bool AsicErrors::ShowAllInstances::OorThresh::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::OorThresh::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::OorThresh::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::OorThresh::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::OorThresh::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::OorThresh::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::OorThresh::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::OorThresh::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::OorThresh::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::OorThresh::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::OorThresh::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Bp::Bp() : location(this, {"location_name"}) { yang_name = "bp"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Bp::~Bp() { } bool AsicErrors::ShowAllInstances::Bp::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Bp::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Bp::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "bp"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Bp::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Bp::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Bp::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Bp::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Bp::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Bp::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Bp::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Bp::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "bp"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Bp::Location::~Location() { } bool AsicErrors::ShowAllInstances::Bp::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Bp::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Bp::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Bp::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Bp::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Bp::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Bp::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Bp::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Bp::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Bp::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Bp::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Bp::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Bp::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Bp::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Bp::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Bp::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Bp::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Bp::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Bp::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Bp::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Bp::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Io::Io() : location(this, {"location_name"}) { yang_name = "io"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Io::~Io() { } bool AsicErrors::ShowAllInstances::Io::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Io::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Io::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "io"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Io::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Io::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Io::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Io::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Io::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Io::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Io::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Io::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "io"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Io::Location::~Location() { } bool AsicErrors::ShowAllInstances::Io::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Io::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Io::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Io::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Io::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Io::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Io::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Io::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Io::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Io::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Io::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Io::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Io::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Io::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Io::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Io::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Io::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Io::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Io::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Io::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Io::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Ucode::Ucode() : location(this, {"location_name"}) { yang_name = "ucode"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Ucode::~Ucode() { } bool AsicErrors::ShowAllInstances::Ucode::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Ucode::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Ucode::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ucode"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Ucode::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Ucode::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Ucode::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Ucode::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Ucode::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Ucode::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Ucode::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Ucode::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "ucode"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Ucode::Location::~Location() { } bool AsicErrors::ShowAllInstances::Ucode::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Ucode::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Ucode::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Ucode::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Ucode::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Ucode::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Ucode::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Ucode::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Ucode::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Ucode::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Ucode::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Ucode::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Ucode::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Ucode::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Ucode::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Ucode::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Ucode::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Ucode::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Ucode::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Ucode::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Ucode::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Config::Config() : location(this, {"location_name"}) { yang_name = "config"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Config::~Config() { } bool AsicErrors::ShowAllInstances::Config::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Config::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Config::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "config"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Config::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Config::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Config::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Config::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Config::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Config::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Config::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Config::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "config"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Config::Location::~Location() { } bool AsicErrors::ShowAllInstances::Config::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Config::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Config::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Config::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Config::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Config::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Config::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Config::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Config::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Config::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Config::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Config::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Config::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Config::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Config::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Config::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Config::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Config::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Config::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Config::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Config::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Indirect::Indirect() : location(this, {"location_name"}) { yang_name = "indirect"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Indirect::~Indirect() { } bool AsicErrors::ShowAllInstances::Indirect::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Indirect::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Indirect::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "indirect"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Indirect::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Indirect::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Indirect::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Indirect::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Indirect::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Indirect::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Indirect::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Indirect::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "indirect"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Indirect::Location::~Location() { } bool AsicErrors::ShowAllInstances::Indirect::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Indirect::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Indirect::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Indirect::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Indirect::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Indirect::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Indirect::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Indirect::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Indirect::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Indirect::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Indirect::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Indirect::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Indirect::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Indirect::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Indirect::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Indirect::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Indirect::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Indirect::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Indirect::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Indirect::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Indirect::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Nonerr::Nonerr() : location(this, {"location_name"}) { yang_name = "nonerr"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Nonerr::~Nonerr() { } bool AsicErrors::ShowAllInstances::Nonerr::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Nonerr::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Nonerr::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "nonerr"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Nonerr::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Nonerr::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Nonerr::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Nonerr::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Nonerr::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Nonerr::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Nonerr::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Nonerr::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "nonerr"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Nonerr::Location::~Location() { } bool AsicErrors::ShowAllInstances::Nonerr::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Nonerr::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Nonerr::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Nonerr::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Nonerr::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Nonerr::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Nonerr::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Nonerr::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Nonerr::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Nonerr::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Nonerr::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::Summary::Summary() : location(this, {"location_name"}) { yang_name = "summary"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Summary::~Summary() { } bool AsicErrors::ShowAllInstances::Summary::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::Summary::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::Summary::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "summary"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Summary::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Summary::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Summary::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Summary::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Summary::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::Summary::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::Summary::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::Summary::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "summary"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Summary::Location::~Location() { } bool AsicErrors::ShowAllInstances::Summary::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::Summary::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::Summary::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Summary::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Summary::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::Summary::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Summary::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::Summary::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Summary::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Summary::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::Summary::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::Summary::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::Summary::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::Summary::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::Summary::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::Summary::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::Summary::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::Summary::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::Summary::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::Summary::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::Summary::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } AsicErrors::ShowAllInstances::All::All() : location(this, {"location_name"}) { yang_name = "all"; yang_parent_name = "show-all-instances"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::All::~All() { } bool AsicErrors::ShowAllInstances::All::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_data()) return true; } return false; } bool AsicErrors::ShowAllInstances::All::has_operation() const { for (std::size_t index=0; index<location.len(); index++) { if(location[index]->has_operation()) return true; } return is_set(yfilter); } std::string AsicErrors::ShowAllInstances::All::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "all"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::All::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::All::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "location") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::All::Location>(); ent_->parent = this; location.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::All::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : location.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::All::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void AsicErrors::ShowAllInstances::All::set_filter(const std::string & value_path, YFilter yfilter) { } bool AsicErrors::ShowAllInstances::All::has_leaf_or_child_of_name(const std::string & name) const { if(name == "location") return true; return false; } AsicErrors::ShowAllInstances::All::Location::Location() : location_name{YType::str, "location-name"} , log_lst(this, {}) { yang_name = "location"; yang_parent_name = "all"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::All::Location::~Location() { } bool AsicErrors::ShowAllInstances::All::Location::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_data()) return true; } return location_name.is_set; } bool AsicErrors::ShowAllInstances::All::Location::has_operation() const { for (std::size_t index=0; index<log_lst.len(); index++) { if(log_lst[index]->has_operation()) return true; } return is_set(yfilter) || ydk::is_set(location_name.yfilter); } std::string AsicErrors::ShowAllInstances::All::Location::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "location"; ADD_KEY_TOKEN(location_name, "location-name"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::All::Location::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (location_name.is_set || is_set(location_name.yfilter)) leaf_name_data.push_back(location_name.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::All::Location::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "log-lst") { auto ent_ = std::make_shared<AsicErrors::ShowAllInstances::All::Location::LogLst>(); ent_->parent = this; log_lst.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::All::Location::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : log_lst.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void AsicErrors::ShowAllInstances::All::Location::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "location-name") { location_name = value; location_name.value_namespace = name_space; location_name.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::All::Location::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "location-name") { location_name.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::All::Location::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-lst" || name == "location-name") return true; return false; } AsicErrors::ShowAllInstances::All::Location::LogLst::LogLst() : log_line{YType::str, "log-line"} { yang_name = "log-lst"; yang_parent_name = "location"; is_top_level_class = false; has_list_ancestor = true; } AsicErrors::ShowAllInstances::All::Location::LogLst::~LogLst() { } bool AsicErrors::ShowAllInstances::All::Location::LogLst::has_data() const { if (is_presence_container) return true; return log_line.is_set; } bool AsicErrors::ShowAllInstances::All::Location::LogLst::has_operation() const { return is_set(yfilter) || ydk::is_set(log_line.yfilter); } std::string AsicErrors::ShowAllInstances::All::Location::LogLst::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "log-lst"; path_buffer << "[" << get_ylist_key() << "]"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > AsicErrors::ShowAllInstances::All::Location::LogLst::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (log_line.is_set || is_set(log_line.yfilter)) leaf_name_data.push_back(log_line.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> AsicErrors::ShowAllInstances::All::Location::LogLst::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> AsicErrors::ShowAllInstances::All::Location::LogLst::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void AsicErrors::ShowAllInstances::All::Location::LogLst::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { if(value_path == "log-line") { log_line = value; log_line.value_namespace = name_space; log_line.value_namespace_prefix = name_space_prefix; } } void AsicErrors::ShowAllInstances::All::Location::LogLst::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "log-line") { log_line.yfilter = yfilter; } } bool AsicErrors::ShowAllInstances::All::Location::LogLst::has_leaf_or_child_of_name(const std::string & name) const { if(name == "log-line") return true; return false; } } }
28.464544
379
0.673796
CiscoDevNet
b0ab4b787921ea1b94e7f14e3143e6c8378f4f61
1,715
cpp
C++
apps/gadgetron/connection/nodes/ParallelProcess.cpp
roopchansinghv/gadgetron
fb6c56b643911152c27834a754a7b6ee2dd912da
[ "MIT" ]
1
2022-02-22T21:06:36.000Z
2022-02-22T21:06:36.000Z
apps/gadgetron/connection/nodes/ParallelProcess.cpp
apd47/gadgetron
073e84dabe77d2dae3b3dd9aa4bf9edbf1f890f2
[ "MIT" ]
null
null
null
apps/gadgetron/connection/nodes/ParallelProcess.cpp
apd47/gadgetron
073e84dabe77d2dae3b3dd9aa4bf9edbf1f890f2
[ "MIT" ]
null
null
null
#include "ParallelProcess.h" #include "ThreadPool.h" using namespace Gadgetron::Core; namespace Gadgetron::Server::Connection::Nodes { void ParallelProcess::process_input(GenericInputChannel input, Queue &queue) { ThreadPool pool(workers ? workers : std::thread::hardware_concurrency()); for (auto message : input) { queue.push( pool.async( [&](auto message) { return pureStream.process_function(std::move(message)); }, std::move(message) ) ); } pool.join(); queue.close(); } void ParallelProcess::process_output(OutputChannel output, Queue &queue) { while(true) output.push_message(queue.pop().get()); } void ParallelProcess::process(GenericInputChannel input, OutputChannel output, ErrorHandler& error_handler ) { Queue queue; auto input_thread = error_handler.run( [&](auto input) { this->process_input(std::move(input), queue); }, std::move(input) ); auto output_thread = error_handler.run( [&](auto output) { this->process_output(std::move(output), queue); }, std::move(output) ); input_thread.join(); output_thread.join(); } ParallelProcess::ParallelProcess( const Config::ParallelProcess& conf, const Context& context, Loader& loader ) : pureStream{ conf.stream, context, loader }, workers{ conf.workers } {} const std::string& ParallelProcess::name() { const static std::string n = "ParallelProcess"; return n; } }
28.114754
102
0.577259
roopchansinghv
b0b0489f869e658de88779d56d4047b07a58ee43
26,553
cc
C++
src/st_sim_utils.cc
vzaccaria/most
2b3b8768a960245e433a5a733cba6f08451e3fec
[ "Unlicense" ]
null
null
null
src/st_sim_utils.cc
vzaccaria/most
2b3b8768a960245e433a5a733cba6f08451e3fec
[ "Unlicense" ]
null
null
null
src/st_sim_utils.cc
vzaccaria/most
2b3b8768a960245e433a5a733cba6f08451e3fec
[ "Unlicense" ]
null
null
null
/* @STSHELL_LICENSE_START@ * * __ _______ ___________ * / |/ / __ \/ ___/_ __/ * / /|_/ / / / /\__ \ / / * / / / / /_/ /___/ // / * /_/ /_/\____//____//_/ * * Multi-Objective System Tuner * Copyright (c) 2007-2022 Politecnico di Milano * * Development leader: Vittorio Zaccaria * Main developers: Vittorio Zaccaria, Gianluca Palermo, Fabrizio Castro * * * @STSHELL_LICENSE_END@ */ #include <algorithm> #include <math.h> #include <st_object.h> #include <st_parser.h> #include <st_rand.h> #include <st_shell_command.h> #include <st_sim_utils.h> #include <st_design_space.h> st_object *sim_generate_dummy_point(st_env *env) { st_point lower(env->current_design_space->ds_parameters.size()); lower.set_error(ST_ERR_CONSTR_ERR); return lower.gen_copy(); } extern void st_print_point(st_env *env, st_point *p); bool sim_is_purely_dominated_by(st_env *env, st_point &e, st_point &p) { bool p_no_worse_than_e = true; bool p_once_better_than_e = false; for (int i = 0; i < env->optimization_objectives.size(); i++) { double e_m_value = env->optimization_objectives[i]->eval(&e, i); double p_m_value = env->optimization_objectives[i]->eval(&p, i); if (e_m_value < p_m_value) p_no_worse_than_e = false; if (e_m_value > p_m_value) p_once_better_than_e = true; } if (p_no_worse_than_e && p_once_better_than_e) { return true; } return false; } /** The following code is inconsistent with TCAD'09 when considering unfeasible * points. It also has transitive property problems. In fact, assume: * * rank for ever point = 1 * * A = [ 0 1 penalty=2 ] * B = [ 1 2 penalty=0 ] * C = [ 2 0 penalty=1 ] * * Then, given the following code, C dominates A, since * the starting condition is that C is always better than A (step 1) and this * condition is not impacted by the computation of pure dominance (step 2). So * the only thing that impacts the dominance relation is the penalty which is * better for C. * * Same relations that we can find are: B dominates C * * TRANSITIVITY PROBLEM: * From this, it should follow that B dominates A, but step 2 tells that B is * not always better than A (being purely dominated by it) but it has a better * penalty. So the domination relationship does not hold in one sense. * * In the other sense, A doesnt dominate B since it is 'better' from the point * of view of the pure dominance but worst in terms of penalty. * * PROBLEMS ENCOUNTERED: * As of August '09, this code presented problems during ReSPIR validation * since when p_F_1 contains C, it conveys a coverage with respect to p_F_0 >=0 * (due to A). C is then put into F_0 but is pruned at the next pareto filter * due to the presence of B. Neither A or B are removed during pareto filtering * since there is no domination relationship between the two. The ReSPIR * algorithm continues to spin over a coverage > 0 which is presumably due to * the lack of transitive properties of the following function. * * SOLUTION: * Go for the solution presented in TCAD, with a relaxed dominance across * unfeasible points. In this case B will not dominate C and C will not dominate * A. */ bool sim_is_strictly_dominated_classic(st_env *env, st_point &e, st_point &p, bool &feasible_e, bool &feasible_p, int &rank_e, int &rank_p, double &penalty_e, double &penalty_p) { feasible_e = opt_check_constraints(e, env, rank_e, penalty_e); feasible_p = opt_check_constraints(p, env, rank_p, penalty_p); if (feasible_e && !feasible_p) { return false; } if (feasible_p) { return (sim_is_purely_dominated_by(env, e, p)); } if (!feasible_e && !feasible_p) { /** Step 1: starting conditions */ bool p_no_worse_than_e = true; bool p_once_better_than_e = false; bool p_min_e = sim_is_purely_dominated_by(env, e, p); bool e_min_p = sim_is_purely_dominated_by(env, p, e); if (rank_p > rank_e) p_no_worse_than_e = false; if (rank_p < rank_e) p_once_better_than_e = true; if (penalty_p > penalty_e) p_no_worse_than_e = false; if (penalty_p < penalty_e) p_once_better_than_e = true; /** Step 2: pure dominance computation */ if (e_min_p) p_no_worse_than_e = false; if (p_min_e) p_once_better_than_e = true; if (p_no_worse_than_e && p_once_better_than_e) { return true; } else return false; } return false; } bool sim_is_strictly_dominated_tcad(st_env *env, st_point &e, st_point &p, bool &feasible_e, bool &feasible_p, int &rank_e, int &rank_p, double &penalty_e, double &penalty_p) { feasible_e = opt_check_constraints(e, env, rank_e, penalty_e); feasible_p = opt_check_constraints(p, env, rank_p, penalty_p); if (feasible_e && !feasible_p) { return false; } if (feasible_p) { return (sim_is_purely_dominated_by(env, e, p)); } if (!feasible_e && !feasible_p) { /** Step 1: starting conditions */ bool p_no_worse_than_e = true; bool p_once_better_than_e = false; for (int i = 0; i < env->optimization_objectives.size(); i++) { double e_m_value = env->optimization_objectives[i]->eval(&e, i); double p_m_value = env->optimization_objectives[i]->eval(&p, i); if (e_m_value < p_m_value) p_no_worse_than_e = false; if (e_m_value > p_m_value) p_once_better_than_e = true; } if (rank_p > rank_e) p_no_worse_than_e = false; if (rank_p < rank_e) p_once_better_than_e = true; if (penalty_p > penalty_e) p_no_worse_than_e = false; if (penalty_p < penalty_e) p_once_better_than_e = true; if (p_no_worse_than_e && p_once_better_than_e) { return true; } else return false; } return false; } bool use_tcad_dominance = false; void sim_set_tcad_dominance(bool value) { use_tcad_dominance = value; } bool sim_is_strictly_dominated(st_env *env, st_point &e, st_point &p, bool &feasible_e, bool &feasible_p, int &rank_e, int &rank_p, double &penalty_e, double &penalty_p) { /* As of october 2009, tcad dominance seems compromising the quality of the * results of both nsga-ii and respir algorithms (the last one being afflicted * by poor convergence problems). As an intermediate solution, nsga-ii will * run with the classic operator, while respir will use the new operator until * it is modified to run without consistency problems with the old operator. * [VZ]*/ if (use_tcad_dominance) return sim_is_strictly_dominated_tcad(env, e, p, feasible_e, feasible_p, rank_e, rank_p, penalty_e, penalty_p); else return sim_is_strictly_dominated_classic(env, e, p, feasible_e, feasible_p, rank_e, rank_p, penalty_e, penalty_p); } bool pareto_verbose = false; /** Note, p should be consistent. Check for integrity */ bool sim_recompute_pareto_with_new_point(st_env *env, st_database *the_database, st_point &p) { st_point_set::iterator c; st_point_set *database_list = the_database->get_set_of_points(); bool is_pareto = true; bool some_real_feasible_removed = false; for (c = database_list->begin(); c != database_list->end();) { st_point &e = *(c->second); /** e cannot have errors nor being inconsistent. */ bool e_dominates_p = false; bool p_dominates_e = false; int rank_e; double penalty_e; int rank_p; double penalty_p; bool feasible_e; bool feasible_p; try { e_dominates_p = sim_is_strictly_dominated(env, p, e, feasible_p, feasible_e, rank_p, rank_e, penalty_p, penalty_e); p_dominates_e = sim_is_strictly_dominated(env, e, p, feasible_e, feasible_p, rank_e, rank_p, penalty_e, penalty_p); } catch (exception &e) { /** The database contains all the points for which meaningfull objectives * have been computed */ return false; } if (p_dominates_e) { if (pareto_verbose) { string ps = p.print(); string es = e.print(); cout << "Information: " << ps << " dominates " << es << endl; } /** Remove e */ st_point_set::iterator j = c; j++; /* Delete the point */ database_list->erase_point(c); c = j; if (feasible_e) some_real_feasible_removed = true; } else c++; if (e_dominates_p) { if (pareto_verbose) { string ps = p.print(); string es = e.print(); cout << "Information: " << es << " dominates " << ps << endl; } st_assert(!some_real_feasible_removed); is_pareto = false; break; } } return is_pareto; } void sim_compute_pareto_nth(st_env *env, st_database *the_database, int level, bool valid) { int n = 0; st_database *entire_pareto_db = new st_database(); while (n < level) { st_database *pareto_db = new st_database(); *pareto_db = *the_database; prs_display_message("Computing pareto front"); sim_compute_pareto(env, pareto_db, valid); /** Remove pareto_db from the_database */ prs_display_message("Removing pareto front from db"); st_point_set *subset = pareto_db->get_set_of_points(); map<vector<int>, st_point *, lt_point>::iterator i; for (i = subset->begin(); i != subset->end(); i++) { st_point_set *fullset = the_database->get_set_of_points(); map<vector<int>, st_point *, lt_point>::iterator k; for (k = fullset->begin(); k != fullset->end();) { st_point *pi = i->second; st_point *pk = k->second; if (*pi == *pk) { map<vector<int>, st_point *, lt_point>::iterator next = k; next++; fullset->erase_point(k); k = next; } else { k++; } } } /** Copy pareto_db into entire_pareto_db */ prs_display_message("Copying pareto front to n-level pareto front"); for (i = subset->begin(); i != subset->end(); i++) { st_point *pi = i->second; entire_pareto_db->insert_point(pi); } delete pareto_db; n++; } the_database->clear(); *the_database = *entire_pareto_db; delete entire_pareto_db; } void sim_compute_pareto(st_env *env, st_database *the_database, bool valid) { st_database *new_database = new st_database(); st_point_set *database_list = the_database->get_set_of_points(); int sz = database_list->get_size(); int n = 0; opt_print_percentage("Computing pareto:", n, sz); st_point_set::iterator c; for (c = database_list->begin(); c != database_list->end();) { st_point &p = *(c->second); st_assert(p.check_consistency(env)); if (!p.get_error()) { int rank_p; double penalty_p; bool consider = true; bool feasible; bool error = false; try { feasible = opt_check_constraints(p, env, rank_p, penalty_p); } catch (exception &e) { error = true; } if (valid && !feasible) { if (pareto_verbose) { string ps = p.print(); cout << "Information: " << ps << " is not feasible " << endl; } consider = false; } if (error) consider = false; if (consider) { if (sim_recompute_pareto_with_new_point(env, new_database, p)) { /* Point p is a pareto point, we insert it by making a copy of it */ new_database->insert_point(&p); } } } c++; n++; opt_print_percentage("Computing Pareto", n, sz); } the_database->clear(); *the_database = *new_database; delete new_database; } double sim_compute_point_distance(st_env *env, st_point *a, st_point *x_p) { double distance = 0; for (int i = 0; i < env->optimization_objectives.size(); i++) { double xp_m_value = env->optimization_objectives[i]->eval(x_p, i); double a_m_value = env->optimization_objectives[i]->eval(a, i); double r_d = max(0.0, (a_m_value - xp_m_value) / (xp_m_value)); distance = max(distance, r_d); } return distance; } double sim_compute_ADRS(st_env *env, st_database *A, st_database *X) { st_list *pareto_metrics; unsigned int X_norm = 0; st_point_set *X_list = X->get_set_of_points(); st_point_set *A_list = A->get_set_of_points(); A->cache_update(env); X->cache_update(env); st_point_set::iterator iA; st_point_set::iterator iX; double total_sum = 0; for (iX = X_list->begin(); iX != X_list->end(); iX++) { double candidate_value = INFINITY; st_point xp = *(iX->second); st_assert(xp.check_consistency(env)); if (!xp.get_error()) { for (iA = A_list->begin(); iA != A_list->end(); iA++) { st_point a = *(iA->second); st_assert(a.check_consistency(env)); if (!a.get_error()) { double d_xp_a = sim_compute_point_distance(env, &a, &xp); candidate_value = min(candidate_value, d_xp_a); } } total_sum += candidate_value; X_norm++; } } if (X_norm == 0) throw std::logic_error("Source database is empty"); return total_sum / X_norm; } double sim_compute_euclidean_point_distance(st_env *env, st_point *a, st_point *x_p) { double distance = 0; for (int i = 0; i < env->optimization_objectives.size(); i++) { double xp_m_value = env->optimization_objectives[i]->eval(x_p, i); double a_m_value = env->optimization_objectives[i]->eval(a, i); double r_d = pow_double_to_int((a_m_value - xp_m_value) / xp_m_value, 2); distance += r_d; } return sqrt(distance); } double sim_compute_avg_euclidean_distance(st_env *env, st_database *A, st_database *X) { st_list *pareto_metrics; unsigned int X_norm = 0; st_point_set *X_list = X->get_set_of_points(); st_point_set *A_list = A->get_set_of_points(); A->cache_update(env); X->cache_update(env); st_point_set::iterator iA; st_point_set::iterator iX; double total_sum = 0; for (iX = X_list->begin(); iX != X_list->end(); iX++) { st_point xp = *(iX->second); st_assert(xp.check_consistency(env)); if (!xp.get_error()) { double candidate_value = INFINITY; for (iA = A_list->begin(); iA != A_list->end(); iA++) { st_point a = *(iA->second); st_assert(a.check_consistency(env)); if (!a.get_error()) { double d_xp_a = sim_compute_euclidean_point_distance(env, &a, &xp); candidate_value = min(candidate_value, d_xp_a); } } total_sum += candidate_value; X_norm++; } } if (X_norm == 0) throw std::logic_error("Reference database is empty"); return total_sum / X_norm; } /** * For useful usage of this function, X should be the approximated pareto set, * while A should be the real Pareto set. */ double sim_compute_median_euclidean_distance(st_env *env, st_database *A, st_database *X) { vector<double> observations; unsigned int X_norm = 0; st_point_set *X_list = X->get_set_of_points(); st_point_set *A_list = A->get_set_of_points(); A->cache_update(env); X->cache_update(env); st_point_set::iterator iA; st_point_set::iterator iX; double total_sum = 0; for (iX = X_list->begin(); iX != X_list->end(); iX++) { st_point xp = *(iX->second); st_assert(xp.check_consistency(env)); if (!xp.get_error()) { double candidate_value = INFINITY; for (iA = A_list->begin(); iA != A_list->end(); iA++) { st_point a = *(iA->second); st_assert(a.check_consistency(env)); if (!a.get_error()) { double d_xp_a = sim_compute_euclidean_point_distance(env, &a, &xp); candidate_value = min(candidate_value, d_xp_a); } } observations.push_back(candidate_value); } } sort(observations.begin(), observations.end()); int sz = observations.size(); if (sz == 0) throw std::logic_error("Reference database is empty"); int mid = (int)floor(((double)sz) / 2); if (!(sz % 2)) return (observations[mid - 1] + observations[mid]) / 2.0; else return observations[mid]; } int sim_compute_how_many_points_in_A_are_in_B(st_env *env, st_database *a, st_database *b) { st_point_set *la = a->get_set_of_points(); st_point_set::iterator ia; int n = 0; for (ia = la->begin(); ia != la->end(); ia++) { st_point *p = b->look_for_point(ia->second); if (p) n++; } return n; } void sim_normalize_databases(st_env *env, st_database *b, st_database *a, bool valid) { st_point_set *la = a->get_set_of_points(); st_point_set *lb = b->get_set_of_points(); st_point_set::iterator ib; for (ib = lb->begin(); ib != lb->end();) { st_point *pb = ib->second; st_point *pa = a->look_for_point(pb); if (!pa || !pb->check_consistency(env) || (valid && pb->get_error())) { st_point_set::iterator in = ib; in++; lb->erase_point(ib); ib = in; } else ib++; } for (ib = la->begin(); ib != la->end();) { st_point *pb = ib->second; st_point *pa = b->look_for_point(pb); if (!pa || !pb->check_consistency(env) || (valid && pb->get_error())) { st_point_set::iterator in = ib; in++; la->erase_point(ib); ib = in; } else ib++; } } extern void st_print_point(st_env *env, st_point *p, bool nometrics, bool clus, bool rp); extern void st_print_header(st_env *env, bool nometrics, bool clus, bool rp); /** Computes C(a,b) that is 'b is covered by a' percentage */ double sim_compute_two_set_coverage_metric(st_env *env, st_database *b, st_database *a, bool verbose) { st_point_set *la = a->get_set_of_points(); st_point_set *lb = b->get_set_of_points(); st_point_set::iterator ia; st_point_set::iterator ib; a->cache_update(env); b->cache_update(env); int sb = 0; int db = 0; if (verbose) { st_print_header(env, true, false, false); } for (ib = lb->begin(); ib != lb->end(); ib++) { st_point pb = *(ib->second); st_assert(pb.check_consistency(env)); if (!pb.get_error()) { for (ia = la->begin(); ia != la->end(); ia++) { st_point pa = *(ia->second); st_assert(pa.check_consistency(env)); if (!pa.get_error()) { bool feasible_b; bool feasible_a; int rank_b; int rank_a; double penalty_b; double penalty_a; if (sim_is_strictly_dominated(env, pb, pa, feasible_b, feasible_a, rank_b, rank_a, penalty_b, penalty_a)) { if (verbose) { cout << "dominating point (following by dominated)" << endl; st_print_point(env, &pa, true, false, false); st_print_point(env, &pb, true, false, false); } db++; break; } } } sb++; } } if (!sb) throw std::logic_error("Source database is empty"); return ((double)db) / ((double)sb); } #define cut(sa, sz) ((sa.size() > sz) ? (sa.substr(0, sz - 2) + "..") : sa) #define CSIZE 15 extern void st_printf_tabbed(string a, int maxsize); extern void st_printf_tabbed_rev(string a, int maxsize); void sim_print_centroid_head(st_env *env, vector<double> &v) { cout << "{"; for (int i = 0; i < v.size(); i++) { cout << (i ? ", " : " "); st_printf_tabbed(cut(env->optimization_objectives[i]->name, CSIZE), CSIZE); cout << " "; } cout << "}"; } #include <st_common_utils.h> void sim_print_centroid(st_env *env, vector<double> &v) { cout << "{"; for (int i = 0; i < v.size(); i++) { cout << (i ? ", " : " "); st_printf_tabbed_rev(cut(st_to_string(v[i]), CSIZE), CSIZE); cout << " "; } cout << "}"; } #define normalize(i, v) \ ((v - minimum_value[i]) / (maximum_value[i] - minimum_value[i])) double sim_compute_kmeans_clusters(st_env *env, int klusters, int iterations, st_database *the_database) { st_list *pareto_metrics; if (env->optimization_objectives.size() < 1) { prs_display_error( "Please, set a consistent set of objectives to be clustered."); return 0.0; } if (klusters == 0 || iterations == 0) return 0.0; double current_cluster_goodness = 0.0; vector<vector<double> > klusters_centroids; vector<vector<double> > cumulative_value; vector<double> cumulative_square_distance; vector<int> cumulative_count; klusters_centroids.resize(klusters); cumulative_value.resize(klusters); cumulative_count.resize(klusters, 0); vector<double> minimum_value; vector<double> maximum_value; minimum_value.resize(env->optimization_objectives.size(), INFINITY); maximum_value.resize(env->optimization_objectives.size(), 0.0); the_database->cache_update(env); st_point_set *set = the_database->get_set_of_points(); st_point_set::iterator p; for (p = set->begin(); p != set->end(); p++) { st_point *x = p->second; st_assert(x->check_consistency(env)); if (!x->get_error()) { int k = 0; for (int i = 0; i < env->optimization_objectives.size(); i++) { double mxv = env->optimization_objectives[i]->eval(x, i); if (mxv > maximum_value[k]) maximum_value[k] = mxv; if (mxv < minimum_value[k]) minimum_value[k] = mxv; k++; } } } klusters_centroids.resize(klusters); cumulative_square_distance.resize(klusters, 0.0); for (int kl = 0; kl < klusters; kl++) { klusters_centroids[kl].resize(env->optimization_objectives.size()); cumulative_value[kl].resize(env->optimization_objectives.size(), 0.0); if (kl == 0) { cout << "Metrics "; sim_print_centroid_head(env, klusters_centroids[0]); cout << endl; } for (int i = 0; i < env->optimization_objectives.size(); i++) { // klusters_centroids[kl][i]= minimum_value[i] + rnd_flat_float() * // (maximum_value[i] - minimum_value[i]); klusters_centroids[kl][i] = rnd_flat_float(); } cout << "Centroid " << kl << " "; sim_print_centroid(env, klusters_centroids[kl]); cout << endl; } vector<double> best_distance_per_cluster; vector<st_point *> current_nearest_centroid_per_cluster; best_distance_per_cluster.resize(klusters, INFINITY); current_nearest_centroid_per_cluster.resize(klusters, NULL); st_database *full = new st_database(); for (int it = 0; it < iterations; it++) { cout << "--" << endl; st_point_set *set = the_database->get_set_of_points(); st_point_set::iterator p; for (p = set->begin(); p != set->end(); p++) { st_point *x = p->second; if (!x->get_error()) { double current_best_distance = INFINITY; int current_best_cluster = 0; for (int kl = 0; kl < klusters; kl++) { double distance = 0; int s = 0; for (int i = 0; i < env->optimization_objectives.size(); i++) { double mxv = normalize(i, env->optimization_objectives[i]->eval(x, i)); double r_d = pow_double_to_int(mxv - klusters_centroids[kl][s], 2); distance += r_d; s++; } if (distance < current_best_distance) { current_best_distance = distance; current_best_cluster = kl; } } if (current_best_distance < best_distance_per_cluster[current_best_cluster]) { if (current_nearest_centroid_per_cluster[current_best_cluster]) delete current_nearest_centroid_per_cluster[current_best_cluster]; current_nearest_centroid_per_cluster[current_best_cluster] = x->gen_copy_point(); } x->set_cluster(current_best_cluster); } } /** Initialize counters */ for (int kl = 0; kl < klusters; kl++) { cumulative_count[kl] = 0; cumulative_square_distance[kl] = 0; int s; for (s = 0; s < env->optimization_objectives.size(); s++) { cumulative_value[kl][s] = 0; } } /** Compute cumulative counts */ for (p = set->begin(); p != set->end(); p++) { st_point *x = p->second; if (!x->get_error()) { int cluster_associated = x->get_cluster(); cumulative_count[cluster_associated]++; int s = 0; for (int c = 0; c < env->optimization_objectives.size(); c++) { double mxv = normalize(c, env->optimization_objectives[c]->eval(x, c)); cumulative_value[cluster_associated][s] += mxv; cumulative_square_distance[cluster_associated] = pow_double_to_int( mxv - klusters_centroids[cluster_associated][s], 2); s++; } } } current_cluster_goodness = 0; /** Compute new centroids */ for (int kl = 0; kl < klusters; kl++) { current_cluster_goodness += cumulative_square_distance[kl]; } /** Compute new centroids */ for (int kl = 0; kl < klusters; kl++) { if (cumulative_count[kl]) { for (int i = 0; i < env->optimization_objectives.size(); i++) { klusters_centroids[kl][i] = cumulative_value[kl][i] / ((double)cumulative_count[kl]); } } cout << "Centroid " << kl << " "; sim_print_centroid(env, klusters_centroids[kl]); cout << " CN: " << current_cluster_goodness; cout << endl; } } /** Compute new centroids */ for (int kl = 0; kl < klusters; kl++) { cout << "Centroid " << kl << " "; sim_print_centroid(env, klusters_centroids[kl]); cout << endl; if (current_nearest_centroid_per_cluster[kl]) { full->insert_point(current_nearest_centroid_per_cluster[kl]); delete current_nearest_centroid_per_cluster[kl]; } } env->insert_new_database(full, "kmean_clusters"); return current_cluster_goodness; }
31.573127
80
0.610741
vzaccaria
b0b0e7932693aa9736d22b38148a2fde451c2921
1,352
cpp
C++
Algo_Ds_Notes-master/Algo_Ds_Notes-master/Topological_Sort/Topological_Sort.cpp
rajatenzyme/Coding-Journey-
65a0570153b7e3393d78352e78fb2111223049f3
[ "MIT" ]
null
null
null
Algo_Ds_Notes-master/Algo_Ds_Notes-master/Topological_Sort/Topological_Sort.cpp
rajatenzyme/Coding-Journey-
65a0570153b7e3393d78352e78fb2111223049f3
[ "MIT" ]
null
null
null
Algo_Ds_Notes-master/Algo_Ds_Notes-master/Topological_Sort/Topological_Sort.cpp
rajatenzyme/Coding-Journey-
65a0570153b7e3393d78352e78fb2111223049f3
[ "MIT" ]
null
null
null
#include <iostream> #include <stack> #include <vector> using namespace std; class Graph { int numVertex; vector<int> *adj; public: // Constructor to initialise graph Graph(int numVertex) { this->numVertex = numVertex; adj = new vector<int> [numVertex]; } // Function to add edge between source and destination void addEdge(int src, int dest) { adj[src].push_back(dest); } void topologicalSort(); void topologicalSortUtil(int vertex, vector<bool> &visited, stack<int> &Stack); }; void Graph::topologicalSortUtil(int vertex, vector<bool> &visited, stack<int> &Stack) { visited[vertex] = true; for(int i = 0; i < adj[vertex].size(); i++) { if(!visited[adj[vertex][i]]) { topologicalSortUtil(adj[vertex][i], visited, Stack); } } Stack.push(vertex); } void Graph::topologicalSort() { stack<int> Stack; vector<bool> visited(numVertex, false); for(int i = 0; i < numVertex; i++) { if(!visited[i]) { topologicalSortUtil(i, visited, Stack); } } while(!Stack.empty()) { cout << Stack.top() << " "; Stack.pop(); } } int main() { Graph graph(6); graph.addEdge(5, 2); graph.addEdge(5, 0); graph.addEdge(4, 0); graph.addEdge(4, 1); graph.addEdge(2, 3); graph.addEdge(3, 1); cout << "Topological Sort: "; graph.topologicalSort(); return 0; } /* Output Topological Sort: 5 4 2 3 1 0 */
18.777778
87
0.648669
rajatenzyme
b0b88e3500534c6d3940146d8d5009731e246a59
12,621
hpp
C++
cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_SYSLOG_MIB.hpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
17
2016-12-02T05:45:49.000Z
2022-02-10T19:32:54.000Z
cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_SYSLOG_MIB.hpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
2
2017-03-27T15:22:38.000Z
2019-11-05T08:30:16.000Z
cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_SYSLOG_MIB.hpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
11
2016-12-02T05:45:52.000Z
2019-11-07T08:28:17.000Z
#ifndef _CISCO_SYSLOG_MIB_ #define _CISCO_SYSLOG_MIB_ #include <memory> #include <vector> #include <string> #include <ydk/types.hpp> #include <ydk/errors.hpp> namespace cisco_ios_xe { namespace CISCO_SYSLOG_MIB { class CISCOSYSLOGMIB : public ydk::Entity { public: CISCOSYSLOGMIB(); ~CISCOSYSLOGMIB(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::shared_ptr<ydk::Entity> clone_ptr() const override; ydk::augment_capabilities_function get_augment_capabilities_function() const override; std::string get_bundle_yang_models_location() const override; std::string get_bundle_name() const override; std::map<std::pair<std::string, std::string>, std::string> get_namespace_identity_lookup() const override; class ClogBasic; //type: CISCOSYSLOGMIB::ClogBasic class ClogHistory; //type: CISCOSYSLOGMIB::ClogHistory class ClogServer; //type: CISCOSYSLOGMIB::ClogServer class ClogHistoryTable; //type: CISCOSYSLOGMIB::ClogHistoryTable class ClogServerConfigTable; //type: CISCOSYSLOGMIB::ClogServerConfigTable std::shared_ptr<cisco_ios_xe::CISCO_SYSLOG_MIB::CISCOSYSLOGMIB::ClogBasic> clogbasic; std::shared_ptr<cisco_ios_xe::CISCO_SYSLOG_MIB::CISCOSYSLOGMIB::ClogHistory> cloghistory; std::shared_ptr<cisco_ios_xe::CISCO_SYSLOG_MIB::CISCOSYSLOGMIB::ClogServer> clogserver; std::shared_ptr<cisco_ios_xe::CISCO_SYSLOG_MIB::CISCOSYSLOGMIB::ClogHistoryTable> cloghistorytable; std::shared_ptr<cisco_ios_xe::CISCO_SYSLOG_MIB::CISCOSYSLOGMIB::ClogServerConfigTable> clogserverconfigtable; }; // CISCOSYSLOGMIB class CISCOSYSLOGMIB::ClogBasic : public ydk::Entity { public: ClogBasic(); ~ClogBasic(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; ydk::YLeaf clognotificationssent; //type: uint32 ydk::YLeaf clognotificationsenabled; //type: boolean ydk::YLeaf clogmaxseverity; //type: SyslogSeverity ydk::YLeaf clogmsgignores; //type: uint32 ydk::YLeaf clogmsgdrops; //type: uint32 ydk::YLeaf clogoriginidtype; //type: ClogOriginIDType ydk::YLeaf clogoriginid; //type: string class ClogOriginIDType; }; // CISCOSYSLOGMIB::ClogBasic class CISCOSYSLOGMIB::ClogHistory : public ydk::Entity { public: ClogHistory(); ~ClogHistory(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; ydk::YLeaf cloghisttablemaxlength; //type: int32 ydk::YLeaf cloghistmsgsflushed; //type: uint32 }; // CISCOSYSLOGMIB::ClogHistory class CISCOSYSLOGMIB::ClogServer : public ydk::Entity { public: ClogServer(); ~ClogServer(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; ydk::YLeaf clogmaxservers; //type: uint32 }; // CISCOSYSLOGMIB::ClogServer class CISCOSYSLOGMIB::ClogHistoryTable : public ydk::Entity { public: ClogHistoryTable(); ~ClogHistoryTable(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; class ClogHistoryEntry; //type: CISCOSYSLOGMIB::ClogHistoryTable::ClogHistoryEntry ydk::YList cloghistoryentry; }; // CISCOSYSLOGMIB::ClogHistoryTable class CISCOSYSLOGMIB::ClogHistoryTable::ClogHistoryEntry : public ydk::Entity { public: ClogHistoryEntry(); ~ClogHistoryEntry(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; ydk::YLeaf cloghistindex; //type: int32 ydk::YLeaf cloghistfacility; //type: string ydk::YLeaf cloghistseverity; //type: SyslogSeverity ydk::YLeaf cloghistmsgname; //type: string ydk::YLeaf cloghistmsgtext; //type: string ydk::YLeaf cloghisttimestamp; //type: uint32 }; // CISCOSYSLOGMIB::ClogHistoryTable::ClogHistoryEntry class CISCOSYSLOGMIB::ClogServerConfigTable : public ydk::Entity { public: ClogServerConfigTable(); ~ClogServerConfigTable(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; class ClogServerConfigEntry; //type: CISCOSYSLOGMIB::ClogServerConfigTable::ClogServerConfigEntry ydk::YList clogserverconfigentry; }; // CISCOSYSLOGMIB::ClogServerConfigTable class CISCOSYSLOGMIB::ClogServerConfigTable::ClogServerConfigEntry : public ydk::Entity { public: ClogServerConfigEntry(); ~ClogServerConfigEntry(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; ydk::YLeaf clogserveraddrtype; //type: InetAddressType ydk::YLeaf clogserveraddr; //type: binary ydk::YLeaf clogserverstatus; //type: RowStatus }; // CISCOSYSLOGMIB::ClogServerConfigTable::ClogServerConfigEntry class SyslogSeverity : public ydk::Enum { public: static const ydk::Enum::YLeaf emergency; static const ydk::Enum::YLeaf alert; static const ydk::Enum::YLeaf critical; static const ydk::Enum::YLeaf error; static const ydk::Enum::YLeaf warning; static const ydk::Enum::YLeaf notice; static const ydk::Enum::YLeaf info; static const ydk::Enum::YLeaf debug; static int get_enum_value(const std::string & name) { if (name == "emergency") return 1; if (name == "alert") return 2; if (name == "critical") return 3; if (name == "error") return 4; if (name == "warning") return 5; if (name == "notice") return 6; if (name == "info") return 7; if (name == "debug") return 8; return -1; } }; class CISCOSYSLOGMIB::ClogBasic::ClogOriginIDType : public ydk::Enum { public: static const ydk::Enum::YLeaf none; static const ydk::Enum::YLeaf other; static const ydk::Enum::YLeaf hostName; static const ydk::Enum::YLeaf ipv4Address; static const ydk::Enum::YLeaf contextName; static const ydk::Enum::YLeaf userDefined; static int get_enum_value(const std::string & name) { if (name == "none") return 1; if (name == "other") return 2; if (name == "hostName") return 3; if (name == "ipv4Address") return 4; if (name == "contextName") return 5; if (name == "userDefined") return 6; return -1; } }; } } #endif /* _CISCO_SYSLOG_MIB_ */
46.062044
162
0.686633
CiscoDevNet
b0bb5fe2bcc6f2ffb141c55e4fb4143367be729f
2,177
hpp
C++
inc/statick/pybind/linear_model.hpp
Dekken/statick
f3759986f68020066fe35c16af843fcf083c0a31
[ "BSD-3-Clause" ]
7
2019-03-13T22:46:57.000Z
2020-06-11T13:10:47.000Z
inc/statick/pybind/linear_model.hpp
Dekken/statick
f3759986f68020066fe35c16af843fcf083c0a31
[ "BSD-3-Clause" ]
4
2019-02-17T14:16:34.000Z
2020-07-11T13:41:56.000Z
inc/statick/pybind/linear_model.hpp
Dekken/statick
f3759986f68020066fe35c16af843fcf083c0a31
[ "BSD-3-Clause" ]
2
2019-10-25T03:24:55.000Z
2020-04-07T13:04:32.000Z
#ifndef STATICK_PYBIND_LINEAR_MODEL_HPP_ #define STATICK_PYBIND_LINEAR_MODEL_HPP_ #include "statick/array.hpp" #include "statick/pybind/def.hpp" #include "statick/linear_model/model_logreg.hpp" namespace statick_py { namespace logreg { template <typename T, typename DAO> void fit_d(DAO &dao, py_array_t<T> &a, py_array_t<T> &b) { pybind11::buffer_info a_info = a.request(), b_info = b.request(); std::vector<size_t> ainfo(3); ainfo[0] = a_info.shape[1]; ainfo[1] = a_info.shape[0]; ainfo[2] = a_info.shape[0] * a_info.shape[1]; dao.m_features = std::make_shared<statick::Array2DView<T>>((T *)a_info.ptr, ainfo.data()); dao.m_labels = std::make_shared<statick::ArrayView<T>>((T *)b_info.ptr, b_info.shape[0]); } template <typename T, typename DAO> void fit_s(DAO &dao, py_csr_t<T> &a, py_array_t<T> &b) { dao.X = a; dao.y = b; dao.m_features = dao.X.m_data_ptr; pybind11::buffer_info b_info = dao.y.request(); dao.m_labels = std::make_shared<statick::ArrayView<T>>((T *)b_info.ptr, b_info.shape[0]); } template <typename _F, typename _L> class DAO : public statick::logreg::DAO<_F, _L> { public: using SUPER = statick::logreg::DAO<_F, _L>; using FEATURES = typename SUPER::FEATURES; using FEATURE = typename SUPER::FEATURE; using LABELS = typename SUPER::LABELS; using LABEL = typename SUPER::LABEL; using T = typename SUPER::T; using X_TYPE = typename std::conditional<FEATURE::is_sparse, py_csr_t<T>, py_array_t<T>>::type; template <typename F = FEATURE, typename = typename std::enable_if<!F::is_sparse>::type> DAO(py_array_t<T> &a, py_array_t<T> &b) { fit_d(*this, a, b); } template <typename F = FEATURE, typename = typename std::enable_if<F::is_sparse>::type> DAO(py_csr_t<T> &a, py_array_t<T> &b) { fit_s(*this, a, b); } X_TYPE X; py_array_t<T> y; }; } /* namespace logreg*/ template <typename _F, typename _L> class ModelLogReg : public statick::ModelLogReg<_F, _L, logreg::DAO<_F, _L>> { public: using SUPER = statick::ModelLogReg<_F, _L, logreg::DAO<_F, _L>>; using DAO = logreg::DAO<_F, _L>; using SUPER::NAME; }; } /* namespace statick_py*/ #endif /* STATICK_PYBIND_LINEAR_MODEL_HPP_ */
33.492308
97
0.694993
Dekken
b0bfb70cbacd1f5f7425e2895d28c66003f38a77
7,481
cpp
C++
samples/snippets/cpp/VS_Snippets_Winforms/ComponentEditorExample/CPP/componenteditorexamplecomponent.cpp
hamarb123/dotnet-api-docs
6aeb55784944a2f1f5e773b657791cbd73a92dd4
[ "CC-BY-4.0", "MIT" ]
421
2018-04-01T01:57:50.000Z
2022-03-28T15:24:42.000Z
samples/snippets/cpp/VS_Snippets_Winforms/ComponentEditorExample/CPP/componenteditorexamplecomponent.cpp
hamarb123/dotnet-api-docs
6aeb55784944a2f1f5e773b657791cbd73a92dd4
[ "CC-BY-4.0", "MIT" ]
5,797
2018-04-02T21:12:23.000Z
2022-03-31T23:54:38.000Z
samples/snippets/cpp/VS_Snippets_Winforms/ComponentEditorExample/CPP/componenteditorexamplecomponent.cpp
hamarb123/dotnet-api-docs
6aeb55784944a2f1f5e773b657791cbd73a92dd4
[ "CC-BY-4.0", "MIT" ]
1,482
2018-03-31T11:26:20.000Z
2022-03-30T22:36:45.000Z
//<Snippet1> #using <System.Windows.Forms.dll> #using <System.Drawing.dll> #using <System.dll> using namespace System; using namespace System::ComponentModel; using namespace System::ComponentModel::Design; using namespace System::Collections; using namespace System::Drawing; using namespace System::IO; using namespace System::Runtime::Serialization; using namespace System::Runtime::Serialization::Formatters::Binary; using namespace System::Windows::Forms; using namespace System::Windows::Forms::Design; // This example demonstrates how to implement a component editor that hosts // component pages and associate it with a component. This example also // demonstrates how to implement a component page that provides a panel-based // control system and Help keyword support. ref class ExampleComponentEditorPage; // The ExampleComponentEditor displays two ExampleComponentEditorPage pages. public ref class ExampleComponentEditor: public System::Windows::Forms::Design::WindowsFormsComponentEditor { //<Snippet2> protected: // This method override returns an type array containing the type of // each component editor page to display. virtual array<Type^>^ GetComponentEditorPages() override { array<Type^>^temp0 = {ExampleComponentEditorPage::typeid,ExampleComponentEditorPage::typeid}; return temp0; } //</Snippet2> //<Snippet3> // This method override returns the index of the page to display when the // component editor is first displayed. protected: virtual int GetInitialComponentEditorPageIndex() override { return 1; } //</Snippet3> }; //<Snippet6> // This example component editor page type provides an example // ComponentEditorPage implementation. private ref class ExampleComponentEditorPage: public System::Windows::Forms::Design::ComponentEditorPage { private: Label^ l1; Button^ b1; PropertyGrid^ pg1; // Base64-encoded serialized image data for the required component editor page icon. String^ icon; public: ExampleComponentEditorPage() { String^ temp = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0xLjAuNTAwMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABNTeXN0ZW0uRHJhd2luZy5JY29uAgAAAAhJY29uRGF0Y" "QhJY29uU2l6ZQcEAhNTeXN0ZW0uRHJhd2luZy5TaXplAgAAAAIAAAAJAwAAAAX8////E1N5c3RlbS5EcmF3aW5nLlNpemUCAAAABXdpZHRoBmhlaWdodAAACAgCAAAAAAAAAAAAAAAPAwAAAD4BAAACAAABAAEAEBAQAAAAAAAoAQAAFgAAACgAAAAQAAAAIA" "AAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgADExAAAgICAAMDAwAA+iPcAY77gACh9kwD/AAAAndPoADpw6wD///8AAAAAAAAAAAAHd3d3d3d3d8IiIiIiIiLHKIiIiIiIiCco///////4Jyj5mfIvIvgnKPn" "p////+Cco+en7u7v4Jyj56f////gnKPmZ8i8i+Cco///////4JyiIiIiIiIgnJmZmZmZmZifCIiIiIiIiwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACw=="; icon = temp; // Initialize the page, which inherits from Panel, and its controls. this->Size = System::Drawing::Size( 400, 250 ); this->Icon = DeserializeIconFromBase64Text( icon ); this->Text = "Example Page"; b1 = gcnew Button; b1->Size = System::Drawing::Size( 200, 20 ); b1->Location = Point(200,0); b1->Text = "Set a random background color"; b1->Click += gcnew EventHandler( this, &ExampleComponentEditorPage::randomBackColor ); this->Controls->Add( b1 ); l1 = gcnew Label; l1->Size = System::Drawing::Size( 190, 20 ); l1->Location = Point(4,2); l1->Text = "Example Component Editor Page"; this->Controls->Add( l1 ); pg1 = gcnew PropertyGrid; pg1->Size = System::Drawing::Size( 400, 280 ); pg1->Location = Point(0,30); this->Controls->Add( pg1 ); } // This method indicates that the Help button should be enabled for this // component editor page. virtual bool SupportsHelp() override { return true; } //<Snippet4> // This method is called when the Help button for this component editor page is pressed. // This implementation uses the IHelpService to show the Help topic for a sample keyword. public: virtual void ShowHelp() override { // The GetSelectedComponent method of a ComponentEditorPage retrieves the // IComponent associated with the WindowsFormsComponentEditor. IComponent^ selectedComponent = this->GetSelectedComponent(); // Retrieve the Site of the component, and return if null. ISite^ componentSite = selectedComponent->Site; if ( componentSite == nullptr ) return; // Acquire the IHelpService to display a help topic using a indexed keyword lookup. IHelpService^ helpService = dynamic_cast<IHelpService^>(componentSite->GetService( IHelpService::typeid )); if ( helpService != nullptr ) helpService->ShowHelpFromKeyword( "System.Windows.Forms.ComboBox" ); } //</Snippet4> protected: // The LoadComponent method is raised when the ComponentEditorPage is displayed. virtual void LoadComponent() override { this->pg1->SelectedObject = this->Component; } // The SaveComponent method is raised when the WindowsFormsComponentEditor is closing // or the current ComponentEditorPage is closing. virtual void SaveComponent() override {} private: // If the associated component is a Control, this method sets the BackColor to a random color. // This method is invoked by the button on this ComponentEditorPage. void randomBackColor( Object^ /*sender*/, EventArgs^ /*e*/ ) { if ( System::Windows::Forms::Control::typeid->IsAssignableFrom( this->::Component::GetType() ) ) { // Sets the background color of the Control associated with the // WindowsFormsComponentEditor to a random color. Random^ rnd = gcnew Random; (dynamic_cast<System::Windows::Forms::Control^>(this->Component))->BackColor = Color::FromArgb( rnd->Next( 255 ), rnd->Next( 255 ), rnd->Next( 255 ) ); pg1->Refresh(); } } // This method can be used to retrieve an Icon from a block // of Base64-encoded text. System::Drawing::Icon^ DeserializeIconFromBase64Text( String^ text ) { System::Drawing::Icon^ img = nullptr; array<Byte>^memBytes = Convert::FromBase64String( text ); IFormatter^ formatter = gcnew BinaryFormatter; MemoryStream^ stream = gcnew MemoryStream( memBytes ); img = dynamic_cast<System::Drawing::Icon^>(formatter->Deserialize( stream )); stream->Close(); return img; } }; //</Snippet6> //<Snippet5> // This example control is associated with the ExampleComponentEditor // through the following EditorAttribute. [EditorAttribute(ExampleComponentEditor::typeid,ComponentEditor::typeid)] public ref class ExampleUserControl: public System::Windows::Forms::UserControl{}; //</Snippet5> //</Snippet1>
42.505682
220
0.670499
hamarb123
b0c269ecd48a8acbbb768b8b2f55d36fb170d983
4,386
cpp
C++
source code/dvcc/v1.4.2.2/paint/ramqgitem.cpp
HarleyEhrich/DvccSimulationEnvironment
fdb082eb52c18a95015fc12058824345875cf038
[ "Apache-2.0" ]
null
null
null
source code/dvcc/v1.4.2.2/paint/ramqgitem.cpp
HarleyEhrich/DvccSimulationEnvironment
fdb082eb52c18a95015fc12058824345875cf038
[ "Apache-2.0" ]
null
null
null
source code/dvcc/v1.4.2.2/paint/ramqgitem.cpp
HarleyEhrich/DvccSimulationEnvironment
fdb082eb52c18a95015fc12058824345875cf038
[ "Apache-2.0" ]
null
null
null
#include "ramqgitem.h" QRectF RamQGItem::boundingRect() const { return QRectF(this->mapFromScene(200*this->data->zoomXPer,-250*this->data->zoomYPer), QSizeF(150*this->data->zoomXPer,390*this->data->zoomYPer)); } void RamQGItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(widget); if(this->data->load_ram==false){ return; } //数据准备 double zoomX=this->data->zoomXPer; double zoomY=this->data->zoomYPer; //位置设定 this->setPos(200*zoomX,-250*zoomY); //Body draw bodyPath->clear(); bodyPath->moveTo(0,0); bodyPath->addRoundedRect(QRectF(0,0,150*zoomX,190*zoomY),10,10); bodyPath->closeSubpath(); this->body->setPath(*this->bodyPath); //Cir draw cirPath->clear(); cirPath->addEllipse(QRectF(110*zoomX,10*zoomY,25*zoomX,25*zoomX)); this->cir->setPath(*this->cirPath); //Name draw this->nameText->setPos(5*zoomX,0); //Data draw if(this->data->signal_ce==true){ this->dataText->setPos(75*zoomX-this->dataText->boundingRect().width()/2,40*zoomY); if(this->data->signal_we==WRITE){//Write--read data from bus this->dataText->setText(this->data->data_bus+"H"); }else{//Read--read data from ram this->dataText->setText(QString("%0%1H") .arg(this->data->data_ram[this->data->data_ar][0]) .arg(this->data->data_ram[this->data->data_ar][1]) ); } }else{ this->dataText->setText(""); } //sig--ce draw if(this->data->signal_ce){ this->signalsText->setPen(lightSignalsPenAct); this->signalsText->setBrush(lightSignalsBrushAct); this->signalsText->setText("CE: Valid"); this->signalsText->setPos(75*zoomX-this->signalsText->boundingRect().width()/2,90*zoomY); }else{ this->signalsText->setPen(lightSignalsPen); this->signalsText->setBrush(lightSignalsBrush); this->signalsText->setText("CE: Invalid"); this->signalsText->setPos(75*zoomX-this->signalsText->boundingRect().width()/2,90*zoomY); } //sig--we draw if(this->data->signal_we==WRITE){ this->signalsText2->setPen(lightSignalsPenAct); this->signalsText2->setBrush(lightSignalsBrushAct); this->signalsText2->setText("WE: 1-Write"); this->signalsText2->setPos(75*zoomX-this->signalsText->boundingRect().width()/2,120*zoomY); }else{ this->signalsText2->setPen(lightSignalsPen); this->signalsText2->setBrush(lightSignalsBrush); this->signalsText2->setText("WE: 0-Read"); this->signalsText2->setPos(75*zoomX-this->signalsText->boundingRect().width()/2,120*zoomY); } //Ram<--Bus line if(this->data->signal_ce==true){ this->toBusLine->setPen(linePenAct); this->setZValue(100); }else{ this->toBusLine->setPen(linePen); this->setZValue(0); } this->toBusLine->setLine(75*zoomX+3,190*zoomY+4,75*zoomX+3,250*zoomY); } RamQGItem::RamQGItem(systemDataSet *data,QGraphicsItem *parent) :QGraphicsItem(parent) { // this->setZValue(0); this->data=data; bodyPath=new QPainterPath(); bodyShadowEff=new QGraphicsDropShadowEffect(); bodyShadowEff->setOffset(5,5); bodyShadowEff->setColor(Qt::gray); bodyShadowEff->setBlurRadius(15); body=new QGraphicsPathItem(this); body->setPen(ramBodyPen); body->setBrush(ramBodyBrush); body->setGraphicsEffect(bodyShadowEff); cirPath=new QPainterPath(); cir=new QGraphicsPathItem(this); cir->setPen(ramCirPen); cir->setBrush(ramCirBrush); nameText=new QGraphicsSimpleTextItem(this); this->nameText->setText("RAM"); this->nameText->setPen(lightTextPen); this->nameText->setBrush(ligthTextBrush); this->nameText->setFont(bigNameTextFont); dataText=new QGraphicsSimpleTextItem(this); this->dataText->setPen(lightTextPen); this->dataText->setBrush(ligthTextBrush); this->dataText->setFont(bigDataTextFont); signalsText=new QGraphicsSimpleTextItem(this); this->signalsText->setFont(bigSignalsFont); signalsText2=new QGraphicsSimpleTextItem(this); this->signalsText2->setFont(bigSignalsFont); toBusLine=new QGraphicsLineItem(this); }
32.488889
99
0.645919
HarleyEhrich
b0c801272d537ad2a94c1bb762a4d0ad52c58a79
119
hpp
C++
src/QonGPU/include/potentials/Potential3D.hpp
s0vereign/SchroedingerSolver
83461ef779019ec7944bb2c5ea0a4702f4aeb32f
[ "MIT" ]
3
2017-04-21T12:22:33.000Z
2019-01-22T13:14:46.000Z
src/QonGPU/include/potentials/Potential3D.hpp
s0vereign/SchroedingerSolver
83461ef779019ec7944bb2c5ea0a4702f4aeb32f
[ "MIT" ]
8
2016-05-09T09:44:35.000Z
2017-03-22T15:31:13.000Z
src/QonGPU/include/potentials/Potential3D.hpp
s0vereign/QonGPU
83461ef779019ec7944bb2c5ea0a4702f4aeb32f
[ "MIT" ]
null
null
null
#ifndef POTENTIAL3D_H #define POTENTIAL3D_H #include "Potential.hpp" class Potential3D: public Potential{}; #endif
11.9
38
0.781513
s0vereign
37cede24bfbdc1e91225b35be3c11718492da60d
1,747
cpp
C++
src/AttackFSM.cpp
mikaelmello/story-based-rpg
bc73c24ad0e41512c3e980ca3aad0fc5738af2f2
[ "Zlib" ]
null
null
null
src/AttackFSM.cpp
mikaelmello/story-based-rpg
bc73c24ad0e41512c3e980ca3aad0fc5738af2f2
[ "Zlib" ]
null
null
null
src/AttackFSM.cpp
mikaelmello/story-based-rpg
bc73c24ad0e41512c3e980ca3aad0fc5738af2f2
[ "Zlib" ]
null
null
null
#include "AttackFSM.hpp" #include <memory> #include "Antagonist.hpp" #include "Collider.hpp" #include "Collision.hpp" #include "Player.hpp" #include "Sprite.hpp" AttackFSM::AttackFSM(GameObject& object) : IFSM(object, ZERO_SPEED) { auto ant_cpt = object.GetComponent(Types::AntagonistType); if (!ant_cpt) { throw std::runtime_error("sem ant em AttackFSM::AttackFSM"); } ant = std::dynamic_pointer_cast<Antagonist>(ant_cpt); } AttackFSM::~AttackFSM() {} void AttackFSM::OnStateEnter() { auto sprite_cpt = object.GetComponent(Types::SpriteType); if (!sprite_cpt) { throw std::runtime_error("objeto nao possui cpt sprite em AttackFSM"); } ant.lock()->AssetsManager(Helpers::Action::ATTACKING); auto sprite = std::dynamic_pointer_cast<Sprite>(sprite_cpt); execution_time = sprite->GetFrameCount() * sprite->GetFrameTime(); } void AttackFSM::OnStateExecution(float dt) { GameData::player_was_hit = IsColliding(); pop_requested = true; } void AttackFSM::OnStateExit() {} void AttackFSM::Update(float dt) { if (timer.Get() >= execution_time) { OnStateExecution(dt); } timer.Update(dt); pop_requested |= !IsColliding(); } bool AttackFSM::IsColliding() { auto a_col = object.GetComponent(ColliderType); if (!a_col) { throw std::runtime_error("ant sem collider em AttackFSM::IsColliding"); } auto p_col = GameData::PlayerGameObject->GetComponent(ColliderType); if (!p_col) { throw std::runtime_error("player sem col em AttackFSM::IsColliding"); } auto ant_col = std::dynamic_pointer_cast<Collider>(a_col); auto player_col = std::dynamic_pointer_cast<Collider>(p_col); Rect a_box = ant_col->box; Rect p_box = ant_col->box; return Collision::IsColliding(a_box, p_box); }
26.469697
75
0.717802
mikaelmello
37d1834549ed27237f7f8ffca18cc5371211d239
521
cpp
C++
Lab Sessions/Lab 2/Left_Rotation.cpp
bimalka98/Data-Structures-and-Algorithms
7d358a816561551a5b04af8de378141becda42bd
[ "MIT" ]
1
2021-03-21T07:54:08.000Z
2021-03-21T07:54:08.000Z
Lab Sessions/Lab 2/Left_Rotation.cpp
bimalka98/Data-Structures-and-Algorithms
7d358a816561551a5b04af8de378141becda42bd
[ "MIT" ]
null
null
null
Lab Sessions/Lab 2/Left_Rotation.cpp
bimalka98/Data-Structures-and-Algorithms
7d358a816561551a5b04af8de378141becda42bd
[ "MIT" ]
null
null
null
vector<int> rotateLeft(int d, vector<int> arr) { int i = 0; // declaring a temporarily variable to store the number of steps while(i < d){ int temp = *arr.begin(); // storing the first element in the vector to a temporarily variable arr.erase(arr.begin()); // erasing the first element arr.push_back(temp); // append the stored first element at the end of the vector i++; // incrmeting the number of steps } return arr; // returning the rotate array }
47.363636
102
0.629559
bimalka98
37d60679c8399348d97a637379229cc175873ab0
447
cc
C++
Sliding_Window/1208.cc
guohaoqiang/leetcode
802447c029c36892e8dd7391c825bcfc7ac0fd0b
[ "MIT" ]
null
null
null
Sliding_Window/1208.cc
guohaoqiang/leetcode
802447c029c36892e8dd7391c825bcfc7ac0fd0b
[ "MIT" ]
null
null
null
Sliding_Window/1208.cc
guohaoqiang/leetcode
802447c029c36892e8dd7391c825bcfc7ac0fd0b
[ "MIT" ]
null
null
null
//https://leetcode.com/problems/get-equal-substrings-within-budget/discuss/392837/JavaC%2B%2BPython-Sliding-Window class Solution { public: int equalSubstring(string s, string t, int maxCost) { int len = s.size(); int i = 0; for (int j=0; j<len; ++j){ if((maxCost -= abs(s[j]-t[j]))<0){ maxCost += abs(s[i]-t[i]); ++i; } } return len-i; } };
26.294118
114
0.505593
guohaoqiang
37d6a0ed152dbb0f062c0d52777ffb96bbc3a8d9
1,711
cc
C++
dragon/kernels/array/tile_op_kernel.cc
seetaresearch/Dragon
494774d3a545f807d483fd9e6e4563cedec6dda5
[ "BSD-2-Clause" ]
81
2018-03-13T13:08:37.000Z
2020-06-13T14:36:29.000Z
dragon/kernels/array/tile_op_kernel.cc
seetaresearch/Dragon
494774d3a545f807d483fd9e6e4563cedec6dda5
[ "BSD-2-Clause" ]
2
2019-08-07T09:26:07.000Z
2019-08-26T07:33:55.000Z
dragon/kernels/array/tile_op_kernel.cc
seetaresearch/Dragon
494774d3a545f807d483fd9e6e4563cedec6dda5
[ "BSD-2-Clause" ]
13
2018-03-13T13:08:50.000Z
2020-05-28T08:20:22.000Z
#include "dragon/utils/math_functions.h" #include "dragon/utils/op_kernels.h" namespace dragon { namespace kernels { namespace { template <typename T> void _Tile( const int num_dims, const int64_t* x_dims, const int64_t* x_strides, const int64_t* y_dims, const T* x, T* y) { const auto N = math::utils::Prod(num_dims, y_dims); vec64_t index(num_dims, 0); int64_t xi; for (int i = 0; i < N; ++i) { xi = 0; for (int d = num_dims - 1; d >= 0; --d) { xi += (index[d] % x_dims[d]) * x_strides[d]; } y[i] = x[xi]; math::utils::IncreaseIndexInDims(num_dims, y_dims, index.data()); } } } // namespace /* ------------------- Launcher Separator ------------------- */ #define DEFINE_KERNEL_LAUNCHER(T) \ template <> \ void Tile<T, CPUContext>( \ const int num_dims, \ const int64_t* x_dims, \ const int64_t* x_strides, \ const int64_t* y_dims, \ const T* x, \ T* y, \ CPUContext* ctx) { \ _Tile(num_dims, x_dims, x_strides, y_dims, x, y); \ } DEFINE_KERNEL_LAUNCHER(bool); DEFINE_KERNEL_LAUNCHER(uint8_t); DEFINE_KERNEL_LAUNCHER(int8_t); DEFINE_KERNEL_LAUNCHER(int); DEFINE_KERNEL_LAUNCHER(int64_t); DEFINE_KERNEL_LAUNCHER(float16); DEFINE_KERNEL_LAUNCHER(float); DEFINE_KERNEL_LAUNCHER(double); #undef DEFINE_KERNEL_LAUNCHER #undef DEFINE_GRAD_KERNEL_LAUNCHER } // namespace kernels } // namespace dragon
27.596774
69
0.534775
seetaresearch
37d88fcebe078f663ad2bdd2163a12602df8a7ae
10,703
cpp
C++
main.cpp
KacperSynator/Process_Scheduler
bdb41fbf8f2fbe473e2aa8fcd34ef5f3fce04428
[ "MIT" ]
null
null
null
main.cpp
KacperSynator/Process_Scheduler
bdb41fbf8f2fbe473e2aa8fcd34ef5f3fce04428
[ "MIT" ]
null
null
null
main.cpp
KacperSynator/Process_Scheduler
bdb41fbf8f2fbe473e2aa8fcd34ef5f3fce04428
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <sstream> #include <algorithm> /* Program description: * Program is simulating a process scheduler. Program executes with three arguments (arguments description below). * Program works in step mode i.e. firstly it reads input from stdin if there is any, secondly it executes a given * schedule method, lastly it prints result of scheduling to stdout. (linefeeder.cpp and repeater.cpp not used). * Program ends if there is no input remaining and all CPUS are in sleep state. * * Input data format: * t id prio exec_t * t -> time * id -> process id * prio -> process priority * exec_t -> process execution time * Note: multiple processes might be given in one line. Last input line must be an "enter" ('\n') * * Output data format: * t cpu1_state cpu2_state ... * t -> time * cpu_state -> id of executing process or -1 (sleeping) * Note: number of columns is equal to the number of CPUS * * Arguments: * arg1 -> schedule method (necessary) * arg2 -> number of CPUS (optional, default 1) * arg3 -> round robin slice time (optional, default 1) * * Implemented schedule methods (arg1): * 0 -> First Come First Serve (FCFS) * 1 -> Shortest Job First (SJF) * 2 -> Shortest Remaining Time First (SRTF) * 3 -> Round Robin (RR) * 4 -> Priority with preemption same priorities scheduled using FCFS (lower the priority number higher the executing priority) * 5 -> Priority with preemption same priorities scheduled using SRTF --"-- * 6 -> Priority without preemption same priorities scheduled using FCFS --"-- */ /*! structure that contains all necessary process data */ struct proc_data{ int id; /*!< process id */ int priority; /*!< process priority */ unsigned int exec_time; /*!< process execution time */ unsigned int remaining_time; /*!< process remaining execution time */ /*! static function for comparing proc_data structures in term of execution time (same values not swapped) */ static bool compare_exec_time(proc_data pd1, proc_data pd2) {return (pd1.exec_time < pd2.exec_time);} /*! static function for comparing proc_data structures in term of priority (same values not swapped) */ static bool compare_priority(proc_data pd1, proc_data pd2) {return (pd1.priority < pd2.priority);} /*! static function for comparing proc_data structures in term of remaining execution time (same values not swapped) */ static bool compare_remaining_time(proc_data pd1, proc_data pd2) {return (pd1.remaining_time < pd2.remaining_time);} }; /*! input operator >> overload for proc_data structure */ std::istream& operator >> (std::istream& is, proc_data& pd) { is >> pd.id >> pd.priority >> pd.exec_time ; pd.remaining_time = pd.exec_time; return is; } /*! puts scheduled processes on CPU/CPUS */ void update_cpus_state(std::vector<proc_data>& proc_list, std::vector<int>& cpus_state) { auto it_proc = proc_list.begin(); for(auto & cpu_state:cpus_state) { if(it_proc == proc_list.end()) { cpu_state = -1; } else { cpu_state = it_proc->id; ++it_proc; } } /* sort processes on CPUS from lower to higher, negative numbers pushed at the end (-1 -> CPU sleep) */ std::stable_sort(cpus_state.begin(), cpus_state.end(), [](int i, int j){return (i >= 0 && j >= 0) ? i < j : i > j;}); } /*! First Come First Serve scheduling algorithm */ void fcfs(std::vector<proc_data>& proc_list, std::vector<int>& cpus_state) { /* processes are already sorted */ update_cpus_state(proc_list, cpus_state); } /*! Shortest Job First scheduling algorithm */ void sjf(std::vector<proc_data>& proc_list, std::vector<int>& cpus_state) { /* prevent preemption by moving iterator after executing processes */ auto proc_it = proc_list.begin(); for(auto cpu_state: cpus_state) { if(proc_it == proc_list.end() || cpu_state == -1) break; for(auto proc: proc_list) if(cpu_state == proc.id) proc_it++; } /* sort remaining processes in terms of execution time */ std::stable_sort (proc_it, proc_list.end(), proc_data::compare_exec_time); update_cpus_state(proc_list, cpus_state); } /*! Shortest Remaining Time First scheduling algorithm */ void srtf(std::vector<proc_data>& proc_list, std::vector<int>& cpus_state) { /* sort processes in terms of execution time */ std::stable_sort (proc_list.begin(), proc_list.end(), proc_data::compare_remaining_time); update_cpus_state(proc_list, cpus_state); } /*! Round Robin scheduling algorithm */ void rr(std::vector<proc_data>& proc_list, std::vector<int>& cpus_state, unsigned int rr_time) { for(auto cpu_state: cpus_state) { if(cpu_state == -1) break; auto proc_it = proc_list.begin(); /* move iterator to executing process */ while(cpu_state != proc_it->id && proc_it != proc_list.end()) proc_it++; if (proc_it == proc_list.end()) continue; /* check if executing process needs to be pushed to the end of process list (if RR time slice has ended) */ unsigned int proc_executed_time = proc_it->exec_time - proc_it->remaining_time; if( proc_executed_time > 0 && proc_executed_time % rr_time == 0) { /* push process to the end of process list */ proc_data pd = *proc_it; proc_list.erase(proc_it); proc_list.push_back(pd); } } update_cpus_state(proc_list, cpus_state); } /*! Priority with preemption scheduling algorithm, same priorities are scheduled using FCFS algorithm */ void prio_fcfs(std::vector<proc_data>& proc_list, std::vector<int>& cpus_state) { /* sort processes in terms of priority, same priorities are already sorted */ std::stable_sort (proc_list.begin(), proc_list.end(), proc_data::compare_priority); update_cpus_state(proc_list, cpus_state); } /*! Priority with preemption scheduling algorithm, same priorities are scheduled using SRTF algorithm */ void prio_srtf(std::vector<proc_data>& proc_list, std::vector<int>& cpus_state) { /* sort processes in terms of remaining execution time (same priority) */ std::stable_sort (proc_list.begin(), proc_list.end(), proc_data::compare_remaining_time); /* sort processes in terms of priority */ std::stable_sort (proc_list.begin(), proc_list.end(), proc_data::compare_priority); update_cpus_state(proc_list, cpus_state); } /*! Priority without preemption scheduling algorithm, same priorities are scheduled using FCFS algorithm */ void prio_fcfs_no_preemption(std::vector<proc_data>& proc_list, std::vector<int>& cpus_state) { /* prevent preemption by moving iterator after executing processes */ auto proc_it = proc_list.begin(); for(auto cpu_state: cpus_state) { if(proc_it == proc_list.end() || cpu_state == -1) break; for(auto proc: proc_list) if(cpu_state == proc.id) proc_it++; } /* sort processes in terms of priority, same priorities are already sorted */ std::stable_sort (proc_it, proc_list.end(), proc_data::compare_priority); update_cpus_state(proc_list, cpus_state); } /*! checks if all CPUS are sleeping (==-1) */ bool all_cpus_sleeping(std::vector<int>& cpus_state) { if(std::any_of(cpus_state.begin(), cpus_state.end(), [](int i){return i != -1;})) return false; return true; } int main(int argc, char* argv[]) { unsigned int method; // scheduling method (arg1) unsigned int cpu_count = 1; // number of CPUS (arg2), default 1 unsigned int rr_time = 1; // Round Robin slice time (arg3), default 1 // read first argument (schedule method) if(argc < 2) throw std::invalid_argument("arg1 not given (schedule method)"); else method = static_cast<unsigned int>(std::strtol(argv[1], nullptr, 0)); // check for second argument (CPU count) if(argc >= 3) cpu_count = static_cast<unsigned int>(std::strtol(argv[2], nullptr, 0)); // check for third argument (round robin time step) if(argc >= 4) rr_time = static_cast<unsigned int>(std::strtol(argv[3], nullptr, 0)); std::vector<proc_data> proc_list; // processes execution list std::vector<int> cpus_state(cpu_count); // CPU states list unsigned int time = 0; // simulation time bool read = true; // flag for reading input while(read || !all_cpus_sleeping(cpus_state)) // run until there is no input and all CPUS are sleeping { // read input if(read) { std::string line; std::getline(std::cin, line); std::istringstream ss(line); if (ss.rdbuf()->in_avail() != 0) { ss >> time; while (ss.rdbuf()->in_avail() / 2 >= 3) { proc_data pd{}; ss >> pd; proc_list.push_back(pd); } } else read = false; } // run given method switch (method) { case 0: // FCFS { fcfs(proc_list, cpus_state); break; } case 1: // SJF { sjf(proc_list, cpus_state); break; } case 2: // SRTF { srtf(proc_list, cpus_state); break; } case 3: // RR { rr(proc_list, cpus_state, rr_time); break; } case 4: // Priority_FCFS { prio_fcfs(proc_list, cpus_state); break; } case 5: // Priority_SRTF { prio_srtf(proc_list, cpus_state); break; } case 6: // Priority without preemption (FCFS) { prio_fcfs_no_preemption(proc_list, cpus_state); break; } default: // Wrong method, raises error throw std::invalid_argument("invalid schedule method"); } // update proc_list for(auto id: cpus_state) { auto it_proc = proc_list.begin(); if(id == -1) continue; while(it_proc->id != id) ++it_proc; // pop an executed process if(--(it_proc->remaining_time) == 0) proc_list.erase(it_proc); } // print output std::cout << time++; for(auto & cpu_state: cpus_state) std::cout << " " << cpu_state; std::cout << "\n"; } return 0; }
38.362007
127
0.622442
KacperSynator
37e270fc5a91c1ef49e228ad39aba802b4cee2f1
1,696
cpp
C++
design_patterns/structural_bridge/bridge_dynamic.cpp
anstellaire/photon-i3-colors
3f3e44a5b9bdfbdc35e00bd2116acb7211ef6f54
[ "MIT" ]
1
2021-06-23T09:08:55.000Z
2021-06-23T09:08:55.000Z
design_patterns/structural_bridge/bridge_dynamic.cpp
anstellaire/sweets
3f3e44a5b9bdfbdc35e00bd2116acb7211ef6f54
[ "MIT" ]
null
null
null
design_patterns/structural_bridge/bridge_dynamic.cpp
anstellaire/sweets
3f3e44a5b9bdfbdc35e00bd2116acb7211ef6f54
[ "MIT" ]
null
null
null
#include <iostream> #include <memory> // ----------------------------------------------------------------------------- // PATTERN (dynamic polymorphism) // ----------------------------------------------------------------------------- struct weapon_slot { virtual char const* use() = 0; virtual ~weapon_slot() {} }; struct missle_weapon : weapon_slot { char const* use() { return "missle launch"; } }; struct dummy_weapon : weapon_slot { char const* use() { return "click-click"; } }; struct spaceship { std::unique_ptr<weapon_slot> slot; spaceship(std::unique_ptr<weapon_slot> s) : slot(std::move(s)) {} void set_slot(std::unique_ptr<weapon_slot> s) { slot = std::move(s); } virtual void attack() = 0; virtual ~spaceship() {} }; struct destroyer : spaceship { destroyer(std::unique_ptr<weapon_slot> slot) : spaceship(std::move(slot)) {} void attack() { std::cout << "Destroyer attacks: " << slot->use() << std::endl; } }; struct cruiser : spaceship { cruiser(std::unique_ptr<weapon_slot> slot) : spaceship(std::move(slot)) {} void attack() { std::cout << "Cruiser attacks: " << slot->use() << std::endl; } }; // ----------------------------------------------------------------------------- // USAGE // ----------------------------------------------------------------------------- void unit_attack(spaceship& ship) { ship.attack(); } int main() { std::unique_ptr<spaceship> ship{new cruiser{ std::unique_ptr<weapon_slot>{new missle_weapon{}} }}; unit_attack(*ship); ship->set_slot( std::unique_ptr<weapon_slot>{new dummy_weapon{}} ); unit_attack(*ship); }
24.941176
80
0.504127
anstellaire
37e367fba0718674625ec86cbf4214c97b764fd9
5,551
cc
C++
mindspore/ccsrc/plugin/device/cpu/kernel/mkldnn/lrn_grad_cpu_kernel.cc
httpsgithu/mindspore
c29d6bb764e233b427319cb89ba79e420f1e2c64
[ "Apache-2.0" ]
1
2022-03-30T03:43:29.000Z
2022-03-30T03:43:29.000Z
mindspore/ccsrc/plugin/device/cpu/kernel/mkldnn/lrn_grad_cpu_kernel.cc
949144093/mindspore
c29d6bb764e233b427319cb89ba79e420f1e2c64
[ "Apache-2.0" ]
null
null
null
mindspore/ccsrc/plugin/device/cpu/kernel/mkldnn/lrn_grad_cpu_kernel.cc
949144093/mindspore
c29d6bb764e233b427319cb89ba79e420f1e2c64
[ "Apache-2.0" ]
null
null
null
/** * Copyright 2022 Huawei Technologies 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. */ #include "plugin/device/cpu/kernel/mkldnn/lrn_grad_cpu_kernel.h" #include <vector> #include <algorithm> #include <utility> #include <memory> #include <string> #include <map> #include "mindspore/core/ops/grad/lrn_grad.h" namespace mindspore { namespace kernel { bool LrnGradCpuKernelMod::GetLrnGradAttr(const BaseOperatorPtr &base_operator) { if (kernel_name_ != ops::kNameLRNGrad) { MS_LOG(ERROR) << "For 'LRNGrad' kernel name get failed, but got " << kernel_name_; return false; } auto kernel_ptr = std::make_shared<ops::LRNGrad>(base_operator->GetPrim()); depth_radius_ = kernel_ptr->get_depth_radius(); bias_ = kernel_ptr->get_bias(); alpha_ = kernel_ptr->get_alpha(); beta_ = kernel_ptr->get_beta(); dnnl_algorithm_ = dnnl::algorithm::lrn_across_channels; return true; } bool LrnGradCpuKernelMod::Init(const BaseOperatorPtr &base_operator, const std::vector<KernelTensorPtr> &inputs, const std::vector<KernelTensorPtr> &outputs) { kernel_name_ = base_operator->name(); if (inputs.empty() || outputs.empty()) { MS_LOG(ERROR) << "For '" << kernel_name_ << "' got empty inputs or outputs, which is invalid."; return false; } if (!GetLrnGradAttr(base_operator)) { MS_LOG(ERROR) << "For '" << kernel_name_ << "' got GetReductionAttr failed."; return false; } auto kernel_attr = GetKernelAttrFromTensors(inputs, outputs); auto [is_match, index] = MatchKernelAttr(kernel_attr, GetOpSupport()); if (!is_match) { MS_LOG(ERROR) << "For '" << kernel_name_ << "' does not support this kernel type: " << kernel_attr; return false; } kernel_func_ = func_list_[index].second; return true; } int LrnGradCpuKernelMod::Resize(const BaseOperatorPtr &base_operator, const std::vector<KernelTensorPtr> &inputs, const std::vector<KernelTensorPtr> &outputs, const std::map<uint32_t, tensor::TensorPtr> &) { int ret = KRET_OK; if ((ret = NativeCpuKernelMod::Resize(base_operator, inputs, outputs)) != KRET_OK) { return ret; } std::vector<size_t> input_shape_; auto input_shape = inputs.at(kIndex0)->GetShapeVector(); (void)std::transform(input_shape.begin(), input_shape.end(), std::back_inserter(input_shape_), LongToSize); dnnl::memory::desc src_desc = GetDefaultMemDesc(input_shape_); const auto lrn_multiple = 2; dnnl::memory::dim local_size = lrn_multiple * depth_radius_ + 1; const auto dnnl_alpha = static_cast<float>(local_size) * alpha_; auto desc = CreateDesc<dnnl::lrn_forward::desc>(dnnl::prop_kind::forward_training, dnnl_algorithm_, src_desc, local_size, dnnl_alpha, beta_, bias_); auto prim_desc = CreateDesc<dnnl::lrn_forward::primitive_desc>(desc, engine_); // Backward description auto backward_desc = CreateDesc<dnnl::lrn_backward::desc>(dnnl_algorithm_, src_desc, src_desc, local_size, dnnl_alpha, beta_, bias_); auto backward_prim_desc = CreateDesc<dnnl::lrn_backward::primitive_desc>(backward_desc, engine_, prim_desc); primitive_ = CreatePrimitive<dnnl::lrn_backward>(backward_prim_desc); AddArgument(DNNL_ARG_SRC, src_desc); AddArgument(DNNL_ARG_DST, src_desc); AddArgument(DNNL_ARG_DIFF_SRC, src_desc); AddArgument(DNNL_ARG_DIFF_DST, src_desc); return ret; } template <typename T> bool LrnGradCpuKernelMod::LaunchKernel(const std::vector<kernel::AddressPtr> &inputs, const std::vector<kernel::AddressPtr> &outputs) { // The input order is dout, x, out. auto dout = reinterpret_cast<T *>(inputs.at(kIndex0)->addr); auto input = reinterpret_cast<T *>(inputs.at(kIndex1)->addr); auto out = reinterpret_cast<T *>(inputs.at(kIndex2)->addr); auto grad_x = reinterpret_cast<T *>(outputs.at(kIndex0)->addr); SetArgumentHandle(DNNL_ARG_SRC, input); SetArgumentHandle(DNNL_ARG_DST, out); SetArgumentHandle(DNNL_ARG_DIFF_DST, dout); SetArgumentHandle(DNNL_ARG_DIFF_SRC, grad_x); ExecutePrimitive(); return true; } std::vector<std::pair<KernelAttr, LrnGradCpuKernelMod::LrnGradFunc>> LrnGradCpuKernelMod::func_list_ = { // For kNumberTypeFloat16 input data type will cast to kNumberTypeFloat32 from frontend to backend. {KernelAttr() .AddAllSameAttr(true) .AddInputAttr(kNumberTypeFloat32) .AddInputAttr(kNumberTypeFloat32) .AddInputAttr(kNumberTypeFloat32) .AddOutputAttr(kNumberTypeFloat32), &LrnGradCpuKernelMod::LaunchKernel<float>}}; std::vector<KernelAttr> LrnGradCpuKernelMod::GetOpSupport() { std::vector<KernelAttr> support_list; (void)std::transform(func_list_.begin(), func_list_.end(), std::back_inserter(support_list), [](const std::pair<KernelAttr, LrnGradFunc> &pair) { return pair.first; }); return support_list; } MS_KERNEL_FACTORY_REG(NativeCpuKernelMod, LRNGrad, LrnGradCpuKernelMod); } // namespace kernel } // namespace mindspore
43.708661
116
0.717709
httpsgithu
37e75c8ec953bc5ccea781d3ba6900291606e451
3,832
cpp
C++
src/treemodel.cpp
RazrFalcon/ttf-explorer
ff6eab3616824a54c466ab28da43464a8a2540f3
[ "MIT" ]
18
2020-03-12T16:03:04.000Z
2022-01-22T16:07:32.000Z
src/treemodel.cpp
RazrFalcon/ttf-explorer
ff6eab3616824a54c466ab28da43464a8a2540f3
[ "MIT" ]
null
null
null
src/treemodel.cpp
RazrFalcon/ttf-explorer
ff6eab3616824a54c466ab28da43464a8a2540f3
[ "MIT" ]
null
null
null
#include <QFont> #include "utils.h" #include "treemodel.h" TreeItem::TreeItem(TreeItem *parent) : m_parent(parent) { } TreeItem::~TreeItem() { qDeleteAll(m_children); } TreeItem* TreeItem::child(int number) { return m_children.value(number); } int TreeItem::childCount() const { return m_children.count(); } int TreeItem::childIndex() const { if (m_parent) { return m_parent->m_children.indexOf(const_cast<TreeItem*>(this)); } return 0; } void TreeItem::reserveChildren(const qsizetype n) { m_children.reserve(n); } QVariant TreeItem::data(int column) const { switch (column) { case Column::Title: return title; case Column::Value: return value; case Column::Type: return type; case Column::Size: return size; default: return QVariant(); } } void TreeItem::addChild(TreeItem *item) { m_children.append(item); } TreeItem* TreeItem::parent() { return m_parent; } TreeModel::TreeModel(QObject *parent) : QAbstractItemModel(parent) , m_rootItem(new TreeItem(nullptr)) { } TreeModel::~TreeModel() { delete m_rootItem; } QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const { if (parent.isValid() && parent.column() != 0) { return QModelIndex(); } const auto parentItem = itemByIndex(parent); const auto childItem = parentItem->child(row); if (childItem) { return createIndex(row, column, childItem); } else { return QModelIndex(); } } QModelIndex TreeModel::parent(const QModelIndex &index) const { if (!index.isValid()) { return QModelIndex(); } const auto childItem = itemByIndex(index); const auto parentItem = childItem->parent(); if (parentItem == m_rootItem) { return QModelIndex(); } return createIndex(parentItem->childIndex(), 0, parentItem); } int TreeModel::rowCount(const QModelIndex &parent) const { if (parent.column() > 0) { return 0; } TreeItem *parentItem = nullptr; if (!parent.isValid()) { parentItem = m_rootItem; } else { parentItem = itemByIndex(parent); } return parentItem->childCount(); } int TreeModel::columnCount(const QModelIndex &/* parent */) const { return (int)Column::LastColumn; } Qt::ItemFlags TreeModel::flags(const QModelIndex &/*index*/) const { return Qt::ItemIsSelectable | Qt::ItemIsEnabled; } QVariant TreeModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { return QVariant(); } const auto item = itemByIndex(index); if (role == Qt::FontRole && index.column() >= Column::Value) { return QVariant(QFont(Utils::monospacedFont())); } if (role == Qt::ToolTipRole && index.column() == Column::Value) { return item->data(index.column()); } if (role == Qt::TextAlignmentRole && index.column() == Column::Size) { return Qt::AlignRight; } if (role != Qt::DisplayRole) { return QVariant(); } return item->data(index.column()); } QVariant TreeModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { switch (section) { case Column::Title: return QLatin1String("Title"); case Column::Value: return QLatin1String("Value"); case Column::Type: return QLatin1String("Type"); case Column::Size: return QLatin1String("Size"); } } return QVariant(); } TreeItem* TreeModel::itemByIndex(const QModelIndex &index) const { if (index.isValid()) { TreeItem *item = static_cast<TreeItem*>(index.internalPointer()); if (item) { return item; } } return m_rootItem; }
21.054945
88
0.629958
RazrFalcon
37e914f417c2ce68699cef8806a884c11fcbc2a8
3,325
cpp
C++
examples/audio/audio_thru_with_scope/audio_thru_with_scope.cpp
newdigate/teensy-eurorack-software
c3013a73f302ae395c5f44dbd53312cb0f54ba6c
[ "MIT" ]
4
2021-10-01T06:11:16.000Z
2022-03-18T03:48:05.000Z
examples/audio/audio_thru_with_scope/audio_thru_with_scope.cpp
newdigate/teensy-eurorack-software
c3013a73f302ae395c5f44dbd53312cb0f54ba6c
[ "MIT" ]
null
null
null
examples/audio/audio_thru_with_scope/audio_thru_with_scope.cpp
newdigate/teensy-eurorack-software
c3013a73f302ae395c5f44dbd53312cb0f54ba6c
[ "MIT" ]
null
null
null
#include <Audio.h> #include <SPI.h> #include <ST7735_t3.h> // Hardware-specific library #include <TeensyEurorack.h> // GUItool: begin automatically generated code AudioInputTDM tdm1; //xy=257,403 AudioRecordQueue queue1; //xy=527,243 AudioOutputTDM tdm3; //xy=671,431 AudioConnection patchCord1(tdm1, 0, tdm3, 0); AudioConnection patchCord2(tdm1, 0, queue1, 0); AudioConnection patchCord3(tdm1, 0, tdm3, 12); AudioConnection patchCord4(tdm1, 2, tdm3, 2); AudioConnection patchCord5(tdm1, 2, tdm3, 14); AudioConnection patchCord6(tdm1, 4, tdm3, 4); AudioConnection patchCord7(tdm1, 6, tdm3, 6); AudioConnection patchCord8(tdm1, 8, tdm3, 8); AudioConnection patchCord9(tdm1, 10, tdm3, 10); AudioControlCS42448 cs42448_1; //xy=470,613 // GUItool: end automatically generated code ST7735_t3 tft = ST7735_t3(TFT_CS, TFT_DC, TFT_RST); int led = 13; int sda = 18; void setup() { //pinMode(led, INPUT); AudioMemory(180); //Wire.begin(); //SPI.setSCK (14); //SPI.setMOSI (7 ); //SPI.setMISO (12); SPI.begin(); delay(100); tft.initR(INITR_GREENTAB); tft.setRotation(3); tft.fillScreen(ST7735_BLACK); Serial.begin(9600); Serial.println("init..."); tft.println("init..."); AudioNoInterrupts(); // disable audio library momentarily // put your setup code here, to run once: //cs42448_1.setAddress(0); cs42448_1.enable(); cs42448_1.volume(1); //cs42448_1.inputLevel(1, 15.0); //cs42448_1.inputLevel(2, 15.0); //cs42448_1.inputLevel(1); AudioInterrupts(); // enable, both tones will start together delay(100); queue1.begin(); } uint32_t oscilliscope_x = 0; int16_t buffer[128]; int16_t lastbuffer[128]; void updateScope() { oscilliscope_x = oscilliscope_x + 1; if (oscilliscope_x > 127) { return; } tft.drawLine(oscilliscope_x, 64 + (lastbuffer[oscilliscope_x-1] >> 8), oscilliscope_x + 1, 64 + (lastbuffer[oscilliscope_x] >> 8), ST7735_BLACK); tft.drawLine(oscilliscope_x, 64 + (buffer[oscilliscope_x-1] >> 8), oscilliscope_x + 1, 64 + (buffer[oscilliscope_x] >> 8), ST7735_GREEN); } unsigned count = 0; void loop() { count++; // put your main code here, to run repeatedly: if ( queue1.available() ) { //Serial.print("."); if (oscilliscope_x < 128) { // completely discard record buffers until x location >= 100 while (queue1.available()) { queue1.readBuffer(); queue1.freeBuffer(); } } else { while (queue1.available() > 1) { queue1.readBuffer(); queue1.freeBuffer(); } memcpy(lastbuffer, buffer, 256); memcpy(buffer, queue1.readBuffer(), 256); oscilliscope_x = 0; queue1.freeBuffer(); } } updateScope(); if (count % 5000000 == 0) { Serial.print("all="); Serial.print(AudioProcessorUsage()); Serial.print(","); Serial.print(AudioProcessorUsageMax()); Serial.print(" "); Serial.print("Memory: "); Serial.print(AudioMemoryUsage()); Serial.print(","); Serial.print(AudioMemoryUsageMax()); Serial.print(" "); Serial.print("Free Mem: "); Serial.print(memfree()); Serial.println(); } }
27.941176
147
0.623459
newdigate
37e95a08ec1c6d85092eba530c33bf32f30ee6b3
1,737
hpp
C++
cmdstan/stan/lib/stan_math/test/unit/math/rev/scal/fun/util.hpp
yizhang-cae/torsten
dc82080ca032325040844cbabe81c9a2b5e046f9
[ "BSD-3-Clause" ]
null
null
null
cmdstan/stan/lib/stan_math/test/unit/math/rev/scal/fun/util.hpp
yizhang-cae/torsten
dc82080ca032325040844cbabe81c9a2b5e046f9
[ "BSD-3-Clause" ]
null
null
null
cmdstan/stan/lib/stan_math/test/unit/math/rev/scal/fun/util.hpp
yizhang-cae/torsten
dc82080ca032325040844cbabe81c9a2b5e046f9
[ "BSD-3-Clause" ]
null
null
null
#ifndef TEST_UNIT_MATH_REV_SCAL_FUN_UTIL_HPP #define TEST_UNIT_MATH_REV_SCAL_FUN_UTIL_HPP #include <stan/math/rev/scal.hpp> #include <test/unit/math/rev/scal/util.hpp> typedef stan::math::var AVAR; typedef std::vector<AVAR> AVEC; typedef std::vector<double> VEC; AVEC createAVEC(AVAR x) { AVEC v; v.push_back(x); return v; } AVEC createAVEC(AVAR x1, AVAR x2) { AVEC v; v.push_back(x1); v.push_back(x2); return v; } AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3) { AVEC v; v.push_back(x1); v.push_back(x2); v.push_back(x3); return v; } AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4) { AVEC v = createAVEC(x1,x2,x3); v.push_back(x4); return v; } AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4, AVAR x5) { AVEC v = createAVEC(x1,x2,x3,x4); v.push_back(x5); return v; } AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4, AVAR x5, AVAR x6) { AVEC v = createAVEC(x1,x2,x3,x4,x5); v.push_back(x6); return v; } AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4, AVAR x5, AVAR x6, AVAR x7) { AVEC v = createAVEC(x1,x2,x3,x4,x5,x6); v.push_back(x7); return v; } AVEC createAVEC(AVAR x1, AVAR x2, AVAR x3, AVAR x4, AVAR x5, AVAR x6, AVAR x7, AVAR x8) { AVEC v = createAVEC(x1,x2,x3,x4,x5,x6,x7); v.push_back(x8); return v; } VEC cgrad(AVAR f, AVAR x1) { AVEC x = createAVEC(x1); VEC g; f.grad(x,g); return g; } VEC cgrad(AVAR f, AVAR x1, AVAR x2) { AVEC x = createAVEC(x1,x2); VEC g; f.grad(x,g); return g; } VEC cgrad(AVAR f, AVAR x1, AVAR x2, AVAR x3) { AVEC x = createAVEC(x1,x2,x3); VEC g; f.grad(x,g); return g; } VEC cgrad(AVAR f, AVAR x1, AVAR x2, AVAR x3, AVAR x4) { AVEC x = createAVEC(x1,x2,x3,x4); VEC g; f.grad(x,g); return g; } #endif
20.927711
89
0.654001
yizhang-cae
37fa5dbcab513c7755df2b2137f41afd6ad207a0
1,331
cpp
C++
test/entity_tests.cpp
ShelbyZ/BattleSystem
475b6e1024267d429c1e0946b7e9ddd05316fb49
[ "MIT" ]
null
null
null
test/entity_tests.cpp
ShelbyZ/BattleSystem
475b6e1024267d429c1e0946b7e9ddd05316fb49
[ "MIT" ]
2
2018-05-29T06:31:12.000Z
2018-06-01T05:44:44.000Z
test/entity_tests.cpp
ShelbyZ/BattleSystem
475b6e1024267d429c1e0946b7e9ddd05316fb49
[ "MIT" ]
null
null
null
#include <string> #include "gtest/gtest.h" #include "../battle_system/entity.h" TEST(Reference, Constructor) { std::string name = "shelby"; auto entity = CEntity(name); ASSERT_EQ("shelby", entity.getName()); ASSERT_EQ("", name); } TEST(Reference_EmptyName, Constructor) { ASSERT_THROW({ std::string name = ""; auto entity = CEntity(name); }, std::logic_error); } TEST(AutoReference, Constructor) { auto name = "shelby"; auto entity = CEntity(name); ASSERT_EQ(name, entity.getName()); } TEST(AutoReference_EmptyName, Constructor) { ASSERT_THROW({ auto name = ""; auto entity = CEntity(name); }, std::logic_error); } TEST(RValueReference, Constructor) { auto entity = CEntity("shelby"); ASSERT_EQ("shelby", entity.getName()); } TEST(RValueReference_EmptyName, Constructor) { ASSERT_THROW({ auto entity = CEntity(""); }, std::logic_error); } TEST(LhsEqualsRhs, operatorEquals) { auto name = "shelby"; auto entity = CEntity(name); auto result = (entity == entity); ASSERT_EQ(true, result); } TEST(LhsNotEqualsRhs, operatorEquals) { auto name = "shelby"; auto entity = CEntity(name); auto entity2 = CEntity("NotShelby"); auto result = (entity == entity2); ASSERT_EQ(false, result); }
18.232877
44
0.636364
ShelbyZ
37fc78e202d07a699204dbf57c3d0692cbf52ba8
3,126
cpp
C++
src/proseco_planning/action/actionSpace.cpp
ProSeCo-Planning/proseco_planning
c9a8d65c5f24e59e170e8de271e769ca65b9b10d
[ "BSD-3-Clause" ]
null
null
null
src/proseco_planning/action/actionSpace.cpp
ProSeCo-Planning/proseco_planning
c9a8d65c5f24e59e170e8de271e769ca65b9b10d
[ "BSD-3-Clause" ]
null
null
null
src/proseco_planning/action/actionSpace.cpp
ProSeCo-Planning/proseco_planning
c9a8d65c5f24e59e170e8de271e769ca65b9b10d
[ "BSD-3-Clause" ]
null
null
null
#include "proseco_planning/action/actionSpace.h" #include <cstddef> #include <random> #include <stdexcept> #include <variant> #include "proseco_planning/action/actionSpaceRectangle.h" #include "proseco_planning/collision_checker/collisionChecker.h" #include "proseco_planning/math/mathlib.h" #include "proseco_planning/trajectory/trajectory.h" #include "proseco_planning/trajectory/trajectorygenerator.h" namespace proseco_planning { class Vehicle; const std::map<ActionClass, std::string> ActionSpace::ACTION_CLASS_NAME_MAP{ {ActionClass::DO_NOTHING, "0"}, {ActionClass::ACCELERATE, "+"}, {ActionClass::DECELERATE, "-"}, {ActionClass::CHANGE_LEFT, "L"}, {ActionClass::CHANGE_RIGHT, "R"}, {ActionClass::CHANGE_LEFT_FAST, "L+"}, {ActionClass::CHANGE_LEFT_SLOW, "L-"}, {ActionClass::CHANGE_RIGHT_FAST, "R+"}, {ActionClass::CHANGE_RIGHT_SLOW, "R-"}, }; /** * @brief Constructs a new ActionSpace object. * * @param type Action space type. */ ActionSpace::ActionSpace(const std::string& type) : m_type(type) {} /** * @brief Factory method that creates an action space according to the specified action space * variant type. * * @param variant The action space variant type. * @return std::shared_ptr<ActionSpace>m The pointer to the action space. */ std::shared_ptr<ActionSpace> ActionSpace::createActionSpace( const config::ActionSpace::variant_t& variant) { if (std::holds_alternative<config::ActionSpaceRectangle>(variant)) { const auto& config = std::get<config::ActionSpaceRectangle>(variant); return std::make_shared<ActionSpaceRectangle>(config); } else { throw std::invalid_argument("Unknown action space variant"); } } /** * @brief Sample an action from the moderate actions, i.e., from the sparse representation of this * action space. * * @param vehicle Current state of the vehicle. * @return ActionPtr */ ActionPtr ActionSpace::sampleModerateAction(const Vehicle& vehicle) const { auto moderateActions = getModerateActions(vehicle); return math::getRandomElementFromVector(moderateActions); } ActionPtr ActionSpace::sampleValidAction(const Vehicle& vehicle, const std::function<ActionPtr()>& samplingFunction, CollisionChecker& collisionChecker, const TrajectoryGenerator& trajectoryGenerator) { auto action = samplingFunction(); auto trajectory = trajectoryGenerator.createTrajectory(0.0, action, vehicle); Trajectory::useActionFraction = false; uint sample{0}; // ensure that the action and state are valid, and that no collision occurs with obstacles while ((!trajectory.isValidAction(vehicle) || !trajectory.isValidState(vehicle) || collisionChecker.collision(vehicle, trajectory, sOpt().obstacles)) && sample < cOpt().max_invalid_action_samples) { action = samplingFunction(); trajectory = trajectoryGenerator.createTrajectory(0.0, action, vehicle); sample++; } return action; }; } // namespace proseco_planning
38.592593
98
0.705374
ProSeCo-Planning
37fc9861f48b90fc05844a3a8b621ce6395a845a
473
cpp
C++
cf/ac/0268A.cpp
vitorgt/problem-solving
11fa59de808f7a113c08454b4aca68b01410892e
[ "MIT" ]
null
null
null
cf/ac/0268A.cpp
vitorgt/problem-solving
11fa59de808f7a113c08454b4aca68b01410892e
[ "MIT" ]
null
null
null
cf/ac/0268A.cpp
vitorgt/problem-solving
11fa59de808f7a113c08454b4aca68b01410892e
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; int main(int argc, const char **argv) { std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); int n = 0, a = 0, b = 0, ans = 0; unordered_multiset<int> h; vector<int> g; cin >> n; while (n--) { cin >> a >> b; h.insert(a); g.push_back(b); } for (int i : g) ans += h.count(i); cout << ans << endl; return 0; }
16.892857
68
0.513742
vitorgt
37fda60166636d21210077343121767f5fb066be
528
hpp
C++
include/snd/ramp_gen.hpp
colugomusic/snd
3ecb87581870b14e62893610d027516aea48ff3c
[ "MIT" ]
18
2020-08-26T11:33:50.000Z
2021-04-13T15:57:28.000Z
include/snd/ramp_gen.hpp
colugomusic/snd
3ecb87581870b14e62893610d027516aea48ff3c
[ "MIT" ]
1
2021-05-16T17:11:57.000Z
2021-05-16T17:25:17.000Z
include/snd/ramp_gen.hpp
colugomusic/snd
3ecb87581870b14e62893610d027516aea48ff3c
[ "MIT" ]
null
null
null
#pragma once #pragma warning(push, 0) #include <DSP/MLDSPOps.h> #pragma warning(pop) namespace ml { class RampGen { public: RampGen(int p = kFloatsPerDSPVector) : mCounter(p), mPeriod(p) {} ~RampGen() {} inline void setPeriod(int p) { mPeriod = p; } inline DSPVectorInt operator()() { DSPVectorInt vy; for (int i = 0; i < kFloatsPerDSPVector; ++i) { float fy = 0; if (++mCounter >= mPeriod) { mCounter = 0; fy = 1; } vy[i] = mCounter; } return vy; } int mCounter; int mPeriod; }; }
14.666667
66
0.611742
colugomusic
5301078cd20e7b2f699cde88f558226e8d6f5047
1,544
cpp
C++
Codeforces/1240C/dp_tree.cpp
codgician/ACM
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
[ "MIT" ]
2
2018-02-14T01:59:31.000Z
2018-03-28T03:30:45.000Z
Codeforces/1240C/dp_tree.cpp
codgician/ACM
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
[ "MIT" ]
null
null
null
Codeforces/1240C/dp_tree.cpp
codgician/ACM
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
[ "MIT" ]
2
2017-12-30T02:46:35.000Z
2018-03-28T03:30:49.000Z
#include <bits/stdc++.h> using namespace std; #define SIZE 500010 class Edge { public: int to, next, len; }; Edge edges[SIZE << 1]; int head[SIZE], edgesPt; int vertexNum, lim; long long int dp[SIZE][2]; void addEdge(int from, int to, int len) { edges[edgesPt] = {to, head[from], len}; head[from] = edgesPt++; } void dfs(int cntPt, int fatherPt) { dp[cntPt][0] = 0; dp[cntPt][1] = 0; vector<long long int> vec; for (int i = head[cntPt]; i != -1; i = edges[i].next) { int nextPt = edges[i].to; if (nextPt == fatherPt) continue; dfs(nextPt, cntPt); dp[cntPt][0] += dp[nextPt][0]; dp[cntPt][1] += dp[nextPt][0]; vec.push_back(-dp[nextPt][0] + dp[nextPt][1] + edges[i].len); } sort(vec.begin(), vec.end(), greater<long long int>()); int siz = vec.size(); for (int i = 0; i < min(siz, lim - 1) && vec[i] > 0; i++) dp[cntPt][0] += vec[i], dp[cntPt][1] += vec[i]; for (int i = lim - 1; i < min(siz, lim) && vec[i] > 0; i++) dp[cntPt][0] += vec[i]; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int caseNum; cin >> caseNum; while (caseNum--) { cin >> vertexNum >> lim; fill(head + 0, head + vertexNum, -1); edgesPt = 0; for (int i = 1; i < vertexNum; i++) { int from, to, len; cin >> from >> to >> len; from--; to--; addEdge(from, to, len); addEdge(to, from, len); } dfs(0, -1); cout << dp[0][0] << '\n'; } return 0; }
27.087719
73
0.513601
codgician
53040e63660eb37274adac7727b0bbece49ddd79
1,183
cpp
C++
src/collections_and_containers/cpp/heap/test/test_heap.cpp
djeada/GraphAlgorithms
0961303ec20430f90053a4efb9074185f96dfddc
[ "MIT" ]
2
2021-05-31T13:01:33.000Z
2021-12-20T19:48:18.000Z
src/collections_and_containers/cpp/heap/test/test_heap.cpp
djeada/GraphAlgorithms
0961303ec20430f90053a4efb9074185f96dfddc
[ "MIT" ]
null
null
null
src/collections_and_containers/cpp/heap/test/test_heap.cpp
djeada/GraphAlgorithms
0961303ec20430f90053a4efb9074185f96dfddc
[ "MIT" ]
null
null
null
#include "heap.h" #include "gtest/gtest.h" TEST(MaxHeapTest, EmptyHeap) { MaxHeap<int> heap; ASSERT_TRUE(heap.empty()); } TEST(MaxHeapTest, AddingSingleElement) { MaxHeap<int> heap; heap.push(10); EXPECT_EQ(heap.peek(), 10); EXPECT_EQ(heap.size(), 1); } TEST(MaxHeapTest, AddingMultipleElements) { MaxHeap<int> heap; heap.push(1); heap.push(2); heap.push(3); EXPECT_EQ(heap.peek(), 3); EXPECT_EQ(heap.size(), 3); EXPECT_EQ(heap.pop(), 3); EXPECT_EQ(heap.size(), 2); EXPECT_EQ(heap.pop(), 2); EXPECT_EQ(heap.size(), 1); EXPECT_EQ(heap.pop(), 1); ASSERT_TRUE(heap.empty()); } TEST(MinHeapTest, EmptyHeap) { MinHeap<int> heap; ASSERT_TRUE(heap.empty()); } TEST(MinHeapTest, AddingSingleElement) { MinHeap<int> heap; heap.push(10); EXPECT_EQ(heap.peek(), 10); EXPECT_EQ(heap.size(), 1); } TEST(MinHeapTest, AddingMultipleElements) { MinHeap<int> heap; heap.push(1); heap.push(2); heap.push(3); EXPECT_EQ(heap.peek(), 1); EXPECT_EQ(heap.size(), 3); EXPECT_EQ(heap.pop(), 1); EXPECT_EQ(heap.size(), 2); EXPECT_EQ(heap.pop(), 2); EXPECT_EQ(heap.size(), 1); EXPECT_EQ(heap.pop(), 3); ASSERT_TRUE(heap.empty()); }
20.754386
43
0.65765
djeada
530417011596662d07fd809484395dd78444c354
1,006
hpp
C++
ModSource/breakingpoint_infected/CfgBody.hpp
nrailuj/breakingpointmod
e102e106b849ca78deb3cb299f3ae18c91c3bfe9
[ "Naumen", "Condor-1.1", "MS-PL" ]
70
2017-06-23T21:25:05.000Z
2022-03-27T02:39:33.000Z
ModSource/breakingpoint_infected/CfgBody.hpp
nrailuj/breakingpointmod
e102e106b849ca78deb3cb299f3ae18c91c3bfe9
[ "Naumen", "Condor-1.1", "MS-PL" ]
84
2017-08-26T22:06:28.000Z
2021-09-09T15:32:56.000Z
ModSource/breakingpoint_infected/CfgBody.hpp
nrailuj/breakingpointmod
e102e106b849ca78deb3cb299f3ae18c91c3bfe9
[ "Naumen", "Condor-1.1", "MS-PL" ]
71
2017-06-24T01:10:42.000Z
2022-03-18T23:02:00.000Z
/* Breaking Point Mod for Arma 3 Released under Arma Public Share Like Licence (APL-SA) https://www.bistudio.com/community/licenses/arma-public-license-share-alike Alderon Games Pty Ltd */ class CfgBody { class head_hit { memoryPoint = "pilot"; variation = 0.08; }; class body { memoryPoint = "aimPoint"; variation = 0.15; }; class Spine2 : body {}; class LeftArm { memoryPoint = "lelbow"; variation = 0.1; }; class RightArm { memoryPoint = "relbow"; variation = 0.04; }; class LeftForeArm { memoryPoint = "lwrist"; variation = 0.04; }; class RightForeArm { memoryPoint = "rwrist"; variation = 0.04; }; class LeftHand { memoryPoint = "LeftHandMiddle1"; variation = 0.04; }; class RightHand { memoryPoint = "RightHandMiddle1"; variation = 0.04; }; class legs { memoryPoint = "pelvis"; variation = 0.15; }; class LeftLeg : legs {}; class LeftUpLeg : legs {}; class RightLeg : legs {}; class RightUpLeg : legs {}; };
15.242424
76
0.638171
nrailuj
5305301f280d86529dc2ead504eed0e339c3b6cd
16,353
hpp
C++
engine/ItemType.hpp
rigertd/LegacyMUD
cf351cca466158f0682f6c877b88d5c2eb59e240
[ "BSD-3-Clause" ]
1
2021-04-24T06:01:57.000Z
2021-04-24T06:01:57.000Z
engine/ItemType.hpp
rigertd/LegacyMUD
cf351cca466158f0682f6c877b88d5c2eb59e240
[ "BSD-3-Clause" ]
null
null
null
engine/ItemType.hpp
rigertd/LegacyMUD
cf351cca466158f0682f6c877b88d5c2eb59e240
[ "BSD-3-Clause" ]
null
null
null
/*********************************************************************//** * \author Rachel Weissman-Hohler * \created 02/01/2017 * \modified 03/08/2017 * \course CS467, Winter 2017 * \file ItemType.hpp * * \details Header file for ItemType class. Defines the members and * functions that apply to all item types. Item types * define in-game item types that an item may use as its * type. Item types allow the world builder to define a type * once and then create many items of that type. ************************************************************************/ #ifndef ITEM_TYPE_HPP #define ITEM_TYPE_HPP #include <string> #include <atomic> #include <mutex> #include <vector> #include "InteractiveNoun.hpp" #include "EquipmentSlot.hpp" #include "ItemRarity.hpp" #include "DataType.hpp" #include "ObjectType.hpp" #include "DamageType.hpp" #include "AreaSize.hpp" #include "EffectType.hpp" namespace legacymud { namespace engine { /*! * \details This class defines in-game item types that an item may use as * its type. Item types allow the world builder to define a type * once and then create many items of that type. */ class ItemType: public InteractiveNoun { public: ItemType(); ItemType(int weight, ItemRarity rarity, std::string description, std::string name, int cost, EquipmentSlot slotType); ItemType(int weight, ItemRarity rarity, std::string description, std::string name, int cost, EquipmentSlot slotType, int anID); /*! * \brief Gets the weight of this item type. * * \return Returns an int with the weight of this item type. */ int getWeight() const; /*! * \brief Gets the rarity of this item type. * * \return Returns an ItemRarity with the rarity of this item type. */ ItemRarity getRarity() const; /*! * \brief Gets the description of this item type. * * \return Returns a std::string with the description of this item type. */ std::string getDescription() const; /*! * \brief Gets the name of this item type. * * \return Returns a std::string with the name of this item type. */ std::string getName() const; /*! * \brief Gets the cost of this item type. * * \return Returns an int with the cost of this item type. */ int getCost() const; /*! * \brief Gets the slot type of this item type. * * \return Returns an EquipmentSlot with the slot type of this item type. */ EquipmentSlot getSlotType() const; /*! * \brief Sets the weight of this item type. * * \param[in] weight Specifies the weight of this item type. * * \return Returns a bool indicating whether or not setting the * weight was successful. */ bool setWeight(int weight); /*! * \brief Sets the rarity of this item type. * * \param[in] rarity Specifies the rarity of this item type. * * \return Returns a bool indicating whether or not setting the * rarity was successful. */ bool setRarity(ItemRarity rarity); /*! * \brief Sets the description of this item type. * * \param[in] description Specifies the description of this item type. * * \return Returns a bool indicating whether or not setting the * description was successful. */ bool setDescription(std::string description); /*! * \brief Sets the name of this item type. * * \param[in] name Specifies the name of this item type. * * \return Returns a bool indicating whether or not setting the * name was successful. */ bool setName(std::string name); /*! * \brief Sets the cost of this item type. * * \param[in] cost Specifies the cost of this item type. * * \return Returns a bool indicating whether or not setting the * cost was successful. */ bool setCost(int cost); /*! * \brief Sets the slot type of this item type. * * \param[in] slotType Specifies the slot type of this item type. * * \return Returns a bool indicating whether or not setting the * slot type was successful. */ bool setSlotType(EquipmentSlot slotType); /*! * \brief Gets the armor bonus if this item type has an armor bonus. * * \return Returns an int with the armor bonus for this item type. */ virtual int getArmorBonus() const; /*! * \brief Gets the damage type this item type is resistant to. * * \return Returns a DamageType with the damage type this item type is * resistant to. */ virtual DamageType getResistantTo() const; /*! * \brief Gets the damage if this item type has a damage. * * \return Returns an int with the damage for this item type. */ virtual int getDamage() const; /*! * \brief Gets the damage type if this item type has a damage type. * * \return Returns a DamageType with the damage type for this item type. */ virtual DamageType getDamageType() const; /*! * \brief Gets the range if this item type has a range. * * \return Returns an AreaSize with the range for this item type. */ virtual AreaSize getRange() const; /*! * \brief Gets the crit multiplier if this item type has an crit multiplier. * * \return Returns an int with the crit multiplier for this item type. */ virtual int getCritMultiplier() const; /*! * \brief Sets the damage if this item type has a damage. * * \param[in] damage Specifies the damage. * * \return Returns a bool indicating whether or not setting the damage was * sucessful. */ virtual bool setDamage(int damage); /*! * \brief Sets the damage type if this item type has a damage type. * * \param[in] type Specifies the damage type. * * \return Returns a bool indicating whether or not setting the damage type was * sucessful. */ virtual bool setDamageType(DamageType type); /*! * \brief Sets the range if this item type has a range. * * \param[in] range Specifies the range. * * \return Returns a bool indicating whether or not setting the range was * sucessful. */ virtual bool setRange(AreaSize range); /*! * \brief Sets the crit multiplier if this item type has a crit multiplier. * * \param[in] multiplier Specifies the crit multiplier. * * \return Returns a bool indicating whether or not setting the crit multiplier * was sucessful. */ virtual bool setCritMultiplier(int multiplier); /*! * \brief Sets the armor bonus for this item type, if it has an armor bonus. * * \param[in] bonus Specifes the armor bonus for this item type. * * \return Returns a bool indicating whether or not setting the * armor bonus was successful. */ virtual bool setArmorBonus(int bonus); /*! * \brief Sets the damage type that this item type is resistant to. * * \param[in] resistance Specifies the damage type this item type * is resistant to. * * \return Returns a bool indicating whether or not setting the * resistance was successful. */ virtual bool setResistantTo(DamageType resistance); /*! * \brief Gets the object type. * * \return Returns an ObjectType indicating the actual class the object * belongs to. */ virtual ObjectType getObjectType() const; /*! * \brief Serializes this object for writing to file. * * \return Returns a std::string with the serialized data. */ virtual std::string serialize(); /*! * \brief Deserializes and creates an object of this type from the * specified string of serialized data. * * \param[in] string Holds the data to be deserialized. * * \return Returns an InteractiveNoun* with the newly created object. */ static ItemType* deserialize(std::string); /*! * \brief Gets the response of this object to the command move. * * \param[in] aPlayer Specifies the player that is moving the object. * \param[out] effects Specifies the effects of the action. * * \note May cause an effect on the player. * * \return Returns a std::string with the response to the command * move. */ virtual std::string move(Player *aPlayer, std::vector<EffectType> *effects); /*! * \brief Gets the response of this object to the command read. * * \param[in] aPlayer Specifies the player that is reading the object. * \param[out] effects Specifies the effects of the action. * * \note May cause an effect on the player. * * \return Returns a std::string with the response to the command * read. */ virtual std::string read(Player *aPlayer, std::vector<EffectType> *effects); /*! * \brief Gets the response of this object to the command break. * * \param[in] aPlayer Specifies the player that is breaking the object. * \param[out] effects Specifies the effects of the action. * * \note May cause an effect on the player. * * \return Returns a std::string with the response to the command * break. */ virtual std::string breakIt(Player *aPlayer, std::vector<EffectType> *effects); /*! * \brief Gets the response of this object to the command climb. * * \param[in] aPlayer Specifies the player that is climbing the object. * \param[out] effects Specifies the effects of the action. * * \note May cause an effect on the player. * * \return Returns a std::string with the response to the command * climb. */ virtual std::string climb(Player *aPlayer, std::vector<EffectType> *effects); /*! * \brief Gets the response of this object to the command turn. * * \param[in] aPlayer Specifies the player that is turning the object. * \param[out] effects Specifies the effects of the action. * * \note May cause an effect on the player. * * \return Returns a std::string with the response to the command * turn. */ virtual std::string turn(Player *aPlayer, std::vector<EffectType> *effects); /*! * \brief Gets the response of this object to the command push. * * \param[in] aPlayer Specifies the player that is pushing the object. * \param[out] effects Specifies the effects of the action. * * \note May cause an effect on the player. * * \return Returns a std::string with the response to the command * push. */ virtual std::string push(Player *aPlayer, std::vector<EffectType> *effects); /*! * \brief Gets the response of this object to the command pull. * * \param[in] aPlayer Specifies the player that is pulling the object. * \param[out] effects Specifies the effects of the action. * * \note May cause an effect on the player. * * \return Returns a std::string with the response to the command * pull. */ virtual std::string pull(Player *aPlayer, std::vector<EffectType> *effects); /*! * \brief Gets the response of this object to the command eat. * * \param[in] aPlayer Specifies the player that is eating the object. * \param[out] effects Specifies the effects of the action. * * \note May cause an effect on the player. * * \return Returns a std::string with the response to the command * eat. */ virtual std::string eat(Player *aPlayer, std::vector<EffectType> *effects); /*! * \brief Gets the response of this object to the command drink. * * \param[in] aPlayer Specifies the player that is drinking the object. * \param[out] effects Specifies the effects of the action. * * \note May cause an effect on the player. * * \return Returns a std::string with the response to the command * drink. */ virtual std::string drink(Player *aPlayer, std::vector<EffectType> *effects); /*! * \brief Creates a copy of this object. * * This function creates a new object with the same attributes as this * object and returns a pointer to the new object. * * \return Returns a pointer to the newly created object or nullptr if * the copy was unsuccessful. */ virtual InteractiveNoun* copy(); /*! * \brief Edits an attribute of this object. * * This function edits the specified attribute of this object. It asks * the user for the new value and then sets it to that. * * \param[in] aPlayer Specifies the player that is doing the editing. * \param[in] attribute Specifies the attribute to edit. * * \return Returns bool indicating whether or not editing the attribute * was successful. */ //virtual bool editAttribute(Player *aPlayer, std::string attribute); /*! * \brief Edits this object. * * This function edits this object. It interacts with the user to determine * which attributes to update and what the new values should be and then * makes those changes. * * \param[in] aPlayer Specifies the player that is doing the editing. * * \return Returns bool indicating whether or not editing this object * was successful. */ virtual bool editWizard(Player *aPlayer); /*! * \brief Gets the attribute signature of the class. * * This function returns a map of string to DataType with the * attributes required by the Action class to instantiate a new * action. * * \return Returns a map of std::string to DataType indicating * the required attributes. */ static std::map<std::string, DataType> getAttributeSignature(); private: std::atomic<int> weight; std::atomic<ItemRarity> rarity; std::string description; mutable std::mutex descriptionMutex; std::string name; mutable std::mutex nameMutex; std::atomic<int> cost; std::atomic<EquipmentSlot> slotType; }; }} #endif
35.940659
135
0.554333
rigertd
530c162bdcea1cd5099808ad4ecffd8bc904549b
9,463
hpp
C++
kv/complex.hpp
soonho-tri/kv
4963be6560d8600cdc9ff22d004b2b965ae7b1df
[ "MIT" ]
67
2017-01-04T15:30:54.000Z
2022-03-31T05:45:02.000Z
src/interval/kv/complex.hpp
takafumihoriuchi/HyLaGI
26b9f32a84611ee62d9cbbd903773d224088c959
[ "BSL-1.0" ]
4
2017-02-10T02:59:45.000Z
2019-10-10T14:17:08.000Z
src/interval/kv/complex.hpp
takafumihoriuchi/HyLaGI
26b9f32a84611ee62d9cbbd903773d224088c959
[ "BSL-1.0" ]
5
2021-09-29T02:27:46.000Z
2022-03-31T05:45:04.000Z
/* * Copyright (c) 2013-2016 Masahide Kashiwagi (kashi@waseda.jp) */ #ifndef COMPLEX_HPP #define COMPLEX_HPP #include <iostream> #include <cmath> #include <kv/convert.hpp> namespace kv { template <class T> class complex; template <class C, class T> struct convertible<C, complex<T> > { static const bool value = convertible<C, T>::value || boost::is_same<C, complex<T> >::value; }; template <class C, class T> struct acceptable_n<C, complex<T> > { static const bool value = convertible<C, T>::value; }; template <class T> class complex { T re; T im; public: typedef T base_type; complex() { re = 0.; im = 0.; } template <class C> explicit complex(const C& x, typename boost::enable_if_c< acceptable_n<C, complex>::value >::type* =0) { re = x; im = 0.; } template <class C> explicit complex(const complex<C>& x, typename boost::enable_if_c< acceptable_n<C, complex>::value >::type* =0) { re = x.real(); im = x.imag(); } template <class C1, class C2> complex(const C1& x, const C2& y, typename boost::enable_if_c< acceptable_n<C1, complex>::value && acceptable_n<C2, complex>::value >::type* =0) { re = x; im = y; } template <class C> typename boost::enable_if_c< acceptable_n<C, complex>::value, complex& >::type operator=(const C& x) { re = x; im = 0.; return *this; } template <class C> typename boost::enable_if_c< acceptable_n<C, complex>::value, complex& >::type operator=(const complex<C>& x) { re = x.real(); im = x.imag(); return *this; } friend complex operator+(const complex& x, const complex& y) { complex r; r.re = x.re + y.re; r.im = x.im + y.im; return r; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex >::type operator+(const complex& x, const C& y) { complex r; r.re = x.re + y; r.im = x.im; return r; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex >::type operator+(const C& x, const complex& y) { complex r; r.re = x + y.re; r.im = y.im; return r; } friend complex& operator+=(complex& x, const complex& y) { x = x + y; return x; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex& >::type operator+=(complex& x, const C& y) { x.re += y; return x; } friend complex operator-(const complex& x, const complex& y) { complex r; r.re = x.re - y.re; r.im = x.im - y.im; return r; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex >::type operator-(const complex& x, const C& y) { complex r; r.re = x.re - y; r.im = x.im; return r; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex >::type operator-(const C& x, const complex& y) { complex r; r.re = x - y.re; r.im = - y.im; return r; } friend complex& operator-=(complex& x, const complex& y) { x = x - y; return x; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex& >::type operator-=(complex& x, const C& y) { x.re -= y; return x; } friend complex operator-(const complex& x) { complex r; r.re = - x.re; r.im = - x.im; return r; } friend complex operator*(const complex& x, const complex& y) { complex r; r.re = x.re * y.re - x.im * y.im; r.im = x.re * y.im + x.im * y.re; return r; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex >::type operator*(const complex& x, const C& y) { complex r; r.re = x.re * y; r.im = x.im * y; return r; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex >::type operator*(const C& x, const complex& y) { complex r; r.re = x * y.re; r.im = x * y.im; return r; } friend complex& operator*=(complex& x, const complex& y) { x = x * y; return x; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex& >::type operator*=(complex& x, const C& y) { x.re *= y; x.im *= y; return x; } friend complex operator/(const complex& x, const complex& y) { complex r; T tmp, tmp2; tmp = y.re * y.re + y.im * y.im; r.re = (y.re * x.re + y.im * x.im) / tmp; r.im = (y.re * x.im - x.re * y.im) / tmp; #if 0 using std::abs; if (abs(y.re) > abs(y.im)) { tmp2 = y.im / y.re; tmp = y.re + y.im * tmp2; r.re = (x.re + tmp2 * x.im) / tmp; r.im = (x.im - x.re * tmp2) / tmp; } else { tmp2 = y.re / y.im; tmp = y.re * tmp2 + y.im; r.re = (tmp2 * x.re + x.im) / tmp; r.im = (tmp2 * x.im - x.re) / tmp; } #endif return r; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex >::type operator/(const complex& x, const C& y) { complex r; r.re = x.re / y; r.im = x.im / y; return r; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex >::type operator/(const C& x, const complex& y) { complex r; T tmp; tmp = y.re * y.re + y.im * y.im; r.re = (y.re * x) / tmp; r.im = (- x * y.im) / tmp; #if 0 T tmp2; using std::abs; if (abs(y.re) > abs(y.im)) { tmp2 = y.im / y.re; tmp = y.re + y.im * tmp2; r.re = x / tmp; r.im = (- x * tmp2) / tmp; } else { tmp2 = y.re / y.im; tmp = y.re * tmp2 + y.im; r.re = (tmp2 * x) / tmp; r.im = (- x) / tmp; } #endif return r; } friend complex& operator/=(complex& x, const complex& y) { x = x / y; return x; } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex& >::type operator/=(complex& x, const C& y) { x.re /= y; x.im /= y; return x; } friend std::ostream& operator<<(std::ostream& s, const complex& x) { s << '(' << x.re << ")+(" << x.im << ")i"; return s; } const T& real() const { return re; } const T& imag() const { return im; } T& real() { return re; } T& imag() { return im; } static complex i() { return complex(T(0.), T(1.)); } friend T abs(const complex& x) { using std::sqrt; using std::pow; return sqrt(pow(x.re, 2) + pow(x.im, 2)); } friend T arg(const complex& x) { using std::atan2; return atan2(x.im, x.re); } friend complex conj(const complex& x) { return complex(x.re, -x.im); } friend complex sqrt(const complex& x) { T a, r; using std::sqrt; r = sqrt(abs(x)); a = arg(x) * 0.5; using std::cos; using std::sin; return complex(r * cos(a), r * sin(a)); } friend complex pow(const complex& x, int y) { complex r, xp; int tmp; if (y == 0) return complex(1.); tmp = (y >= 0) ? y : -y; r = 1.; xp = x; while (tmp != 0) { if (tmp % 2 != 0) { r *= xp; } tmp /= 2; xp = xp * xp; } if (y < 0) { r = 1. / r; } return r; } friend complex pow(const complex& x, const complex& y) { return exp(y * log(x)); } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value && ! boost::is_integral<C>::value, complex >::type pow(const complex& x, const C& y) { return pow(x, complex(y)); } template <class C> friend typename boost::enable_if_c< acceptable_n<C, complex>::value, complex >::type pow(const C& x, const complex& y) { return pow(complex(x), y); } friend complex exp(const complex& x) { T tmp; using std::exp; using std::cos; using std::sin; tmp = exp(x.re); return complex(tmp * cos(x.im), tmp * sin(x.im)); } friend complex log(const complex& x) { using std::log; return complex(log(abs(x)), arg(x)); } friend complex sin(const complex& x) { using std::sin; using std::cos; using std::cosh; using std::sinh; return complex(sin(x.re) * cosh(x.im), cos(x.re) * sinh(x.im)); } friend complex cos(const complex& x) { using std::sin; using std::cos; using std::cosh; using std::sinh; return complex(cos(x.re) * cosh(x.im), - sin(x.re) * sinh(x.im)); } friend complex tan(const complex& x) { T tx, ty, tmp; tx = 2. * x.re; ty = 2. * x.im; using std::sin; using std::cos; using std::cosh; using std::sinh; tmp = cos(tx) + cosh(ty); return complex(sin(tx) / tmp, sinh(ty) / tmp); } friend complex asin(const complex& x) { return -i() * log(i() * x + sqrt(1. - x * x)); } friend complex acos(const complex& x) { return -i() * log(x + i() * sqrt(1. - x * x)); } friend complex atan(const complex& x) { return i() * 0.5 * log((i() + x) / (i() - x)); } friend complex sinh(const complex& x) { using std::sin; using std::cos; using std::cosh; using std::sinh; return complex(sinh(x.re) * cos(x.im), cosh(x.re) * sin(x.im)); } friend complex cosh(const complex& x) { using std::sin; using std::cos; using std::cosh; using std::sinh; return complex(cosh(x.re) * cos(x.im), sinh(x.re) * sin(x.im)); } friend complex tanh(const complex& x) { T tx, ty, tmp; tx = 2. * x.re; ty = 2. * x.im; using std::sin; using std::cos; using std::cosh; using std::sinh; tmp = cosh(tx) + cos(ty); return complex(sinh(tx) / tmp, sin(ty) / tmp); } friend complex asinh(const complex& x) { return log(x + sqrt(x * x + 1.)); } friend complex acosh(const complex& x) { return log(x + sqrt(x * x - 1.)); } friend complex atanh(const complex& x) { return 0.5 * log((1. + x) / (1. - x)); } }; } // namespace kv #endif // COMPLEX_HPP
21.265169
177
0.590933
soonho-tri
530c4b2b94372f67ff4688139ea8d9b08d386bdf
7,496
cpp
C++
Source/HeliumRain/UI/Menus/FlareCompanyMenu.cpp
fdsalbj/HeliumRain
a429db86e59e3c8d71c306a20c7abd2899a36464
[ "BSD-3-Clause" ]
2
2016-09-20T18:48:21.000Z
2021-03-30T02:42:59.000Z
Source/HeliumRain/UI/Menus/FlareCompanyMenu.cpp
fdsalbj/HeliumRain
a429db86e59e3c8d71c306a20c7abd2899a36464
[ "BSD-3-Clause" ]
null
null
null
Source/HeliumRain/UI/Menus/FlareCompanyMenu.cpp
fdsalbj/HeliumRain
a429db86e59e3c8d71c306a20c7abd2899a36464
[ "BSD-3-Clause" ]
null
null
null
#include "../../Flare.h" #include "FlareCompanyMenu.h" #include "../Components/FlarePartInfo.h" #include "../Components/FlareCompanyInfo.h" #include "../../Game/FlareGame.h" #include "../../Game/FlareCompany.h" #include "../../Player/FlareMenuManager.h" #include "../../Player/FlareMenuPawn.h" #include "../../Player/FlarePlayerController.h" #define LOCTEXT_NAMESPACE "FlareCompanyMenu" /*---------------------------------------------------- Construct ----------------------------------------------------*/ void SFlareCompanyMenu::Construct(const FArguments& InArgs) { // Data Company = NULL; MenuManager = InArgs._MenuManager; const FFlareStyleCatalog& Theme = FFlareStyleSet::GetDefaultTheme(); AFlarePlayerController* PC = MenuManager->GetPC(); // Build structure ChildSlot .HAlign(HAlign_Fill) .VAlign(VAlign_Fill) .Padding(FMargin(0, AFlareMenuManager::GetMainOverlayHeight(), 0, 0)) [ SNew(SVerticalBox) // Content block + SVerticalBox::Slot() [ SNew(SScrollBox) .Style(&Theme.ScrollBoxStyle) .ScrollBarStyle(&Theme.ScrollBarStyle) + SScrollBox::Slot() [ SNew(SVerticalBox) // Company name + SVerticalBox::Slot() .Padding(Theme.TitlePadding) .AutoHeight() [ SNew(STextBlock) .Text(this, &SFlareCompanyMenu::GetCompanyName) .TextStyle(&Theme.SubTitleFont) ] // Company info + SVerticalBox::Slot() .Padding(Theme.ContentPadding) .AutoHeight() [ SAssignNew(CompanyInfo, SFlareCompanyInfo) .Player(PC) ] // Title + SVerticalBox::Slot() .Padding(Theme.TitlePadding) .AutoHeight() [ SNew(STextBlock) .Text(LOCTEXT("Colors", "Colors")) .TextStyle(&Theme.SubTitleFont) ] // Color picker + SVerticalBox::Slot() .Padding(Theme.ContentPadding) .AutoHeight() [ SAssignNew(ColorBox, SFlareColorPanel) .MenuManager(MenuManager) ] // Trade routes Title + SVerticalBox::Slot() .Padding(Theme.TitlePadding) .AutoHeight() [ SNew(STextBlock) .Text(LOCTEXT("Trade routes", "Trade routes")) .TextStyle(&Theme.SubTitleFont) .Visibility(this, &SFlareCompanyMenu::GetTradeRouteVisibility) ] // New trade route button + SVerticalBox::Slot() .AutoHeight() .Padding(Theme.ContentPadding) .HAlign(HAlign_Left) [ SNew(SFlareButton) .Width(6) .Text(LOCTEXT("NewTradeRouteButton", "Add new trade route")) .HelpText(LOCTEXT("NewTradeRouteInfo", "Create a new trade route and edit it")) .Icon(FFlareStyleSet::GetIcon("New")) .OnClicked(this, &SFlareCompanyMenu::OnNewTradeRouteClicked) .Visibility(this, &SFlareCompanyMenu::GetTradeRouteVisibility) ] // Trade route list + SVerticalBox::Slot() .AutoHeight() .HAlign(HAlign_Left) [ SAssignNew(TradeRouteList, SVerticalBox) ] // Object list + SVerticalBox::Slot() .AutoHeight() .HAlign(HAlign_Left) [ SAssignNew(ShipList, SFlareShipList) .MenuManager(MenuManager) .Title(LOCTEXT("Property", "Property")) ] ] ] ]; } /*---------------------------------------------------- Interaction ----------------------------------------------------*/ void SFlareCompanyMenu::Setup() { SetEnabled(false); SetVisibility(EVisibility::Collapsed); } void SFlareCompanyMenu::Enter(UFlareCompany* Target) { FLOG("SFlareCompanyMenu::Enter"); SetEnabled(true); // Company data Company = Target; SetVisibility(EVisibility::Visible); CompanyInfo->SetCompany(Company); AFlarePlayerController* PC = MenuManager->GetPC(); if (PC && Target) { // Colors FFlarePlayerSave Data; FFlareCompanyDescription Unused; PC->Save(Data, Unused); ColorBox->Setup(Data); // Menu PC->GetMenuPawn()->SetCameraOffset(FVector2D(100, -30)); if (PC->GetPlayerShip()) { PC->GetMenuPawn()->ShowShip(PC->GetPlayerShip()); } else { const FFlareSpacecraftComponentDescription* PartDesc = PC->GetGame()->GetShipPartsCatalog()->Get("object-safe"); PC->GetMenuPawn()->ShowPart(PartDesc); } // Station list TArray<UFlareSimulatedSpacecraft*>& CompanyStations = Target->GetCompanyStations(); for (int32 i = 0; i < CompanyStations.Num(); i++) { if (CompanyStations[i]->GetDamageSystem()->IsAlive()) { ShipList->AddShip(CompanyStations[i]); } } // Ship list TArray<UFlareSimulatedSpacecraft*>& CompanyShips = Target->GetCompanyShips(); for (int32 i = 0; i < CompanyShips.Num(); i++) { if (CompanyShips[i]->GetDamageSystem()->IsAlive()) { ShipList->AddShip(CompanyShips[i]); } } } ShipList->RefreshList(); ShipList->SetVisibility(EVisibility::Visible); UpdateTradeRouteList(); } void SFlareCompanyMenu::Exit() { SetEnabled(false); ShipList->Reset(); ShipList->SetVisibility(EVisibility::Collapsed); TradeRouteList->ClearChildren(); Company = NULL; SetVisibility(EVisibility::Collapsed); } void SFlareCompanyMenu::UpdateTradeRouteList() { if (Company) { TradeRouteList->ClearChildren(); const FFlareStyleCatalog& Theme = FFlareStyleSet::GetDefaultTheme(); TArray<UFlareTradeRoute*>& TradeRoutes = Company->GetCompanyTradeRoutes(); for (int RouteIndex = 0; RouteIndex < TradeRoutes.Num(); RouteIndex++) { UFlareTradeRoute* TradeRoute = TradeRoutes[RouteIndex]; // Add line TradeRouteList->AddSlot() .AutoHeight() .HAlign(HAlign_Right) .Padding(Theme.ContentPadding) [ SNew(SHorizontalBox) // Inspect + SHorizontalBox::Slot() .AutoWidth() [ SNew(SFlareButton) .Width(6) .Text(TradeRoute->GetTradeRouteName()) .HelpText(FText(LOCTEXT("InspectHelp", "Edit this trade route"))) .OnClicked(this, &SFlareCompanyMenu::OnInspectTradeRouteClicked, TradeRoute) ] // Remove + SHorizontalBox::Slot() .AutoWidth() [ SNew(SFlareButton) .Transparent(true) .Text(FText()) .HelpText(LOCTEXT("RemoveTradeRouteHelp", "Remove this trade route")) .Icon(FFlareStyleSet::GetIcon("Stop")) .OnClicked(this, &SFlareCompanyMenu::OnDeleteTradeRoute, TradeRoute) .Width(1) ] ]; } } } /*---------------------------------------------------- Callbacks ----------------------------------------------------*/ FText SFlareCompanyMenu::GetCompanyName() const { FText Result; if (Company) { Result = FText::Format(LOCTEXT("Company", "Company : {0}"), Company->GetCompanyName()); } return Result; } void SFlareCompanyMenu::OnNewTradeRouteClicked() { UFlareTradeRoute* TradeRoute = Company->CreateTradeRoute(LOCTEXT("UntitledRoute", "Untitled Route")); check(TradeRoute); FFlareMenuParameterData Data; Data.Route = TradeRoute; MenuManager->OpenMenu(EFlareMenu::MENU_TradeRoute, Data); } void SFlareCompanyMenu::OnInspectTradeRouteClicked(UFlareTradeRoute* TradeRoute) { FFlareMenuParameterData Data; Data.Route = TradeRoute; MenuManager->OpenMenu(EFlareMenu::MENU_TradeRoute, Data); } void SFlareCompanyMenu::OnDeleteTradeRoute(UFlareTradeRoute* TradeRoute) { check(TradeRoute); TradeRoute->Dissolve(); UpdateTradeRouteList(); } EVisibility SFlareCompanyMenu::GetTradeRouteVisibility() const { if (Company) { return MenuManager->GetPC()->GetCompany()->GetVisitedSectors().Num() >= 2 ? EVisibility::Visible : EVisibility::Collapsed; } else { return EVisibility::Collapsed; } } #undef LOCTEXT_NAMESPACE
23.796825
130
0.651147
fdsalbj
53127eaa0c23b10c46391f8b88f95e066d5df024
181
cpp
C++
chapters/1/1-10.cpp
Raymain1944/CPPLv1
96e5fd5347a336870fc868206ebfe44f88ce69eb
[ "Apache-2.0" ]
null
null
null
chapters/1/1-10.cpp
Raymain1944/CPPLv1
96e5fd5347a336870fc868206ebfe44f88ce69eb
[ "Apache-2.0" ]
null
null
null
chapters/1/1-10.cpp
Raymain1944/CPPLv1
96e5fd5347a336870fc868206ebfe44f88ce69eb
[ "Apache-2.0" ]
null
null
null
#include <iostream> /* * 使用递减运算符打印10到0之间的整数 */ int main() { int base = 10; while(base >= 0){ std::cout << base << std::endl; --base; } return 0; }
12.928571
39
0.486188
Raymain1944
531421e1ca3b40383e7cb57725b02c17f7238ee8
215
cpp
C++
ares/sfc/coprocessor/dip/dip.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
153
2020-07-25T17:55:29.000Z
2021-10-01T23:45:01.000Z
ares/sfc/coprocessor/dip/dip.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
245
2021-10-08T09:14:46.000Z
2022-03-31T08:53:13.000Z
ares/sfc/coprocessor/dip/dip.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
44
2020-07-25T08:51:55.000Z
2021-09-25T16:09:01.000Z
//DIP switch //used for Nintendo Super System emulation DIP dip; #include "serialization.cpp" auto DIP::power() -> void { } auto DIP::read(n24, n8) -> n8 { return value; } auto DIP::write(n24, n8) -> void { }
13.4375
42
0.646512
CasualPokePlayer
531507ccae44b4d0653aa8c98c677bbb806d7f9f
13,857
cpp
C++
src/spy/Spy.cpp
VincentPT/spy
f3b4dd87d00cf12886f52b4ee30ee15430317acd
[ "MIT" ]
1
2022-02-14T12:42:26.000Z
2022-02-14T12:42:26.000Z
src/spy/Spy.cpp
VincentPT/spy
f3b4dd87d00cf12886f52b4ee30ee15430317acd
[ "MIT" ]
null
null
null
src/spy/Spy.cpp
VincentPT/spy
f3b4dd87d00cf12886f52b4ee30ee15430317acd
[ "MIT" ]
null
null
null
#include "Spy.h" #include <Shlwapi.h> #include <Windows.h> #include <iostream> #include <vector> #include <list> #include "CustomCommandInvoker.h" #include "CustomCommandManager.h" #include "spy_interfaces.h" // internal command function handlers int freeBufferCommand(FreeBufferCmdData* commandData); int loadPredifnedFunctions(LoadPredefinedCmdData* param); int invokeCustomCommand(CustomCommandCmdData* commandData); int LoadCustomFunctions(LoadCustomFunctionsCmdData* commandData); int unloadModule(UnloadModuleCmdData* commandData); int getFunctionPtr(GetFunctionPtrCmdData* commandData); int getModule(GetModuleCmdData* commandData); int getModulePath(GetModulePathCmdData* commandData); // using namespaces using namespace std; // extern variables declaration extern int _runner_count; // global variables CustomFunctionManager customFunctionManager; // macro definition #define GetPredefinedFunctionCountName "getPredefinedFunctionCount" #define LoadPredefinedFunctionsName "loadPredefinedFunctions" // internal structures struct SetPredefinedCommandContext { ModuleInfo* moduleInfo; CustomCommandId commandBase; unsigned short loadedFunctionCount; }; extern "C" { SPY_API DWORD spyRoot(BaseCmdData* param) { switch (param->commandId) { case CommandId::CUSTOM_COMMAND: return invokeCustomCommand((CustomCommandCmdData*)param); case CommandId::FREE_BUFFER: return freeBufferCommand((FreeBufferCmdData*)param); case CommandId::LOAD_PREDEFINED_FUNCTIONS: return loadPredifnedFunctions((LoadPredefinedCmdData*)param); case CommandId::LOAD_CUSTOM_FUNCTIONS: return LoadCustomFunctions((LoadCustomFunctionsCmdData*)param); case CommandId::UNLOAD_MODULE: return unloadModule((UnloadModuleCmdData*)param); case CommandId::GET_CUSTOM_FUNCTION_PTR: return getFunctionPtr((GetFunctionPtrCmdData*)param); case CommandId::GET_MODULE: return getModule((GetModuleCmdData*)param); case CommandId::GET_MODULE_PATH: return getModulePath((GetModulePathCmdData*)param); default: break; } return -1; } } int freeBufferCommand(FreeBufferCmdData* commandData) { if (commandData->commandSize != sizeof(FreeBufferCmdData)) { cout << "Invalid free buffer command" << std::endl; return -1; } cout << "deallocated buffer:" << commandData->buffer << std::endl; free(commandData->buffer); //VirtualFree(commandData->buffer, commandData->bufferSize, MEM_RELEASE); return 0; } inline CustomCommandId addCustomFunction(void* pFunc, const char* sFunctionName) { return customFunctionManager.addCustomFunction(pFunc, sFunctionName); } int setCustomFunction(SetPredefinedCommandContext* context, CustomCommandId cmdId, void* pFunc) { if (context == nullptr) { cout << "setCustomFunction must be call with suppiled context of function " LoadPredefinedFunctionsName << std::endl; return -1; } ModuleInfo* moduleInfo = context->moduleInfo; cmdId = cmdId + context->commandBase; if (!customFunctionManager.setCustomFunction(cmdId, pFunc, "predefined function")) { return -1; } moduleInfo->commandListRef->push_back(cmdId); cout << "Command " << cmdId << " loaded!" << std::endl; context->loadedFunctionCount++; return 0; } inline void* getCustomFunction(CustomCommandId cmdId) { return customFunctionManager.getFunctionAddress(cmdId); } // load custom functions function // all custom functions must be set here int loadPredifnedFunctions(LoadPredefinedCmdData* param) { if (param->commandSize < sizeof(LoadPredefinedCmdData)) { cout << "Invalid custom command:" << (unsigned short)param->commandId << std::endl; return -1; } ReturnData& returnData = param->returnData; returnData.customData = nullptr; returnData.sizeOfCustomData = 0; char* dllFile = param->dllName; // first try load the dll file as it is, dll file can be an absolute path or a relative path HMODULE hModule = LoadLibrary(dllFile); // if dll cannot be load... if (hModule == NULL) { // if the dll file is a relative path, we find it in location of root dll HMODULE hModuleRoot = GetModuleHandle(SPY_ROOT_DLL_NAME); if (hModuleRoot == nullptr) { cout << "Name of spy root dll is changed." << std::endl; return -1; } char path[MAX_PATH]; int pathLen; if (!(pathLen = GetModuleFileName(hModuleRoot, path, MAX_PATH))) { cout << "Cannot find location of root dll path" << std::endl; return -1; } // remove root dll name to get the directory path[pathLen - strlen(SPY_ROOT_DLL_NAME)] = 0; string moduleFullPath(path); moduleFullPath.append(dllFile); hModule = LoadLibrary(moduleFullPath.c_str()); if (hModule == nullptr) { cout << "Cannot find location of spy lib dll (" << dllFile << ")" << std::endl; return -1; } } auto GetPredefinedFunctionCount = (FGetPredefinedFunctionCount)GetProcAddress(hModule, GetPredefinedFunctionCountName); if (GetPredefinedFunctionCount == nullptr) { FreeLibrary(hModule); cout << dllFile << " does not contain function " GetPredefinedFunctionCountName << std::endl; return -1; } auto LoadPredefinedFunctions = (FLoadPredefinedFunctions)GetProcAddress(hModule, LoadPredefinedFunctionsName); if (LoadPredefinedFunctions == nullptr) { FreeLibrary(hModule); cout << dllFile << " does not contain function " LoadPredefinedFunctionsName << std::endl; return -1; } auto moduleInfo = customFunctionManager.createModuleContainer(hModule, dllFile); returnData.sizeOfCustomData = sizeof(LoadPredefinedReturnData); auto pLoadPredefinedReturnData = (LoadPredefinedReturnData*)malloc(returnData.sizeOfCustomData); returnData.customData = (char*)pLoadPredefinedReturnData; pLoadPredefinedReturnData->hModule = hModule; pLoadPredefinedReturnData->moduleId = moduleInfo->moduleId; int iNumberOfPredefinedFunction = GetPredefinedFunctionCount(); // check if there is no predefined functions need to be loaded if (iNumberOfPredefinedFunction <= 0) { return MAKE_RESULT_OF_LOAD_PREDEFINED_FUNC(0, CUSTOM_COMMAND_END); } SetPredefinedCommandContext context; context.moduleInfo = moduleInfo; context.commandBase = (CustomCommandId)customFunctionManager.getCommandCount(); context.loadedFunctionCount = 0; // add space to store predefined functions customFunctionManager.addFunctionSpace(iNumberOfPredefinedFunction); // call the funcion the load the predefined function to the engine int iRes = LoadPredefinedFunctions(&context, (FSetPredefinedFunction)setCustomFunction, context.commandBase); if (iRes != 0) { // unload all loadded function of the module customFunctionManager.unloadModule(moduleInfo->moduleId); cout << LoadPredefinedFunctionsName " return a cancelled value(" << iRes << "the loading result will be discard" << std::endl; return MAKE_RESULT_OF_LOAD_PREDEFINED_FUNC(0, CUSTOM_COMMAND_END); } return MAKE_RESULT_OF_LOAD_PREDEFINED_FUNC(context.loadedFunctionCount, context.commandBase); } // this function use to invoke the corresponding custom function with the custom data int invokeCustomCommand(CustomCommandCmdData* commandData) { if (commandData->commandSize != sizeof(CustomCommandCmdData) + (commandData->paramCount - 1) * sizeof(void*)) { cout << "Invalid custom command:" << commandData->commandSize << std::endl; return -1; } // get function pointer void* fx = getCustomFunction(commandData->customCommandId); if (fx == nullptr) { cout << "custom command '" << (unsigned short)commandData->customCommandId << "' has been not set" << std::endl; return -1; } if (_runner_count <= commandData->paramCount) { cout << "custom command " << commandData->paramCount << " parameters has been not supported" << std::endl; return -1; } CustomCommandInvoker invoker(fx, commandData->paramCount); commandData->returnData = invoker.invoke(commandData->params); return 0; } int LoadCustomFunctions(LoadCustomFunctionsCmdData* commandData) { if (commandData->commandSize < sizeof(LoadCustomFunctionsCmdData)) { cout << "Invalid load custom command" << std::endl; return -1; } int bufferSize = commandData->commandSize - sizeof(LoadCustomFunctionsCmdData) + sizeof(LoadCustomFunctionsCmdData::fNames); if (commandData->fNames[bufferSize - 1] != 0) { cout << "Invalid load custom command" << std::endl; return -1; } char* dllFile = commandData->fNames; char* endBuffer = dllFile + bufferSize; auto c = dllFile + strlen(dllFile) + 1; // first try load the dll file as it is, dll file can be an absolute path or a relative path HMODULE hModule = LoadLibrary(dllFile); vector<CustomCommandId> commandIds; commandData->returnData.sizeOfCustomData = 0; commandData->returnData.customData = nullptr; // if dll cannot be load... if (hModule == NULL) { // if the dll file is not a relative path, we don't process more if (!PathIsRelative(dllFile)) { return 0; } // if the dll file is a relative path, we find it in location of root dll HMODULE hModuleRoot = GetModuleHandle(SPY_ROOT_DLL_NAME); if (hModuleRoot == nullptr) { cout << "Name of spy root dll is changed." << std::endl; return -1; } char path[MAX_PATH]; int pathLen; if (!(pathLen = GetModuleFileName(hModuleRoot, path, MAX_PATH))) { cout << "Cannot find location of root dll path" << std::endl; return -1; } // remove root dll name to get the directory path[pathLen - strlen(SPY_ROOT_DLL_NAME)] = 0; string moduleFullPath(path); moduleFullPath.append(dllFile); hModule = LoadLibrary(moduleFullPath.c_str()); if (hModule == nullptr) { cout << "Cannot find location of " << dllFile << std::endl; return 0; } } auto moduleInfo = customFunctionManager.createModuleContainer(hModule, dllFile); // load procs address from the loaded dll file void* pFunc; CustomCommandId customCommandId; while (c < endBuffer) { while (c < endBuffer && (*c == ' ' || *c == '\t') || *c == 0) { c++; } if (c >= endBuffer) { break; } pFunc = GetProcAddress(hModule, c); if (pFunc) { customCommandId = addCustomFunction(pFunc, c); if (customCommandId != CUSTOM_COMMAND_END && moduleInfo) { moduleInfo->commandListRef->push_back(customCommandId); cout << "Command " << c << " <--> " << customCommandId << " loaded!" << std::endl; } } else { customCommandId = CUSTOM_COMMAND_END; } commandIds.push_back(customCommandId); c += strlen(c) + 1; } ReturnData& returnData = commandData->returnData; returnData.sizeOfCustomData = (int)(sizeof(LoadCustomFunctionsReturnData) - sizeof(LoadCustomFunctionsReturnData::cmdIds) + commandIds.size() * sizeof(CustomCommandId)); // allocate memory for return data, spy client should be responsible to free the memory after using LoadCustomFunctionsReturnData* pCustomFunctionsReturnData = (LoadCustomFunctionsReturnData*)malloc(returnData.sizeOfCustomData); returnData.customData = (char*)pCustomFunctionsReturnData; pCustomFunctionsReturnData->hModule = hModule; pCustomFunctionsReturnData->moduleId = moduleInfo->moduleId; memcpy_s(&pCustomFunctionsReturnData->cmdIds[0], commandIds.size() * sizeof(CustomCommandId), commandIds.data(), commandIds.size() * sizeof(CustomCommandId)); return 0; } int unloadModule(UnloadModuleCmdData* commandData) { if (commandData->commandSize != sizeof(UnloadModuleCmdData)) { cout << "Invalid load custom command" << std::endl; return -1; } return customFunctionManager.unloadModule(commandData->moduleId) ? 0 : 1; } int getFunctionPtr(GetFunctionPtrCmdData* commandData) { if (commandData->commandSize != sizeof(GetFunctionPtrCmdData)) { cout << "Invalid load custom command" << std::endl; return -1; } commandData->ptr = customFunctionManager.getFunctionAddress(commandData->customCommandId); return 0; } int getModule(GetModuleCmdData* commandData) { if (commandData->commandSize != sizeof(GetModuleCmdData)) { cout << "Invalid load custom command" << std::endl; return -1; } auto& returnData = commandData->returnData; returnData.customData = nullptr; returnData.sizeOfCustomData = 0; returnData.returnCode = 0; auto moduleInfo = customFunctionManager.getModuleContainer(commandData->moduleId); int cmdCount = 0; int rawDataSize = sizeof(ModuleData) - sizeof(ModuleData::cmdIds); if (moduleInfo != nullptr) { auto commandListRef = moduleInfo->commandListRef; ModuleData* pModuleData; if (commandListRef) { cmdCount = (int)moduleInfo->commandListRef->size(); rawDataSize += cmdCount * sizeof(CustomCommandId); pModuleData = (ModuleData*)malloc(rawDataSize); auto pCmdId = pModuleData->cmdIds; for (auto it = commandListRef->begin(); it != commandListRef->end(); it++) { *pCmdId++ = *it; } } else { pModuleData = (ModuleData*)malloc(rawDataSize); } pModuleData->hModule = moduleInfo->hModule; pModuleData->commandCount = cmdCount; returnData.customData = (char*)pModuleData; returnData.sizeOfCustomData = rawDataSize; } return 0; } int getModulePath(GetModulePathCmdData* commandData) { if (commandData->commandSize != sizeof(GetModulePathCmdData)) { cout << "Invalid load custom command" << std::endl; return -1; } auto& returnData = commandData->returnData; returnData.customData = nullptr; returnData.sizeOfCustomData = 0; returnData.returnCode = 0; auto moduleInfo = customFunctionManager.getModuleContainer(commandData->moduleId); int cmdCount = 0; if (moduleInfo != nullptr) { HMODULE hModule = moduleInfo->hModule; int bufferSize = MAX_PATH; int rawDataSize = sizeof(ModulePathData) - sizeof(ModulePathData::path) + bufferSize; ModulePathData* pModuleData; pModuleData = (ModulePathData*)malloc(rawDataSize); pModuleData->hModule = moduleInfo->hModule; pModuleData->bufferSize = bufferSize; GetModuleFileNameA(hModule, pModuleData->path, bufferSize); returnData.customData = (char*)pModuleData; returnData.sizeOfCustomData = rawDataSize; } return 0; }
33.633495
170
0.748358
VincentPT
531835c944c674196e44c74ac93ada0b75ffd32a
1,077
cpp
C++
c++/omarket/omarket/mainframe.cpp
optimus-informatica/omarket-qt
ea2285e1e587b83c8cf15ef06e1ee22e39a46e8a
[ "Apache-2.0" ]
null
null
null
c++/omarket/omarket/mainframe.cpp
optimus-informatica/omarket-qt
ea2285e1e587b83c8cf15ef06e1ee22e39a46e8a
[ "Apache-2.0" ]
null
null
null
c++/omarket/omarket/mainframe.cpp
optimus-informatica/omarket-qt
ea2285e1e587b83c8cf15ef06e1ee22e39a46e8a
[ "Apache-2.0" ]
null
null
null
#include "mainframe.h" #include "ui_mainframe.h" MainFrame::MainFrame(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainFrame) { ui->setupUi(this); QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL"); db.setHostName("localhost"); db.setPort(5432); db.setUserName("omarket"); db.setDatabaseName("o_market"); if (!db.open()) { qDebug() << " ERRO " << db.lastError(); } settings = new QSettings; loginDialog = new LoginDialog(settings, this); produtosDialog = new ProdutosDialog(this); connect(loginDialog, &LoginDialog::accepted, this, &MainFrame::logonAccept); connect(loginDialog, &LoginDialog::rejected, this, &MainFrame::logonReject); loginDialog->show(); ui->tabs->clear(); ui->tabs->addTab(new CaixaForm(settings), "Caixa"); } MainFrame::~MainFrame() { delete ui; } // SLOTS void MainFrame::logonAccept() { qDebug() << settings->value("session/usuarioid"); } void MainFrame::logonReject() { this->close(); } void MainFrame::openProdutos() { produtosDialog->show(); }
20.711538
82
0.657382
optimus-informatica
531b53c42ec6d2d4364908c747ef96121e018a25
1,121
cc
C++
gcc-gcc-7_3_0-release/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
best08618/asylo
5a520a9f5c461ede0f32acc284017b737a43898c
[ "Apache-2.0" ]
7
2020-05-02T17:34:05.000Z
2021-10-17T10:15:18.000Z
gcc-gcc-7_3_0-release/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
best08618/asylo
5a520a9f5c461ede0f32acc284017b737a43898c
[ "Apache-2.0" ]
null
null
null
gcc-gcc-7_3_0-release/libstdc++-v3/testsuite/20_util/duration/literals/range.cc
best08618/asylo
5a520a9f5c461ede0f32acc284017b737a43898c
[ "Apache-2.0" ]
2
2020-07-27T00:22:36.000Z
2021-04-01T09:41:02.000Z
// { dg-do compile { target c++14 } } // Copyright (C) 2014-2017 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library 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, 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 General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. #include <chrono> void test01() { using namespace std::literals::chrono_literals; // std::numeric_limits<int64_t>::max() == 9223372036854775807; auto h = 9223372036854775808h; // { dg-error "cannot be represented" "" { target *-*-* } 893 } } // { dg-prune-output "in constexpr expansion" } // needed for -O0
35.03125
74
0.714541
best08618
531e78bfa2c8716a6cf77d286ea5767c4ecf7ab4
1,260
cpp
C++
CTCI/Chapter3/3-4.cpp
EdwaRen/Competitve-Programming
e8bffeb457936d28c75ecfefb5a1f316c15a9b6c
[ "MIT" ]
1
2021-05-03T21:48:25.000Z
2021-05-03T21:48:25.000Z
CTCI/Chapter3/3-4.cpp
EdwaRen/Competitve_Programming
e8bffeb457936d28c75ecfefb5a1f316c15a9b6c
[ "MIT" ]
null
null
null
CTCI/Chapter3/3-4.cpp
EdwaRen/Competitve_Programming
e8bffeb457936d28c75ecfefb5a1f316c15a9b6c
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; const int MAX_SIZE = 100; class Stack { private: int cur; int *buf; int capacity; public: Stack(int capa = MAX_SIZE) { capacity = capa; cur = -1; buf = new int[capa]; } void updateQueue() { // if (bufFilled) { for (int i = 0; i < cur; i++) { queue[i] = buf[cur-i]; bufFilled = !bufFilled; } // } else { // for (int i = 0; i < cur; i++) { // buf[i] = queue[cur-i]; // bufFilled = !bufFilled; // } // } } void push(int value) { cur++; buf[cur] = value; } void pop() { cur--; } int peak() { return buf[cur]; } int size() { return cur; } bool isEmpty() { return (cur == -1); } } class MyQueue { private: Stack stackNew; Stack stackOld; public: MyQueue(int capa) { stackNew = Stack(capa); stackOld = Stack(capa) } void add(int value) { stackNew.push(value); } void shiftStacks() { if (stackOld.isEmpty) { while (!stackNew.isEmpty()) { stackOld.push(stackNew.peak()); stackNew.pop(); } } } int peek() { shiftStacks(); return(stackOld.peak()) } void remove() { shiftStacks(); stackOld.pop(); } }
14.651163
40
0.512698
EdwaRen