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
138b76dce495b006a8db1478e0c30014407eb225
11,524
cpp
C++
example/runtime_property_change.cpp
JSUYA/rive-tizen
f62cf0bc8a60bc4293855150e926163d446ac57e
[ "MIT" ]
null
null
null
example/runtime_property_change.cpp
JSUYA/rive-tizen
f62cf0bc8a60bc4293855150e926163d446ac57e
[ "MIT" ]
null
null
null
example/runtime_property_change.cpp
JSUYA/rive-tizen
f62cf0bc8a60bc4293855150e926163d446ac57e
[ "MIT" ]
null
null
null
#include <thread> #include <dirent.h> #include <algorithm> #include <Elementary.h> #include <rive_tizen.hpp> #include "shapes/paint/fill.hpp" #include "shapes/paint/stroke.hpp" #include "shapes/paint/color.hpp" #include "shapes/paint/solid_color.hpp" #include "animation/linear_animation_instance.hpp" #include "artboard.hpp" #include "file.hpp" #include "tvg_renderer.hpp" using namespace std; #define WIDTH 1000 #define HEIGHT 700 #define LIST_HEIGHT 200 static unique_ptr<tvg::SwCanvas> canvas = nullptr; static rive::File* currentFile = nullptr; static rive::Artboard* artboard = nullptr; static rive::LinearAnimationInstance* animationInstance = nullptr; static Ecore_Animator *animator = nullptr; static Eo* view = nullptr; static vector<std::string> rivefiles; static double lastTime; static Eo* statePopup = nullptr; std::string currentColorInstance; Eo *entryR, *entryG, *entryB, *entryA; static void deleteWindow(void *data, Evas_Object *obj, void *ev) { elm_exit(); } static void drawToCanvas(void* data, Eo* obj) { if (canvas->draw() == tvg::Result::Success) canvas->sync(); } static void initAnimation(int index) { delete animationInstance; animationInstance = nullptr; auto animation = artboard->animation(index); if (animation) animationInstance = new rive::LinearAnimationInstance(animation); } static void loadRiveFile(const char* filename) { lastTime = ecore_time_get(); //Check point // Load Rive File FILE* fp = fopen(filename, "r"); fseek(fp, 0, SEEK_END); size_t length = ftell(fp); fseek(fp, 0, SEEK_SET); uint8_t* bytes = new uint8_t[length]; if (fread(bytes, 1, length, fp) != length) { delete[] bytes; fprintf(stderr, "failed to read all of %s\n", filename); return; } auto reader = rive::BinaryReader(bytes, length); rive::File* file = nullptr; auto result = rive::File::import(reader, &file); if (result != rive::ImportResult::success) { delete[] bytes; fprintf(stderr, "failed to import %s\n", filename); return; } artboard = file->artboard(); artboard->advance(0.0f); delete animationInstance; animationInstance = nullptr; auto animation = artboard->firstAnimation(); if (animation) animationInstance = new rive::LinearAnimationInstance(animation); delete currentFile; currentFile = file; delete[] bytes; } Eina_Bool animationLoop(void *data) { canvas->clear(); double currentTime = ecore_time_get(); float elapsed = currentTime - lastTime; lastTime = currentTime; if (!artboard || !animationInstance) return ECORE_CALLBACK_RENEW; artboard->updateComponents(); animationInstance->advance(elapsed); animationInstance->apply(artboard); artboard->advance(elapsed); rive::TvgRenderer renderer(canvas.get()); renderer.save(); renderer.align(rive::Fit::contain, rive::Alignment::center, rive::AABB(0, 0, WIDTH, HEIGHT), artboard->bounds()); artboard->draw(&renderer); renderer.restore(); evas_object_image_pixels_dirty_set(view, EINA_TRUE); evas_object_image_data_update_add(view, 0, 0, WIDTH, HEIGHT); return ECORE_CALLBACK_RENEW; } static void runExample(uint32_t* buffer) { std::string path = RIVE_FILE_DIR; path.append("runtime_color_change.riv"); loadRiveFile(path.c_str()); //Create a Canvas canvas = tvg::SwCanvas::gen(); canvas->target(buffer, WIDTH, WIDTH, HEIGHT, tvg::SwCanvas::ARGB8888); animator = ecore_animator_add(animationLoop, nullptr); } static void cleanExample() { delete animationInstance; } static void animPopupItemCb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info) { int animationIndex = static_cast<int>(reinterpret_cast<intptr_t>(data)); initAnimation(animationIndex); elm_ctxpopup_dismiss(statePopup); } static Elm_Object_Item* animPopupItemNew(Evas_Object *obj, const char *label, int index) { if (!obj) return nullptr; return elm_ctxpopup_item_append(obj, label, nullptr, animPopupItemCb, reinterpret_cast<void*>(index)); } static void animPopupDismissCb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) { evas_object_del(obj); statePopup = nullptr; } static void viewClickedCb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) { if (!artboard) return; if (statePopup) evas_object_del(statePopup); statePopup = elm_ctxpopup_add(obj); evas_object_smart_callback_add(statePopup, "dismissed", animPopupDismissCb, nullptr); for (size_t index = 0; index < artboard->animationCount(); index++) animPopupItemNew(statePopup, artboard->animation(index)->name().c_str(), index); int x, y; evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); evas_object_move(statePopup, x, y); evas_object_show(statePopup); } static void selectedCb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) { const char *text = elm_object_item_text_get((Elm_Object_Item*)event_info); currentColorInstance = text; } static void applyCb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { const char *r = elm_object_text_get(entryR); const char *g = elm_object_text_get(entryG); const char *b = elm_object_text_get(entryB); const char *a = elm_object_text_get(entryA); printf("current vector instance: %s r:%d g:%d b:%d a:%d\n", currentColorInstance.c_str(), atoi(r), atoi(g), atoi(b), atoi(a)); auto colorInstance = artboard->find<rive::Fill>(currentColorInstance.c_str()); if (colorInstance) colorInstance->paint()->as<rive::SolidColor>()->colorValue(rive::colorARGB(atoi(a), atoi(r), atoi(g), atoi(b))); } static void setupScreen(uint32_t* buffer) { Eo* win = elm_win_util_standard_add(nullptr, "Rive-Tizen Viewer"); evas_object_smart_callback_add(win, "delete,request", deleteWindow, 0); Eo* box = elm_box_add(win); evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, box); evas_object_show(box); view = evas_object_image_filled_add(evas_object_evas_get(box)); evas_object_image_size_set(view, WIDTH, HEIGHT); evas_object_image_data_set(view, buffer); evas_object_image_pixels_get_callback_set(view, drawToCanvas, nullptr); evas_object_image_pixels_dirty_set(view, EINA_TRUE); evas_object_image_data_update_add(view, 0, 0, WIDTH, HEIGHT); evas_object_size_hint_weight_set(view, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_min_set(view, WIDTH, HEIGHT); evas_object_show(view); elm_box_pack_end(box, view); evas_object_event_callback_add(view, EVAS_CALLBACK_MOUSE_UP, viewClickedCb, nullptr); Eo* hoversel = elm_hoversel_add(win); elm_hoversel_auto_update_set(hoversel, EINA_TRUE); elm_hoversel_hover_parent_set(hoversel, win); evas_object_smart_callback_add(hoversel, "selected", selectedCb, NULL); evas_object_size_hint_weight_set(hoversel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(hoversel, EVAS_HINT_FILL, 0.0); elm_object_text_set(hoversel, "Vector Instances"); elm_hoversel_item_add(hoversel, "body_color", NULL, ELM_ICON_NONE, NULL, NULL); elm_hoversel_item_add(hoversel, "straw_color", NULL, ELM_ICON_NONE, NULL, NULL); elm_hoversel_item_add(hoversel, "eye_left_color", NULL, ELM_ICON_NONE, NULL, NULL); elm_hoversel_item_add(hoversel, "eye_right_color", NULL, ELM_ICON_NONE, NULL, NULL); elm_hoversel_item_add(hoversel, "mouse_color", NULL, ELM_ICON_NONE, NULL, NULL); evas_object_show(hoversel); elm_box_pack_end(box, hoversel); Eo* colorBox = elm_box_add(win); elm_box_horizontal_set(colorBox, true); evas_object_size_hint_weight_set(colorBox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(colorBox, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(box, colorBox); Eo* colorRText = elm_label_add(colorBox); elm_object_text_set(colorRText, "R : "); evas_object_size_hint_weight_set(colorRText, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(colorRText); entryR = elm_entry_add(colorBox); elm_entry_scrollable_set(entryR, EINA_TRUE); elm_entry_single_line_set(entryR, EINA_TRUE); elm_scroller_policy_set(entryR, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF); evas_object_size_hint_weight_set(entryR, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(entryR, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(entryR); elm_box_pack_end(colorBox, colorRText); elm_box_pack_end(colorBox, entryR); Eo* colorGText = elm_label_add(colorBox); elm_object_text_set(colorGText, "G : "); evas_object_size_hint_weight_set(colorGText, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(colorGText); entryG = elm_entry_add(colorBox); elm_entry_single_line_set(entryG, EINA_TRUE); elm_entry_scrollable_set(entryG, EINA_TRUE); elm_entry_single_line_set(entryG, EINA_TRUE); evas_object_size_hint_weight_set(entryG, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(entryG, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(entryG); elm_box_pack_end(colorBox, colorGText); elm_box_pack_end(colorBox, entryG); Eo* colorBText = elm_label_add(colorBox); elm_object_text_set(colorBText, "B : "); evas_object_size_hint_weight_set(colorBText, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(colorBText); entryB = elm_entry_add(colorBox); elm_entry_single_line_set(entryB, EINA_TRUE); elm_entry_scrollable_set(entryB, EINA_TRUE); elm_entry_single_line_set(entryB, EINA_TRUE); evas_object_size_hint_weight_set(entryB, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(entryB, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(entryB); elm_box_pack_end(colorBox, colorBText); elm_box_pack_end(colorBox, entryB); Eo* colorAText = elm_label_add(colorBox); elm_object_text_set(colorAText, "A : "); evas_object_size_hint_weight_set(colorAText, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(colorAText); entryA = elm_entry_add(colorBox); elm_entry_single_line_set(entryA, EINA_TRUE); elm_entry_scrollable_set(entryA, EINA_TRUE); elm_entry_single_line_set(entryA, EINA_TRUE); evas_object_size_hint_weight_set(entryA, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(entryA, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(entryA); elm_box_pack_end(colorBox, colorAText); elm_box_pack_end(colorBox, entryA); Eo* applyButton = elm_button_add(colorBox); elm_object_text_set(applyButton, "Apply"); evas_object_smart_callback_add(applyButton, "clicked", applyCb, nullptr); evas_object_show(applyButton); elm_box_pack_end(colorBox, applyButton); evas_object_show(colorBox); evas_object_resize(win, WIDTH, HEIGHT + LIST_HEIGHT); evas_object_show(win); } int main(int argc, char **argv) { static uint32_t buffer[WIDTH * HEIGHT]; tvg::Initializer::init(tvg::CanvasEngine::Sw, thread::hardware_concurrency()); elm_init(argc, argv); setupScreen(buffer); runExample(buffer); elm_run(); cleanExample(); elm_shutdown(); tvg::Initializer::term(tvg::CanvasEngine::Sw); return 0; }
33.114943
129
0.738719
JSUYA
138e11ef61f9342e7b2e8b4cd1c556cf7272247f
2,680
cpp
C++
src/nc/common/Escaping.cpp
treadstoneproject/tracethreat_nrml
bcf666b01c20f7da4234fed018dad3b2cf4d3d28
[ "Apache-2.0" ]
6
2016-09-06T02:10:08.000Z
2021-01-19T09:02:04.000Z
src/nc/common/Escaping.cpp
treadstoneproject/tracethreat_nrml
bcf666b01c20f7da4234fed018dad3b2cf4d3d28
[ "Apache-2.0" ]
null
null
null
src/nc/common/Escaping.cpp
treadstoneproject/tracethreat_nrml
bcf666b01c20f7da4234fed018dad3b2cf4d3d28
[ "Apache-2.0" ]
6
2015-10-02T14:11:45.000Z
2021-01-19T09:02:07.000Z
/* The file is part of Snowman decompiler. */ /* See doc/licenses.asciidoc for the licensing information. */ // // SmartDec decompiler - SmartDec is a native code to C/C++ decompiler // Copyright (C) 2015 Alexander Chernov, Katerina Troshina, Yegor Derevenets, // Alexander Fokin, Sergey Levin, Leonid Tsvetkov // // This file is part of SmartDec decompiler. // // SmartDec decompiler 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. // // SmartDec decompiler 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 SmartDec decompiler. If not, see <http://www.gnu.org/licenses/>. // #include "Escaping.h" #include <Foreach.h> //#include <Qfbstring> namespace nc { fbstring escapeDotString(const fbstring &string) { fbstring result; result.reserve(string.size()); foreach (char c, string) { //toLatin1() switch (c) { case '\\': result += "\\\\"; break; case '"': result += "\\\""; break; case '\n': result += "\\n"; break; default: result += c; break; } } return result; } fbstring escapeCString(const fbstring &string) { fbstring result; result.reserve(string.size()); foreach (char c, string) { switch (c) { case '\\': result += "\\\\"; break; case '\a': result += "\\a"; break; case '\b': result += "\\b"; break; case '\f': result += "\\f"; break; case '\n': result += "\\n"; break; case '\r': result += "\\r"; break; case '\t': result += "\\t"; break; case '\v': result += "\\v"; break; case '"': result += "\\\""; break; default: result += c; break; } } return result; } } // namespace nc /* vim:set et sts=4 sw=4: */
26.019417
79
0.496269
treadstoneproject
13902d871b65094252561d3245951094dd1dc8ce
19,406
hpp
C++
src/dense/DistributedMatrix.hpp
skn123/STRUMPACK
4c2f9b0b411e9a334900acab02ea89d91fbc8e59
[ "BSD-3-Clause-LBNL" ]
77
2017-06-11T15:18:56.000Z
2022-03-28T02:01:28.000Z
src/dense/DistributedMatrix.hpp
skn123/STRUMPACK
4c2f9b0b411e9a334900acab02ea89d91fbc8e59
[ "BSD-3-Clause-LBNL" ]
42
2017-11-02T12:18:04.000Z
2022-03-19T15:07:58.000Z
src/dense/DistributedMatrix.hpp
skn123/STRUMPACK
4c2f9b0b411e9a334900acab02ea89d91fbc8e59
[ "BSD-3-Clause-LBNL" ]
19
2017-07-22T14:31:37.000Z
2021-09-25T04:04:23.000Z
/* * STRUMPACK -- STRUctured Matrices PACKage, Copyright (c) 2014, The * Regents of the University of California, through Lawrence Berkeley * National Laboratory (subject to receipt of any required approvals * from the U.S. Dept. of Energy). All rights reserved. * * If you have questions about your rights to use or distribute this * software, please contact Berkeley Lab's Technology Transfer * Department at TTD@lbl.gov. * * NOTICE. This software is owned by the U.S. Department of Energy. As * such, the U.S. Government has been granted for itself and others * acting on its behalf a paid-up, nonexclusive, irrevocable, * worldwide license in the Software to reproduce, prepare derivative * works, and perform publicly and display publicly. Beginning five * (5) years after the date permission to assert copyright is obtained * from the U.S. Department of Energy, and subject to any subsequent * five (5) year renewals, the U.S. Government is granted for itself * and others acting on its behalf a paid-up, nonexclusive, * irrevocable, worldwide license in the Software to reproduce, * prepare derivative works, distribute copies to the public, perform * publicly and display publicly, and to permit others to do so. * * Developers: Pieter Ghysels, Francois-Henry Rouet, Xiaoye S. Li. * (Lawrence Berkeley National Lab, Computational Research * Division). */ #ifndef DISTRIBUTED_MATRIX_HPP #define DISTRIBUTED_MATRIX_HPP #include <vector> #include <string> #include <cmath> #include <functional> #include "misc/MPIWrapper.hpp" #include "misc/RandomWrapper.hpp" #include "DenseMatrix.hpp" #include "BLACSGrid.hpp" namespace strumpack { inline int indxl2g(int INDXLOC, int NB, int IPROC, int ISRCPROC, int NPROCS) { return NPROCS*NB*((INDXLOC-1)/NB) + (INDXLOC-1) % NB + ((NPROCS+IPROC-ISRCPROC) % NPROCS)*NB + 1; } inline int indxg2l(int INDXGLOB, int NB, int IPROC, int ISRCPROC, int NPROCS) { return NB*((INDXGLOB-1)/(NB*NPROCS)) + (INDXGLOB-1) % NB + 1; } inline int indxg2p(int INDXGLOB, int NB, int IPROC, int ISRCPROC, int NPROCS) { return ( ISRCPROC + (INDXGLOB - 1) / NB ) % NPROCS; } template<typename scalar_t> class DistributedMatrix { using real_t = typename RealType<scalar_t>::value_type; protected: const BLACSGrid* grid_ = nullptr; scalar_t* data_ = nullptr; int lrows_; int lcols_; int desc_[9]; public: DistributedMatrix(); DistributedMatrix(const BLACSGrid* g, int M, int N); DistributedMatrix(const BLACSGrid* g, int M, int N, const std::function<scalar_t(std::size_t, std::size_t)>& A); DistributedMatrix(const BLACSGrid* g, const DenseMatrix<scalar_t>& m); DistributedMatrix(const BLACSGrid* g, DenseMatrix<scalar_t>&& m); DistributedMatrix(const BLACSGrid* g, DenseMatrixWrapper<scalar_t>&& m); DistributedMatrix(const BLACSGrid* g, int M, int N, const DistributedMatrix<scalar_t>& m, int context_all); DistributedMatrix(const BLACSGrid* g, int M, int N, int MB, int NB); DistributedMatrix(const BLACSGrid* g, int desc[9]); DistributedMatrix(const DistributedMatrix<scalar_t>& m); DistributedMatrix(DistributedMatrix<scalar_t>&& m); virtual ~DistributedMatrix(); DistributedMatrix<scalar_t>& operator=(const DistributedMatrix<scalar_t>& m); DistributedMatrix<scalar_t>& operator=(DistributedMatrix<scalar_t>&& m); const int* desc() const { return desc_; } int* desc() { return desc_; } bool active() const { return grid() && grid()->active(); } const BLACSGrid* grid() const { return grid_; } const MPIComm& Comm() const { return grid()->Comm(); } MPI_Comm comm() const { return Comm().comm(); } int ctxt() const { return grid() ? grid()->ctxt() : -1; } int ctxt_all() const { return grid() ? grid()->ctxt_all() : -1; } virtual int rows() const { return desc_[2]; } virtual int cols() const { return desc_[3]; } int lrows() const { return lrows_; } int lcols() const { return lcols_; } int ld() const { return lrows_; } int MB() const { return desc_[4]; } int NB() const { return desc_[5]; } int rowblocks() const { return std::ceil(float(lrows()) / MB()); } int colblocks() const { return std::ceil(float(lcols()) / NB()); } virtual int I() const { return 1; } virtual int J() const { return 1; } virtual void lranges(int& rlo, int& rhi, int& clo, int& chi) const; const scalar_t* data() const { return data_; } scalar_t* data() { return data_; } const scalar_t& operator()(int r, int c) const { return data_[r+ld()*c]; } scalar_t& operator()(int r, int c) { return data_[r+ld()*c]; } int prow() const { assert(grid()); return grid()->prow(); } int pcol() const { assert(grid()); return grid()->pcol(); } int nprows() const { assert(grid()); return grid()->nprows(); } int npcols() const { assert(grid()); return grid()->npcols(); } int npactives() const { assert(grid()); return grid()->npactives(); } bool is_master() const { return grid() && prow() == 0 && pcol() == 0; } int rowl2g(int row) const { assert(grid()); return indxl2g(row+1, MB(), prow(), 0, nprows()) - I(); } int coll2g(int col) const { assert(grid()); return indxl2g(col+1, NB(), pcol(), 0, npcols()) - J(); } int rowg2l(int row) const { assert(grid()); return indxg2l(row+I(), MB(), prow(), 0, nprows()) - 1; } int colg2l(int col) const { assert(grid()); return indxg2l(col+J(), NB(), pcol(), 0, npcols()) - 1; } int rowg2p(int row) const { assert(grid()); return indxg2p(row+I(), MB(), prow(), 0, nprows()); } int colg2p(int col) const { assert(grid()); return indxg2p(col+J(), NB(), pcol(), 0, npcols()); } int rank(int r, int c) const { return rowg2p(r) + colg2p(c) * nprows(); } bool is_local(int r, int c) const { assert(grid()); return rowg2p(r) == prow() && colg2p(c) == pcol(); } bool fixed() const { return MB()==default_MB && NB()==default_NB; } int rowl2g_fixed(int row) const { assert(grid() && fixed()); return indxl2g(row+1, default_MB, prow(), 0, nprows()) - I(); } int coll2g_fixed(int col) const { assert(grid() && fixed()); return indxl2g(col+1, default_NB, pcol(), 0, npcols()) - J(); } int rowg2l_fixed(int row) const { assert(grid() && fixed()); return indxg2l(row+I(), default_MB, prow(), 0, nprows()) - 1; } int colg2l_fixed(int col) const { assert(grid() && fixed()); return indxg2l(col+J(), default_NB, pcol(), 0, npcols()) - 1; } int rowg2p_fixed(int row) const { assert(grid() && fixed()); return indxg2p(row+I(), default_MB, prow(), 0, nprows()); } int colg2p_fixed(int col) const { assert(grid() && fixed()); return indxg2p(col+J(), default_NB, pcol(), 0, npcols()); } int rank_fixed(int r, int c) const { assert(grid() && fixed()); return rowg2p_fixed(r) + colg2p_fixed(c) * nprows(); } bool is_local_fixed(int r, int c) const { assert(grid() && fixed()); return rowg2p_fixed(r) == prow() && colg2p_fixed(c) == pcol(); } // TODO fixed versions?? const scalar_t& global(int r, int c) const { assert(is_local(r, c)); return operator()(rowg2l(r),colg2l(c)); } scalar_t& global(int r, int c) { assert(is_local(r, c)); return operator()(rowg2l(r),colg2l(c)); } scalar_t& global_fixed(int r, int c) { assert(is_local(r, c)); assert(fixed()); return operator()(rowg2l_fixed(r),colg2l_fixed(c)); } void global(int r, int c, scalar_t v) { if (active() && is_local(r, c)) operator()(rowg2l(r),colg2l(c)) = v; } scalar_t all_global(int r, int c) const; void print() const { print("A"); } void print(std::string name, int precision=15) const; void print_to_file(std::string name, std::string filename, int width=8) const; void print_to_files(std::string name, int precision=16) const; void random(); void random(random::RandomGeneratorBase<typename RealType<scalar_t>:: value_type>& rgen); void zero(); void fill(scalar_t a); void fill(const std::function<scalar_t(std::size_t, std::size_t)>& A); void eye(); void shift(scalar_t sigma); void clear(); virtual void resize(std::size_t m, std::size_t n); virtual void hconcat(const DistributedMatrix<scalar_t>& b); DistributedMatrix<scalar_t> transpose() const; void mult(Trans op, const DistributedMatrix<scalar_t>& X, DistributedMatrix<scalar_t>& Y) const; void laswp(const std::vector<int>& P, bool fwd); DistributedMatrix<scalar_t> extract_rows(const std::vector<std::size_t>& Ir) const; DistributedMatrix<scalar_t> extract_cols(const std::vector<std::size_t>& Ic) const; DistributedMatrix<scalar_t> extract(const std::vector<std::size_t>& I, const std::vector<std::size_t>& J) const; DistributedMatrix<scalar_t>& add(const DistributedMatrix<scalar_t>& B); DistributedMatrix<scalar_t>& scaled_add(scalar_t alpha, const DistributedMatrix<scalar_t>& B); DistributedMatrix<scalar_t>& scale_and_add(scalar_t alpha, const DistributedMatrix<scalar_t>& B); real_t norm() const; real_t normF() const; real_t norm1() const; real_t normI() const; virtual std::size_t memory() const { return sizeof(scalar_t)*std::size_t(lrows())*std::size_t(lcols()); } virtual std::size_t total_memory() const { return sizeof(scalar_t)*std::size_t(rows())*std::size_t(cols()); } virtual std::size_t nonzeros() const { return std::size_t(lrows())*std::size_t(lcols()); } virtual std::size_t total_nonzeros() const { return std::size_t(rows())*std::size_t(cols()); } void scatter(const DenseMatrix<scalar_t>& a); DenseMatrix<scalar_t> gather() const; DenseMatrix<scalar_t> all_gather() const; DenseMatrix<scalar_t> dense_and_clear(); DenseMatrix<scalar_t> dense() const; DenseMatrixWrapper<scalar_t> dense_wrapper(); std::vector<int> LU(); int LU(std::vector<int>&); DistributedMatrix<scalar_t> solve(const DistributedMatrix<scalar_t>& b, const std::vector<int>& piv) const; void LQ(DistributedMatrix<scalar_t>& L, DistributedMatrix<scalar_t>& Q) const; void orthogonalize(scalar_t& r_max, scalar_t& r_min); void ID_column(DistributedMatrix<scalar_t>& X, std::vector<int>& piv, std::vector<std::size_t>& ind, real_t rel_tol, real_t abs_tol, int max_rank); void ID_row(DistributedMatrix<scalar_t>& X, std::vector<int>& piv, std::vector<std::size_t>& ind, real_t rel_tol, real_t abs_tol, int max_rank, const BLACSGrid* grid_T); static const int default_MB = STRUMPACK_PBLAS_BLOCKSIZE; static const int default_NB = STRUMPACK_PBLAS_BLOCKSIZE; }; /** * copy submatrix of a DistM_t at ia,ja of size m,n into a DenseM_t * b at proc dest */ template<typename scalar_t> void copy(std::size_t m, std::size_t n, const DistributedMatrix<scalar_t>& a, std::size_t ia, std::size_t ja, DenseMatrix<scalar_t>& b, int dest, int context_all); template<typename scalar_t> void copy(std::size_t m, std::size_t n, const DenseMatrix<scalar_t>& a, int src, DistributedMatrix<scalar_t>& b, std::size_t ib, std::size_t jb, int context_all); /** copy submatrix of a at ia,ja of size m,n into b at position ib,jb */ template<typename scalar_t> void copy(std::size_t m, std::size_t n, const DistributedMatrix<scalar_t>& a, std::size_t ia, std::size_t ja, DistributedMatrix<scalar_t>& b, std::size_t ib, std::size_t jb, int context_all); /** * Wrapper class does exactly the same as a regular DistributedMatrix, * but it is initialized with existing memory, so it does not * allocate, own or delete the memory */ template<typename scalar_t> class DistributedMatrixWrapper : public DistributedMatrix<scalar_t> { private: int _rows, _cols, _i, _j; public: DistributedMatrixWrapper() : DistributedMatrix<scalar_t>(), _rows(0), _cols(0), _i(0), _j(0) {} DistributedMatrixWrapper(DistributedMatrix<scalar_t>& A); DistributedMatrixWrapper(const DistributedMatrixWrapper<scalar_t>& A); DistributedMatrixWrapper(DistributedMatrixWrapper<scalar_t>&& A); DistributedMatrixWrapper(std::size_t m, std::size_t n, DistributedMatrix<scalar_t>& A, std::size_t i, std::size_t j); DistributedMatrixWrapper(const BLACSGrid* g, std::size_t m, std::size_t n, scalar_t* A); DistributedMatrixWrapper(const BLACSGrid* g, std::size_t m, std::size_t n, int MB, int NB, scalar_t* A); DistributedMatrixWrapper(const BLACSGrid* g, std::size_t m, std::size_t n, DenseMatrix<scalar_t>& A); virtual ~DistributedMatrixWrapper() { this->data_ = nullptr; } DistributedMatrixWrapper<scalar_t>& operator=(const DistributedMatrixWrapper<scalar_t>& A); DistributedMatrixWrapper<scalar_t>& operator=(DistributedMatrixWrapper<scalar_t>&& A); int rows() const override { return _rows; } int cols() const override { return _cols; } int I() const override { return _i+1; } int J() const override { return _j+1; } void lranges(int& rlo, int& rhi, int& clo, int& chi) const override; void resize(std::size_t m, std::size_t n) override { assert(1); } void hconcat(const DistributedMatrix<scalar_t>& b) override { assert(1); } void clear() { this->data_ = nullptr; DistributedMatrix<scalar_t>::clear(); } std::size_t memory() const override { return 0; } std::size_t total_memory() const override { return 0; } std::size_t nonzeros() const override { return 0; } std::size_t total_nonzeros() const override { return 0; } DenseMatrix<scalar_t> dense_and_clear() = delete; DenseMatrixWrapper<scalar_t> dense_wrapper() = delete; DistributedMatrixWrapper<scalar_t>& operator=(const DistributedMatrix<scalar_t>&) = delete; DistributedMatrixWrapper<scalar_t>& operator=(DistributedMatrix<scalar_t>&&) = delete; }; template<typename scalar_t> long long int LU_flops(const DistributedMatrix<scalar_t>& a) { if (!a.active()) return 0; return (is_complex<scalar_t>() ? 4:1) * blas::getrf_flops(a.rows(), a.cols()) / a.npactives(); } template<typename scalar_t> long long int solve_flops(const DistributedMatrix<scalar_t>& b) { if (!b.active()) return 0; return (is_complex<scalar_t>() ? 4:1) * blas::getrs_flops(b.rows(), b.cols()) / b.npactives(); } template<typename scalar_t> long long int LQ_flops(const DistributedMatrix<scalar_t>& a) { if (!a.active()) return 0; auto minrc = std::min(a.rows(), a.cols()); return (is_complex<scalar_t>() ? 4:1) * (blas::gelqf_flops(a.rows(), a.cols()) + blas::xxglq_flops(a.cols(), a.cols(), minrc)) / a.npactives(); } template<typename scalar_t> long long int ID_row_flops(const DistributedMatrix<scalar_t>& a, int rank) { if (!a.active()) return 0; return (is_complex<scalar_t>() ? 4:1) * (blas::geqp3_flops(a.cols(), a.rows()) + blas::trsm_flops(rank, a.cols() - rank, scalar_t(1.), 'L')) / a.npactives(); } template<typename scalar_t> long long int trsm_flops(Side s, scalar_t alpha, const DistributedMatrix<scalar_t>& a, const DistributedMatrix<scalar_t>& b) { if (!a.active()) return 0; return (is_complex<scalar_t>() ? 4:1) * blas::trsm_flops(b.rows(), b.cols(), alpha, char(s)) / a.npactives(); } template<typename scalar_t> long long int gemm_flops(Trans ta, Trans tb, scalar_t alpha, const DistributedMatrix<scalar_t>& a, const DistributedMatrix<scalar_t>& b, scalar_t beta) { if (!a.active()) return 0; return (is_complex<scalar_t>() ? 4:1) * blas::gemm_flops ((ta==Trans::N) ? a.rows() : a.cols(), (tb==Trans::N) ? b.cols() : b.rows(), (ta==Trans::N) ? a.cols() : a.rows(), alpha, beta) / a.npactives(); } template<typename scalar_t> long long int gemv_flops(Trans ta, const DistributedMatrix<scalar_t>& a, scalar_t alpha, scalar_t beta) { if (!a.active()) return 0; auto m = (ta==Trans::N) ? a.rows() : a.cols(); auto n = (ta==Trans::N) ? a.cols() : a.rows(); return (is_complex<scalar_t>() ? 4:1) * ((alpha != scalar_t(0.)) * m * (n * 2 - 1) + (alpha != scalar_t(1.) && alpha != scalar_t(0.)) * m + (beta != scalar_t(0.) && beta != scalar_t(1.)) * m + (alpha != scalar_t(0.) && beta != scalar_t(0.)) * m) / a.npactives(); } template<typename scalar_t> long long int orthogonalize_flops(const DistributedMatrix<scalar_t>& a) { if (!a.active()) return 0; auto minrc = std::min(a.rows(), a.cols()); return (is_complex<scalar_t>() ? 4:1) * (blas::geqrf_flops(a.rows(), minrc) + blas::xxgqr_flops(a.rows(), minrc, minrc)) / a.npactives(); } template<typename scalar_t> std::unique_ptr<const DistributedMatrixWrapper<scalar_t>> ConstDistributedMatrixWrapperPtr (std::size_t m, std::size_t n, const DistributedMatrix<scalar_t>& D, std::size_t i, std::size_t j) { return std::unique_ptr<const DistributedMatrixWrapper<scalar_t>> (new DistributedMatrixWrapper<scalar_t> (m, n, const_cast<DistributedMatrix<scalar_t>&>(D), i, j)); } template<typename scalar_t> void gemm (Trans ta, Trans tb, scalar_t alpha, const DistributedMatrix<scalar_t>& A, const DistributedMatrix<scalar_t>& B, scalar_t beta, DistributedMatrix<scalar_t>& C); template<typename scalar_t> void trsm (Side s, UpLo u, Trans ta, Diag d, scalar_t alpha, const DistributedMatrix<scalar_t>& A, DistributedMatrix<scalar_t>& B); template<typename scalar_t> void trsv (UpLo ul, Trans ta, Diag d, const DistributedMatrix<scalar_t>& A, DistributedMatrix<scalar_t>& B); template<typename scalar_t> void gemv (Trans ta, scalar_t alpha, const DistributedMatrix<scalar_t>& A, const DistributedMatrix<scalar_t>& X, scalar_t beta, DistributedMatrix<scalar_t>& Y); template<typename scalar_t> DistributedMatrix<scalar_t> vconcat (int cols, int arows, int brows, const DistributedMatrix<scalar_t>& a, const DistributedMatrix<scalar_t>& b, const BLACSGrid* gnew, int cxt_all); template<typename scalar_t> void subgrid_copy_to_buffers (const DistributedMatrix<scalar_t>& a, const DistributedMatrix<scalar_t>& b, int p0, int npr, int npc, std::vector<std::vector<scalar_t>>& sbuf); template<typename scalar_t> void subproc_copy_to_buffers (const DenseMatrix<scalar_t>& a, const DistributedMatrix<scalar_t>& b, int p0, int npr, int npc, std::vector<std::vector<scalar_t>>& sbuf); template<typename scalar_t> void subgrid_add_from_buffers (const BLACSGrid* subg, int master, DistributedMatrix<scalar_t>& b, std::vector<scalar_t*>& pbuf); } // end namespace strumpack #endif // DISTRIBUTED_MATRIX_HPP
41.289362
87
0.651036
skn123
ca5cb1098c67ed0ca812b1b9b7acaab7ab34ed61
2,846
cpp
C++
Tuniac1/tak_Plugin/TAKDecoder.cpp
Harteex/Tuniac
dac98a68c1b801b7fc82874aad16cc8adcabb606
[ "BSD-3-Clause" ]
3
2022-01-05T08:47:51.000Z
2022-01-06T12:42:18.000Z
Tuniac1/tak_Plugin/TAKDecoder.cpp
Harteex/Tuniac
dac98a68c1b801b7fc82874aad16cc8adcabb606
[ "BSD-3-Clause" ]
null
null
null
Tuniac1/tak_Plugin/TAKDecoder.cpp
Harteex/Tuniac
dac98a68c1b801b7fc82874aad16cc8adcabb606
[ "BSD-3-Clause" ]
1
2022-01-06T16:12:58.000Z
2022-01-06T16:12:58.000Z
#include "StdAfx.h" #include "takdecoder.h" CTAKDecoder::CTAKDecoder(void) { } CTAKDecoder::~CTAKDecoder(void) { } bool CTAKDecoder::Open(LPTSTR szSource) { char tempname[MAX_PATH]; WideCharToMultiByte(CP_UTF8, 0, szSource, -1, tempname, MAX_PATH, 0, 0); Options.Cpu = tak_Cpu_Any; Options.Flags = NULL; Decoder = tak_SSD_Create_FromFile (tempname, &Options, NULL, NULL); if (Decoder == NULL) return false; if (tak_SSD_Valid (Decoder) != tak_True) return false; if (tak_SSD_GetStreamInfo (Decoder, &StreamInfo) != tak_res_Ok) return false; //SamplesPerBuf = StreamInfo.Sizes.FrameSizeInSamples; //SampleSize = StreamInfo.Audio.BlockSize; /* Frame / Sample size. */ //BufSize = SamplesPerBuf * SampleSize; /* Enough space to hold a decoded frame. */ buffer = new char [4096 * StreamInfo.Audio.BlockSize]; m_Buffer = new float [4096 * StreamInfo.Audio.BlockSize]; if(StreamInfo.Audio.SampleBits == 8) { m_divider = 128.0f; } else if(StreamInfo.Audio.SampleBits == 16) { m_divider = 32767.0f; } else if(StreamInfo.Audio.SampleBits == 24) { m_divider = 8388608.0f; } else if(StreamInfo.Audio.SampleBits == 32) { m_divider = 2147483648.0f; } return(true); } void CTAKDecoder::Destroy(void) { tak_SSD_Destroy (Decoder); if(buffer) { delete [] buffer; buffer = NULL; } if(m_Buffer) { delete [] m_Buffer; m_Buffer = NULL; } delete this; } bool CTAKDecoder::GetFormat(unsigned long * SampleRate, unsigned long * Channels) { *SampleRate = StreamInfo.Audio.SampleRate; *Channels = StreamInfo.Audio.ChannelNum; return(true); } bool CTAKDecoder::GetLength(unsigned long * MS) { *MS = StreamInfo.Sizes.SampleNum/StreamInfo.Audio.SampleRate*1000; return true; } bool CTAKDecoder::SetPosition(unsigned long * MS) { unsigned long sample = (*MS * StreamInfo.Audio.SampleRate)/1000; tak_SSD_Seek(Decoder, sample); return true; } bool CTAKDecoder::SetState(unsigned long State) { return(true); } bool CTAKDecoder::GetBuffer(float ** ppBuffer, unsigned long * NumSamples) { *NumSamples =0; OpResult = tak_SSD_ReadAudio (Decoder, buffer, 4096, &ReadNum); if ((OpResult != tak_res_Ok) && (OpResult != tak_res_ssd_FrameDamaged)) { //char ErrorMsg[tak_ErrorStringSizeMax]; //tak_SSD_GetErrorString (tak_SSD_State (Decoder), ErrorMsg, tak_ErrorStringSizeMax); return false; } if (ReadNum > 0) { short * pData = (short*)buffer; float * pBuffer = m_Buffer; for(int x=0; x<ReadNum * StreamInfo.Audio.ChannelNum; x++) { *pBuffer = (*pData) / m_divider; pData ++; pBuffer++; } *ppBuffer = m_Buffer; } else return false; *NumSamples = ReadNum * StreamInfo.Audio.ChannelNum; return true; }
21.398496
88
0.665847
Harteex
ca5d21327bc4d8d6f6d46093549bd84a15c69721
13,552
cpp
C++
taichi/ir/ir.cpp
gaoxinge/taichi
86d403f071b8505858763d4712b37cd71b89db91
[ "MIT" ]
1
2020-11-10T07:17:01.000Z
2020-11-10T07:17:01.000Z
taichi/ir/ir.cpp
gaoxinge/taichi
86d403f071b8505858763d4712b37cd71b89db91
[ "MIT" ]
1
2020-08-24T05:18:43.000Z
2020-08-24T05:18:43.000Z
taichi/ir/ir.cpp
gaoxinge/taichi
86d403f071b8505858763d4712b37cd71b89db91
[ "MIT" ]
null
null
null
#include "taichi/ir/ir.h" #include <numeric> #include <thread> #include <unordered_map> // #include "taichi/ir/analysis.h" #include "taichi/ir/statements.h" #include "taichi/ir/transforms.h" namespace taichi { namespace lang { std::string snode_access_flag_name(SNodeAccessFlag type) { if (type == SNodeAccessFlag::block_local) { return "block_local"; } else if (type == SNodeAccessFlag::read_only) { return "read_only"; } else if (type == SNodeAccessFlag::mesh_local) { return "mesh_local"; } else { TI_ERROR("Undefined SNode AccessType (value={})", int(type)); } } std::string Identifier::raw_name() const { if (name_.empty()) return fmt::format("tmp{}", id); else return name_; } Stmt *VecStatement::push_back(pStmt &&stmt) { auto ret = stmt.get(); stmts.push_back(std::move(stmt)); return ret; } IRNode *IRNode::get_ir_root() { auto node = this; while (node->get_parent()) { node = node->get_parent(); } return node; } std::unique_ptr<IRNode> IRNode::clone() { std::unique_ptr<IRNode> new_irnode; if (is<Block>()) new_irnode = as<Block>()->clone(); else if (is<Stmt>()) new_irnode = as<Stmt>()->clone(); else { TI_NOT_IMPLEMENTED } new_irnode->kernel = kernel; return new_irnode; } class StatementTypeNameVisitor : public IRVisitor { public: std::string type_name; StatementTypeNameVisitor() { } #define PER_STATEMENT(x) \ void visit(x *stmt) override { \ type_name = #x; \ } #include "taichi/inc/statements.inc.h" #undef PER_STATEMENT }; int StmtFieldSNode::get_snode_id(SNode *snode) { if (snode == nullptr) return -1; return snode->id; } bool StmtFieldSNode::equal(const StmtField *other_generic) const { if (auto other = dynamic_cast<const StmtFieldSNode *>(other_generic)) { return get_snode_id(snode_) == get_snode_id(other->snode_); } else { // Different types return false; } } bool StmtFieldMemoryAccessOptions::equal(const StmtField *other_generic) const { if (auto other = dynamic_cast<const StmtFieldMemoryAccessOptions *>(other_generic)) { return opt_.get_all() == other->opt_.get_all(); } else { // Different types return false; } } bool StmtFieldManager::equal(StmtFieldManager &other) const { if (fields.size() != other.fields.size()) { return false; } auto num_fields = fields.size(); for (std::size_t i = 0; i < num_fields; i++) { if (!fields[i]->equal(other.fields[i].get())) { return false; } } return true; } std::atomic<int> Stmt::instance_id_counter(0); Stmt::Stmt() : field_manager(this), fields_registered(false) { parent = nullptr; instance_id = instance_id_counter++; id = instance_id; erased = false; } Stmt::Stmt(const Stmt &stmt) : field_manager(this), fields_registered(false) { parent = stmt.parent; instance_id = instance_id_counter++; id = instance_id; erased = stmt.erased; tb = stmt.tb; ret_type = stmt.ret_type; } Stmt *Stmt::insert_before_me(std::unique_ptr<Stmt> &&new_stmt) { auto ret = new_stmt.get(); TI_ASSERT(parent); auto iter = parent->find(this); TI_ASSERT(iter != parent->statements.end()); parent->insert_at(std::move(new_stmt), iter); return ret; } Stmt *Stmt::insert_after_me(std::unique_ptr<Stmt> &&new_stmt) { auto ret = new_stmt.get(); TI_ASSERT(parent); auto iter = parent->find(this); TI_ASSERT(iter != parent->statements.end()); parent->insert_at(std::move(new_stmt), std::next(iter)); return ret; } void Stmt::replace_usages_with(Stmt *new_stmt) { irpass::replace_all_usages_with(nullptr, this, new_stmt); } void Stmt::replace_with(VecStatement &&new_statements, bool replace_usages) { parent->replace_with(this, std::move(new_statements), replace_usages); } void Stmt::replace_operand_with(Stmt *old_stmt, Stmt *new_stmt) { int n_op = num_operands(); for (int i = 0; i < n_op; i++) { if (operand(i) == old_stmt) { *operands[i] = new_stmt; } } } std::string Stmt::type_hint() const { if (ret_type->is_primitive(PrimitiveTypeID::unknown)) return ""; else return fmt::format("<{}> ", ret_type.to_string()); } std::string Stmt::type() { StatementTypeNameVisitor v; this->accept(&v); return v.type_name; } IRNode *Stmt::get_parent() const { return parent; } std::vector<Stmt *> Stmt::get_operands() const { std::vector<Stmt *> ret; for (int i = 0; i < num_operands(); i++) { ret.push_back(*operands[i]); } return ret; } void Stmt::set_operand(int i, Stmt *stmt) { *operands[i] = stmt; } void Stmt::register_operand(Stmt *&stmt) { operands.push_back(&stmt); } void Stmt::mark_fields_registered() { TI_ASSERT(!fields_registered); fields_registered = true; } bool Stmt::has_operand(Stmt *stmt) const { for (int i = 0; i < num_operands(); i++) { if (*operands[i] == stmt) { return true; } } return false; } int Stmt::locate_operand(Stmt **stmt) { for (int i = 0; i < num_operands(); i++) { if (operands[i] == stmt) { return i; } } return -1; } void Block::erase(int location) { auto iter = locate(location); erase_range(iter, std::next(iter)); } void Block::erase(Stmt *stmt) { auto iter = find(stmt); erase_range(iter, std::next(iter)); } void Block::erase_range(stmt_vector::iterator begin, stmt_vector::iterator end) { for (auto iter = begin; iter != end; iter++) { (*iter)->erased = true; trash_bin.push_back(std::move(*iter)); } statements.erase(begin, end); } void Block::erase(std::unordered_set<Stmt *> stmts) { stmt_vector clean_stmts; clean_stmts.reserve(statements.size()); // We dont have access to erase_if in C++17 for (pStmt &stmt : statements) { if (stmts.find(stmt.get()) != stmts.end()) { stmt->erased = true; trash_bin.push_back(std::move(stmt)); } else { clean_stmts.push_back(std::move(stmt)); } } statements = std::move(clean_stmts); } std::unique_ptr<Stmt> Block::extract(int location) { auto stmt = std::move(statements[location]); statements.erase(statements.begin() + location); return stmt; } std::unique_ptr<Stmt> Block::extract(Stmt *stmt) { for (int i = 0; i < (int)statements.size(); i++) { if (statements[i].get() == stmt) { return extract(i); } } TI_ERROR("stmt not found"); } Stmt *Block::insert(std::unique_ptr<Stmt> &&stmt, int location) { return insert_at(std::move(stmt), locate(location)); } Stmt *Block::insert_at(std::unique_ptr<Stmt> &&stmt, stmt_vector::iterator location) { auto stmt_ptr = stmt.get(); stmt->parent = this; statements.insert(location, std::move(stmt)); return stmt_ptr; } Stmt *Block::insert(VecStatement &&stmt, int location) { return insert_at(std::move(stmt), locate(location)); } Stmt *Block::insert_at(VecStatement &&stmt, stmt_vector::iterator location) { Stmt *stmt_ptr = nullptr; if (stmt.size()) { stmt_ptr = stmt.back().get(); } for (auto &s : stmt.stmts) { s->parent = this; } statements.insert(location, std::make_move_iterator(stmt.stmts.begin()), std::make_move_iterator(stmt.stmts.end())); return stmt_ptr; } void Block::replace_statements_in_range(int start, int end, VecStatement &&stmts) { TI_ASSERT(start <= end); erase_range(locate(start), locate(end)); insert(std::move(stmts), start); } void Block::replace_with(Stmt *old_statement, std::unique_ptr<Stmt> &&new_statement, bool replace_usages) { VecStatement vec; vec.push_back(std::move(new_statement)); replace_with(old_statement, std::move(vec), replace_usages); } Stmt *Block::lookup_var(const Identifier &ident) const { auto ptr = local_var_to_stmt.find(ident); if (ptr != local_var_to_stmt.end()) { return ptr->second; } else { if (parent_block()) { return parent_block()->lookup_var(ident); } else { return nullptr; } } } void Block::set_statements(VecStatement &&stmts) { statements.clear(); for (int i = 0; i < (int)stmts.size(); i++) { insert(std::move(stmts[i]), i); } } void Block::insert_before(Stmt *old_statement, VecStatement &&new_statements) { insert_at(std::move(new_statements), find(old_statement)); } void Block::insert_after(Stmt *old_statement, VecStatement &&new_statements) { insert_at(std::move(new_statements), std::next(find(old_statement))); } void Block::replace_with(Stmt *old_statement, VecStatement &&new_statements, bool replace_usages) { auto iter = find(old_statement); TI_ASSERT(iter != statements.end()); if (replace_usages && !new_statements.stmts.empty()) old_statement->replace_usages_with(new_statements.back().get()); trash_bin.push_back(std::move(*iter)); if (new_statements.size() == 1) { // Keep all std::vector::iterator valid in this case. *iter = std::move(new_statements[0]); (*iter)->parent = this; } else { statements.erase(iter); insert_at(std::move(new_statements), iter); } } Block *Block::parent_block() const { if (parent_stmt == nullptr) return nullptr; return parent_stmt->parent; } IRNode *Block::get_parent() const { return parent_stmt; } bool Block::has_container_statements() { for (auto &s : statements) { if (s->is_container_statement()) return true; } return false; } int Block::locate(Stmt *stmt) { for (int i = 0; i < (int)statements.size(); i++) { if (statements[i].get() == stmt) { return i; } } return -1; } stmt_vector::iterator Block::locate(int location) { if (location == -1) return statements.end(); return statements.begin() + location; } stmt_vector::iterator Block::find(Stmt *stmt) { return std::find_if(statements.begin(), statements.end(), [stmt](const pStmt &x) { return x.get() == stmt; }); } std::unique_ptr<Block> Block::clone() const { auto new_block = std::make_unique<Block>(); new_block->parent_stmt = parent_stmt; new_block->stop_gradients = stop_gradients; new_block->statements.reserve(size()); for (auto &stmt : statements) new_block->insert(stmt->clone()); return new_block; } DelayedIRModifier::~DelayedIRModifier() { TI_ASSERT(to_insert_before_.empty()); TI_ASSERT(to_insert_after_.empty()); TI_ASSERT(to_erase_.empty()); TI_ASSERT(to_replace_with_.empty()); TI_ASSERT(to_extract_to_block_front_.empty()); TI_ASSERT(to_type_check_.empty()); } void DelayedIRModifier::erase(Stmt *stmt) { to_erase_.push_back(stmt); } void DelayedIRModifier::insert_before(Stmt *old_statement, std::unique_ptr<Stmt> new_statements) { to_insert_before_.emplace_back(old_statement, VecStatement(std::move(new_statements))); } void DelayedIRModifier::insert_before(Stmt *old_statement, VecStatement &&new_statements) { to_insert_before_.emplace_back(old_statement, std::move(new_statements)); } void DelayedIRModifier::insert_after(Stmt *old_statement, std::unique_ptr<Stmt> new_statements) { to_insert_after_.emplace_back(old_statement, VecStatement(std::move(new_statements))); } void DelayedIRModifier::insert_after(Stmt *old_statement, VecStatement &&new_statements) { to_insert_after_.emplace_back(old_statement, std::move(new_statements)); } void DelayedIRModifier::replace_with(Stmt *stmt, VecStatement &&new_statements, bool replace_usages) { to_replace_with_.emplace_back(stmt, std::move(new_statements), replace_usages); } void DelayedIRModifier::extract_to_block_front(Stmt *stmt, Block *blk) { to_extract_to_block_front_.emplace_back(stmt, blk); } void DelayedIRModifier::type_check(IRNode *node, CompileConfig cfg) { to_type_check_.emplace_back(node, cfg); } bool DelayedIRModifier::modify_ir() { bool force_modified = modified_; modified_ = false; if (to_insert_before_.empty() && to_insert_after_.empty() && to_erase_.empty() && to_replace_with_.empty() && to_extract_to_block_front_.empty() && to_type_check_.empty()) return force_modified; for (auto &i : to_insert_before_) { i.first->parent->insert_before(i.first, std::move(i.second)); } to_insert_before_.clear(); for (auto &i : to_insert_after_) { i.first->parent->insert_after(i.first, std::move(i.second)); } to_insert_after_.clear(); for (auto &stmt : to_erase_) { stmt->parent->erase(stmt); } to_erase_.clear(); for (auto &i : to_replace_with_) { std::get<0>(i)->replace_with(std::move(std::get<1>(i)), std::get<2>(i)); } to_replace_with_.clear(); for (auto &i : to_extract_to_block_front_) { auto extracted = i.first->parent->extract(i.first); i.second->insert(std::move(extracted), 0); } to_extract_to_block_front_.clear(); for (auto &i : to_type_check_) { irpass::type_check(i.first, i.second); } to_type_check_.clear(); return true; } void DelayedIRModifier::mark_as_modified() { modified_ = true; } LocalAddress::LocalAddress(Stmt *var, int offset) : var(var), offset(offset) { TI_ASSERT(var->is<AllocaStmt>() || var->is<PtrOffsetStmt>()); } } // namespace lang } // namespace taichi
26.835644
80
0.652966
gaoxinge
ca5e1cf6af97b55dfbe6ab458a620d084e887766
3,835
cpp
C++
example/rsp/rsp_engine.cpp
krakeusz/bot-judge
d4879f7e58ecb91d6668d7e317018a8a184a4923
[ "MIT" ]
null
null
null
example/rsp/rsp_engine.cpp
krakeusz/bot-judge
d4879f7e58ecb91d6668d7e317018a8a184a4923
[ "MIT" ]
null
null
null
example/rsp/rsp_engine.cpp
krakeusz/bot-judge
d4879f7e58ecb91d6668d7e317018a8a184a4923
[ "MIT" ]
null
null
null
// Rock, Scissors, Paper engine #include "engine.h" #include <algorithm> #include <array> #include <cctype> #include <cstring> #include <limits> #include <memory> namespace Engine { using std::array; using std::string; using std::to_string; using std::unique_ptr; using std::vector; class Choice { public: virtual bool losesAgainstPaper() const = 0; virtual bool losesAgainstRock() const = 0; virtual bool losesAgainstScissors() const = 0; virtual bool beats(const Choice& choice) const = 0; }; class Rock : public Choice { public: virtual bool losesAgainstPaper() const override { return true; } virtual bool losesAgainstRock() const override { return false; } virtual bool losesAgainstScissors() const override { return false; } virtual bool beats(const Choice& choice) const override { return choice.losesAgainstRock(); } }; class Paper : public Choice { public: virtual bool losesAgainstPaper() const override { return false; } virtual bool losesAgainstRock() const override { return false; } virtual bool losesAgainstScissors() const override { return true; } virtual bool beats(const Choice& choice) const override { return choice.losesAgainstPaper(); } }; class Scissors : public Choice { public: virtual bool losesAgainstPaper() const override { return false; } virtual bool losesAgainstRock() const override { return true; } virtual bool losesAgainstScissors() const override { return false; } virtual bool beats(const Choice& choice) const override { return choice.losesAgainstScissors(); } }; void ignoreLine(std::istream& istr) { istr.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); } unique_ptr<Choice> choiceFromString(const string& str) { string upperStr = str; if (str == "ROCK") { return unique_ptr<Choice>(new Rock); } else if (str == "PAPER") { return unique_ptr<Choice>(new Paper); } else if (str == "SCISSORS") { return unique_ptr<Choice>(new Scissors); } return nullptr; } constexpr int PLAYERS = 2; GameResult play_game(vector<PlayerData>& players) noexcept { try { if (players.size() != PLAYERS) { return GameResult::createError(players, "This game is meant for " + to_string(PLAYERS) + " players only"); } array<int, PLAYERS> winCount = { 0, 0 }; constexpr int ROUNDS = 10; for (int i = 0; i < ROUNDS; i++) { vector<unique_ptr<Choice>> choices; for (auto& player: players) { auto& stream = player.playerStream(); string response; stream.set_timeout_ms(100); stream << "MOVE" << std::endl; stream >> response; ignoreLine(stream); if (stream.eof()) { string details = string("Win by opponent error: ") + stream.get_last_strerror(); return GameResult::createWin(players, players[1-player.getPlayerId()], details); } auto choiceP = choiceFromString(response); if (!choiceP) { string details = "Win by opponent error: move not recognized: '" + response + "'"; return GameResult::createWin(players, players[1-player.getPlayerId()], details); } choices.push_back(std::move(choiceP)); } if (choices[0]->beats(*choices[1])) winCount[0]++; if (choices[1]->beats(*choices[0])) winCount[1]++; } int winnerId = (winCount[0] > winCount[1] ? 0 : 1); string details = to_string(winCount[winnerId]) + "-" + to_string(winCount[1-winnerId]); if (winCount[0] == winCount[1]) { return GameResult::createDraw(players, details); } return GameResult::createWin(players, players[winnerId], details); } catch (std::exception& e) { return GameResult::createError(players, e.what()); } } } // namespace Engine
27.589928
99
0.652151
krakeusz
ca5fef96d6c71e371afbac6047fcbf7d6beb5198
5,407
cxx
C++
Src/Decimation/qslim-2.1/tools/qslim/main.cxx
AspdenGroup/PeleAnalysis_Aspden
4259efa97a65a646a4e1bc3493cd9dae1e7024c5
[ "BSD-3-Clause-LBNL" ]
null
null
null
Src/Decimation/qslim-2.1/tools/qslim/main.cxx
AspdenGroup/PeleAnalysis_Aspden
4259efa97a65a646a4e1bc3493cd9dae1e7024c5
[ "BSD-3-Clause-LBNL" ]
null
null
null
Src/Decimation/qslim-2.1/tools/qslim/main.cxx
AspdenGroup/PeleAnalysis_Aspden
4259efa97a65a646a4e1bc3493cd9dae1e7024c5
[ "BSD-3-Clause-LBNL" ]
null
null
null
/************************************************************************ Main QSlim file. Copyright (C) 1998 Michael Garland. See "COPYING.txt" for details. $Id: main.cxx,v 1.1.1.1 2006/09/20 01:42:05 marc Exp $ ************************************************************************/ #include <stdmix.h> #include <mixio.h> #include "qslim.h" // Configuration variables and initial values // unsigned int face_target = 0; bool will_use_fslim = false; int placement_policy = MX_PLACE_OPTIMAL; double boundary_weight = 1000.0; int weighting_policy = MX_WEIGHT_AREA; bool will_record_history = false; double compactness_ratio = 0.0; double meshing_penalty = 1.0; bool will_join_only = false; bool be_quiet = false; OutputFormat output_format = SMF; char *output_filename = NULL; // Globally visible variables // MxSMFReader *smf = NULL; MxStdModel *m = NULL; MxStdModel *m_orig = NULL; MxQSlim *slim = NULL; MxEdgeQSlim *eslim = NULL; MxFaceQSlim *fslim = NULL; QSlimLog *history = NULL; MxDynBlock<MxEdge> *target_edges = NULL; const char *slim_copyright_notice = "Copyright (C) 1998-2002 Michael Garland. See \"COPYING.txt\" for details."; const char *slim_version_string = "2.1"; static ostream *output_stream = NULL; static bool qslim_smf_hook(char *op, int, char *argv[], MxStdModel& m) { if( streq(op, "e") ) { if( !target_edges ) target_edges = new MxDynBlock<MxEdge>(m.vert_count() * 3); MxEdge& e = target_edges->add(); e.v1 = atoi(argv[0]) - 1; e.v2 = atoi(argv[1]) - 1; return true; } return false; } bool (*unparsed_hook)(char *, int, char*[], MxStdModel&) = qslim_smf_hook; void slim_print_banner(ostream& out) { out << "QSlim surface simplification software." << endl << "Version " << slim_version_string << " " << "[Built " << __DATE__ << "]." << endl << slim_copyright_notice << endl; } void slim_init() { if( !slim ) { if( will_use_fslim ) slim = fslim = new MxFaceQSlim(*m); else slim = eslim = new MxEdgeQSlim(*m); } else { if( will_use_fslim ) fslim = (MxFaceQSlim *)slim; else eslim = (MxEdgeQSlim *)slim; } slim->placement_policy = placement_policy; slim->boundary_weight = boundary_weight; slim->weighting_policy = weighting_policy; slim->compactness_ratio = compactness_ratio; slim->meshing_penalty = meshing_penalty; slim->will_join_only = will_join_only; if( eslim && target_edges ) { eslim->initialize(*target_edges, target_edges->length()); } else slim->initialize(); if( will_record_history ) { if( !eslim ) mxmsg_signal(MXMSG_WARN, "History only available for edge contractions."); else { history = new QSlimLog(100); eslim->contraction_callback = slim_history_callback; } } } #define CLEANUP(x) if(x) { delete x; x=NULL; } void slim_cleanup() { CLEANUP(smf); CLEANUP(m); CLEANUP(slim); eslim = NULL; fslim = NULL; CLEANUP(history); CLEANUP(target_edges); if( output_stream != &cout ) CLEANUP(output_stream); } static void setup_output() { if( !output_stream ) { if( output_filename ) output_stream = new ofstream(output_filename); else output_stream = &cout; } } bool select_output_format(const char *fmt) { bool h = false; if ( streq(fmt, "mmf") ) { output_format = MMF; h = true; } else if( streq(fmt, "pm") ) { output_format = PM; h = true; } else if( streq(fmt, "log") ) { output_format = LOG; h = true; } else if( streq(fmt, "smf") ) output_format = SMF; else if( streq(fmt, "iv") ) output_format = IV; else if( streq(fmt, "vrml")) output_format = VRML; else return false; if( h ) will_record_history = true; return true; } void output_preamble() { if( output_format==MMF || output_format==LOG ) output_current_model(); } void output_current_model() { setup_output(); MxSMFWriter writer; writer.write(*output_stream, *m); } static void cleanup_for_output() { // First, mark stray vertices for removal // for(uint i=0; i<m->vert_count(); i++) if( m->vertex_is_valid(i) && m->neighbors(i).length() == 0 ) m->vertex_mark_invalid(i); // Compact vertex array so only valid vertices remain m->compact_vertices(); } void output_final_model() { setup_output(); switch( output_format ) { case MMF: output_regressive_mmf(*output_stream); break; case LOG: output_regressive_log(*output_stream); break; case PM: output_progressive_pm(*output_stream); break; case IV: cleanup_for_output(); output_iv(*output_stream); break; case VRML: cleanup_for_output(); output_vrml(*output_stream); break; case SMF: cleanup_for_output(); output_current_model(); break; } } void input_file(const char *filename) { if( streq(filename, "-") ) smf->read(cin, m); else { ifstream in(filename); if( !in.good() ) mxmsg_signal(MXMSG_FATAL, "Failed to open input file", filename); smf->read(in, m); in.close(); } } static MxDynBlock<char*> files_to_include(2); void defer_file_inclusion(char *filename) { files_to_include.add(filename); } void include_deferred_files() { for(uint i=0; i<files_to_include.length(); i++) input_file(files_to_include[i]); } void slim_history_callback(const MxPairContraction& conx, float cost) { history->add(conx); }
20.716475
77
0.64546
AspdenGroup
ca6035e03a2fc225a5fcdb566961c571c0301f95
1,012
hpp
C++
idock/src/matrix.hpp
kingdavid72/Calici-Nebular
6bd51f63c7de37605dcbfbd3669462a997638ffb
[ "Apache-2.0" ]
30
2015-02-09T00:53:09.000Z
2022-01-19T13:36:20.000Z
idock/src/matrix.hpp
kingdavid72/Calici-Nebular
6bd51f63c7de37605dcbfbd3669462a997638ffb
[ "Apache-2.0" ]
3
2016-06-16T18:07:30.000Z
2019-01-15T23:45:34.000Z
idock/src/matrix.hpp
kingdavid72/Calici-Nebular
6bd51f63c7de37605dcbfbd3669462a997638ffb
[ "Apache-2.0" ]
19
2015-04-15T12:48:13.000Z
2021-04-19T11:30:46.000Z
#pragma once #ifndef IDOCK_MATRIX_HPP #define IDOCK_MATRIX_HPP #include "atom.hpp" /// Returns the flattened 1D index of a 2D index (i, j) where j is the lowest dimension. inline size_t triangular_matrix_restrictive_index(const size_t i, const size_t j) { BOOST_ASSERT(i <= j); return i + j * (j + 1) / 2; } /// Returns the flattened 1D index of a 2D index (i, j) where either i or j is the lowest dimension. inline size_t triangular_matrix_permissive_index(const size_t i, const size_t j) { return (i <= j) ? triangular_matrix_restrictive_index(i, j) : triangular_matrix_restrictive_index(j, i); } // i j 0 1 2 3 // 0 0 1 3 6 // 1 2 4 7 // 2 5 8 // 3 9 /// Represents a generic triangular matrix. template<typename T> class triangular_matrix : public vector<T> { public: /// Constructs a triangular matrix with specified 1D size and value to fill. triangular_matrix(const size_t n, const T& filler_val) : vector<T>(n * (n+1) / 2, filler_val) {} }; #endif
28.914286
106
0.687747
kingdavid72
ca6066f57caf92d7c73421cabf138b9710992ac9
7,134
hpp
C++
water/cmath.hpp
watercpp/water
7a9a292a2513529cf5dabac1bc7a755055dac9b5
[ "MIT" ]
5
2017-04-18T18:18:50.000Z
2018-08-03T09:13:26.000Z
water/cmath.hpp
watercpp/water
7a9a292a2513529cf5dabac1bc7a755055dac9b5
[ "MIT" ]
null
null
null
water/cmath.hpp
watercpp/water
7a9a292a2513529cf5dabac1bc7a755055dac9b5
[ "MIT" ]
null
null
null
// Copyright 2017-2018 Johan Paulsson // This file is part of the Water C++ Library. It is licensed under the MIT License. // See the license.txt file in this distribution or https://watercpp.com/license.txt //\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_/\_ #ifndef WATER_CMATH_HPP #define WATER_CMATH_HPP #include <water/water.hpp> #ifndef WATER_NO_CHEADERS #include <cmath> namespace water { using ::std::fmod; using ::std::frexp; using ::std::log; using ::std::log10; using ::std::pow; using ::std::isfinite; using ::std::isinf; using ::std::isnan; using ::std::isnormal; using ::std::signbit; using ::std::fpclassify; // isnormal = not 0, subnormal, infinity or nan. it may not work for subnormals when building without strict IEEE compliance, like -ffast-math // isfinite = not nan or infinity } #else #include <math.h> namespace water { // this is not needed if the math.h header is made for c++ inline float fmod(float a, float b) { return ::fmodf(a, b); } inline double fmod(double a, double b) { return ::fmod(a, b); } inline long double fmod(long double a, long double b) { return ::fmodl(a, b); } inline float frexp(float a, int* b) { return ::frexpf(a, b); } inline double frexp(double a, int* b) { return ::frexp(a, b); } inline long double frexp(long double a, int* b) { return ::frexpl(a, b); } inline float log(float a) { return ::logf(a); } inline double log(double a) { return ::log(a); } inline long double log(long double a) { return ::logl(a); } inline float log10(float a) { return ::log10f(a); } inline double log10(double a) { return ::log10(a); } inline long double log10(long double a) { return ::log10l(a); } inline float pow(float a, float b) { return ::powf(a, b); } inline double pow(double a, double b) { return ::pow(a, b); } inline long double pow(long double a, long double b) { return ::powl(a, b); } } #endif #if !defined(WATER_CMATH_NO_SLOW_MATH) && (((defined(WATER_COMPILER_GCC) || defined(WATER_COMPILER_CLANG)) && defined(__FAST_MATH__)) || defined(WATER_CMATH_SLOW_MATH)) // On GCC and Clang with -ffast-math (enabled with -Ofast) isinf + isnan is optimized away to always return false. // Sometimes fpclassify seems to work, not sure if it depends on the C library or GCC/Clang version. // slow_math below should detect NaN and infinity for all types as long as one of them is a IEEE 754 / IEC 60559 32 bit or 64 bit type. // The motivation for this is to be able to build with -ffast-math but still be able to sanitize floating point values #include <water/int.hpp> #include <water/numeric_limits.hpp> #include <water/types/types.hpp> namespace water { namespace _ { template< typename float_, unsigned bits_ = sizeof(float_) * numeric_limits<unsigned char>::digits, typename unsigned_ = uint_bits<bits_>, bool = (bits_ == 32 || bits_ == 64) && !types::is_void<unsigned_>::result && numeric_limits<float_>::is_iec559 > struct slow_math { static bool constexpr can = true; bool finite = true, normal = true, infinity = false, nan = false; slow_math(float_ f) { // 32 bit // exponent 8 bits, 128 = 0, range -126 - 127 // fraction 23 bits // // 64 bit // exponent 11 bits, 1023 = 0, range -1022 - 1023 // fraction 52 bits unsigned constexpr exponent_bits = bits_ == 32 ? 8 : 11, fraction_bits = bits_ == 32 ? 23 : 52; unsigned_ constexpr exponent_max = (1 << exponent_bits) - 1; unsigned_ u = 0; auto ub = static_cast<unsigned char*>(static_cast<void*>(&u)); auto fb = static_cast<unsigned char const*>(static_cast<void const*>(&f)), fe = fb + sizeof(f); do *ub++ = *fb++; while(fb != fe); unsigned_ exponent = (u >> fraction_bits) & exponent_max; if(!exponent) // subnormal or 0 normal = false; else if(exponent == exponent_max) { // infinity or nan if(u & ((static_cast<unsigned_>(1) << fraction_bits) - 1)) // fraction not 0 == nan nan = true; else infinity = true; finite = normal = false; } } }; template<typename float_, unsigned bits_, typename unsigned_> struct slow_math<float_, bits_, unsigned_, false> { static bool constexpr can = false; bool finite = true, normal = true, infinity = false, nan = false; slow_math(float_ f) { auto c = fpclassify(f); if(c == FP_NAN) nan = true; else if(c == FP_INFINITE) infinity = true; else if(other(static_cast<double>(f), f) || other(static_cast<float>(f), f) || other(static_cast<long double>(f), f)) ; else if(f < -numeric_limits<float_>::max() || numeric_limits<float_>::max() < f) // will this be optimized away? infinity = true; else if(f != f) // will this be optimized away? nan = true; if(nan || infinity) normal = finite = false; else if(c == FP_ZERO || c == FP_SUBNORMAL || (-numeric_limits<float_>::min() < f && f < numeric_limits<float_>::min())) normal = false; } private: bool other(float_, float_) { return false; } template<typename other_> bool other(other_ o, float_ f) { if(!slow_math<other_>::can) return false; auto s = slow_math<other_>{o}; if(s.nan) nan = true; if(s.infinity && static_cast<float_>(o) == f) infinity = true; return true; } }; } template<typename float_> bool isfinite_strict(float_ a) { return _::slow_math<float_>{a}.finite; } template<typename float_> bool isinf_strict(float_ a) { return _::slow_math<float_>{a}.infinity; } template<typename float_> bool isnan_strict(float_ a) { return _::slow_math<float_>{a}.nan; } template<typename float_> bool isnormal_strict(float_ a) { return _::slow_math<float_>{a}.normal; } } #else namespace water { // fpclassify seems less likley to be optimized away template<typename float_> bool isfinite_strict(float_ a) { auto c = fpclassify(a); return c != FP_INFINITE && c != FP_NAN; } template<typename float_> bool isinf_strict(float_ a) { return fpclassify(a) == FP_INFINITE; } template<typename float_> bool isnan_strict(float_ a) { return fpclassify(a) == FP_NAN; } template<typename float_> bool isnormal_strict(float_ a) { auto c = fpclassify(a); return c != FP_INFINITE && c != FP_NAN && c != FP_ZERO && c != FP_SUBNORMAL; } } #endif #endif
32.135135
168
0.586207
watercpp
ca60e53e1af9091655a0f3e5461747ad89db7587
54
hpp
C++
addons/common/ui/script_component.hpp
JeffPerk/HavocTeam
6fb616c41da4baece79ebac941bac72a78c715f9
[ "MIT" ]
null
null
null
addons/common/ui/script_component.hpp
JeffPerk/HavocTeam
6fb616c41da4baece79ebac941bac72a78c715f9
[ "MIT" ]
7
2021-11-22T04:36:52.000Z
2021-12-13T18:55:24.000Z
addons/common/ui/script_component.hpp
JeffPerk/HavocTeam
6fb616c41da4baece79ebac941bac72a78c715f9
[ "MIT" ]
null
null
null
#include "\z\havoc\addons\common\script_component.hpp"
54
54
0.814815
JeffPerk
ca61ff9a42d7076e2baffa1e949c520814dbd950
1,435
cpp
C++
src/core/Platform.cpp
GiorgioCaculli/Sokoban-Cpp
96447016268d1a23a9cb2291480f851d0d5b90dc
[ "BSD-3-Clause" ]
null
null
null
src/core/Platform.cpp
GiorgioCaculli/Sokoban-Cpp
96447016268d1a23a9cb2291480f851d0d5b90dc
[ "BSD-3-Clause" ]
null
null
null
src/core/Platform.cpp
GiorgioCaculli/Sokoban-Cpp
96447016268d1a23a9cb2291480f851d0d5b90dc
[ "BSD-3-Clause" ]
null
null
null
#include <gzc/games/sokoban/core/Platform.hpp> #include <sstream> #include <iostream> using namespace sokoban::core; /** * Default constructor for the platforms * @param x The X coordinates on the board * @param y The Y coordinates on the board */ Platform::Platform( float x, float y ) : Actor( x, y ) { } /** * Copy constructor for the platform actor * @param platform The platform we wish to copy the information from */ Platform::Platform( const Platform &platform ) : Platform( platform.get_x(), platform.get_y() ) { } /** * Redefinition of the = operator * @param platform The platform we wish to copy the information from * @return New instance of a platform with the copied information */ Platform &Platform::operator=( const Platform &platform ) { if ( &platform != this ) { set_x( platform.get_x() ); set_y( platform.get_y() ); } return *this; } /** * Default destructor for the platforms */ Platform::~Platform() = default; /** * Getter meant to retrieve the nature of a platform actor * @return The fact that the actor is actually a platform */ Actor::ID Platform::get_type() const { return Actor::PLATFORM; } /** * Textual output containing the platform's information * @return Text containing the info */ std::string Platform::to_string() const { std::stringstream ss; ss << "Platform: " << Actor::to_string(); return ss.str(); }
21.41791
68
0.671777
GiorgioCaculli
ca6201110f6438634a84462fec388e7743bca691
915
cpp
C++
2020/practice/e.cpp
Akash671/KickStart
7cf7e572408203c881d56989fb37e6270bd696f0
[ "CC0-1.0" ]
1
2021-03-12T08:39:01.000Z
2021-03-12T08:39:01.000Z
2020/practice/e.cpp
Akash671/KickStart
7cf7e572408203c881d56989fb37e6270bd696f0
[ "CC0-1.0" ]
null
null
null
2020/practice/e.cpp
Akash671/KickStart
7cf7e572408203c881d56989fb37e6270bd696f0
[ "CC0-1.0" ]
1
2021-03-20T18:55:52.000Z
2021-03-20T18:55:52.000Z
/* author : @akash kumar */ #include<bits/stdc++.h> using namespace std; #define ll long long int #define mod 1000000007 #define pb push_back #define ld long double int solve(vector<int> array) { int maxLen = 0; for(int i = 0; i < array.size() - 1;) { int j = i; int common_difference = array[i+1] - array[i]; while(j < array.size() - 1 && (array[j + 1] - array[j] == common_difference)) j++; int max_j = j; maxLen = max(maxLen, max_j - i + 1); i = max(i + 1, j); } return maxLen; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin>>t; for(int i=1;i<=t;++i) { int n; cin>>n; vector<int>array(n); for(int i=0;i<n;++i) { cin>>array[i]; } cout<<"Case #"<<i<<": "<<solve(array); cout<<"\n"; } return 0; }
19.0625
85
0.488525
Akash671
ca6419b9acb25bfe19a56a39f202357d48d11cc4
12,028
cpp
C++
src/services/pcn-loadbalancer-rp/src/Lbrp.cpp
francescomessina/polycube
38f2fb4ffa13cf51313b3cab9994be738ba367be
[ "ECL-2.0", "Apache-2.0" ]
1
2019-10-02T23:09:42.000Z
2019-10-02T23:09:42.000Z
src/services/pcn-loadbalancer-rp/src/Lbrp.cpp
l1b0k/polycube
7af919245c131fa9fe24c5d39d10039cbb81e825
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
src/services/pcn-loadbalancer-rp/src/Lbrp.cpp
l1b0k/polycube
7af919245c131fa9fe24c5d39d10039cbb81e825
[ "ECL-2.0", "Apache-2.0" ]
1
2019-09-02T10:05:14.000Z
2019-09-02T10:05:14.000Z
/* * Copyright 2018 The Polycube Authors * * 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. */ // Modify these methods with your own implementation #include "Lbrp.h" #include "Lbrp_dp.h" #include <tins/ethernetII.h> #include <tins/tins.h> using namespace Tins; Lbrp::Lbrp(const std::string name, const LbrpJsonObject &conf) : Cube(conf.getBase(), {lbrp_code}, {}) { logger()->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [Lbrp] [%n] [%l] %v"); logger()->info("Creating Lbrp instance"); addServiceList(conf.getService()); addSrcIpRewrite(conf.getSrcIpRewrite()); addPortsList(conf.getPorts()); } Lbrp::~Lbrp() {} void Lbrp::update(const LbrpJsonObject &conf) { // This method updates all the object/parameter in Lbrp object specified in // the conf JsonObject. // You can modify this implementation. Cube::set_conf(conf.getBase()); if (conf.serviceIsSet()) { for (auto &i : conf.getService()) { auto vip = i.getVip(); auto vport = i.getVport(); auto proto = i.getProto(); auto m = getService(vip, vport, proto); m->update(i); } } if (conf.srcIpRewriteIsSet()) { auto m = getSrcIpRewrite(); m->update(conf.getSrcIpRewrite()); } if (conf.portsIsSet()) { for (auto &i : conf.getPorts()) { auto name = i.getName(); auto m = getPorts(name); m->update(i); } } } LbrpJsonObject Lbrp::toJsonObject() { LbrpJsonObject conf; conf.setBase(Cube::to_json()); for (auto &i : getServiceList()) { conf.addService(i->toJsonObject()); } conf.setSrcIpRewrite(getSrcIpRewrite()->toJsonObject()); for (auto &i : getPortsList()) { conf.addPorts(i->toJsonObject()); } return conf; } void Lbrp::packet_in(Ports &port, polycube::service::PacketInMetadata &md, const std::vector<uint8_t> &packet) { EthernetII eth(&packet[0], packet.size()); auto b_port = getBackendPort(); if (!b_port) return; // send the original packet logger()->debug("Sending original ARP reply to backend port: {}", b_port->name()); b_port->send_packet_out(eth); // send a second packet for the virtual src IPs ARP &arp = eth.rfind_pdu<ARP>(); uint32_t ip = uint32_t(arp.sender_ip_addr()); ip &= htonl(src_ip_rewrite_->mask); ip |= htonl(src_ip_rewrite_->net); IPv4Address addr(ip); arp.sender_ip_addr(addr); logger()->debug("Sending modified ARP reply to backend port: {}", b_port->name()); b_port->send_packet_out(eth); } void Lbrp::reloadCodeWithNewPorts() { uint16_t frontend_port = 0; uint16_t backend_port = 1; for (auto &it : get_ports()) { switch (it->getType()) { case PortsTypeEnum::FRONTEND: frontend_port = it->index(); break; case PortsTypeEnum::BACKEND: backend_port = it->index(); break; } } logger()->debug("Reloading code with frontend port: {0} and backend port {1}", frontend_port, backend_port); std::string frontend_port_str("#define FRONTEND_PORT " + std::to_string(frontend_port)); std::string backend_port_str("#define BACKEND_PORT " + std::to_string(backend_port)); reload(frontend_port_str + "\n" + backend_port_str + "\n" + lbrp_code); logger()->trace("New lbrp code loaded"); } std::shared_ptr<Ports> Lbrp::getFrontendPort() { for (auto &it : get_ports()) { if (it->getType() == PortsTypeEnum::FRONTEND) { return it; } } return nullptr; } std::shared_ptr<Ports> Lbrp::getBackendPort() { for (auto &it : get_ports()) { if (it->getType() == PortsTypeEnum::BACKEND) { return it; } } return nullptr; } std::shared_ptr<Ports> Lbrp::getPorts(const std::string &name) { return get_port(name); } std::vector<std::shared_ptr<Ports>> Lbrp::getPortsList() { return get_ports(); } void Lbrp::addPorts(const std::string &name, const PortsJsonObject &conf) { if (get_ports().size() == 2) { logger()->warn("Reached maximum number of ports"); throw std::runtime_error("Reached maximum number of ports"); } try { switch (conf.getType()) { case PortsTypeEnum::FRONTEND: if (getFrontendPort() != nullptr) { logger()->warn("There is already a FRONTEND port"); throw std::runtime_error("There is already a FRONTEND port"); } break; case PortsTypeEnum::BACKEND: if (getBackendPort() != nullptr) { logger()->warn("There is already a BACKEND port"); throw std::runtime_error("There is already a BACKEND port"); } break; } } catch (std::runtime_error &e) { logger()->warn("Error when adding the port {0}", name); logger()->warn("Error message: {0}", e.what()); throw; } add_port<PortsJsonObject>(name, conf); if (get_ports().size() == 2) { logger()->info("Reloading code because of the new port"); reloadCodeWithNewPorts(); } logger()->info("New port created with name {0}", name); } void Lbrp::addPortsList(const std::vector<PortsJsonObject> &conf) { for (auto &i : conf) { std::string name_ = i.getName(); addPorts(name_, i); } } void Lbrp::replacePorts(const std::string &name, const PortsJsonObject &conf) { delPorts(name); std::string name_ = conf.getName(); addPorts(name_, conf); } void Lbrp::delPorts(const std::string &name) { remove_port(name); } void Lbrp::delPortsList() { auto ports = get_ports(); for (auto it : ports) { delPorts(it->name()); } } std::shared_ptr<SrcIpRewrite> Lbrp::getSrcIpRewrite() { return src_ip_rewrite_; } void Lbrp::addSrcIpRewrite(const SrcIpRewriteJsonObject &value) { logger()->debug( "[SrcIpRewrite] Received request to create SrcIpRewrite range {0} , new " "ip range {1} ", value.getIpRange(), value.getNewIpRange()); src_ip_rewrite_ = std::make_shared<SrcIpRewrite>(*this, value); src_ip_rewrite_->update(value); } void Lbrp::replaceSrcIpRewrite(const SrcIpRewriteJsonObject &conf) { delSrcIpRewrite(); addSrcIpRewrite(conf); } void Lbrp::delSrcIpRewrite() { // what the hell means to remove entry in this case? } std::shared_ptr<Service> Lbrp::getService(const std::string &vip, const uint16_t &vport, const ServiceProtoEnum &proto) { // This method retrieves the pointer to Service object specified by its keys. logger()->debug("[Service] Received request to read a service entry"); logger()->debug("[Service] Virtual IP: {0}, virtual port: {1}, protocol: {2}", vip, vport, ServiceJsonObject::ServiceProtoEnum_to_string(proto)); uint16_t vp = vport; if (Service::convertProtoToNumber(proto) == 1) vp = vport; Service::ServiceKey key = Service::ServiceKey(vip, vp, Service::convertProtoToNumber(proto)); if (service_map_.count(key) == 0) { logger()->error("[Service] There are no entries associated with that key"); throw std::runtime_error("There are no entries associated with that key"); } return std::shared_ptr<Service>(&service_map_.at(key), [](Service *) {}); } std::vector<std::shared_ptr<Service>> Lbrp::getServiceList() { std::vector<std::shared_ptr<Service>> services_vect; for (auto &it : service_map_) { Service::ServiceKey key = it.first; services_vect.push_back( getService(std::get<0>(key), std::get<1>(key), Service::convertNumberToProto(std::get<2>(key)))); } return services_vect; } void Lbrp::addService(const std::string &vip, const uint16_t &vport, const ServiceProtoEnum &proto, const ServiceJsonObject &conf) { logger()->debug("[Service] Received request to create new service entry"); logger()->debug("[Service] Virtual IP: {0}, virtual port: {1}, protocol: {2}", vip, vport, ServiceJsonObject::ServiceProtoEnum_to_string(proto)); if (proto == ServiceProtoEnum::ALL) { // Let's create 3 different services for TCP, UDP and ICMP // Let's start from TCP ServiceJsonObject new_conf(conf); new_conf.setProto(ServiceProtoEnum::TCP); addService(vip, vport, ServiceProtoEnum::TCP, new_conf); // Now is the UDP turn new_conf.setProto(ServiceProtoEnum::UDP); addService(vip, vport, ServiceProtoEnum::UDP, new_conf); // Finally, is ICMP turn. For ICMP we use a "special" port since this field // is useless new_conf.setProto(ServiceProtoEnum::ICMP); new_conf.setVport(Service::ICMP_EBPF_PORT); addService(vip, Service::ICMP_EBPF_PORT, ServiceProtoEnum::ICMP, new_conf); // We completed all task, let's directly return since we do not have to // execute the code below return; } else if (proto == ServiceProtoEnum::ICMP && conf.getVport() != Service::ICMP_EBPF_PORT) { throw std::runtime_error( "ICMP Service requires 0 as virtual port. Since this parameter is " "useless for ICMP services"); } } void Lbrp::addServiceList(const std::vector<ServiceJsonObject> &conf) { for (auto &i : conf) { std::string vip_ = i.getVip(); uint16_t vport_ = i.getVport(); ServiceProtoEnum proto_ = i.getProto(); addService(vip_, vport_, proto_, i); } } void Lbrp::replaceService(const std::string &vip, const uint16_t &vport, const ServiceProtoEnum &proto, const ServiceJsonObject &conf) { delService(vip, vport, proto); std::string vip_ = conf.getVip(); uint16_t vport_ = conf.getVport(); ServiceProtoEnum proto_ = conf.getProto(); addService(vip_, vport_, proto_, conf); } void Lbrp::delService(const std::string &vip, const uint16_t &vport, const ServiceProtoEnum &proto) { if (proto == ServiceProtoEnum::ALL) { // Let's create 3 different services for TCP, UDP and ICMP // Let's start from TCP delService(vip, vport, ServiceProtoEnum::TCP); // Now is the UDP turn delService(vip, vport, ServiceProtoEnum::UDP); // Finally, is ICMP turn. For ICMP we use a "special" port since this field // is useless delService(vip, Service::ICMP_EBPF_PORT, ServiceProtoEnum::ICMP); // We completed all task, let's directly return since we do not have to // execute the code below return; } else if (proto == ServiceProtoEnum::ICMP && vport != Service::ICMP_EBPF_PORT) { throw std::runtime_error( "ICMP Service requires 0 as virtual port. Since this parameter is " "useless for ICMP services"); } logger()->debug("[Service] Received request to delete a service entry"); logger()->debug("[Service] Virtual IP: {0}, virtual port: {1}, protocol: {2}", vip, vport, ServiceJsonObject::ServiceProtoEnum_to_string(proto)); Service::ServiceKey key = Service::ServiceKey(vip, vport, Service::convertProtoToNumber(proto)); if (service_map_.count(key) == 0) { logger()->error("[Service] There are no entries associated with that key"); throw std::runtime_error("There are no entries associated with that key"); } auto service = getService(vip, vport, proto); service->removeServiceFromKernelMap(); service_map_.erase(key); } void Lbrp::delServiceList() { for (auto it = service_map_.begin(); it != service_map_.end();) { auto tmp = it; it++; delService(tmp->second.getVip(), tmp->second.getVport(), tmp->second.getProto()); } }
30.605598
80
0.647406
francescomessina
ca6421ef2d2e5cbed7a2689915d48c40fccf5b52
596
cpp
C++
Resources/Example Code/12 Pointers and Memory Management/Addresses/addresses.cpp
tdfairch2/CS200-Concepts-of-Progamming-Algorithms
050510da8eea06aff3519097cc5f22831036b7cf
[ "MIT" ]
null
null
null
Resources/Example Code/12 Pointers and Memory Management/Addresses/addresses.cpp
tdfairch2/CS200-Concepts-of-Progamming-Algorithms
050510da8eea06aff3519097cc5f22831036b7cf
[ "MIT" ]
null
null
null
Resources/Example Code/12 Pointers and Memory Management/Addresses/addresses.cpp
tdfairch2/CS200-Concepts-of-Progamming-Algorithms
050510da8eea06aff3519097cc5f22831036b7cf
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; void SetNumber( int& number ) { number = 5; } int main() { int myNumber1, myNumber2, myNumber3; SetNumber( myNumber1 ); myNumber2 = 20; myNumber3 = 10; cout << "Variable value 1: " << myNumber1 << endl; cout << "Variable address 1: " << &myNumber1 << endl << endl; cout << "Variable value 2: " << myNumber2 << endl; cout << "Variable address 2: " << &myNumber2 << endl << endl; cout << "Variable value 3: " << myNumber3 << endl; cout << "Variable address 3: " << &myNumber3 << endl; return 0; }
22.074074
65
0.578859
tdfairch2
ca646a7722c5f56c31892659460ea273df62f7df
12,114
cpp
C++
src/pk.cpp
tjahn/mbedcrypto
23ea27d1d7602e0f2c4e8c8c148b73ca7b4f1425
[ "MIT" ]
40
2016-04-01T15:20:24.000Z
2022-03-24T08:38:12.000Z
src/pk.cpp
tjahn/mbedcrypto
23ea27d1d7602e0f2c4e8c8c148b73ca7b4f1425
[ "MIT" ]
4
2017-12-12T09:04:38.000Z
2021-01-30T04:19:05.000Z
src/pk.cpp
tjahn/mbedcrypto
23ea27d1d7602e0f2c4e8c8c148b73ca7b4f1425
[ "MIT" ]
15
2016-07-22T02:46:23.000Z
2020-12-23T15:57:37.000Z
#include "mbedcrypto/pk.hpp" #include "mbedcrypto/hash.hpp" #include "./pk_private.hpp" //----------------------------------------------------------------------------- namespace mbedcrypto { namespace pk { //----------------------------------------------------------------------------- static_assert(std::is_copy_constructible<context>::value == false, ""); static_assert(std::is_move_constructible<context>::value == true, ""); //----------------------------------------------------------------------------- namespace { //----------------------------------------------------------------------------- // constants enum K { DefaultExportBufferSize = 16000, }; struct larger_than_key : public exceptions::usage_error { larger_than_key() : exceptions::usage_error( "the input value is larger than max_crypt_size()") {} }; // struct larger_than_key void check_crypt_size_of(const context& pk, buffer_view_t in) { if ( in.size() > max_crypt_size(pk)) throw larger_than_key{}; } void finalize_pem(buffer_t& pem) { pem.push_back('\0'); } void reset_as_impl(context& d, pk_t ptype) { reset(d); mbedcrypto_c_call(mbedtls_pk_setup, &d.pk_, native_info(ptype)); } bool check_rsa_conversion(pk_t ptype) { switch (ptype) { case pk_t::rsa: case pk_t::rsa_alt: case pk_t::rsassa_pss: return true; default: return false; } } bool check_ec_conversion(pk_t ptype) { switch (ptype) { case pk_t::eckey: case pk_t::eckey_dh: case pk_t::ecdsa: return true; default: return false; } } void ensure_type_match(context& d, pk_t old_type, pk_t new_type) { switch (old_type) { case pk_t::rsa: case pk_t::rsa_alt: case pk_t::rsassa_pss: if (!check_rsa_conversion(new_type)) { reset_as_impl(d, old_type); throw exceptions::type_error{}; } break; case pk_t::eckey: case pk_t::eckey_dh: case pk_t::ecdsa: if (!check_ec_conversion(new_type)) { reset_as_impl(d, old_type); throw exceptions::type_error{}; } break; default: break; } } //----------------------------------------------------------------------------- } // namespace anon //----------------------------------------------------------------------------- void reset(context& d) noexcept { d.key_is_private_ = false; mbedtls_pk_free(&d.pk_); } void reset_as(context& d, pk_t ptype) { // is ptype compatible with current context? ensure_type_match(d, type_of(d), ptype); reset_as_impl(d, ptype); } pk_t type_of(const context& d) { return from_native(mbedtls_pk_get_type(&d.pk_)); } const char* name_of(const context& d) noexcept { return mbedtls_pk_get_name(&d.pk_); } size_t key_length(const context& d) noexcept { return (size_t)mbedtls_pk_get_len(&d.pk_); } size_t key_bitlen(const context& d) noexcept { return (size_t)mbedtls_pk_get_bitlen(&d.pk_); } size_t max_crypt_size(const context& d) { // padding / header data (11 bytes for PKCS#1 v1.5 padding). if (type_of(d) == pk_t::rsa) return key_length(d) - 11; #if defined(MBEDTLS_ECDSA_C) else if (can_do(d, pk_t::ecdsa)) return (size_t)MBEDTLS_ECDSA_MAX_LEN; #endif throw exceptions::support_error{}; } bool has_private_key(const context& d) noexcept { return d.key_is_private_; } bool can_do(const context& d, pk_t ptype) { int ret = mbedtls_pk_can_do(&d.pk_, to_native(ptype)); // refinement due to build options if (type_of(d) == pk_t::eckey && ptype == pk_t::ecdsa) { if (!supports(pk_t::ecdsa)) ret = 0; } return ret == 1; } action_flags what_can_do(const context& d) { pk::action_flags f{false, false, false, false}; if (d.pk_.pk_info != nullptr && key_bitlen(d) > 0) { const auto* info = d.pk_.pk_info; f.encrypt = info->encrypt_func != nullptr; f.decrypt = info->decrypt_func != nullptr; f.sign = info->sign_func != nullptr; f.verify = info->verify_func != nullptr; // refine due to pub/priv key // pub keys can not sign, nor decrypt switch (type_of(d)) { case pk_t::rsa: if (!d.key_is_private_) f.decrypt = f.sign = false; break; case pk_t::eckey: case pk_t::ecdsa: if (!d.key_is_private_) f.sign = false; break; default: break; } } return f; } bool check_pair(const context& pub, const context& priv) { int ret = mbedtls_pk_check_pair(&pub.pk_, &priv.pk_); switch (ret) { case 0: return true; case MBEDTLS_ERR_PK_BAD_INPUT_DATA: case MBEDTLS_ERR_PK_TYPE_MISMATCH: throw exception{ret, __FUNCTION__}; break; default: return false; break; } } void import_key(context& d, buffer_view_t priv_data, buffer_view_t pass) { auto old_type = type_of(d); reset(d); mbedcrypto_c_call( mbedtls_pk_parse_key, &d.pk_, priv_data.data(), priv_data.size(), pass.data(), pass.size()); // check the key type ensure_type_match(d, old_type, type_of(d)); d.key_is_private_ = true; } void import_public_key(context& d, buffer_view_t pub_data) { auto old_type = type_of(d); reset(d); mbedcrypto_c_call( mbedtls_pk_parse_public_key, &d.pk_, pub_data.data(), pub_data.size()); // check the key type ensure_type_match(d, old_type, type_of(d)); d.key_is_private_ = false; } void load_key(context& d, const char* fpath, const char* pass) { auto old_type = type_of(d); reset(d); mbedcrypto_c_call(mbedtls_pk_parse_keyfile, &d.pk_, fpath, pass); // check the key type ensure_type_match(d, old_type, type_of(d)); d.key_is_private_ = true; } void load_public_key(context& d, const char* fpath) { auto old_type = type_of(d); reset(d); mbedcrypto_c_call(mbedtls_pk_parse_public_keyfile, &d.pk_, fpath); // check the key type ensure_type_match(d, old_type, type_of(d)); d.key_is_private_ = false; } buffer_t export_key(context& d, key_format fmt) { #if defined(MBEDTLS_PK_WRITE_C) buffer_t output(K::DefaultExportBufferSize, '\0'); if (fmt == pem_format) { mbedcrypto_c_call( mbedtls_pk_write_key_pem, &d.pk_, to_ptr(output), K::DefaultExportBufferSize); output.resize(std::strlen(output.c_str())); finalize_pem(output); } else if (fmt == pk::der_format) { int ret = mbedtls_pk_write_key_der( &d.pk_, to_ptr(output), K::DefaultExportBufferSize); if (ret < 0) throw exception{ret, __FUNCTION__}; size_t length = ret; output.erase(0, K::DefaultExportBufferSize - length); output.resize(length); } return output; #else // MBEDTLS_PK_WRITE_C throw exceptions::pk_export_missed{}; #endif // MBEDTLS_PK_WRITE_C } buffer_t export_public_key(context& d, key_format fmt) { #if defined(MBEDTLS_PK_WRITE_C) buffer_t output(K::DefaultExportBufferSize, '\0'); if (fmt == pk::pem_format) { mbedcrypto_c_call( mbedtls_pk_write_pubkey_pem, &d.pk_, to_ptr(output), K::DefaultExportBufferSize); output.resize(std::strlen(output.c_str())); finalize_pem(output); } else if (fmt == pk::der_format) { int ret = mbedtls_pk_write_pubkey_der( &d.pk_, to_ptr(output), K::DefaultExportBufferSize); if (ret < 0) throw exception{ret, __FUNCTION__}; size_t length = ret; output.erase(0, K::DefaultExportBufferSize - length); output.resize(length); } return output; #else // MBEDTLS_PK_WRITE_C throw exceptions::pk_export_missed{}; #endif // MBEDTLS_PK_WRITE_C } bool supports_key_export() noexcept { #if defined(MBEDTLS_PK_WRITE_C) return true; #else // MBEDTLS_PK_WRITE_C return false; #endif // MBEDTLS_PK_WRITE_C } bool supports_rsa_keygen() noexcept { #if defined(MBEDTLS_GENPRIME) return true; #else return false; #endif } bool supports_ec_keygen() noexcept { #if defined(MBEDTLS_ECP_C) return true; #else return false; #endif } void generate_rsa_key(context& d, size_t key_bitlen, size_t exponent) { #if defined(MBEDTLS_GENPRIME) // resets previous states pk::reset_as(d, pk_t::rsa); mbedcrypto_c_call( mbedtls_rsa_gen_key, mbedtls_pk_rsa(d.pk_), rnd_generator::maker, &d.rnd_, static_cast<unsigned int>(key_bitlen), static_cast<int>(exponent)); // set the key type d.key_is_private_ = true; #else // MBEDTLS_GENPRIME throw exceptions::rsa_keygen_missed{}; #endif // MBEDTLS_GENPRIME } void generate_ec_key(context& d, curve_t ctype) { #if defined(MBEDTLS_ECP_C) // resets previous states pk::reset_as(d, pk_t::eckey); mbedcrypto_c_call( mbedtls_ecp_gen_key, to_native(ctype), mbedtls_pk_ec(d.pk_), rnd_generator::maker, &d.rnd_); // set the key type d.key_is_private_ = true; #else // MBEDTLS_ECP_C throw exceptions::ecp_missed{}; #endif // MBEDTLS_ECP_C } buffer_t sign(context& d, buffer_view_t hvalue, hash_t halgo) { if (type_of(d) != pk_t::rsa && !can_do(d, pk_t::ecdsa)) throw exceptions::support_error{}; check_crypt_size_of(d, hvalue); size_t olen = 32 + max_crypt_size(d); buffer_t output(olen, '\0'); mbedcrypto_c_call( mbedtls_pk_sign, &d.pk_, to_native(halgo), hvalue.data(), hvalue.size(), to_ptr(output), &olen, rnd_generator::maker, &d.rnd_); output.resize(olen); return output; } bool verify( context& d, buffer_view_t signature, buffer_view_t hvalue, hash_t halgo) { if (type_of(d) != pk_t::rsa && !can_do(d, pk_t::ecdsa)) throw exceptions::support_error{}; check_crypt_size_of(d, hvalue); int ret = mbedtls_pk_verify( &d.pk_, to_native(halgo), hvalue.data(), hvalue.size(), signature.data(), signature.size()); // TODO: check when to report other errors switch (ret) { case 0: return true; case MBEDTLS_ERR_PK_BAD_INPUT_DATA: case MBEDTLS_ERR_PK_TYPE_MISMATCH: throw exception{ret, "failed to verify the signature"}; break; default: break; } return false; } buffer_t encrypt(context& d, buffer_view_t source) { if (type_of(d) != pk_t::rsa) throw exceptions::support_error{}; check_crypt_size_of(d, source); size_t olen = 32 + max_crypt_size(d); buffer_t output(olen, '\0'); mbedcrypto_c_call( mbedtls_pk_encrypt, &d.pk_, source.data(), source.size(), to_ptr(output), &olen, olen, rnd_generator::maker, &d.rnd_); output.resize(olen); return output; } buffer_t decrypt(context& d, buffer_view_t encrypted_value) { if (type_of(d) != pk_t::rsa) throw exceptions::support_error{}; if ((encrypted_value.size() << 3) > key_bitlen(d)) throw larger_than_key{}; size_t olen = 32 + max_crypt_size(d); buffer_t output(olen, '\0'); mbedcrypto_c_call( mbedtls_pk_decrypt, &d.pk_, encrypted_value.data(), encrypted_value.size(), to_ptr(output), &olen, olen, rnd_generator::maker, &d.rnd_); output.resize(olen); return output; } //----------------------------------------------------------------------------- rnd_generator& pk_base::rnd() { return context().rnd_; } //----------------------------------------------------------------------------- } // namespace pk } // namespace mbedcrypto //-----------------------------------------------------------------------------
22.856604
79
0.586264
tjahn
ca650fbc9b9fd882424e6ff6e6b4821782aaf19e
1,455
cpp
C++
dev/Basic/long/database/entity/TravelTime.cpp
gusugusu1018/simmobility-prod
d30a5ba353673f8fd35f4868c26994a0206a40b6
[ "MIT" ]
50
2018-12-21T08:21:38.000Z
2022-01-24T09:47:59.000Z
dev/Basic/long/database/entity/TravelTime.cpp
gusugusu1018/simmobility-prod
d30a5ba353673f8fd35f4868c26994a0206a40b6
[ "MIT" ]
2
2018-12-19T13:42:47.000Z
2019-05-13T04:11:45.000Z
dev/Basic/long/database/entity/TravelTime.cpp
gusugusu1018/simmobility-prod
d30a5ba353673f8fd35f4868c26994a0206a40b6
[ "MIT" ]
27
2018-11-28T07:30:34.000Z
2022-02-05T02:22:26.000Z
/* * TravelTime.cpp * * Created on: 11 Mar 2016 * Author: gishara */ #include "TravelTime.hpp" #include "util/Utils.hpp" using namespace sim_mob::long_term; TravelTime::TravelTime(BigSerial origin, BigSerial destination, double carTravelTime,double publicTravelTime,double numTransfers): origin(origin), destination(destination),carTravelTime(carTravelTime),publicTravelTime(publicTravelTime) ,numTransfers(numTransfers){} TravelTime::~TravelTime() {} double TravelTime::getCarTravelTime() const { return carTravelTime; } void TravelTime::setCarTravelTime(double carTravelTime) { this->carTravelTime = carTravelTime; } BigSerial TravelTime::getDestination() const { return destination; } void TravelTime::setDestination(BigSerial destination) { this->destination = destination; } BigSerial TravelTime::getOrigin() const { return origin; } void TravelTime::setOrigin(BigSerial origin) { this->origin = origin; } double TravelTime::getPublicTravelTime() const { return publicTravelTime; } void TravelTime::setPublicTravelTime(double publicTravelTime) { this->publicTravelTime = publicTravelTime; } double TravelTime::getNumTransfers() const { return numTransfers; } void TravelTime::setNumTransfers(double numTransfers) { this->numTransfers = numTransfers; }
20.785714
235
0.692784
gusugusu1018
ca67342f1bf4fc8fd50302e0c131e91b518a2dd6
1,887
cpp
C++
src/ScriptInterface/TitleFormat.cpp
marc2k3/foo_jscript_panel
3bc2dedd8c0961993bd3a13ddd4e69f4c6832cdb
[ "MIT" ]
139
2017-12-22T12:53:03.000Z
2022-03-01T08:27:25.000Z
src/ScriptInterface/TitleFormat.cpp
marc2k3/foo_jscript_panel
3bc2dedd8c0961993bd3a13ddd4e69f4c6832cdb
[ "MIT" ]
48
2018-01-14T17:21:19.000Z
2020-02-01T16:32:18.000Z
src/ScriptInterface/TitleFormat.cpp
marc2k3/foo_jscript_panel
3bc2dedd8c0961993bd3a13ddd4e69f4c6832cdb
[ "MIT" ]
27
2017-12-23T10:23:13.000Z
2022-03-22T10:50:37.000Z
#include "stdafx.h" #include "TitleFormat.h" TitleFormat::TitleFormat(const std::wstring& pattern) { const string8 upattern = from_wide(pattern); titleformat_compiler::get()->compile_safe(m_obj, upattern); } STDMETHODIMP TitleFormat::get__ptr(void** out) { if (!out) return E_POINTER; *out = m_obj.get_ptr(); return S_OK; } STDMETHODIMP TitleFormat::Eval(BSTR* out) { if (m_obj.is_empty() || !out) return E_POINTER; string8 str; playback_control::get()->playback_format_title(nullptr, str, m_obj, nullptr, playback_control::display_level_all); *out = to_bstr(str); return S_OK; } STDMETHODIMP TitleFormat::EvalActivePlaylistItem(UINT playlistItemIndex, BSTR* out) { if (m_obj.is_empty() || !out) return E_POINTER; string8 str; Plman::theAPI()->activeplaylist_item_format_title(playlistItemIndex, nullptr, str, m_obj, nullptr, playback_control::display_level_all); *out = to_bstr(str); return S_OK; } STDMETHODIMP TitleFormat::EvalWithMetadb(IMetadbHandle* handle, BSTR* out) { if (m_obj.is_empty() || !out) return E_POINTER; metadb_handle* ptr = nullptr; GET_PTR(handle, ptr); string8 str; ptr->format_title(nullptr, str, m_obj, nullptr); *out = to_bstr(str); return S_OK; } STDMETHODIMP TitleFormat::EvalWithMetadbs(IMetadbHandleList* handles, VARIANT* out) { if (m_obj.is_empty() || !out) return E_POINTER; metadb_handle_list* handles_ptr = nullptr; GET_PTR(handles, handles_ptr); const uint32_t count = handles_ptr->get_count(); ComArrayWriter writer; if (!writer.create(count)) return E_OUTOFMEMORY; for (const uint32_t i : std::views::iota(0U, count)) { string8 str; handles_ptr->get_item(i)->format_title(nullptr, str, m_obj, nullptr); if (!writer.put_item(i, str)) return E_OUTOFMEMORY; } out->vt = VT_ARRAY | VT_VARIANT; out->parray = writer.get_ptr(); return S_OK; } void TitleFormat::FinalRelease() { m_obj.release(); }
24.192308
137
0.738209
marc2k3
ca6e22c41d1eddb977506f02d5c727cbac0634cf
340
cpp
C++
luogu/P6159.cpp
wznmickey/StudyInUMSJTU-JI
d4111de5995bfae06cd606464979c52ae631b8fb
[ "MIT" ]
1
2020-12-09T09:09:09.000Z
2020-12-09T09:09:09.000Z
luogu/P6159.cpp
wznmickey/StudyInUMSJTU-JI
d4111de5995bfae06cd606464979c52ae631b8fb
[ "MIT" ]
null
null
null
luogu/P6159.cpp
wznmickey/StudyInUMSJTU-JI
d4111de5995bfae06cd606464979c52ae631b8fb
[ "MIT" ]
1
2021-11-28T11:41:36.000Z
2021-11-28T11:41:36.000Z
#include <bits/stdc++.h> using namespace std; long long n, p, k, now, temp; int main() { scanf("%lld%lld%lld", &n, &p, &k); /* now = 0; for (int i = 0; i < k; i++) { temp = ((p + n - now) % n + p) % n; now = p; p = temp; } printf("%d", now); */ printf("%d",p*k%n); return 0; }
17.894737
43
0.405882
wznmickey
ca7719da1517fa1dfa3598b76bf0cd357eb6b212
1,130
cpp
C++
LeetCode/198. House Robber.cpp
tanishq1g/cp_codes
80b8ccc9e195a66d6d317076fdd54a02cd21275b
[ "MIT" ]
null
null
null
LeetCode/198. House Robber.cpp
tanishq1g/cp_codes
80b8ccc9e195a66d6d317076fdd54a02cd21275b
[ "MIT" ]
null
null
null
LeetCode/198. House Robber.cpp
tanishq1g/cp_codes
80b8ccc9e195a66d6d317076fdd54a02cd21275b
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <map> #include <algorithm> #include <cstdlib> #include <string> #include <queue> #include <stack> using namespace std; // class Solution { // public: // // DP dynamic programming // int rob(vector<int>& nums) { // int s = nums.size(); // if(s == 0) return 0; // if(s == 1) return nums[0]; // if(s == 2) return max(nums[0], nums[1]); // vector<int> dp(s); // dp[0] = nums[0]; // dp[1] = max(nums[0], nums[1]); // for (int i = 2; i < s; i++){ // dp[i] = max(nums[i] + dp[i - 2], dp[i - 1]); // } // return dp[s-1]; // } // }; // DP dynamic programming class Solution { public: int rob(vector<int>& nums) { int s = nums.size(); if(s == 0) return 0; if(s == 1) return nums[0]; if(s == 2) return max(nums[0], nums[1]); vector<int> dp(s); dp[0] = nums[0]; dp[1] = max(nums[0], nums[1]); for(int i = 2; i < s; i++){ dp[i] = max(dp[i - 1], dp[i - 2] + nums[i]); } return dp[s - 1]; } };
24.042553
59
0.453097
tanishq1g
ca797b779007981051fe156c68850c3b37152ce9
1,379
cpp
C++
Source Code/05_functions_and_random/05_04.cpp
rushone2010/CS_A150
0acab19e69c051f67b8dafe904ca77de0431958d
[ "MIT" ]
2
2017-03-18T22:04:47.000Z
2017-03-30T23:24:53.000Z
Source Code/05_functions_and_random/05_04.cpp
rushone2010/CS_A150
0acab19e69c051f67b8dafe904ca77de0431958d
[ "MIT" ]
null
null
null
Source Code/05_functions_and_random/05_04.cpp
rushone2010/CS_A150
0acab19e69c051f67b8dafe904ca77de0431958d
[ "MIT" ]
null
null
null
// Computes the area of a circle with the radius given and // the volume of a sphere with the radius given. #include <iostream> #include <cmath> using namespace std; const double PI = 3.14159; double area(double radius); // area - Computes the area of a circle with the radius given. // @param double - The radius of the circle. // @return double - The area of the circle. double volume(double radius); // volume - Computes the volume of a sphere with the radius given. // @param double - The radius of the sphere. // @return double - The volume of the sphere. int main() { double radiusOfBoth; cout << "Enter a radius to use for both a circle\n" << "and a sphere (in inches): "; cin >> radiusOfBoth; double areaOfCircle = area(radiusOfBoth); double volumeOfSphere = volume(radiusOfBoth); cout << "\nRadius = " << radiusOfBoth << " inches\n" << "Area of circle = " << areaOfCircle << " square inches\n" << "Volume of sphere = " << volumeOfSphere << " cubic inches\n"; cout << endl; cin.ignore(); cin.get(); return 0; } double area(double radius) { // formula for area of a circle: (PI * r^2) return (PI * radius * radius); } double volume(double radius) { // formula for volume of a sphere: ((4/3) * PI * r^2) return ((4.0/3.0) * PI * pow(radius, 3)); }
25.537037
67
0.622915
rushone2010
ca79f6088eca14a295862089a21d9b78f20e9fb6
3,697
cpp
C++
src/librt/primitives/ell/ell_brep.cpp
lf-/brlcad
f91ea585c1a930a2e97c3f5a8274db8805ebbb46
[ "BSD-4-Clause", "BSD-3-Clause" ]
83
2021-03-10T05:54:52.000Z
2022-03-31T16:33:46.000Z
src/librt/primitives/ell/ell_brep.cpp
lf-/brlcad
f91ea585c1a930a2e97c3f5a8274db8805ebbb46
[ "BSD-4-Clause", "BSD-3-Clause" ]
13
2021-06-24T17:07:48.000Z
2022-03-31T15:31:33.000Z
src/librt/primitives/ell/ell_brep.cpp
lf-/brlcad
f91ea585c1a930a2e97c3f5a8274db8805ebbb46
[ "BSD-4-Clause", "BSD-3-Clause" ]
54
2021-03-10T07:57:06.000Z
2022-03-28T23:20:37.000Z
/* E L L _ B R E P . C P P * BRL-CAD * * Copyright (c) 2008-2021 United States Government as represented by * the U.S. Army Research Laboratory. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this file; see the file named COPYING for more * information. */ /** @file ell_brep.cpp * * Convert a Generalized Ellipsoid to b-rep form * */ #include "common.h" #include "raytrace.h" #include "rt/geom.h" #include "brep.h" extern "C" void rt_ell_brep(ON_Brep **b, const struct rt_db_internal *ip, const struct bn_tol *tol) { struct rt_ell_internal *eip; RT_CK_DB_INTERNAL(ip); eip = (struct rt_ell_internal *)ip->idb_ptr; RT_ELL_CK_MAGIC(eip); // For Algorithms used in rotation and translation // Please refer to ell.c // X' = S(R(X - V)) // X = invR(invS(X')) + V = invRinvS(X') + V; // where R(X) = (A/(|A|)) // (B/(|B|)) . X // (C/(|C|)) // // and S(X) = (1/|A| 0 0 ) // (0 1/|B| 0 ) . X // (0 0 1/|C|) // Parameters for Rotate and Translate vect_t Au, Bu, Cu; /* A, B, C with unit length */ mat_t R; mat_t Rinv; mat_t Sinv; mat_t invRinvS; fastf_t magsq_a, magsq_b, magsq_c; fastf_t f; magsq_a = MAGSQ(eip->a); magsq_b = MAGSQ(eip->b); magsq_c = MAGSQ(eip->c); if (magsq_a < tol->dist_sq || magsq_b < tol->dist_sq || magsq_c < tol->dist_sq) { bu_log("rt_ell_brep(): ell zero length A(%g), B(%g), or C(%g) vector\n", magsq_a, magsq_b, magsq_c); } f = 1.0/sqrt(magsq_a); VSCALE(Au, eip->a, f); f = 1.0/sqrt(magsq_b); VSCALE(Bu, eip->b, f); f = 1.0/sqrt(magsq_c); VSCALE(Cu, eip->c, f); MAT_IDN(R); VMOVE(&R[0], Au); VMOVE(&R[4], Bu); VMOVE(&R[8], Cu); bn_mat_trn(Rinv, R); MAT_IDN(Sinv); Sinv[0] = MAGNITUDE(eip->a); Sinv[5] = MAGNITUDE(eip->b); Sinv[10] = MAGNITUDE(eip->c); bn_mat_mul(invRinvS, Rinv, Sinv); point_t origin; VSET(origin, 0, 0, 0); ON_Sphere sph(origin, 1); // Get the NURBS form of the surface ON_NurbsSurface *ellcurvedsurf = ON_NurbsSurface::New(); sph.GetNurbForm(*ellcurvedsurf); // Scale, rotate and translate control points for (int i = 0; i < ellcurvedsurf->CVCount(0); i++) { for (int j = 0; j < ellcurvedsurf->CVCount(1); j++) { point_t cvpt; ON_4dPoint ctrlpt; ellcurvedsurf->GetCV(i, j, ctrlpt); MAT3X3VEC(cvpt, invRinvS, ctrlpt); point_t scale_v; VSCALE(scale_v, eip->v, ctrlpt.w); VADD2(cvpt, scale_v, cvpt); ON_4dPoint newpt = ON_4dPoint(cvpt[0], cvpt[1], cvpt[2], ctrlpt.w); ellcurvedsurf->SetCV(i, j, newpt); } } ellcurvedsurf->SetDomain(0, 0.0, 1.0); ellcurvedsurf->SetDomain(1, 0.0, 1.0); // Make final BREP structure (*b)->m_S.Append(ellcurvedsurf); int surfindex = (*b)->m_S.Count(); (*b)->NewFace(surfindex - 1); int faceindex = (*b)->m_F.Count(); (*b)->NewOuterLoop(faceindex-1); } // Local Variables: // tab-width: 8 // mode: C++ // c-basic-offset: 4 // indent-tabs-mode: t // c-file-style: "stroustrup" // End: // ex: shiftwidth=4 tabstop=8
27.796992
85
0.600216
lf-
ca7af721bc525e5290e95b5b81e1fbfcd4070e14
2,791
cpp
C++
compiler/loco/src/IR/TensorShape.test.cpp
bogus-sudo/ONE-1
7052a817eff661ec2854ed2e7ee0de5e8ba82b55
[ "Apache-2.0" ]
255
2020-05-22T07:45:29.000Z
2022-03-29T23:58:22.000Z
compiler/loco/src/IR/TensorShape.test.cpp
bogus-sudo/ONE-1
7052a817eff661ec2854ed2e7ee0de5e8ba82b55
[ "Apache-2.0" ]
5,102
2020-05-22T07:48:33.000Z
2022-03-31T23:43:39.000Z
compiler/loco/src/IR/TensorShape.test.cpp
bogus-sudo/ONE-1
7052a817eff661ec2854ed2e7ee0de5e8ba82b55
[ "Apache-2.0" ]
120
2020-05-22T07:51:08.000Z
2022-02-16T19:08:05.000Z
/* * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "loco/IR/TensorShape.h" #include <gtest/gtest.h> TEST(TensorShapeTest, default_constructor) { loco::TensorShape tensor_shape; ASSERT_EQ(0, tensor_shape.rank()); } TEST(TensorShapeTest, initializer_list_constructor) { loco::TensorShape tensor_shape{3, 5}; ASSERT_EQ(2, tensor_shape.rank()); ASSERT_TRUE(tensor_shape.dim(0).known()); ASSERT_TRUE(tensor_shape.dim(1).known()); ASSERT_EQ(3, tensor_shape.dim(0).value()); ASSERT_EQ(5, tensor_shape.dim(1).value()); } TEST(TensorShapeTest, rank) { loco::TensorShape tensor_shape; tensor_shape.rank(2); ASSERT_EQ(2, tensor_shape.rank()); ASSERT_FALSE(tensor_shape.dim(0).known()); ASSERT_FALSE(tensor_shape.dim(1).known()); } TEST(TensorShapeTest, dim) { loco::TensorShape tensor_shape; tensor_shape.rank(2); tensor_shape.dim(0) = 3; ASSERT_TRUE(tensor_shape.dim(0).known()); ASSERT_FALSE(tensor_shape.dim(1).known()); ASSERT_EQ(3, tensor_shape.dim(0)); } TEST(TensorShapeTest, rank_update) { loco::TensorShape tensor_shape; tensor_shape.rank(2); tensor_shape.dim(1) = 3; tensor_shape.rank(4); ASSERT_FALSE(tensor_shape.dim(0).known()); ASSERT_TRUE(tensor_shape.dim(1).known()); ASSERT_FALSE(tensor_shape.dim(2).known()); ASSERT_FALSE(tensor_shape.dim(3).known()); ASSERT_EQ(3, tensor_shape.dim(1)); } TEST(TensorShapeTest, copy) { loco::TensorShape src; src.rank(2); src.dim(1) = 3; loco::TensorShape dst; dst = src; ASSERT_EQ(2, dst.rank()); ASSERT_FALSE(dst.dim(0).known()); ASSERT_TRUE(dst.dim(1).known()); ASSERT_EQ(3, dst.dim(1)); } TEST(TensorShapeTest, element_count) { // Check Rank-0 case loco::TensorShape src; ASSERT_EQ(1, loco::element_count(&src)); } TEST(TensorShapeTest, equal_operator) { loco::TensorShape lhs, rhs; lhs.rank(2); lhs.dim(0) = 1; lhs.dim(1) = 3; rhs.rank(1); rhs.dim(0) = 1; EXPECT_FALSE(lhs == rhs); rhs.rank(2); rhs.dim(0) = 1; rhs.dim(1) = 3; EXPECT_TRUE(lhs == rhs); // for unknown loco::TensorShape lhs_u, rhs_u; lhs_u.rank(2); lhs_u.dim(0) = 1; rhs_u.rank(2); rhs_u.dim(0) = 1; EXPECT_FALSE(lhs == rhs_u); }
19.794326
75
0.692942
bogus-sudo
ca7b6718574b0b2e80980fe993f72ae8d641c699
1,161
cpp
C++
nowcoder/contests/浙城校赛/C.cpp
songhn233/Algorithm-Packages
56d6f3c2467c175ab8a19b82bdfb25fc881e2206
[ "CC0-1.0" ]
1
2020-08-10T21:40:21.000Z
2020-08-10T21:40:21.000Z
nowcoder/contests/浙城校赛/C.cpp
songhn233/Algorithm-Packages
56d6f3c2467c175ab8a19b82bdfb25fc881e2206
[ "CC0-1.0" ]
null
null
null
nowcoder/contests/浙城校赛/C.cpp
songhn233/Algorithm-Packages
56d6f3c2467c175ab8a19b82bdfb25fc881e2206
[ "CC0-1.0" ]
null
null
null
#include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #include<vector> #include<queue> #include<cmath> #include<map> #include<set> #define ll long long #define F(i,a,b) for(int i=(a);i<=(b);i++) #define mst(a,b) memset((a),(b),sizeof(a)) #define PII pair<int,int> #define rep(i,x,y) for(auto i=(x);i<=(y);++i) #define dep(i,x,y) for(auto i=(x);i>=(y);--i) using namespace std; template<class T>inline void rd(T &x) { x=0; int ch=getchar(),f=0; while(ch<'0'||ch>'9'){if (ch=='-') f=1;ch=getchar();} while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();} if(f)x=-x; } const int inf=0x3f3f3f3f; const int maxn=100050; int T; ll x,m,n,f[maxn]; int main() { cin>>T; while(T--) { cin>>x>>m>>n; f[0]=1; ll tot=1; for(int i=1;i<=n;i++) { f[i]=f[i-1]; if(i%7==1&&i!=1) { f[i]+=min(x,max(m-tot,0ll)); tot+=x; } else if(i>=14) f[i]-=f[i-14]; } if(n<8) puts("0"); else if(n<14) cout<<f[n-8]<<endl; else cout<<f[n-8]-f[n-14]<<endl; } return 0; }
23.22
67
0.485788
songhn233
ca7de9eee7bfae5c3aad7d20a516efcf8cb230bb
3,116
cpp
C++
src/IECore/FromCoreConverter.cpp
gcodebackups/cortex-vfx
72fa6c6eb3327fce4faf01361c8fcc2e1e892672
[ "BSD-3-Clause" ]
5
2016-07-26T06:09:28.000Z
2022-03-07T03:58:51.000Z
src/IECore/FromCoreConverter.cpp
turbosun/cortex
4bdc01a692652cd562f3bfa85f3dae99d07c0b15
[ "BSD-3-Clause" ]
null
null
null
src/IECore/FromCoreConverter.cpp
turbosun/cortex
4bdc01a692652cd562f3bfa85f3dae99d07c0b15
[ "BSD-3-Clause" ]
3
2015-03-25T18:45:24.000Z
2020-02-15T15:37:18.000Z
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2008-2010, Image Engine Design 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 Image Engine Design nor the names of any // other contributors to this software may be used to endorse or // promote products derived from this software without specific prior // written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////// #include "IECore/FromCoreConverter.h" #include "IECore/CompoundParameter.h" #include "IECore/NullObject.h" using namespace IECore; IE_CORE_DEFINERUNTIMETYPED( FromCoreConverter ); FromCoreConverter::FromCoreConverter( const std::string &description, TypeId supportedType ) : Converter( description ) { m_srcParameter = new ObjectParameter( "src", "The object to be converted.", new NullObject(), supportedType ); parameters()->addParameter( m_srcParameter ); } FromCoreConverter::FromCoreConverter( const std::string &description, const ObjectParameter::TypeIdSet &supportedTypes ) : Converter( description ) { m_srcParameter = new ObjectParameter( "src", "The object to be converted.", new NullObject(), supportedTypes ); parameters()->addParameter( m_srcParameter ); } FromCoreConverter::FromCoreConverter( const std::string &description, const TypeId *supportedTypes ) : Converter( description ) { m_srcParameter = new ObjectParameter( "src", "The object to be converted.", new NullObject(), supportedTypes ); parameters()->addParameter( m_srcParameter ); } FromCoreConverter::~FromCoreConverter() { } ObjectParameterPtr FromCoreConverter::srcParameter() { return m_srcParameter; } ConstObjectParameterPtr FromCoreConverter::srcParameter() const { return m_srcParameter; }
39.948718
120
0.721759
gcodebackups
ca7e6735dca1ae95cec310cda7a885d1f20d74b1
142,444
cpp
C++
C10_Libraries/Plugins/VRExpansionPlugin/VRExpansionPlugin/Intermediate/Build/Win64/UE4Editor/Inc/VRExpansionPlugin/GrippableStaticMeshComponent.gen.cpp
Docdavies/Unreal-Engine-4-Virtual-Reality-Projects
86305b7a7c8112933e73bcd95d7d33a1d6b8c210
[ "MIT" ]
24
2019-04-20T01:46:33.000Z
2022-02-06T07:22:53.000Z
C10_Libraries/Plugins/VRExpansionPlugin/VRExpansionPlugin/Intermediate/Build/Win64/UE4Editor/Inc/VRExpansionPlugin/GrippableStaticMeshComponent.gen.cpp
Docdavies/Unreal-Engine-4-Virtual-Reality-Projects
86305b7a7c8112933e73bcd95d7d33a1d6b8c210
[ "MIT" ]
null
null
null
C10_Libraries/Plugins/VRExpansionPlugin/VRExpansionPlugin/Intermediate/Build/Win64/UE4Editor/Inc/VRExpansionPlugin/GrippableStaticMeshComponent.gen.cpp
Docdavies/Unreal-Engine-4-Virtual-Reality-Projects
86305b7a7c8112933e73bcd95d7d33a1d6b8c210
[ "MIT" ]
16
2019-06-03T16:02:56.000Z
2022-01-19T08:36:57.000Z
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "UObject/GeneratedCppIncludes.h" #include "VRExpansionPlugin/Public/Grippables/GrippableStaticMeshComponent.h" #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4883) #endif PRAGMA_DISABLE_DEPRECATION_WARNINGS void EmptyLinkFunctionForGeneratedCodeGrippableStaticMeshComponent() {} // Cross Module References VREXPANSIONPLUGIN_API UClass* Z_Construct_UClass_UGrippableStaticMeshComponent_NoRegister(); VREXPANSIONPLUGIN_API UClass* Z_Construct_UClass_UGrippableStaticMeshComponent(); ENGINE_API UClass* Z_Construct_UClass_UStaticMeshComponent(); UPackage* Z_Construct_UPackage__Script_VRExpansionPlugin(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings(); VREXPANSIONPLUGIN_API UScriptStruct* Z_Construct_UScriptStruct_FBPAdvGripSettings(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange(); VREXPANSIONPLUGIN_API UClass* Z_Construct_UClass_UGripMotionControllerComponent_NoRegister(); COREUOBJECT_API UScriptStruct* Z_Construct_UScriptStruct_FTransform(); COREUOBJECT_API UScriptStruct* Z_Construct_UScriptStruct_FVector(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts(); VREXPANSIONPLUGIN_API UClass* Z_Construct_UClass_UVRGripScriptBase_NoRegister(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType(); VREXPANSIONPLUGIN_API UEnum* Z_Construct_UEnum_VRExpansionPlugin_EGripCollisionType(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting(); VREXPANSIONPLUGIN_API UEnum* Z_Construct_UEnum_VRExpansionPlugin_EGripLateUpdateSettings(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType(); VREXPANSIONPLUGIN_API UEnum* Z_Construct_UEnum_VRExpansionPlugin_EGripMovementReplicationSettings(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip(); VREXPANSIONPLUGIN_API UScriptStruct* Z_Construct_UScriptStruct_FBPActorGripInformation(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndSecondaryUsed(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndUsed(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput(); ENGINE_API UEnum* Z_Construct_UEnum_Engine_EInputEvent(); INPUTCORE_API UScriptStruct* Z_Construct_UScriptStruct_FKey(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip(); ENGINE_API UClass* Z_Construct_UClass_USceneComponent_NoRegister(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryUsed(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnUsed(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing(); VREXPANSIONPLUGIN_API UScriptStruct* Z_Construct_UScriptStruct_FTransform_NetQuantize(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType(); VREXPANSIONPLUGIN_API UEnum* Z_Construct_UEnum_VRExpansionPlugin_ESecondaryGripType(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior(); VREXPANSIONPLUGIN_API UEnum* Z_Construct_UEnum_VRExpansionPlugin_EGripInterfaceTeleportBehavior(); VREXPANSIONPLUGIN_API UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip(); VREXPANSIONPLUGIN_API UScriptStruct* Z_Construct_UScriptStruct_FBPInterfaceProperties(); GAMEPLAYTAGS_API UScriptStruct* Z_Construct_UScriptStruct_FGameplayTagContainer(); VREXPANSIONPLUGIN_API UClass* Z_Construct_UClass_UVRGripInterface_NoRegister(); GAMEPLAYTAGS_API UClass* Z_Construct_UClass_UGameplayTagAssetInterface_NoRegister(); // End Cross Module References static FName NAME_UGrippableStaticMeshComponent_AdvancedGripSettings = FName(TEXT("AdvancedGripSettings")); FBPAdvGripSettings UGrippableStaticMeshComponent::AdvancedGripSettings() { GrippableStaticMeshComponent_eventAdvancedGripSettings_Parms Parms; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_AdvancedGripSettings),&Parms); return Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_ClosestGripSlotInRange = FName(TEXT("ClosestGripSlotInRange")); void UGrippableStaticMeshComponent::ClosestGripSlotInRange(FVector WorldLocation, bool bSecondarySlot, bool& bHadSlotInRange, FTransform& SlotWorldTransform, UGripMotionControllerComponent* CallingController, FName OverridePrefix) { GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms Parms; Parms.WorldLocation=WorldLocation; Parms.bSecondarySlot=bSecondarySlot ? true : false; Parms.bHadSlotInRange=bHadSlotInRange ? true : false; Parms.SlotWorldTransform=SlotWorldTransform; Parms.CallingController=CallingController; Parms.OverridePrefix=OverridePrefix; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_ClosestGripSlotInRange),&Parms); bHadSlotInRange=Parms.bHadSlotInRange; SlotWorldTransform=Parms.SlotWorldTransform; } static FName NAME_UGrippableStaticMeshComponent_DenyGripping = FName(TEXT("DenyGripping")); bool UGrippableStaticMeshComponent::DenyGripping() { GrippableStaticMeshComponent_eventDenyGripping_Parms Parms; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_DenyGripping),&Parms); return !!Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_GetGripScripts = FName(TEXT("GetGripScripts")); bool UGrippableStaticMeshComponent::GetGripScripts(TArray<UVRGripScriptBase*>& ArrayReference) { GrippableStaticMeshComponent_eventGetGripScripts_Parms Parms; Parms.ArrayReference=ArrayReference; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_GetGripScripts),&Parms); ArrayReference=Parms.ArrayReference; return !!Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping = FName(TEXT("GetGripStiffnessAndDamping")); void UGrippableStaticMeshComponent::GetGripStiffnessAndDamping(float& GripStiffnessOut, float& GripDampingOut) { GrippableStaticMeshComponent_eventGetGripStiffnessAndDamping_Parms Parms; Parms.GripStiffnessOut=GripStiffnessOut; Parms.GripDampingOut=GripDampingOut; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping),&Parms); GripStiffnessOut=Parms.GripStiffnessOut; GripDampingOut=Parms.GripDampingOut; } static FName NAME_UGrippableStaticMeshComponent_GetPrimaryGripType = FName(TEXT("GetPrimaryGripType")); EGripCollisionType UGrippableStaticMeshComponent::GetPrimaryGripType(bool bIsSlot) { GrippableStaticMeshComponent_eventGetPrimaryGripType_Parms Parms; Parms.bIsSlot=bIsSlot ? true : false; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_GetPrimaryGripType),&Parms); return Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_GripBreakDistance = FName(TEXT("GripBreakDistance")); float UGrippableStaticMeshComponent::GripBreakDistance() { GrippableStaticMeshComponent_eventGripBreakDistance_Parms Parms; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_GripBreakDistance),&Parms); return Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_GripLateUpdateSetting = FName(TEXT("GripLateUpdateSetting")); EGripLateUpdateSettings UGrippableStaticMeshComponent::GripLateUpdateSetting() { GrippableStaticMeshComponent_eventGripLateUpdateSetting_Parms Parms; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_GripLateUpdateSetting),&Parms); return Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_GripMovementReplicationType = FName(TEXT("GripMovementReplicationType")); EGripMovementReplicationSettings UGrippableStaticMeshComponent::GripMovementReplicationType() { GrippableStaticMeshComponent_eventGripMovementReplicationType_Parms Parms; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_GripMovementReplicationType),&Parms); return Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_IsHeld = FName(TEXT("IsHeld")); void UGrippableStaticMeshComponent::IsHeld(UGripMotionControllerComponent*& HoldingController, bool& bIsHeld) { GrippableStaticMeshComponent_eventIsHeld_Parms Parms; Parms.HoldingController=HoldingController; Parms.bIsHeld=bIsHeld ? true : false; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_IsHeld),&Parms); HoldingController=Parms.HoldingController; bIsHeld=Parms.bIsHeld; } static FName NAME_UGrippableStaticMeshComponent_OnChildGrip = FName(TEXT("OnChildGrip")); void UGrippableStaticMeshComponent::OnChildGrip(UGripMotionControllerComponent* GrippingController, FBPActorGripInformation const& GripInformation) { GrippableStaticMeshComponent_eventOnChildGrip_Parms Parms; Parms.GrippingController=GrippingController; Parms.GripInformation=GripInformation; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnChildGrip),&Parms); } static FName NAME_UGrippableStaticMeshComponent_OnChildGripRelease = FName(TEXT("OnChildGripRelease")); void UGrippableStaticMeshComponent::OnChildGripRelease(UGripMotionControllerComponent* ReleasingController, FBPActorGripInformation const& GripInformation, bool bWasSocketed) { GrippableStaticMeshComponent_eventOnChildGripRelease_Parms Parms; Parms.ReleasingController=ReleasingController; Parms.GripInformation=GripInformation; Parms.bWasSocketed=bWasSocketed ? true : false; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnChildGripRelease),&Parms); } static FName NAME_UGrippableStaticMeshComponent_OnEndSecondaryUsed = FName(TEXT("OnEndSecondaryUsed")); void UGrippableStaticMeshComponent::OnEndSecondaryUsed() { ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnEndSecondaryUsed),NULL); } static FName NAME_UGrippableStaticMeshComponent_OnEndUsed = FName(TEXT("OnEndUsed")); void UGrippableStaticMeshComponent::OnEndUsed() { ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnEndUsed),NULL); } static FName NAME_UGrippableStaticMeshComponent_OnGrip = FName(TEXT("OnGrip")); void UGrippableStaticMeshComponent::OnGrip(UGripMotionControllerComponent* GrippingController, FBPActorGripInformation const& GripInformation) { GrippableStaticMeshComponent_eventOnGrip_Parms Parms; Parms.GrippingController=GrippingController; Parms.GripInformation=GripInformation; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnGrip),&Parms); } static FName NAME_UGrippableStaticMeshComponent_OnGripRelease = FName(TEXT("OnGripRelease")); void UGrippableStaticMeshComponent::OnGripRelease(UGripMotionControllerComponent* ReleasingController, FBPActorGripInformation const& GripInformation, bool bWasSocketed) { GrippableStaticMeshComponent_eventOnGripRelease_Parms Parms; Parms.ReleasingController=ReleasingController; Parms.GripInformation=GripInformation; Parms.bWasSocketed=bWasSocketed ? true : false; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnGripRelease),&Parms); } static FName NAME_UGrippableStaticMeshComponent_OnInput = FName(TEXT("OnInput")); void UGrippableStaticMeshComponent::OnInput(FKey Key, EInputEvent KeyEvent) { GrippableStaticMeshComponent_eventOnInput_Parms Parms; Parms.Key=Key; Parms.KeyEvent=KeyEvent; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnInput),&Parms); } static FName NAME_UGrippableStaticMeshComponent_OnSecondaryGrip = FName(TEXT("OnSecondaryGrip")); void UGrippableStaticMeshComponent::OnSecondaryGrip(USceneComponent* SecondaryGripComponent, FBPActorGripInformation const& GripInformation) { GrippableStaticMeshComponent_eventOnSecondaryGrip_Parms Parms; Parms.SecondaryGripComponent=SecondaryGripComponent; Parms.GripInformation=GripInformation; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnSecondaryGrip),&Parms); } static FName NAME_UGrippableStaticMeshComponent_OnSecondaryGripRelease = FName(TEXT("OnSecondaryGripRelease")); void UGrippableStaticMeshComponent::OnSecondaryGripRelease(USceneComponent* ReleasingSecondaryGripComponent, FBPActorGripInformation const& GripInformation) { GrippableStaticMeshComponent_eventOnSecondaryGripRelease_Parms Parms; Parms.ReleasingSecondaryGripComponent=ReleasingSecondaryGripComponent; Parms.GripInformation=GripInformation; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnSecondaryGripRelease),&Parms); } static FName NAME_UGrippableStaticMeshComponent_OnSecondaryUsed = FName(TEXT("OnSecondaryUsed")); void UGrippableStaticMeshComponent::OnSecondaryUsed() { ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnSecondaryUsed),NULL); } static FName NAME_UGrippableStaticMeshComponent_OnUsed = FName(TEXT("OnUsed")); void UGrippableStaticMeshComponent::OnUsed() { ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_OnUsed),NULL); } static FName NAME_UGrippableStaticMeshComponent_RequestsSocketing = FName(TEXT("RequestsSocketing")); bool UGrippableStaticMeshComponent::RequestsSocketing(USceneComponent*& ParentToSocketTo, FName& OptionalSocketName, FTransform_NetQuantize& RelativeTransform) { GrippableStaticMeshComponent_eventRequestsSocketing_Parms Parms; Parms.ParentToSocketTo=ParentToSocketTo; Parms.OptionalSocketName=OptionalSocketName; Parms.RelativeTransform=RelativeTransform; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_RequestsSocketing),&Parms); ParentToSocketTo=Parms.ParentToSocketTo; OptionalSocketName=Parms.OptionalSocketName; RelativeTransform=Parms.RelativeTransform; return !!Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_SecondaryGripType = FName(TEXT("SecondaryGripType")); ESecondaryGripType UGrippableStaticMeshComponent::SecondaryGripType() { GrippableStaticMeshComponent_eventSecondaryGripType_Parms Parms; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_SecondaryGripType),&Parms); return Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_SetHeld = FName(TEXT("SetHeld")); void UGrippableStaticMeshComponent::SetHeld(UGripMotionControllerComponent* HoldingController, bool bIsHeld) { GrippableStaticMeshComponent_eventSetHeld_Parms Parms; Parms.HoldingController=HoldingController; Parms.bIsHeld=bIsHeld ? true : false; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_SetHeld),&Parms); } static FName NAME_UGrippableStaticMeshComponent_SimulateOnDrop = FName(TEXT("SimulateOnDrop")); bool UGrippableStaticMeshComponent::SimulateOnDrop() { GrippableStaticMeshComponent_eventSimulateOnDrop_Parms Parms; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_SimulateOnDrop),&Parms); return !!Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_TeleportBehavior = FName(TEXT("TeleportBehavior")); EGripInterfaceTeleportBehavior UGrippableStaticMeshComponent::TeleportBehavior() { GrippableStaticMeshComponent_eventTeleportBehavior_Parms Parms; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_TeleportBehavior),&Parms); return Parms.ReturnValue; } static FName NAME_UGrippableStaticMeshComponent_TickGrip = FName(TEXT("TickGrip")); void UGrippableStaticMeshComponent::TickGrip(UGripMotionControllerComponent* GrippingController, FBPActorGripInformation const& GripInformation, float DeltaTime) { GrippableStaticMeshComponent_eventTickGrip_Parms Parms; Parms.GrippingController=GrippingController; Parms.GripInformation=GripInformation; Parms.DeltaTime=DeltaTime; ProcessEvent(FindFunctionChecked(NAME_UGrippableStaticMeshComponent_TickGrip),&Parms); } void UGrippableStaticMeshComponent::StaticRegisterNativesUGrippableStaticMeshComponent() { UClass* Class = UGrippableStaticMeshComponent::StaticClass(); static const FNameNativePtrPair Funcs[] = { { "AdvancedGripSettings", &UGrippableStaticMeshComponent::execAdvancedGripSettings }, { "ClosestGripSlotInRange", &UGrippableStaticMeshComponent::execClosestGripSlotInRange }, { "DenyGripping", &UGrippableStaticMeshComponent::execDenyGripping }, { "GetGripScripts", &UGrippableStaticMeshComponent::execGetGripScripts }, { "GetGripStiffnessAndDamping", &UGrippableStaticMeshComponent::execGetGripStiffnessAndDamping }, { "GetPrimaryGripType", &UGrippableStaticMeshComponent::execGetPrimaryGripType }, { "GripBreakDistance", &UGrippableStaticMeshComponent::execGripBreakDistance }, { "GripLateUpdateSetting", &UGrippableStaticMeshComponent::execGripLateUpdateSetting }, { "GripMovementReplicationType", &UGrippableStaticMeshComponent::execGripMovementReplicationType }, { "IsHeld", &UGrippableStaticMeshComponent::execIsHeld }, { "OnChildGrip", &UGrippableStaticMeshComponent::execOnChildGrip }, { "OnChildGripRelease", &UGrippableStaticMeshComponent::execOnChildGripRelease }, { "OnEndSecondaryUsed", &UGrippableStaticMeshComponent::execOnEndSecondaryUsed }, { "OnEndUsed", &UGrippableStaticMeshComponent::execOnEndUsed }, { "OnGrip", &UGrippableStaticMeshComponent::execOnGrip }, { "OnGripRelease", &UGrippableStaticMeshComponent::execOnGripRelease }, { "OnInput", &UGrippableStaticMeshComponent::execOnInput }, { "OnSecondaryGrip", &UGrippableStaticMeshComponent::execOnSecondaryGrip }, { "OnSecondaryGripRelease", &UGrippableStaticMeshComponent::execOnSecondaryGripRelease }, { "OnSecondaryUsed", &UGrippableStaticMeshComponent::execOnSecondaryUsed }, { "OnUsed", &UGrippableStaticMeshComponent::execOnUsed }, { "RequestsSocketing", &UGrippableStaticMeshComponent::execRequestsSocketing }, { "SecondaryGripType", &UGrippableStaticMeshComponent::execSecondaryGripType }, { "SetDenyGripping", &UGrippableStaticMeshComponent::execSetDenyGripping }, { "SetHeld", &UGrippableStaticMeshComponent::execSetHeld }, { "SimulateOnDrop", &UGrippableStaticMeshComponent::execSimulateOnDrop }, { "TeleportBehavior", &UGrippableStaticMeshComponent::execTeleportBehavior }, { "TickGrip", &UGrippableStaticMeshComponent::execTickGrip }, }; FNativeFunctionRegistrar::RegisterFunctions(Class, Funcs, ARRAY_COUNT(Funcs)); } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics { static const UE4CodeGen_Private::FStructPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventAdvancedGripSettings_Parms, ReturnValue), Z_Construct_UScriptStruct_FBPAdvGripSettings, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::NewProp_ReturnValue, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Get the advanced physics settings for this grip" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "AdvancedGripSettings", sizeof(GrippableStaticMeshComponent_eventAdvancedGripSettings_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics { static const UE4CodeGen_Private::FNamePropertyParams NewProp_OverridePrefix; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_CallingController_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_CallingController; static const UE4CodeGen_Private::FStructPropertyParams NewProp_SlotWorldTransform; static void NewProp_bHadSlotInRange_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bHadSlotInRange; static void NewProp_bSecondarySlot_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bSecondarySlot; static const UE4CodeGen_Private::FStructPropertyParams NewProp_WorldLocation; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FNamePropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_OverridePrefix = { "OverridePrefix", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Name, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms, OverridePrefix), METADATA_PARAMS(nullptr, 0) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_CallingController_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_CallingController = { "CallingController", nullptr, (EPropertyFlags)0x0010000000080080, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms, CallingController), Z_Construct_UClass_UGripMotionControllerComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_CallingController_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_CallingController_MetaData)) }; const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_SlotWorldTransform = { "SlotWorldTransform", nullptr, (EPropertyFlags)0x0010000000000180, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms, SlotWorldTransform), Z_Construct_UScriptStruct_FTransform, METADATA_PARAMS(nullptr, 0) }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_bHadSlotInRange_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms*)Obj)->bHadSlotInRange = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_bHadSlotInRange = { "bHadSlotInRange", nullptr, (EPropertyFlags)0x0010000000000180, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_bHadSlotInRange_SetBit, METADATA_PARAMS(nullptr, 0) }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_bSecondarySlot_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms*)Obj)->bSecondarySlot = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_bSecondarySlot = { "bSecondarySlot", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_bSecondarySlot_SetBit, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_WorldLocation = { "WorldLocation", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms, WorldLocation), Z_Construct_UScriptStruct_FVector, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_OverridePrefix, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_CallingController, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_SlotWorldTransform, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_bHadSlotInRange, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_bSecondarySlot, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::NewProp_WorldLocation, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "CPP_Default_CallingController", "None" }, { "CPP_Default_OverridePrefix", "None" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Get closest primary slot in range" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "ClosestGripSlotInRange", sizeof(GrippableStaticMeshComponent_eventClosestGripSlotInRange_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0CC20C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics { static void NewProp_ReturnValue_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::NewProp_ReturnValue_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventDenyGripping_Parms*)Obj)->ReturnValue = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventDenyGripping_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::NewProp_ReturnValue_SetBit, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::NewProp_ReturnValue, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "DisplayName", "IsDenyingGrips" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Set up as deny instead of allow so that default allows for gripping" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "DenyGripping", sizeof(GrippableStaticMeshComponent_eventDenyGripping_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics { static void NewProp_ReturnValue_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_ReturnValue; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_ArrayReference_MetaData[]; #endif static const UE4CodeGen_Private::FArrayPropertyParams NewProp_ArrayReference; static const UE4CodeGen_Private::FObjectPropertyParams NewProp_ArrayReference_Inner; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ReturnValue_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventGetGripScripts_Parms*)Obj)->ReturnValue = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventGetGripScripts_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ReturnValue_SetBit, METADATA_PARAMS(nullptr, 0) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ArrayReference_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FArrayPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ArrayReference = { "ArrayReference", nullptr, (EPropertyFlags)0x0010008000000180, UE4CodeGen_Private::EPropertyGenFlags::Array, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventGetGripScripts_Parms, ArrayReference), METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ArrayReference_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ArrayReference_MetaData)) }; const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ArrayReference_Inner = { "ArrayReference", nullptr, (EPropertyFlags)0x0000000000080000, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, Z_Construct_UClass_UVRGripScriptBase_NoRegister, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ReturnValue, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ArrayReference, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::NewProp_ArrayReference_Inner, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Get grip scripts" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "GetGripScripts", sizeof(GrippableStaticMeshComponent_eventGetGripScripts_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics { static const UE4CodeGen_Private::FFloatPropertyParams NewProp_GripDampingOut; static const UE4CodeGen_Private::FFloatPropertyParams NewProp_GripStiffnessOut; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FFloatPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::NewProp_GripDampingOut = { "GripDampingOut", nullptr, (EPropertyFlags)0x0010000000000180, UE4CodeGen_Private::EPropertyGenFlags::Float, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventGetGripStiffnessAndDamping_Parms, GripDampingOut), METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FFloatPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::NewProp_GripStiffnessOut = { "GripStiffnessOut", nullptr, (EPropertyFlags)0x0010000000000180, UE4CodeGen_Private::EPropertyGenFlags::Float, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventGetGripStiffnessAndDamping_Parms, GripStiffnessOut), METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::NewProp_GripDampingOut, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::NewProp_GripStiffnessOut, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "What grip stiffness and damping to use if using a physics constraint" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "GetGripStiffnessAndDamping", sizeof(GrippableStaticMeshComponent_eventGetGripStiffnessAndDamping_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics { static const UE4CodeGen_Private::FEnumPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FBytePropertyParams NewProp_ReturnValue_Underlying; static void NewProp_bIsSlot_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bIsSlot; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FEnumPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Enum, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventGetPrimaryGripType_Parms, ReturnValue), Z_Construct_UEnum_VRExpansionPlugin_EGripCollisionType, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::NewProp_ReturnValue_Underlying = { "UnderlyingType", nullptr, (EPropertyFlags)0x0000000000000000, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, nullptr, METADATA_PARAMS(nullptr, 0) }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::NewProp_bIsSlot_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventGetPrimaryGripType_Parms*)Obj)->bIsSlot = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::NewProp_bIsSlot = { "bIsSlot", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventGetPrimaryGripType_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::NewProp_bIsSlot_SetBit, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::NewProp_ReturnValue, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::NewProp_ReturnValue_Underlying, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::NewProp_bIsSlot, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Grip type to use" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "GetPrimaryGripType", sizeof(GrippableStaticMeshComponent_eventGetPrimaryGripType_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics { static const UE4CodeGen_Private::FFloatPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FFloatPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Float, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventGripBreakDistance_Parms, ReturnValue), METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::NewProp_ReturnValue, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "What distance to break a grip at (only relevent with physics enabled grips" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "GripBreakDistance", sizeof(GrippableStaticMeshComponent_eventGripBreakDistance_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics { static const UE4CodeGen_Private::FEnumPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FBytePropertyParams NewProp_ReturnValue_Underlying; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FEnumPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Enum, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventGripLateUpdateSetting_Parms, ReturnValue), Z_Construct_UEnum_VRExpansionPlugin_EGripLateUpdateSettings, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::NewProp_ReturnValue_Underlying = { "UnderlyingType", nullptr, (EPropertyFlags)0x0000000000000000, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, nullptr, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::NewProp_ReturnValue, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::NewProp_ReturnValue_Underlying, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Define the late update setting" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "GripLateUpdateSetting", sizeof(GrippableStaticMeshComponent_eventGripLateUpdateSetting_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics { static const UE4CodeGen_Private::FEnumPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FBytePropertyParams NewProp_ReturnValue_Underlying; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FEnumPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Enum, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventGripMovementReplicationType_Parms, ReturnValue), Z_Construct_UEnum_VRExpansionPlugin_EGripMovementReplicationSettings, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::NewProp_ReturnValue_Underlying = { "UnderlyingType", nullptr, (EPropertyFlags)0x0000000000000000, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, nullptr, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::NewProp_ReturnValue, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::NewProp_ReturnValue_Underlying, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Define which movement repliation setting to use" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "GripMovementReplicationType", sizeof(GrippableStaticMeshComponent_eventGripMovementReplicationType_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics { static void NewProp_bIsHeld_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bIsHeld; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_HoldingController_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_HoldingController; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::NewProp_bIsHeld_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventIsHeld_Parms*)Obj)->bIsHeld = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::NewProp_bIsHeld = { "bIsHeld", nullptr, (EPropertyFlags)0x0010000000000180, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventIsHeld_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::NewProp_bIsHeld_SetBit, METADATA_PARAMS(nullptr, 0) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::NewProp_HoldingController_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::NewProp_HoldingController = { "HoldingController", nullptr, (EPropertyFlags)0x0010000000080180, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventIsHeld_Parms, HoldingController), Z_Construct_UClass_UGripMotionControllerComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::NewProp_HoldingController_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::NewProp_HoldingController_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::NewProp_bIsHeld, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::NewProp_HoldingController, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Returns if the object is held and if so, which pawn is holding it" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "IsHeld", sizeof(GrippableStaticMeshComponent_eventIsHeld_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics { #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GripInformation_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GripInformation; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GrippingController_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_GrippingController; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GripInformation_MetaData[] = { { "NativeConst", "" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GripInformation = { "GripInformation", nullptr, (EPropertyFlags)0x0010008008000182, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnChildGrip_Parms, GripInformation), Z_Construct_UScriptStruct_FBPActorGripInformation, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GripInformation_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GripInformation_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GrippingController_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GrippingController = { "GrippingController", nullptr, (EPropertyFlags)0x0010000000080080, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnChildGrip_Parms, GrippingController), Z_Construct_UClass_UGripMotionControllerComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GrippingController_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GrippingController_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GripInformation, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::NewProp_GrippingController, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Event triggered on the interfaced object when child component is gripped" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnChildGrip", sizeof(GrippableStaticMeshComponent_eventOnChildGrip_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x08420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics { static void NewProp_bWasSocketed_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bWasSocketed; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GripInformation_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GripInformation; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_ReleasingController_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_ReleasingController; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_bWasSocketed_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventOnChildGripRelease_Parms*)Obj)->bWasSocketed = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_bWasSocketed = { "bWasSocketed", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventOnChildGripRelease_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_bWasSocketed_SetBit, METADATA_PARAMS(nullptr, 0) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_GripInformation_MetaData[] = { { "NativeConst", "" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_GripInformation = { "GripInformation", nullptr, (EPropertyFlags)0x0010008008000182, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnChildGripRelease_Parms, GripInformation), Z_Construct_UScriptStruct_FBPActorGripInformation, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_GripInformation_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_GripInformation_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_ReleasingController_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_ReleasingController = { "ReleasingController", nullptr, (EPropertyFlags)0x0010000000080080, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnChildGripRelease_Parms, ReleasingController), Z_Construct_UClass_UGripMotionControllerComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_ReleasingController_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_ReleasingController_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_bWasSocketed, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_GripInformation, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::NewProp_ReleasingController, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Event triggered on the interfaced object when child component is released" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnChildGripRelease", sizeof(GrippableStaticMeshComponent_eventOnChildGripRelease_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x08420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndSecondaryUsed_Statics { #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndSecondaryUsed_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Call to stop using an object" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndSecondaryUsed_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnEndSecondaryUsed", 0, nullptr, 0, RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndSecondaryUsed_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndSecondaryUsed_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndSecondaryUsed() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndSecondaryUsed_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndUsed_Statics { #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndUsed_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Call to stop using an object" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndUsed_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnEndUsed", 0, nullptr, 0, RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndUsed_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndUsed_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndUsed() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndUsed_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics { #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GripInformation_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GripInformation; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GrippingController_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_GrippingController; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GripInformation_MetaData[] = { { "NativeConst", "" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GripInformation = { "GripInformation", nullptr, (EPropertyFlags)0x0010008008000182, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnGrip_Parms, GripInformation), Z_Construct_UScriptStruct_FBPActorGripInformation, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GripInformation_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GripInformation_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GrippingController_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GrippingController = { "GrippingController", nullptr, (EPropertyFlags)0x0010000000080080, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnGrip_Parms, GrippingController), Z_Construct_UClass_UGripMotionControllerComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GrippingController_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GrippingController_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GripInformation, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::NewProp_GrippingController, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Event triggered on the interfaced object when gripped" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnGrip", sizeof(GrippableStaticMeshComponent_eventOnGrip_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x08420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics { static void NewProp_bWasSocketed_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bWasSocketed; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GripInformation_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GripInformation; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_ReleasingController_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_ReleasingController; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_bWasSocketed_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventOnGripRelease_Parms*)Obj)->bWasSocketed = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_bWasSocketed = { "bWasSocketed", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventOnGripRelease_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_bWasSocketed_SetBit, METADATA_PARAMS(nullptr, 0) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_GripInformation_MetaData[] = { { "NativeConst", "" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_GripInformation = { "GripInformation", nullptr, (EPropertyFlags)0x0010008008000182, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnGripRelease_Parms, GripInformation), Z_Construct_UScriptStruct_FBPActorGripInformation, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_GripInformation_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_GripInformation_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_ReleasingController_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_ReleasingController = { "ReleasingController", nullptr, (EPropertyFlags)0x0010000000080080, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnGripRelease_Parms, ReleasingController), Z_Construct_UClass_UGripMotionControllerComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_ReleasingController_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_ReleasingController_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_bWasSocketed, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_GripInformation, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::NewProp_ReleasingController, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Event triggered on the interfaced object when grip is released" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnGripRelease", sizeof(GrippableStaticMeshComponent_eventOnGripRelease_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x08420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics { static const UE4CodeGen_Private::FBytePropertyParams NewProp_KeyEvent; static const UE4CodeGen_Private::FStructPropertyParams NewProp_Key; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::NewProp_KeyEvent = { "KeyEvent", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnInput_Parms, KeyEvent), Z_Construct_UEnum_Engine_EInputEvent, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::NewProp_Key = { "Key", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnInput_Parms, Key), Z_Construct_UScriptStruct_FKey, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::NewProp_KeyEvent, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::NewProp_Key, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Call to send an action event to the object" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnInput", sizeof(GrippableStaticMeshComponent_eventOnInput_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics { #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GripInformation_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GripInformation; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_SecondaryGripComponent_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_SecondaryGripComponent; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_GripInformation_MetaData[] = { { "NativeConst", "" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_GripInformation = { "GripInformation", nullptr, (EPropertyFlags)0x0010008008000182, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnSecondaryGrip_Parms, GripInformation), Z_Construct_UScriptStruct_FBPActorGripInformation, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_GripInformation_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_GripInformation_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_SecondaryGripComponent_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_SecondaryGripComponent = { "SecondaryGripComponent", nullptr, (EPropertyFlags)0x0010000000080080, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnSecondaryGrip_Parms, SecondaryGripComponent), Z_Construct_UClass_USceneComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_SecondaryGripComponent_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_SecondaryGripComponent_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_GripInformation, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::NewProp_SecondaryGripComponent, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Event triggered on the interfaced object when secondary gripped" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnSecondaryGrip", sizeof(GrippableStaticMeshComponent_eventOnSecondaryGrip_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x08420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics { #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GripInformation_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GripInformation; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_ReleasingSecondaryGripComponent_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_ReleasingSecondaryGripComponent; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_GripInformation_MetaData[] = { { "NativeConst", "" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_GripInformation = { "GripInformation", nullptr, (EPropertyFlags)0x0010008008000182, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnSecondaryGripRelease_Parms, GripInformation), Z_Construct_UScriptStruct_FBPActorGripInformation, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_GripInformation_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_GripInformation_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_ReleasingSecondaryGripComponent_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_ReleasingSecondaryGripComponent = { "ReleasingSecondaryGripComponent", nullptr, (EPropertyFlags)0x0010000000080080, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventOnSecondaryGripRelease_Parms, ReleasingSecondaryGripComponent), Z_Construct_UClass_USceneComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_ReleasingSecondaryGripComponent_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_ReleasingSecondaryGripComponent_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_GripInformation, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::NewProp_ReleasingSecondaryGripComponent, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Event triggered on the interfaced object when secondary grip is released" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnSecondaryGripRelease", sizeof(GrippableStaticMeshComponent_eventOnSecondaryGripRelease_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x08420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryUsed_Statics { #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryUsed_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Call to use an object" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryUsed_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnSecondaryUsed", 0, nullptr, 0, RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryUsed_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryUsed_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryUsed() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryUsed_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_OnUsed_Statics { #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_OnUsed_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Call to use an object" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_OnUsed_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "OnUsed", 0, nullptr, 0, RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnUsed_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_OnUsed_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_OnUsed() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_OnUsed_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics { static void NewProp_ReturnValue_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FStructPropertyParams NewProp_RelativeTransform; static const UE4CodeGen_Private::FNamePropertyParams NewProp_OptionalSocketName; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_ParentToSocketTo_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_ParentToSocketTo; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_ReturnValue_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventRequestsSocketing_Parms*)Obj)->ReturnValue = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventRequestsSocketing_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_ReturnValue_SetBit, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_RelativeTransform = { "RelativeTransform", nullptr, (EPropertyFlags)0x0010000000000180, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventRequestsSocketing_Parms, RelativeTransform), Z_Construct_UScriptStruct_FTransform_NetQuantize, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FNamePropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_OptionalSocketName = { "OptionalSocketName", nullptr, (EPropertyFlags)0x0010000000000180, UE4CodeGen_Private::EPropertyGenFlags::Name, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventRequestsSocketing_Parms, OptionalSocketName), METADATA_PARAMS(nullptr, 0) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_ParentToSocketTo_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_ParentToSocketTo = { "ParentToSocketTo", nullptr, (EPropertyFlags)0x0010000000080180, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventRequestsSocketing_Parms, ParentToSocketTo), Z_Construct_UClass_USceneComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_ParentToSocketTo_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_ParentToSocketTo_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_ReturnValue, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_RelativeTransform, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_OptionalSocketName, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::NewProp_ParentToSocketTo, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Returns if the object wants to be socketed" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "RequestsSocketing", sizeof(GrippableStaticMeshComponent_eventRequestsSocketing_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics { static const UE4CodeGen_Private::FEnumPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FBytePropertyParams NewProp_ReturnValue_Underlying; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FEnumPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Enum, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventSecondaryGripType_Parms, ReturnValue), Z_Construct_UEnum_VRExpansionPlugin_ESecondaryGripType, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::NewProp_ReturnValue_Underlying = { "UnderlyingType", nullptr, (EPropertyFlags)0x0000000000000000, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, nullptr, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::NewProp_ReturnValue, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::NewProp_ReturnValue_Underlying, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Secondary grip type" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "SecondaryGripType", sizeof(GrippableStaticMeshComponent_eventSecondaryGripType_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics { struct GrippableStaticMeshComponent_eventSetDenyGripping_Parms { bool bDenyGripping; }; static void NewProp_bDenyGripping_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bDenyGripping; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::NewProp_bDenyGripping_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventSetDenyGripping_Parms*)Obj)->bDenyGripping = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::NewProp_bDenyGripping = { "bDenyGripping", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventSetDenyGripping_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::NewProp_bDenyGripping_SetBit, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::NewProp_bDenyGripping, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Sets the Deny Gripping variable on the FBPInterfaceSettings struct" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "SetDenyGripping", sizeof(GrippableStaticMeshComponent_eventSetDenyGripping_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x04020401, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics { static void NewProp_bIsHeld_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bIsHeld; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_HoldingController_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_HoldingController; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::NewProp_bIsHeld_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventSetHeld_Parms*)Obj)->bIsHeld = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::NewProp_bIsHeld = { "bIsHeld", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventSetHeld_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::NewProp_bIsHeld_SetBit, METADATA_PARAMS(nullptr, 0) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::NewProp_HoldingController_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::NewProp_HoldingController = { "HoldingController", nullptr, (EPropertyFlags)0x0010000000080080, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventSetHeld_Parms, HoldingController), Z_Construct_UClass_UGripMotionControllerComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::NewProp_HoldingController_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::NewProp_HoldingController_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::NewProp_bIsHeld, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::NewProp_HoldingController, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "BlueprintCallable," }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "SetHeld", sizeof(GrippableStaticMeshComponent_eventSetHeld_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x08020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics { static void NewProp_ReturnValue_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; void Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::NewProp_ReturnValue_SetBit(void* Obj) { ((GrippableStaticMeshComponent_eventSimulateOnDrop_Parms*)Obj)->ReturnValue = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(GrippableStaticMeshComponent_eventSimulateOnDrop_Parms), &Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::NewProp_ReturnValue_SetBit, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::NewProp_ReturnValue, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Should this object simulate on drop" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "SimulateOnDrop", sizeof(GrippableStaticMeshComponent_eventSimulateOnDrop_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics { static const UE4CodeGen_Private::FEnumPropertyParams NewProp_ReturnValue; static const UE4CodeGen_Private::FBytePropertyParams NewProp_ReturnValue_Underlying; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FEnumPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::NewProp_ReturnValue = { "ReturnValue", nullptr, (EPropertyFlags)0x0010000000000580, UE4CodeGen_Private::EPropertyGenFlags::Enum, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventTeleportBehavior_Parms, ReturnValue), Z_Construct_UEnum_VRExpansionPlugin_EGripInterfaceTeleportBehavior, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FBytePropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::NewProp_ReturnValue_Underlying = { "UnderlyingType", nullptr, (EPropertyFlags)0x0000000000000000, UE4CodeGen_Private::EPropertyGenFlags::Byte, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, nullptr, METADATA_PARAMS(nullptr, 0) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::NewProp_ReturnValue, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::NewProp_ReturnValue_Underlying, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "How an interfaced object behaves when teleporting" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "TeleportBehavior", sizeof(GrippableStaticMeshComponent_eventTeleportBehavior_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x0C020C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior_Statics::FuncParams); } return ReturnFunction; } struct Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics { static const UE4CodeGen_Private::FFloatPropertyParams NewProp_DeltaTime; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GripInformation_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GripInformation; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GrippingController_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_GrippingController; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[]; #endif static const UE4CodeGen_Private::FFunctionParams FuncParams; }; const UE4CodeGen_Private::FFloatPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_DeltaTime = { "DeltaTime", nullptr, (EPropertyFlags)0x0010000000000080, UE4CodeGen_Private::EPropertyGenFlags::Float, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventTickGrip_Parms, DeltaTime), METADATA_PARAMS(nullptr, 0) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GripInformation_MetaData[] = { { "NativeConst", "" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GripInformation = { "GripInformation", nullptr, (EPropertyFlags)0x0010008008000182, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventTickGrip_Parms, GripInformation), Z_Construct_UScriptStruct_FBPActorGripInformation, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GripInformation_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GripInformation_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GrippingController_MetaData[] = { { "EditInline", "true" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GrippingController = { "GrippingController", nullptr, (EPropertyFlags)0x0010000000080080, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(GrippableStaticMeshComponent_eventTickGrip_Parms, GrippingController), Z_Construct_UClass_UGripMotionControllerComponent_NoRegister, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GrippingController_MetaData, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GrippingController_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_DeltaTime, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GripInformation, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::NewProp_GrippingController, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::Function_MetaDataParams[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Event triggered each tick on the interfaced object when gripped, can be used for custom movement or grip based logic" }, }; #endif const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_UGrippableStaticMeshComponent, nullptr, "TickGrip", sizeof(GrippableStaticMeshComponent_eventTickGrip_Parms), Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x08420C00, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::Function_MetaDataParams)) }; UFunction* Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip() { static UFunction* ReturnFunction = nullptr; if (!ReturnFunction) { UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip_Statics::FuncParams); } return ReturnFunction; } UClass* Z_Construct_UClass_UGrippableStaticMeshComponent_NoRegister() { return UGrippableStaticMeshComponent::StaticClass(); } struct Z_Construct_UClass_UGrippableStaticMeshComponent_Statics { static UObject* (*const DependentSingletons[])(); static const FClassFunctionLinkInfo FuncInfo[]; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[]; #endif #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_VRGripInterfaceSettings_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_VRGripInterfaceSettings; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_bReplicateMovement_MetaData[]; #endif static void NewProp_bReplicateMovement_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bReplicateMovement; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_bRepGripSettingsAndGameplayTags_MetaData[]; #endif static void NewProp_bRepGripSettingsAndGameplayTags_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_bRepGripSettingsAndGameplayTags; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GameplayTags_MetaData[]; #endif static const UE4CodeGen_Private::FStructPropertyParams NewProp_GameplayTags; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GripLogicScripts_MetaData[]; #endif static const UE4CodeGen_Private::FArrayPropertyParams NewProp_GripLogicScripts; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_GripLogicScripts_Inner_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_GripLogicScripts_Inner; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; static const UE4CodeGen_Private::FImplementedInterfaceParams InterfaceParams[]; static const FCppClassTypeInfoStatic StaticCppClassTypeInfo; static const UE4CodeGen_Private::FClassParams ClassParams; }; UObject* (*const Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::DependentSingletons[])() = { (UObject* (*)())Z_Construct_UClass_UStaticMeshComponent, (UObject* (*)())Z_Construct_UPackage__Script_VRExpansionPlugin, }; const FClassFunctionLinkInfo Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::FuncInfo[] = { { &Z_Construct_UFunction_UGrippableStaticMeshComponent_AdvancedGripSettings, "AdvancedGripSettings" }, // 762585886 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_ClosestGripSlotInRange, "ClosestGripSlotInRange" }, // 2272821568 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_DenyGripping, "DenyGripping" }, // 1767275283 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripScripts, "GetGripScripts" }, // 2279644934 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_GetGripStiffnessAndDamping, "GetGripStiffnessAndDamping" }, // 1500980331 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_GetPrimaryGripType, "GetPrimaryGripType" }, // 2963296902 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_GripBreakDistance, "GripBreakDistance" }, // 1478392741 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_GripLateUpdateSetting, "GripLateUpdateSetting" }, // 1324845332 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_GripMovementReplicationType, "GripMovementReplicationType" }, // 2319373172 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_IsHeld, "IsHeld" }, // 3786169678 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGrip, "OnChildGrip" }, // 767601137 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnChildGripRelease, "OnChildGripRelease" }, // 4287492726 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndSecondaryUsed, "OnEndSecondaryUsed" }, // 3833655261 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnEndUsed, "OnEndUsed" }, // 1028990552 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGrip, "OnGrip" }, // 1314697240 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnGripRelease, "OnGripRelease" }, // 387544051 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnInput, "OnInput" }, // 166655003 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGrip, "OnSecondaryGrip" }, // 935206333 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryGripRelease, "OnSecondaryGripRelease" }, // 1160525169 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnSecondaryUsed, "OnSecondaryUsed" }, // 949007931 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_OnUsed, "OnUsed" }, // 2025767282 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_RequestsSocketing, "RequestsSocketing" }, // 1815442755 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_SecondaryGripType, "SecondaryGripType" }, // 1854293530 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_SetDenyGripping, "SetDenyGripping" }, // 3496596012 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_SetHeld, "SetHeld" }, // 316638335 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_SimulateOnDrop, "SimulateOnDrop" }, // 3409704786 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_TeleportBehavior, "TeleportBehavior" }, // 19720207 { &Z_Construct_UFunction_UGrippableStaticMeshComponent_TickGrip, "TickGrip" }, // 2703171655 }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::Class_MetaDataParams[] = { { "BlueprintSpawnableComponent", "" }, { "BlueprintType", "true" }, { "ClassGroupNames", "VRExpansionPlugin" }, { "HideCategories", "Object Activation Components|Activation Trigger" }, { "IncludePath", "Grippables/GrippableStaticMeshComponent.h" }, { "IsBlueprintBase", "true" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ObjectInitializerConstructorDeclared", "" }, }; #endif #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_VRGripInterfaceSettings_MetaData[] = { { "Category", "VRGripInterface" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_VRGripInterfaceSettings = { "VRGripInterfaceSettings", nullptr, (EPropertyFlags)0x0010008000000025, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UGrippableStaticMeshComponent, VRGripInterfaceSettings), Z_Construct_UScriptStruct_FBPInterfaceProperties, METADATA_PARAMS(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_VRGripInterfaceSettings_MetaData, ARRAY_COUNT(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_VRGripInterfaceSettings_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bReplicateMovement_MetaData[] = { { "Category", "VRGripInterface|Replication" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Overrides the default of : true and allows for controlling it like in an actor, should be default of off normally with grippable components" }, }; #endif void Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bReplicateMovement_SetBit(void* Obj) { ((UGrippableStaticMeshComponent*)Obj)->bReplicateMovement = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bReplicateMovement = { "bReplicateMovement", nullptr, (EPropertyFlags)0x0010000000000025, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(UGrippableStaticMeshComponent), &Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bReplicateMovement_SetBit, METADATA_PARAMS(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bReplicateMovement_MetaData, ARRAY_COUNT(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bReplicateMovement_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bRepGripSettingsAndGameplayTags_MetaData[] = { { "Category", "VRGripInterface|Replication" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Requires bReplicates to be true for the component" }, }; #endif void Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bRepGripSettingsAndGameplayTags_SetBit(void* Obj) { ((UGrippableStaticMeshComponent*)Obj)->bRepGripSettingsAndGameplayTags = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bRepGripSettingsAndGameplayTags = { "bRepGripSettingsAndGameplayTags", nullptr, (EPropertyFlags)0x0010000000000025, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(UGrippableStaticMeshComponent), &Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bRepGripSettingsAndGameplayTags_SetBit, METADATA_PARAMS(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bRepGripSettingsAndGameplayTags_MetaData, ARRAY_COUNT(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bRepGripSettingsAndGameplayTags_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GameplayTags_MetaData[] = { { "Category", "GameplayTags" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Tags that are set on this object" }, }; #endif const UE4CodeGen_Private::FStructPropertyParams Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GameplayTags = { "GameplayTags", nullptr, (EPropertyFlags)0x0010000000000025, UE4CodeGen_Private::EPropertyGenFlags::Struct, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UGrippableStaticMeshComponent, GameplayTags), Z_Construct_UScriptStruct_FGameplayTagContainer, METADATA_PARAMS(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GameplayTags_MetaData, ARRAY_COUNT(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GameplayTags_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts_MetaData[] = { { "Category", "VRGripInterface" }, { "EditInline", "true" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Overridden to return requirements tags" }, }; #endif const UE4CodeGen_Private::FArrayPropertyParams Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts = { "GripLogicScripts", nullptr, (EPropertyFlags)0x001000800000003d, UE4CodeGen_Private::EPropertyGenFlags::Array, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(UGrippableStaticMeshComponent, GripLogicScripts), METADATA_PARAMS(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts_MetaData, ARRAY_COUNT(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts_Inner_MetaData[] = { { "Category", "VRGripInterface" }, { "EditInline", "true" }, { "ModuleRelativePath", "Public/Grippables/GrippableStaticMeshComponent.h" }, { "ToolTip", "Overridden to return requirements tags" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts_Inner = { "GripLogicScripts", nullptr, (EPropertyFlags)0x0002000000080008, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, 0, Z_Construct_UClass_UVRGripScriptBase_NoRegister, METADATA_PARAMS(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts_Inner_MetaData, ARRAY_COUNT(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts_Inner_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_VRGripInterfaceSettings, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bReplicateMovement, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_bRepGripSettingsAndGameplayTags, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GameplayTags, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::NewProp_GripLogicScripts_Inner, }; const UE4CodeGen_Private::FImplementedInterfaceParams Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::InterfaceParams[] = { { Z_Construct_UClass_UVRGripInterface_NoRegister, (int32)VTABLE_OFFSET(UGrippableStaticMeshComponent, IVRGripInterface), false }, { Z_Construct_UClass_UGameplayTagAssetInterface_NoRegister, (int32)VTABLE_OFFSET(UGrippableStaticMeshComponent, IGameplayTagAssetInterface), false }, }; const FCppClassTypeInfoStatic Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::StaticCppClassTypeInfo = { TCppClassTypeTraits<UGrippableStaticMeshComponent>::IsAbstract, }; const UE4CodeGen_Private::FClassParams Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::ClassParams = { &UGrippableStaticMeshComponent::StaticClass, "Engine", &StaticCppClassTypeInfo, DependentSingletons, FuncInfo, Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::PropPointers, InterfaceParams, ARRAY_COUNT(DependentSingletons), ARRAY_COUNT(FuncInfo), ARRAY_COUNT(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::PropPointers), ARRAY_COUNT(InterfaceParams), 0x00B010A4u, METADATA_PARAMS(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::Class_MetaDataParams, ARRAY_COUNT(Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::Class_MetaDataParams)) }; UClass* Z_Construct_UClass_UGrippableStaticMeshComponent() { static UClass* OuterClass = nullptr; if (!OuterClass) { UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_UGrippableStaticMeshComponent_Statics::ClassParams); } return OuterClass; } IMPLEMENT_CLASS(UGrippableStaticMeshComponent, 4292704888); template<> VREXPANSIONPLUGIN_API UClass* StaticClass<UGrippableStaticMeshComponent>() { return UGrippableStaticMeshComponent::StaticClass(); } static FCompiledInDefer Z_CompiledInDefer_UClass_UGrippableStaticMeshComponent(Z_Construct_UClass_UGrippableStaticMeshComponent, &UGrippableStaticMeshComponent::StaticClass, TEXT("/Script/VRExpansionPlugin"), TEXT("UGrippableStaticMeshComponent"), false, nullptr, nullptr, nullptr); DEFINE_VTABLE_PTR_HELPER_CTOR(UGrippableStaticMeshComponent); PRAGMA_ENABLE_DEPRECATION_WARNINGS #ifdef _MSC_VER #pragma warning (pop) #endif
86.962149
881
0.873782
Docdavies
ca7ec0b1df0f7c046addc60c9aa536150ce2c972
1,477
cc
C++
CPP/No506.cc
hxz1998/funny_leetcode
1d2c425af09b57a030fc018ddc1e1a5ffb966cd0
[ "Apache-2.0" ]
null
null
null
CPP/No506.cc
hxz1998/funny_leetcode
1d2c425af09b57a030fc018ddc1e1a5ffb966cd0
[ "Apache-2.0" ]
null
null
null
CPP/No506.cc
hxz1998/funny_leetcode
1d2c425af09b57a030fc018ddc1e1a5ffb966cd0
[ "Apache-2.0" ]
null
null
null
/** * Created by Xiaozhong on 2020/10/6. * Copyright (c) 2020/10/6 Xiaozhong. All rights reserved. */ #include <vector> #include <iostream> #include <algorithm> #include <map> using namespace std; class Solution { public: vector<string> findRelativeRanks(vector<int> &nums) { vector<string> ans(nums.size()); map<int, int, greater<int>> mapper; for (int i = 0; i < nums.size(); ++i) { mapper[nums[i]] = i; } int rank = 0; for (auto iter = mapper.begin(); iter != mapper.end(); ++iter) { switch (rank) { case 0: ans[iter->second] = "Gold Medal"; ++rank; break; case 1: ans[iter->second] = "Silver Medal"; ++rank; break; case 2: ans[iter->second] = "Bronze Medal"; ++rank; break; default: ans[iter->second] = to_string(rank + 1); ++rank; } } return ans; } }; int main() { Solution s; vector<int> nums = {5, 4, 3, 2, 1}; vector<string> ans = s.findRelativeRanks(nums); for (string item : ans) { cout << item << endl; } nums = {10, 3, 8, 9, 4}; ans = s.findRelativeRanks(nums); for (string item : ans) { cout << item << endl; } }
25.465517
72
0.445498
hxz1998
ca7edf48008e93d1131ba1efae51b5ec54014aa2
492
cpp
C++
contest/AOJ/1601.cpp
not522/Competitive-Programming
be4a7d25caf5acbb70783b12899474a56c34dedb
[ "Unlicense" ]
7
2018-04-14T14:55:51.000Z
2022-01-31T10:49:49.000Z
contest/AOJ/1601.cpp
not522/Competitive-Programming
be4a7d25caf5acbb70783b12899474a56c34dedb
[ "Unlicense" ]
5
2018-04-14T14:28:49.000Z
2019-05-11T02:22:10.000Z
contest/AOJ/1601.cpp
not522/Competitive-Programming
be4a7d25caf5acbb70783b12899474a56c34dedb
[ "Unlicense" ]
null
null
null
#include "stack.hpp" #include "string.hpp" int main() { for (int n; n = in, n != 0;) { Vector<String> w(n, in); for (int i = 0;; ++i) { Stack<int> s({7, 7, 5, 7, 5}); for (int j = i; j < n && !s.empty(); ++j) { int k = s.top() - w[j].size(); if (k == 0) { continue; } s.emplace(k); if (k < 0) { break; } } if (s.empty()) { cout << i + 1 << endl; break; } } } }
18.923077
49
0.351626
not522
ca7f1e2fbfa8165834f1e421e1ce74cd2225376f
40,099
hpp
C++
1/Code/Source/Engine/Math.hpp
Zakhar-V/Prototypes
413a7ce9fdb2a6f3ba97a041f798c71351efc855
[ "MIT" ]
null
null
null
1/Code/Source/Engine/Math.hpp
Zakhar-V/Prototypes
413a7ce9fdb2a6f3ba97a041f798c71351efc855
[ "MIT" ]
null
null
null
1/Code/Source/Engine/Math.hpp
Zakhar-V/Prototypes
413a7ce9fdb2a6f3ba97a041f798c71351efc855
[ "MIT" ]
null
null
null
#pragma once #include "Common.hpp" #include "String.hpp" namespace ge { //----------------------------------------------------------------------------// // Defs //----------------------------------------------------------------------------// #ifdef _FAST_HALF_FLOAT # define FAST_HALF_FLOAT #endif typedef float float32; typedef struct half float16; typedef double float64; static const float Epsilon = 1e-6f; static const float Epsilon2 = 1e-12f; static const float Pi = 3.1415926535897932384626433832795f; static const float Rad2Deg = 57.295779513082320876798154814105f; static const float Deg2Rad = 0.01745329251994329576923690768489f; //----------------------------------------------------------------------------// // Math funcs //----------------------------------------------------------------------------// template <typename T> const T& Min(const T& _a, const T& _b) { return _a < _b ? _a : _b; } template <typename T> const T& Min(const T& _a, const T& _b, const T& _c) { return _a < _b ? (_a < _c ? _a : _c) : (_b < _c ? _b : _c); } template <typename T> const T& Max(const T& _a, const T& _b) { return _a > _b ? _a : _b; } template <typename T> const T& Max(const T& _a, const T& _b, const T& _c) { return _a > _b ? (_a > _c ? _a : _c) : (_b > _c ? _b : _c); } template <typename T> const T Clamp(T _x, T _l, T _u) { return _x > _l ? (_x < _u ? _x : _u) : _l; } template <typename T> T Mix(const T& _a, const T& _b, float _t) { return _a + (_b - _a) * _t; } template <typename T> T Abs(T _x) { return abs(_x); } template <typename T> T Radians(T _val) { return _val * Deg2Rad; } template <typename T> T Degrees(T _val) { return _val * Rad2Deg; } template <typename T> T Sqr(T _x) { return _x * _x; } inline float Sqrt(float _x) { return sqrt(_x); } inline float RSqrt(float _x) { return 1 / sqrt(_x); } inline float Sin(float _x) { return sin(_x); } inline float Cos(float _x) { return cos(_x); } inline void SinCos(float _a, float& _s, float& _c) { _s = sin(_a), _c = cos(_a); } inline float Tan(float _x) { return tan(_x); } inline float ASin(float _x) { return asin(_x); } inline float ACos(float _x) { return acos(_x); } inline float ATan2(float _y, float _x) { return atan2(_y, _x); } inline float Log2(float _x) { return log2(_x); } inline int Log2i(int _x) { return (int)log2f((float)_x); } //----------------------------------------------------------------------------// // Bitwise //----------------------------------------------------------------------------// inline uint32 FirstPow2(uint32 _val) { --_val |= _val >> 16; _val |= _val >> 8; _val |= _val >> 4; _val |= _val >> 2; _val |= _val >> 1; return ++_val; } inline bool IsPow2(uint32 _val) { return (_val & (_val - 1)) == 0; } inline uint8 FloatToByte(float _value) { return (uint8)(_value * 0xff); } inline float ByteToFloat(uint8 _value) { return (float)(_value * (1 / 255.0f)); } inline uint16 FloatToHalf(float _value) { union { float f; uint32 i; }_fb = { _value }; # ifdef FAST_HALF_FLOAT return (uint16)((_fb.i >> 16) & 0x8000) | ((((_fb.i & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) | ((_fb.i >> 13) & 0x03ff); # else uint32 _s = (_fb.i >> 16) & 0x00008000; // sign int32 _e = ((_fb.i >> 23) & 0x000000ff) - 0x00000070; // exponent uint32 _r = _fb.i & 0x007fffff; // mantissa if (_e < 1) { if (_e < -10) return 0; _r = (_r | 0x00800000) >> (14 - _e); return (uint16)(_s | _r); } else if (_e == 0x00000071) { if (_r == 0) return (uint16)(_s | 0x7c00); // Inf else return (uint16)(((_s | 0x7c00) | (_r >>= 13)) | (_r == 0)); // NaN } if (_e > 30) return (uint16)(_s | 0x7c00); // Overflow return (uint16)((_s | (_e << 10)) | (_r >> 13)); # endif } inline float HalfToFloat(uint16 _value) { union { uint32 i; float f; }_fb; # ifdef FAST_HALF_FLOAT _fb.i = ((_value & 0x8000) << 16) | (((_value & 0x7c00) + 0x1C000) << 13) | ((_value & 0x03FF) << 13); # else register int32 _s = (_value >> 15) & 0x00000001; // sign register int32 _e = (_value >> 10) & 0x0000001f; // exponent register int32 _r = _value & 0x000003ff; // mantissa if (_e == 0) { if (_r == 0) // Plus or minus zero { _fb.i = _s << 31; return _fb.f; } else // Denormalized number -- renormalize it { for (; !(_r & 0x00000400); _r <<= 1, _e -= 1); _e += 1; _r &= ~0x00000400; } } else if (_e == 31) { if (_r == 0) // Inf { _fb.i = (_s << 31) | 0x7f800000; return _fb.f; } else // NaN { _fb.i = ((_s << 31) | 0x7f800000) | (_r << 13); return _fb.f; } } _e = (_e + 112) << 23; _r = _r << 13; _fb.i = ((_s << 31) | _e) | _r; # endif return _fb.f; } inline float FixedToFloat(uint32 _value, uint32 _bits, float _default = 0) { if (_bits > 31) _bits = 31; return _bits ? ((float)_value) / ((float)((1u << _bits) - 1u)) : _default; } inline uint32 FloatToFixed(float _value, uint32 _bits) { if (_bits > 31) _bits = 31; if (_value <= 0) return 0; if (_value >= 1) return (1u << _bits) - 1u; return (uint32)(_value * (float)(1u << _bits)); } inline uint32 FixedToFixed(uint32 _value, uint32 _from, uint32 _to) { if (_from > 31) _from = 31; if (_to > 31) _to = 31; if (_from > _to) _value >>= _from - _to; else if (_from < _to && _value != 0) { uint32 _max = (1u << _from) - 1u; if (_value == _max) _value = (1u << _to) - 1u; else if (_max > 0) _value *= (1u << _to) / _max; else _value = 0; } return _value; } //----------------------------------------------------------------------------// // CheckSum //----------------------------------------------------------------------------// ENGINE_API uint32 Crc32(uint32 _crc, const void* _buf, uint _size); inline uint32 Crc32(const void* _buf, uint _size) { return Crc32(0, _buf, _size); } inline uint32 Crc32(const char* _str, int _length = -1, uint32 _crc = 0) { return _str ? Crc32(_crc, _str, _length < 0 ? (uint)strlen(_str) : _length) : _crc; } inline uint32 Crc32(const String& _str, uint32 _crc = 0) { return Crc32(_crc, _str, _str.Length()); } template <typename T> uint32 Crc32(const T& _obj, uint32 _crc = 0) { return Crc32(_crc, &_obj, sizeof(_obj)); } //----------------------------------------------------------------------------// // half //----------------------------------------------------------------------------// struct half { half(void) { } half(float _value) { Pack(_value); } half& operator = (float _value) { return Pack(_value); } operator const float(void) const { return Unpack(); } half operator ++ (int) { half _tmp(*this); Pack(Unpack() + 1); return _tmp; } half& operator ++ (void) { return Pack(Unpack() + 1); } half operator -- (int) { half _tmp(*this); Pack(Unpack() - 1); return _tmp; } half& operator -- (void) { return Pack(Unpack() - 1); } half& operator += (float _rhs) { return Pack(Unpack() + _rhs); } half& operator -= (float _rhs) { return Pack(Unpack() - _rhs); } half& operator *= (float _rhs) { return Pack(Unpack() * _rhs); } half& operator /= (float _rhs) { return Pack(Unpack() / _rhs); } half& Pack(float _value) { value = FloatToHalf(_value); return *this; } const float Unpack(void) const { return HalfToFloat(value); } uint16 value; }; //----------------------------------------------------------------------------// // Vec2T //----------------------------------------------------------------------------// template <typename T> struct Vec2T { Vec2T(void) { } Vec2T(T _xy) : x(_xy), y(_xy) { } Vec2T(T _x, T _y) : x(_x), y(_y) { } Vec2T Copy(void) const { return *this; } template <typename X> Vec2T(const Vec2T<X>& _v) : x(static_cast<T>(_v.x)), y(static_cast<T>(_v.y)) { } template <typename X> explicit Vec2T(X _x, X _y) : x(static_cast<T>(_x)), y(static_cast<T>(_y)) { } template <typename X> X Cast(void) const { return X(x, y); } const T operator [] (uint _index) const { return (&x)[_index]; } T& operator [] (uint _index) { return (&x)[_index]; } const T* operator * (void) const { return &x; } T* operator * (void) { return &x; } Vec2T operator - (void) const { return Vec2T(-x, -y); } Vec2T operator + (const Vec2T& _rhs) const { return Vec2T(x + _rhs.x, y + _rhs.y); } Vec2T operator - (const Vec2T& _rhs) const { return Vec2T(x - _rhs.x, y - _rhs.y); } Vec2T operator * (T _rhs) const { return Vec2T(x * _rhs, y * _rhs); } Vec2T operator / (T _rhs) const { return Vec2T(x / _rhs, y / _rhs); } Vec2T& operator += (const Vec2T& _rhs) { x += _rhs.x, y += _rhs.y; return *this; } Vec2T& operator -= (const Vec2T& _rhs) { x -= _rhs.x, y -= _rhs.y; return *this; } Vec2T& operator *= (T _rhs) { x *= _rhs, y *= _rhs; return *this; } Vec2T& operator /= (T _rhs) { x /= _rhs, y /= _rhs; return *this; } bool operator == (const Vec2T& _rhs) const { return x == _rhs.x && y == _rhs.y; } bool operator != (const Vec2T& _rhs) const { return x != _rhs.x || y != _rhs.y; } Vec2T& Set(T _xy) { x = _xy, y = _xy; return *this; } Vec2T& Set(T _x, T _y) { x = _x, y = _y; return *this; } Vec2T& Set(const Vec2T& _other) { return *this = _other; } T x, y; static const Vec2T Zero; static const Vec2T One; static const Vec2T UnitX; static const Vec2T UnitY; }; template <typename T> const Vec2T<T> Vec2T<T>::Zero(0); template <typename T> const Vec2T<T> Vec2T<T>::One(1); template <typename T> const Vec2T<T> Vec2T<T>::UnitX(1, 0); template <typename T> const Vec2T<T> Vec2T<T>::UnitY(0, 1); typedef Vec2T<float> Vec2; typedef Vec2T<half> Vec2h; typedef Vec2T<int> Vec2i; typedef Vec2T<uint> Vec2ui; //----------------------------------------------------------------------------// // Vec3T //----------------------------------------------------------------------------// template <typename T> struct Vec3T { Vec3T(void) { } Vec3T(T _xyz) : x(_xyz), y(_xyz), z(_xyz) { } Vec3T(T _x, T _y, T _z) : x(_x), y(_y), z(_z) { } template <typename X> Vec3T(const Vec3T<X>& _v) : x(static_cast<T>(_v.x)), y(static_cast<T>(_v.y)), z(static_cast<T>(_v.z)) { } template <typename X> explicit Vec3T(X _x, X _y, X _z) : x(static_cast<T>(_x)), y(static_cast<T>(_y)), z(static_cast<T>(_z)) { } Vec3T Copy(void) const { return *this; } template <typename X> X Cast(void) const { return X(x, y, z); } const T operator [] (uint _index) const { return (&x)[_index]; } T& operator [] (uint _index) { return (&x)[_index]; } const T* operator * (void) const { return &x; } T* operator * (void) { return &x; } Vec3T operator - (void) const { return Vec3T(-x, -y, -z); } Vec3T operator + (const Vec3T& _rhs) const { return Vec3T(x + _rhs.x, y + _rhs.y, z + _rhs.z); } Vec3T operator - (const Vec3T& _rhs) const { return Vec3T(x - _rhs.x, y - _rhs.y, z - _rhs.z); } Vec3T operator * (const Vec3T& _rhs) const { return Vec3T(x * _rhs.x, y * _rhs.y, z * _rhs.z); } Vec3T operator / (const Vec3T& _rhs) const { return Vec3T(x / _rhs.x, y / _rhs.y, z / _rhs.z); } Vec3T operator * (T _rhs) const { return Vec3T(x * _rhs, y * _rhs, z * _rhs); } Vec3T operator / (T _rhs) const { return Vec3T(x / _rhs, y / _rhs, z / _rhs); } Vec3T& operator += (const Vec3T& _rhs) { x += _rhs.x, y += _rhs.y, z += _rhs.z; return *this; } Vec3T& operator -= (const Vec3T& _rhs) { x -= _rhs.x, y -= _rhs.y, z -= _rhs.z; return *this; } Vec3T& operator *= (const Vec3T& _rhs) { x *= _rhs.x, y *= _rhs.y, z *= _rhs.z; return *this; } Vec3T& operator /= (const Vec3T& _rhs) { x /= _rhs.x, y /= _rhs.y, z /= _rhs.z; return *this; } Vec3T& operator *= (T _rhs) { x *= _rhs, y *= _rhs, z *= _rhs; return *this; } Vec3T& operator /= (T _rhs) { x /= _rhs, y /= _rhs, z /= _rhs; return *this; } friend Vec3T operator / (T _lhs, const Vec3T& _rhs) { return Vec3T(_lhs / _rhs.x, _lhs / _rhs.y, _lhs / _rhs.z); } friend Vec3T operator * (T _lhs, const Vec3T& _rhs) { return Vec3T(_lhs * _rhs.x, _lhs * _rhs.y, _lhs * _rhs.z); } bool operator == (const Vec3T& _rhs) const { return x == _rhs.x && y == _rhs.y && z == _rhs.z; } bool operator != (const Vec3T& _rhs) const { return x != _rhs.x || y != _rhs.y || z != _rhs.z; } Vec3T& Set(T _xyz) { x = _xyz, y = _xyz, z = _xyz; return *this; } Vec3T& Set(T _x, T _y, T _z) { x = _x, y = _y, z = _z; return *this; } Vec3T& Set(const Vec3T& _other) { return *this = _other; } // [for Vec3T<float>] Vec3T<float>& SetMin(const Vec3T<float>& _a, const Vec3T<float>& _b) { x = Min(_a.x, _b.x), y = Min(_a.y, _b.y), z = Min(_a.z, _b.z); return *this; } Vec3T<float>& SetMin(const Vec3T<float>& _other) { return SetMin(*this, _other); } Vec3T<float>& SetMax(const Vec3T<float>& _a, const Vec3T<float>& _b) { x = Max(_a.x, _b.x), y = Max(_a.y, _b.y), z = Max(_a.z, _b.z); return *this; } Vec3T<float>& SetMax(const Vec3T<float>& _other) { return SetMax(*this, _other); } Vec3T<float>& Normalize(void) { float _l = LengthSq(); if (_l > Epsilon2) *this *= RSqrt(_l); return *this; } Vec3T<float>& NormalizeFast(void) { return *this *= LengthInv(); } float LengthSq(void) const { return x * x + y * y + z * z; } float Length(void) const { return Sqrt(x * x + y * y + z * z); } float LengthInv(void) const { return Sqrt(x * x + y * y + z * z); } float Dot(const Vec3T<float>& _rhs) const { return x * _rhs.x + y * _rhs.y + z * _rhs.z; } float AbsDot(const Vec3T<float>& _rhs) const { return Abs(x * _rhs.x) + Abs(y * _rhs.y) + Abs(z * _rhs.z); } Vec3T<float> Cross(const Vec3T<float>& _rhs) const { return Vec3T<float>(y * _rhs.z - z * _rhs.y, z * _rhs.x - x * _rhs.z, x * _rhs.y - y * _rhs.x); } float Distance(const Vec3T<float>& _v) const { return (*this - _v).Length(); } float DistanceSq(const Vec3T<float>& _v) const { return (*this - _v).LengthSq(); } Vec3T<float> MidPoint(const Vec3T<float>& _v) const { return (*this + _v) * 0.5f; } Vec3T<float> Reflect(const Vec3T<float>& _n) const { return Vec3T<float>(*this - (2 * Dot(_n) * _n)); } Vec3T<float> Perpendicular(void) const { Vec3T<float> _perp = Cross(UNIT_X); if (_perp.LengthSq() <= EPSILON2) _perp = Cross(UNIT_Y); return _perp.Normalize(); } float Angle(const Vec3T<float>& _v) const { float _lp = LengthSq() * _v.LengthSq(); if (_lp > EPSILON2) _lp = RSqrt(_lp); return ACos(Clamp<float>(Dot(_v) * _lp, -1, 1)); } T x, y, z; static const Vec3T Zero; static const Vec3T One; static const Vec3T UnitX; static const Vec3T UnitY; static const Vec3T UnitZ; }; template <typename T> const Vec3T<T> Vec3T<T>::Zero(0); template <typename T> const Vec3T<T> Vec3T<T>::One(1); template <typename T> const Vec3T<T> Vec3T<T>::UnitX(1, 0, 0); template <typename T> const Vec3T<T> Vec3T<T>::UnitY(0, 1, 0); template <typename T> const Vec3T<T> Vec3T<T>::UnitZ(0, 0, 1); typedef Vec3T<float> Vec3; typedef Vec3T<half> Vec3h; typedef Vec3T<int> Vec3i; typedef Vec3T<uint> Vec3ui; //----------------------------------------------------------------------------// // Vec4T //----------------------------------------------------------------------------// template <typename T> struct Vec4T { Vec4T(void) { } Vec4T(T _xyzw) : x(_xyzw), y(_xyzw), z(_xyzw), w(_xyzw) { } Vec4T(T _x, T _y, T _z, T _w) : x(_x), y(_y), z(_z), w(_w) { } template <typename X> Vec4T(const Vec4T<X>& _v) : x(static_cast<T>(_v.x)), y(static_cast<T>(_v.y)), z(static_cast<T>(_v.z)), w(static_cast<T>(_v.w)) { } template <typename X> explicit Vec4T(X _x, X _y, X _z, X _w) : x(static_cast<T>(_x)), y(static_cast<T>(_y)), z(static_cast<T>(_z)), w(static_cast<T>(_w)) { } Vec4T Copy(void) const { return *this; } template <typename X> X Cast(void) const { return X(x, y, z, w); } const T operator [] (uint _index) const { return (&x)[_index]; } T& operator [] (uint _index) { return (&x)[_index]; } const T* operator * (void) const { return &x; } T* operator * (void) { return &x; } Vec4T operator - (void) const { return Vec4T(-x, -y, -z, -w); } Vec4T operator + (const Vec4T& _rhs) const { return Vec4T(x + _rhs.x, y + _rhs.y, z + _rhs.z, w + _rhs.w); } Vec4T operator - (const Vec4T& _rhs) const { return Vec4T(x - _rhs.x, y - _rhs.y, z - _rhs.z, w - _rhs.w); } Vec4T operator * (T _rhs) const { return Vec4T(x * _rhs, y * _rhs, z * _rhs, w * _rhs); } Vec4T operator / (T _rhs) const { return Vec4T(x / _rhs, y / _rhs, z / _rhs, w / _rhs); } Vec4T& operator += (const Vec4T& _rhs) { x += _rhs.x, y += _rhs.y, z += _rhs.z, w += _rhs.w; return *this; } Vec4T& operator -= (const Vec4T& _rhs) { x -= _rhs.x, y -= _rhs.y, z -= _rhs.z, w -= _rhs.w; return *this; } Vec4T& operator *= (T _rhs) { x *= _rhs, y *= _rhs, z *= _rhs, w *= _rhs; return *this; } Vec4T& operator /= (T _rhs) { x /= _rhs, y /= _rhs, z /= _rhs, w /= _rhs; return *this; } Vec4T& Set(T _xyzw) { x = _xyzw, y = _xyzw, z = _xyzw, w = _xyzw; return *this; } Vec4T& Set(T _x, T _y, T _z, T _w) { x = _x, y = _y, z = _z, w = _w; return *this; } Vec4T& Set(const Vec4T& _other) { return *this = _other; } T x, y, z, w; static const Vec4T Zero; static const Vec4T One; static const Vec4T Identity; }; template <typename T> const Vec4T<T> Vec4T<T>::Zero(0); template <typename T> const Vec4T<T> Vec4T<T>::One(1); template <typename T> const Vec4T<T> Vec4T<T>::Identity(0, 0, 0, 1); typedef Vec4T<float> Vec4; typedef Vec4T<half> Vec4h; typedef Vec4T<int> Vec4i; typedef Vec4T<int8> Vec4b; typedef Vec4T<uint8> Vec4ub; //----------------------------------------------------------------------------// // Quat //----------------------------------------------------------------------------// struct Quat { Quat(void) { } Quat(float _x, float _y, float _z, float _w) : x(_x), y(_y), z(_z), w(_w) { } Quat Copy(void) const { return *this; } template <typename X> X Cast(void) const { return X(x, y, z, w); } const float operator [] (uint _index) const { return v[_index]; } float& operator [] (uint _index) { return v[_index]; } const float* operator * (void) const { return v; } float* operator * (void) { return v; } Quat operator - (void) const { return Quat(-x, -y, -z, -w); } Quat operator + (const Quat& _rhs) const { return Quat(x + _rhs.x, y + _rhs.y, z + _rhs.z, w + _rhs.w); } Quat operator - (const Quat& _rhs) const { return Quat(x - _rhs.x, y - _rhs.y, z - _rhs.z, w - _rhs.w); } Quat operator * (const Quat& _rhs) const { return Quat(w * _rhs.x + x * _rhs.w + y * _rhs.z - z * _rhs.y, w * _rhs.y + y * _rhs.w + z * _rhs.x - x * _rhs.z, w * _rhs.z + z * _rhs.w + x * _rhs.y - y * _rhs.x, w * _rhs.w - x * _rhs.x - y * _rhs.y - z * _rhs.z); } Quat operator * (float _rhs) const { return Quat(x * _rhs, y * _rhs, z * _rhs, w * _rhs); } Quat operator / (float _rhs) const { return Quat(x / _rhs, y / _rhs, z / _rhs, w / _rhs); } Quat& operator += (const Quat& _rhs) { x += _rhs.x, y += _rhs.y, z += _rhs.z, w += _rhs.w; return *this; } Quat& operator -= (const Quat& _rhs) { x -= _rhs.x, y -= _rhs.y, z -= _rhs.z, w -= _rhs.w; return *this; } Quat& operator *= (const Quat& _rhs) { return *this = *this * _rhs; } Quat& operator *= (float _rhs) { x += _rhs, y += _rhs, z += _rhs, w += _rhs; return *this; } Quat& operator /= (float _rhs) { x += _rhs, y += _rhs, z += _rhs, w += _rhs; return *this; } friend Quat operator * (float _lhs, const Quat& _rhs) { return Quat(_lhs * _rhs.x, _lhs * _rhs.y, _lhs * _rhs.z, _lhs * _rhs.w); } friend Vec3 operator * (const Vec3& _lhs, const Quat& _rhs) { const Vec3& _q = *(Vec3*)_rhs.v; Vec3 _uv(_q.Cross(_lhs)); return _lhs + _uv * 2 * _rhs.w + _q.Cross(_uv) * 2; } Quat& Set(float _x, float _y, float _z, float _w) { x = _x, y = _y, z = _z, w = _w; return *this; } Quat& Set(const Quat& _other) { return *this = _other; } float Dot(const Quat& _q) const { return x * _q.x + y * _q.y + z * _q.z + w * _q.w; } Quat& Normalize(void) { float _l = x * x + y * y + z * z + w * w; if (_l > Epsilon2) *this *= RSqrt(_l); return *this; } Quat& Inverse(void) { float _d = x * x + y * y + z * z + w * w; if (_d > 0) x *= -_d, y *= -_d, z *= -_d, w *= _d; else x = 0, y = 0, z = 0, w = 1; return *this; } Quat& UnitInverse(void) { x = -x, y = -y, z = -z; return *this; } Quat Nlerp(const Quat& _q, float _t, bool _shortestPath = false) const { const Quat& _p = *this; float _c = _p.Dot(_q); Quat _result; if (_c < 0 && _shortestPath) _result = _p + _t * ((-_q) - _p); else _result = _p + _t * (_q - _p); return _result.Normalize(); } Quat Slerp(const Quat& _q, float _t, bool _shortestPath = false) const { const Quat& _p = *this; float _c = _p.Dot(_q); Quat _tmp; if (_c < 0 && _shortestPath) _c = -_c, _tmp = -_q; else _tmp = _q; if (Abs(_c) < 1 - Epsilon) { float _s = Sqrt(1 - _c * _c); float _angle = ATan2(_s, _c); float _invs = 1 / _s; float _coeff0 = Sin((1 - _t) * _angle) * _invs; float _coeff1 = Sin(_t * _angle) * _invs; return _coeff0 * _p + _coeff1 * _tmp; } return Quat((1 - _t) * _p + _t * _tmp).Normalize(); } void ToMatrixRows(float* _r0, float* _r1, float* _r2) const { float _x2 = x + x, _y2 = y + y, _z2 = z + z; float _wx = _x2 * w, _wy = _y2 * w, _wz = _z2 * w, _xx = _x2 * x, _xy = _y2 * x, _xz = _z2 * x, _yy = _y2 * y, _yz = _z2 * y, _zz = _z2 * z; _r0[0] = 1 - (_yy + _zz), _r0[1] = _xy + _wz, _r0[2] = _xz - _wy; _r1[0] = _xy - _wz, _r1[1] = 1 - (_xx + _zz), _r1[2] = _yz + _wx; _r2[0] = _xz + _wy, _r2[1] = _yz - _wx, _r2[2] = 1 - (_xx + _yy); } Quat& FromMatrixRows(const float* _r0, const float* _r1, const float* _r2) { float _invr, _root = _r0[0] + _r1[1] + _r2[2]; if (_root > 0) { _root = Sqrt(_root + 1); _invr = 0.5f / _root; return Set((_r1[2] - _r2[1]) * _invr, (_r2[0] - _r0[2]) * _invr, (_r0[1] - _r1[0]) * _invr, _root * 0.5f); } if (_r0[0] > _r1[1] && _r0[0] > _r2[2]) { _root = Sqrt(_r0[0] - _r1[1] - _r2[2] + 1); _invr = 0.5f / _root; return Set(_root * 0.5f, (_r0[1] + _r1[0]) * _invr, (_r0[2] + _r2[0]) * _invr, (_r1[2] - _r2[1]) * _invr); } else if (_r1[1] > _r0[0] && _r1[1] > _r2[2]) { _root = Sqrt(_r1[1] - _r2[2] - _r0[0] + 1); _invr = 0.5f / _root; return Set((_r1[0] + _r0[1]) * _invr, _root * 0.5f, (_r1[2] + _r2[1]) * _invr, (_r2[0] - _r0[2]) * _invr); } _root = Sqrt(_r2[2] - _r0[0] - _r1[1] + 1); _invr = 0.5f / _root; return Set((_r2[0] + _r0[2]) * _invr, (_r2[1] + _r1[2]) * _invr, _root * 0.5f, (_r0[1] - _r1[0]) * _invr); } Quat& FromAxisAngle(const Vec3& _axis, float _angle) { float _s, _c; SinCos(_angle*0.5f, _s, _c); return Set(_axis.x * _s, _axis.y * _s, _axis.z * _s, _c); } union { struct { float x, y, z, w; }; float v[4]; }; ENGINE_API static const Quat Zero; ENGINE_API static const Quat Identity; }; inline Quat Mix(const Quat& _a, const Quat& _b, float _t) { return _a.Slerp(_b, _t); } //----------------------------------------------------------------------------// // Mat34 //----------------------------------------------------------------------------// struct Mat34 { Mat34(void) { } Mat34(float _val) { *this = Zero; m[0][0] = _val; m[1][1] = _val; m[2][2] = _val; } Mat34(float _00, float _01, float _02, float _03, float _10, float _11, float _12, float _13, float _20, float _21, float _22, float _23) : m00(_00), m01(_01), m02(_02), m03(_03), m10(_10), m11(_11), m12(_12), m13(_13), m20(_20), m21(_21), m22(_22), m23(_23) { } explicit Mat34(const float* _m34) { memcpy(v, _m34, 12 * sizeof(float)); } Mat34 Copy(void) const { return *this; } const float* operator [] (int _row) const { return m[_row]; } float* operator [] (int _row) { return m[_row]; } const float* operator * (void) const { return v; } float* operator * (void) { return v; } float& operator () (uint _row, uint _col) { return m[_row][_col]; } const float operator () (uint _row, uint _col) const { return m[_row][_col]; } const Vec3& Row(uint _row) const { return *(Vec3*)(m[_row]); } Vec3& Row(uint _row) { return *(Vec3*)(m[_row]); } Mat34 operator + (const Mat34& _rhs) const { return Copy().Add(_rhs); } Mat34 operator * (const Mat34& _rhs) const { return Copy().Multiply(_rhs); } Mat34 operator * (float _rhs) const{ return Copy().Multiply(_rhs); } friend Vec3 operator * (const Vec3& _lhs, const Mat34& _rhs) { return _rhs.Transform(_lhs); } // Vec3 = Vec3 * Mat34 Mat34& operator += (const Mat34& _rhs) { return Add(_rhs); } Mat34& operator *= (const Mat34& _rhs) { return Multiply(_rhs); } Mat34& operator *= (float _rhs) { return Multiply(_rhs); } Mat34& Add(const Mat34& _rhs) { for (int i = 0; i < 12; ++i) v[i] += v[i]; return *this; } Mat34& Multiply(float _rhs) { for (int i = 0; i < 12; ++i) v[i] *= _rhs; return *this; } Mat34& Multiply(const Mat34& _rhs) { return *this = Mat34(m00 * _rhs.m00 + m01 * _rhs.m10 + m02 * _rhs.m20, m00 * _rhs.m01 + m01 * _rhs.m11 + m02 * _rhs.m21, m00 * _rhs.m02 + m01 * _rhs.m12 + m02 * _rhs.m22, m00 * _rhs.m03 + m01 * _rhs.m13 + m02 * _rhs.m23 + m03, m10 * _rhs.m00 + m11 * _rhs.m10 + m12 * _rhs.m20, m10 * _rhs.m01 + m11 * _rhs.m11 + m12 * _rhs.m21, m10 * _rhs.m02 + m11 * _rhs.m12 + m12 * _rhs.m22, m10 * _rhs.m03 + m11 * _rhs.m13 + m12 * _rhs.m23 + m13, m20 * _rhs.m00 + m21 * _rhs.m10 + m22 * _rhs.m20, m20 * _rhs.m01 + m21 * _rhs.m11 + m22 * _rhs.m21, m20 * _rhs.m02 + m21 * _rhs.m12 + m22 * _rhs.m22, m20 * _rhs.m03 + m21 * _rhs.m13 + m22 * _rhs.m23 + m23); } float Determinant(void) const { return m00 * m11 * m22 + m01 * m12 * m20 + m02 * m10 * m21 - m02 * m11 * m20 - m00 * m12 * m21 - m01 * m10 * m22; } Mat34& Inverse(void) { float _m00 = m00, _m01 = m01, _m02 = m02, _m03 = m03, _m10 = m10, _m11 = m11, _m12 = m12, _m13 = m13, _m20 = m20, _m21 = m21, _m22 = m22, _m23 = m23; float _v0 = (_m23 * _m10 - _m20 * _m13), _v1 = (_m23 * _m11 - _m21 * _m13), _v2 = (_m23 * _m12 - _m22 * _m13); float _t00 = +(_m22 * _m11 - _m21 * _m12), _t10 = -(_m22 * _m10 - _m20 * _m12), _t20 = +(_m21 * _m10 - _m20 * _m11); float _invdet = 1 / (_t00 * _m00 + _t10 * _m01 + _t20 * _m02); m00 = _t00 * _invdet; m10 = _t10 * _invdet; m20 = _t20 * _invdet; m01 = -(_m22 * _m01 - _m21 * _m02) * _invdet; m11 = +(_m22 * _m00 - _m20 * _m02) * _invdet; m21 = -(_m21 * _m00 - _m20 * _m01) * _invdet; m02 = +(_m12 * _m01 - _m11 * _m02) * _invdet; m12 = -(_m12 * _m00 - _m10 * _m02) * _invdet; m22 = +(_m11 * _m00 - _m10 * _m01) * _invdet; m03 = -(_v2 * _m01 - _v1 * _m02 + (_m22 * _m11 - _m21 * _m12) * _m03) * _invdet; m13 = +(_v2 * _m00 - _v0 * _m02 + (_m22 * _m10 - _m20 * _m12) * _m03) * _invdet; m23 = -(_v1 * _m00 - _v0 * _m01 + (_m21 * _m10 - _m20 * _m11) * _m03) * _invdet; return *this; } Vec3 Translate(const Vec3& _v) const { return Vec3(_v.x + m03, _v.y + m13, _v.z + m23); } Vec3 Transform(const Vec3& _v) const { return Vec3( m00 * _v.x + m01 * _v.y + m02 * _v.z + m03, m10 * _v.x + m11 * _v.y + m12 * _v.z + m13, m20 * _v.x + m21 * _v.y + m22 * _v.z + m23); } Vec3 TransformVectorAbs(const Vec3& _v) const { return Vec3( Abs(m00) * _v.x + Abs(m01) * _v.y + Abs(m02) * _v.z, Abs(m10) * _v.x + Abs(m11) * _v.y + Abs(m12) * _v.z, Abs(m20) * _v.x + Abs(m21) * _v.y + Abs(m22) * _v.z); } Vec3 TransformVector(const Vec3& _v) const { return Vec3(m00 * _v.x + m01 * _v.y + m02 * _v.z, m10 * _v.x + m11 * _v.y + m12 * _v.z, m20 * _v.x + m21 * _v.y + m22 * _v.z); } Mat34& SetTranslation(const Vec3& _translation) { m03 = _translation.x, m13 = _translation.y, m23 = _translation.z; return *this; } Vec3 GetTranslation(void) const { return Vec3(m03, m12, m23); } Mat34& CreateTranslation(const Vec3& _translation) { return (*this = Identity).SetTranslation(_translation); } Mat34& SetRotation(const Quat& _rotation) { Vec3 _scale = GetScale(); _rotation.ToMatrixRows(m[0], m[1], m[2]); Row(0) *= _scale, Row(1) *= _scale, Row(2) *= _scale; return *this; } Quat GetRotation(void) const { Vec3 _m0(m00, m10, m20); Vec3 _m1(m01, m11, m21); Vec3 _m2(m02, m12, m22); Vec3 _q0 = _m0.Copy().Normalize(); Vec3 _q1 = (_m1 - _q0 * _q0.Dot(_m1)).Normalize(); Vec3 _q2 = ((_m2 - _q0 * _q0.Dot(_m2)) - _q1 * _q1.Dot(_m2)).Normalize(); float _det = _q0[0] * _q1[1] * _q2[2] + _q0[1] * _q1[2] * _q2[0] + _q0[2] * _q1[0] * _q2[1] - _q0[2] * _q1[1] * _q2[0] - _q0[1] * _q1[0] * _q2[2] - _q0[0] * _q1[2] * _q2[1]; if (_det < 0) _q0 = -_q0, _q1 = -_q1, _q2 = -_q2; return Quat().FromMatrixRows(*_q0, *_q1, *_q2); } Mat34& CreateRotation(const Quat& _rotation) { SetTranslation(Vec3::Zero); _rotation.ToMatrixRows(m[0], m[1], m[2]); return *this; } bool HasScale(void) const { if (!(Abs((m00 * m00 + m10 * m10 + m20 * m20) - 1) < Epsilon)) return true; if (!(Abs((m01 * m01 + m11 * m11 + m21 * m21) - 1) < Epsilon)) return true; if (!(Abs((m02 * m02 + m12 * m12 + m22 * m22) - 1) < Epsilon)) return true; return false; } bool HasNegativeScale(void) const { return Determinant() < 0; } Mat34& SetScale(const Vec3& _scale) { Quat _rotation = GetRotation(); _rotation.ToMatrixRows(m[0], m[1], m[2]); Row(0) *= _scale, Row(1) *= _scale, Row(2) *= _scale; return *this; } Vec3 GetScale(void) const { return Vec3( Sqrt(m00 * m00 + m10 * m10 + m20 * m20), Sqrt(m01 * m01 + m11 * m11 + m21 * m21), Sqrt(m02 * m02 + m12 * m12 + m22 * m22)); } Mat34& CreateScale(const Vec3& _scale) { *this = Zero; m00 = _scale.x, m11 = _scale.y, m22 = _scale.z; return *this; } Mat34& CreateTransform(const Vec3& _translation, const Quat& _rotation, const Vec3& _scale = Vec3::One) { // Ordering: Scale, Rotate, Translate float _r0[3], _r1[3], _r2[3]; _rotation.ToMatrixRows(_r0, _r1, _r2); m00 = _scale.x * _r0[0], m01 = _scale.y * _r0[1], m02 = _scale.z * _r0[2], m03 = _translation.x; m10 = _scale.x * _r1[0], m11 = _scale.y * _r1[1], m12 = _scale.z * _r1[2], m13 = _translation.y; m20 = _scale.x * _r2[0], m21 = _scale.y * _r2[1], m22 = _scale.z * _r2[2], m23 = _translation.z; return *this; } Mat34& CreateInverseTransform(const Vec3& _translation, const Quat& _rotation, const Vec3& _scale = Vec3::One) { Vec3 _inv_scale(1 / _scale); Quat _inv_rotation = _rotation.Copy().Inverse(); Vec3 _inv_translation((-_translation * _inv_rotation) * _inv_scale); return CreateTransform(_inv_translation, _inv_rotation, _inv_scale); } union { struct { float m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23; }; float m[3][4]; // [row][col] float v[12]; }; ENGINE_API static const Mat34 Zero; ENGINE_API static const Mat34 Identity; }; //----------------------------------------------------------------------------// // Mat44 //----------------------------------------------------------------------------// struct Mat44 { Mat44(void) { } Mat44(float _val) { *this = Zero; m[0][0] = _val; m[1][1] = _val; m[2][2] = _val; m[3][3] = _val; } Mat44(const Mat34& _m34) : m30(0), m31(0), m32(0), m33(1) { memcpy(v, *_m34, 12 * sizeof(float)); } explicit Mat44(const float* _m44) { memcpy(v, _m44, 16 * sizeof(float)); } Mat44(float _00, float _01, float _02, float _03, float _10, float _11, float _12, float _13, float _20, float _21, float _22, float _23, float _30, float _31, float _32, float _33) : m00(_00), m01(_01), m02(_02), m03(_03), m10(_10), m11(_11), m12(_12), m13(_13), m20(_20), m21(_21), m22(_22), m23(_23), m30(_30), m31(_31), m32(_32), m33(_33) { } Mat44 Copy(void) const { return *this; } operator const Mat34& (void) const { /*ASSERT(IsAffine());*/ return *(Mat34*)(v); } const float* operator [] (int _row) const { return m[_row]; } float* operator [] (int _row) { return m[_row]; } const float* operator * (void) const { return v; } float* operator * (void) { return v; } float& operator () (uint _row, uint _col) { return m[_row][_col]; } const float operator () (uint _row, uint _col) const { return m[_row][_col]; } const Vec3& Row(uint _row) const { return *(Vec3*)(m[_row]); } Vec3& Row(uint _row) { return *(Vec3*)(m[_row]); } const Vec4& Row4(uint _row) const { return *(Vec4*)(m[_row]); } Vec4& Row4(uint _row) { return *(Vec4*)(m[_row]); } Mat44 operator + (const Mat44& _rhs) const { return Copy().Add(_rhs); } Mat44 operator * (const Mat44& _rhs) const { return Copy().Multiply(_rhs); } Mat44 operator * (const Mat34& _rhs) const { return Copy().Multiply(_rhs); } Mat44 operator * (float _rhs) const { return Copy().Multiply(_rhs); } friend Vec3 operator * (const Vec3& _lhs, const Mat44& _rhs) { return _rhs.Transform(_lhs); } // Vec3 = Vec3 * Mat44 Mat44& operator += (const Mat44& _rhs) { return Add(_rhs); } Mat44& operator *= (const Mat44& _rhs) { return Multiply(_rhs); } Mat44& operator *= (const Mat34& _rhs) { return Multiply(_rhs); } Mat44& operator *= (float _rhs) { return Multiply(_rhs); } Mat44& Add(const Mat44& _rhs) { for (int i = 0; i < 16; ++i) v[i] += _rhs.v[i]; return *this; } Mat44& Multiply(float _rhs) { for (int i = 0; i < 16; ++i) v[i] += _rhs; return *this; } Mat44& Multiply(const Mat44& _rhs) { return *this = Mat44( m00 * _rhs.m00 + m01 * _rhs.m10 + m02 * _rhs.m20 + m03 * _rhs.m30, m00 * _rhs.m01 + m01 * _rhs.m11 + m02 * _rhs.m21 + m03 * _rhs.m31, m00 * _rhs.m02 + m01 * _rhs.m12 + m02 * _rhs.m22 + m03 * _rhs.m32, m00 * _rhs.m03 + m01 * _rhs.m13 + m02 * _rhs.m23 + m03 * _rhs.m33, m10 * _rhs.m00 + m11 * _rhs.m10 + m12 * _rhs.m20 + m13 * _rhs.m30, m10 * _rhs.m01 + m11 * _rhs.m11 + m12 * _rhs.m21 + m13 * _rhs.m31, m10 * _rhs.m02 + m11 * _rhs.m12 + m12 * _rhs.m22 + m13 * _rhs.m32, m10 * _rhs.m03 + m11 * _rhs.m13 + m12 * _rhs.m23 + m13 * _rhs.m33, m20 * _rhs.m00 + m21 * _rhs.m10 + m22 * _rhs.m20 + m23 * _rhs.m30, m20 * _rhs.m01 + m21 * _rhs.m11 + m22 * _rhs.m21 + m23 * _rhs.m31, m20 * _rhs.m02 + m21 * _rhs.m12 + m22 * _rhs.m22 + m23 * _rhs.m32, m20 * _rhs.m03 + m21 * _rhs.m13 + m22 * _rhs.m23 + m23 * _rhs.m33, m30 * _rhs.m00 + m31 * _rhs.m10 + m32 * _rhs.m20 + m33 * _rhs.m30, m30 * _rhs.m01 + m31 * _rhs.m11 + m32 * _rhs.m21 + m33 * _rhs.m31, m30 * _rhs.m02 + m31 * _rhs.m12 + m32 * _rhs.m22 + m33 * _rhs.m32, m30 * _rhs.m03 + m31 * _rhs.m13 + m32 * _rhs.m23 + m33 * _rhs.m33); } Mat44& Multiply(const Mat34& _rhs) { return *this = Mat44( m00 * _rhs.m00 + m01 * _rhs.m10 + m02 * _rhs.m20, m00 * _rhs.m01 + m01 * _rhs.m11 + m02 * _rhs.m21, m00 * _rhs.m02 + m01 * _rhs.m12 + m02 * _rhs.m22, m00 * _rhs.m03 + m01 * _rhs.m13 + m02 * _rhs.m23 + m03, m10 * _rhs.m00 + m11 * _rhs.m10 + m12 * _rhs.m20, m10 * _rhs.m01 + m11 * _rhs.m11 + m12 * _rhs.m21, m10 * _rhs.m02 + m11 * _rhs.m12 + m12 * _rhs.m22, m10 * _rhs.m03 + m11 * _rhs.m13 + m12 * _rhs.m23 + m13, m20 * _rhs.m00 + m21 * _rhs.m10 + m22 * _rhs.m20, m20 * _rhs.m01 + m21 * _rhs.m11 + m22 * _rhs.m21, m20 * _rhs.m02 + m21 * _rhs.m12 + m22 * _rhs.m22, m20 * _rhs.m03 + m21 * _rhs.m13 + m22 * _rhs.m23 + m23, m30 * _rhs.m00 + m31 * _rhs.m10 + m32 * _rhs.m20, m30 * _rhs.m01 + m31 * _rhs.m11 + m32 * _rhs.m21, m30 * _rhs.m02 + m31 * _rhs.m12 + m32 * _rhs.m22, m30 * _rhs.m03 + m31 * _rhs.m13 + m32 * _rhs.m23 + m33); } Mat44& Inverse(void) { float _m00 = m00, _m01 = m01, _m02 = m02, _m03 = m03, _m10 = m10, _m11 = m11, _m12 = m12, _m13 = m13, _m20 = m20, _m21 = m21, _m22 = m22, _m23 = m23, _m30 = m30, _m31 = m31, _m32 = m32, _m33 = m33; float _v0 = (_m20 * _m31 - _m21 * _m30), _v1 = (_m20 * _m32 - _m22 * _m30), _v2 = (_m20 * _m33 - _m23 * _m30), _v3 = (_m21 * _m32 - _m22 * _m31), _v4 = (_m21 * _m33 - _m23 * _m31), _v5 = (_m22 * _m33 - _m23 * _m32); float _t00 = +(_v5 * _m11 - _v4 * _m12 + _v3 * _m13), _t10 = -(_v5 * _m10 - _v2 * _m12 + _v1 * _m13), _t20 = +(_v4 * _m10 - _v2 * _m11 + _v0 * _m13), _t30 = -(_v3 * _m10 - _v1 * _m11 + _v0 * _m12); float _invdet = 1 / (_t00 * _m00 + _t10 * _m01 + _t20 * _m02 + _t30 * _m03); m00 = _t00 * _invdet; m10 = _t10 * _invdet; m20 = _t20 * _invdet; m30 = _t30 * _invdet; m01 = -(_v5 * _m01 - _v4 * _m02 + _v3 * _m03) * _invdet; m11 = +(_v5 * _m00 - _v2 * _m02 + _v1 * _m03) * _invdet; m21 = -(_v4 * _m00 - _v2 * _m01 + _v0 * _m03) * _invdet; m31 = +(_v3 * _m00 - _v1 * _m01 + _v0 * _m02) * _invdet; _v0 = (_m10 * _m31 - _m11 * _m30); _v1 = (_m10 * _m32 - _m12 * _m30); _v2 = (_m10 * _m33 - _m13 * _m30); _v3 = (_m11 * _m32 - _m12 * _m31); _v4 = (_m11 * _m33 - _m13 * _m31); _v5 = (_m12 * _m33 - _m13 * _m32); m02 = +(_v5 * _m01 - _v4 * _m02 + _v3 * _m03) * _invdet; m12 = -(_v5 * _m00 - _v2 * _m02 + _v1 * _m03) * _invdet; m22 = +(_v4 * _m00 - _v2 * _m01 + _v0 * _m03) * _invdet; m32 = -(_v3 * _m00 - _v1 * _m01 + _v0 * _m02) * _invdet; _v0 = (_m21 * _m10 - _m20 * _m11); _v1 = (_m22 * _m10 - _m20 * _m12); _v2 = (_m23 * _m10 - _m20 * _m13); _v3 = (_m22 * _m11 - _m21 * _m12); _v4 = (_m23 * _m11 - _m21 * _m13); _v5 = (_m23 * _m12 - _m22 * _m13); m03 = -(_v5 * _m01 - _v4 * _m02 + _v3 * _m03) * _invdet; m13 = +(_v5 * _m00 - _v2 * _m02 + _v1 * _m03) * _invdet; m23 = -(_v4 * _m00 - _v2 * _m01 + _v0 * _m03) * _invdet; m33 = +(_v3 * _m00 - _v1 * _m01 + _v0 * _m02) * _invdet; return *this; } Vec3 Transform(const Vec3& _v) const { float _iw = 1 / (m30 * _v.x + m31 * _v.y + m32 * _v.z + m33); return Vec3( (m00 * _v.x + m01 * _v.y + m02 * _v.z + m03) * _iw, (m10 * _v.x + m11 * _v.y + m12 * _v.z + m13) * _iw, (m20 * _v.x + m21 * _v.y + m22 * _v.z + m23) * _iw); } Mat44& CreatePerspective(float _fov, float _aspect, float _near, float _far, bool _reversed = false) { if (_aspect != _aspect) _aspect = 1; // NaN if (_far == _near) _far = _near + Epsilon; float _h = 1 / Tan(_fov * 0.5f); float _w = _h / _aspect; float _d = (_far - _near); float _q = -(_far + _near) / _d; float _qn = -2 * (_far * _near) / _d; if (_reversed) Swap(_q, _qn); return *this = Mat44(_w, 0, 0, 0, 0, _h, 0, 0, 0, 0, _q, _qn, 0, 0, -1, 0); } Mat44& CreateOrtho2D(float _w, float _h, bool _leftTop = true) { *this = Zero; v[0] = 2 / _w, v[3] = -1, v[10] = -1, v[15] = 1; if (_leftTop) v[5] = -2 / _h, v[7] = 1; else v[5] = 2 / _h, v[7] = -1; return *this; } union { struct { float m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33; }; float m[4][4]; // [row][col] float v[16]; }; ENGINE_API static const Mat44 Zero; ENGINE_API static const Mat44 Identity; }; //----------------------------------------------------------------------------// // //----------------------------------------------------------------------------// }
42.0766
219
0.540013
Zakhar-V
ca7f608f4a4652b4ee3ad834d27312c85d43967d
3,249
cpp
C++
src/GuacInstructionParser.cpp
unk0rrupt/collab-vm-server
30a18cc91b757216a08e900826b589ce29bc3bf0
[ "Apache-2.0" ]
74
2020-12-20T19:29:21.000Z
2021-12-04T14:59:29.000Z
src/GuacInstructionParser.cpp
unk0rrupt/collab-vm-server
30a18cc91b757216a08e900826b589ce29bc3bf0
[ "Apache-2.0" ]
2
2020-12-27T12:10:50.000Z
2021-01-24T12:38:24.000Z
src/GuacInstructionParser.cpp
unk0rrupt/collab-vm-server
30a18cc91b757216a08e900826b589ce29bc3bf0
[ "Apache-2.0" ]
4
2020-12-20T14:28:11.000Z
2021-08-20T17:01:11.000Z
#include "GuacInstructionParser.h" #include "CollabVM.h" #include <vector> #include <functional> #include <string> namespace GuacInstructionParser { typedef void (CollabVMServer::*InstructionHandler)(const std::shared_ptr<CollabVMUser>&, std::vector<char*>&); struct Instruction { std::string opcode; InstructionHandler handler; }; static const Instruction instructions[] = { // Guacamole instructions { "mouse", &CollabVMServer::OnMouseInstruction }, { "key", &CollabVMServer::OnKeyInstruction }, // Custom instructions { "rename", &CollabVMServer::OnRenameInstruction }, { "connect", &CollabVMServer::OnConnectInstruction }, { "chat", &CollabVMServer::OnChatInstruction }, { "turn", &CollabVMServer::OnTurnInstruction }, { "admin", &CollabVMServer::OnAdminInstruction }, { "nop", &CollabVMServer::OnNopInstruction }, { "list", &CollabVMServer::OnListInstruction }, { "vote", &CollabVMServer::OnVoteInstruction }, { "file", &CollabVMServer::OnFileInstruction } }; constexpr size_t instruction_count = sizeof(instructions)/sizeof(Instruction); /** * Max element size of a Guacamole element. */ constexpr std::uint64_t MAX_GUAC_ELEMENT_LENGTH = 2500; /** * Max size of a Guacamole frame. */ constexpr std::uint64_t MAX_GUAC_FRAME_LENGTH = 6144; /** * Decode an instruction from a string. * \param[in] input input guacamole string to decode */ std::vector<std::string> Decode(const std::string& input) { std::vector<std::string> output; if (input.back() != ';') return output; if(input.empty() || input.length() >= MAX_GUAC_FRAME_LENGTH) return output; std::istringstream iss{input}; while (iss) { unsigned long long length{0}; iss >> length; if (!iss) return std::vector<std::string>(); // Ignore weird elements that could be an attempt to crash the server if(length >= MAX_GUAC_ELEMENT_LENGTH || length >= input.length()) return std::vector<std::string>(); if (iss.peek() != '.') return std::vector<std::string>(); iss.get(); // remove the period std::vector<char> content(length + 1, '\0'); iss.read(content.data(), static_cast<std::streamsize>(length)); output.push_back(std::string(content.data())); const char& separator = iss.peek(); if (separator != ',') { if (separator == ';') return output; return std::vector<std::string>(); } iss.get(); } return std::vector<std::string>(); } void ParseInstruction(CollabVMServer& server, const std::shared_ptr<CollabVMUser>& user, const std::string& instruction) { std::vector<std::string> decoded = Decode(instruction); if(decoded.empty()) return; for(size_t i = 0; i < instruction_count; ++i) { if(instructions[i].opcode == decoded[0]) { auto arguments = std::vector<std::string>(decoded.begin() + 1, decoded.end()); auto argument_conv = std::vector<char*>(); argument_conv.resize(arguments.size()); for(size_t j = 0; j < arguments.size(); ++j) argument_conv[j] = const_cast<char*>(arguments[j].c_str()); // Call the instruction handler InstructionHandler x = instructions[i].handler; (server.*x)(user, argument_conv); argument_conv.clear(); } } } }
28.752212
121
0.667898
unk0rrupt
ca7f8f20d6226f5647a021787cd7a1f36fcf9078
1,797
cpp
C++
runtime/tree/pattern/ParseTreePattern.cpp
mengdemao/AntlrExpr
78ed13bf7f6eda26d3eae81c361e60321643f406
[ "BSD-3-Clause" ]
1
2021-12-19T14:03:24.000Z
2021-12-19T14:03:24.000Z
runtime/tree/pattern/ParseTreePattern.cpp
mengdemao/AntlrExpr
78ed13bf7f6eda26d3eae81c361e60321643f406
[ "BSD-3-Clause" ]
null
null
null
runtime/tree/pattern/ParseTreePattern.cpp
mengdemao/AntlrExpr
78ed13bf7f6eda26d3eae81c361e60321643f406
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. * Use of this file is governed by the BSD 3-clause license that * can be found in the LICENSE.txt file in the project root. */ #include "tree/ParseTree.h" #include "tree/pattern/ParseTreePatternMatcher.h" #include "tree/pattern/ParseTreeMatch.h" #include "tree/xpath/XPath.h" #include "tree/xpath/XPathElement.h" #include "tree/pattern/ParseTreePattern.h" using namespace antlr4::tree; using namespace antlr4::tree::pattern; using namespace antlrcpp; ParseTreePattern::ParseTreePattern(ParseTreePatternMatcher *matcher, const std::string &pattern, int patternRuleIndex_, ParseTree *patternTree) : patternRuleIndex(patternRuleIndex_), _pattern(pattern), _patternTree(patternTree), _matcher(matcher) { } ParseTreePattern::~ParseTreePattern() { } ParseTreeMatch ParseTreePattern::match(ParseTree *tree) { return _matcher->match(tree, *this); } bool ParseTreePattern::matches(ParseTree *tree) { return _matcher->match(tree, *this).succeeded(); } std::vector<ParseTreeMatch> ParseTreePattern::findAll(ParseTree *tree, const std::string &xpath) { xpath::XPath finder(_matcher->getParser(), xpath); std::vector<ParseTree *> subtrees = finder.evaluate(tree); std::vector<ParseTreeMatch> matches; for (auto *t : subtrees) { ParseTreeMatch aMatch = match(t); if (aMatch.succeeded()) { matches.push_back(aMatch); } } return matches; } ParseTreePatternMatcher *ParseTreePattern::getMatcher() const { return _matcher; } std::string ParseTreePattern::getPattern() const { return _pattern; } int ParseTreePattern::getPatternRuleIndex() const { return patternRuleIndex; } ParseTree* ParseTreePattern::getPatternTree() const { return _patternTree; }
27.646154
119
0.739009
mengdemao
ca7f96498664b6db97b9b5dada55d1605af3d885
3,310
cpp
C++
Applications/Utils/FileConverter/GMSH2OGS.cpp
yingtaohu/ogs
651ca2f903ee0bf5a8cfb505e8e2fd0562b4ce8e
[ "BSD-4-Clause" ]
null
null
null
Applications/Utils/FileConverter/GMSH2OGS.cpp
yingtaohu/ogs
651ca2f903ee0bf5a8cfb505e8e2fd0562b4ce8e
[ "BSD-4-Clause" ]
null
null
null
Applications/Utils/FileConverter/GMSH2OGS.cpp
yingtaohu/ogs
651ca2f903ee0bf5a8cfb505e8e2fd0562b4ce8e
[ "BSD-4-Clause" ]
null
null
null
/** * \file * \author Thomas Fischer * \date 2011-12-13 * \brief Implementation of the GMSH2OGS converter. * * \copyright * Copyright (c) 2012-2017, OpenGeoSys Community (http://www.opengeosys.org) * Distributed under a Modified BSD License. * See accompanying file LICENSE.txt or * http://www.opengeosys.org/project/license * */ // STL #include <string> #include <algorithm> // ThirdParty #include <tclap/CmdLine.h> #include "Applications/ApplicationsLib/LogogSetup.h" // BaseLib #include "BaseLib/FileTools.h" #include "BaseLib/RunTime.h" #ifndef WIN32 #include "BaseLib/MemWatch.h" #endif #include "Applications/FileIO/Gmsh/GmshReader.h" #include "MeshLib/IO/writeMeshToFile.h" #include "MeshLib/MeshSearch/ElementSearch.h" #include "MeshLib/Mesh.h" #include "MeshLib/MeshEditing/RemoveMeshComponents.h" int main (int argc, char* argv[]) { ApplicationsLib::LogogSetup logog_setup; TCLAP::CmdLine cmd("Converting meshes in gmsh file format (ASCII, version 2.2) to a vtk unstructured grid file (new OGS file format) or to the old OGS file format - see options.", ' ', "0.1"); TCLAP::ValueArg<std::string> ogs_mesh_arg( "o", "out", "filename for output mesh (if extension is .msh, old OGS-5 fileformat is written, if extension is .vtu, a vtk unstructure grid file is written (OGS-6 mesh format))", true, "", "filename as string"); cmd.add(ogs_mesh_arg); TCLAP::ValueArg<std::string> gmsh_mesh_arg( "i", "in", "gmsh input file", true, "", "filename as string"); cmd.add(gmsh_mesh_arg); TCLAP::SwitchArg exclude_lines_arg("e", "exclude-lines", "if set, lines will not be written to the ogs mesh"); cmd.add(exclude_lines_arg); cmd.parse(argc, argv); // *** read mesh INFO("Reading %s.", gmsh_mesh_arg.getValue().c_str()); #ifndef WIN32 BaseLib::MemWatch mem_watch; unsigned long mem_without_mesh (mem_watch.getVirtMemUsage()); #endif BaseLib::RunTime run_time; run_time.start(); MeshLib::Mesh* mesh( FileIO::GMSH::readGMSHMesh(gmsh_mesh_arg.getValue())); if (mesh == nullptr) { INFO("Could not read mesh from %s.", gmsh_mesh_arg.getValue().c_str()); return -1; } #ifndef WIN32 INFO("Mem for mesh: %i MB", (mem_watch.getVirtMemUsage() - mem_without_mesh) / (1024 * 1024)); #endif INFO("Time for reading: %f seconds.", run_time.elapsed()); INFO("Read %d nodes and %d elements.", mesh->getNumberOfNodes(), mesh->getNumberOfElements()); // *** remove line elements on request if (exclude_lines_arg.getValue()) { auto ex = MeshLib::ElementSearch(*mesh); ex.searchByElementType(MeshLib::MeshElemType::LINE); auto m = MeshLib::removeElements(*mesh, ex.getSearchedElementIDs(), mesh->getName()+"-withoutLines"); if (m != nullptr) { INFO("Removed %d lines.", mesh->getNumberOfElements() - m->getNumberOfElements()); std::swap(m, mesh); delete m; } else { INFO("Mesh does not contain any lines."); } } // *** write mesh in new format MeshLib::IO::writeMeshToFile(*mesh, ogs_mesh_arg.getValue()); delete mesh; }
29.81982
196
0.641088
yingtaohu
ca82a20d582a0a492fc78bf81ff35f0f8f012d98
6,672
cc
C++
pointcloud-fusion/src/dense_map/DepthPredictor.cc
NetEaseAI-CVLab/CNN-MonoFusion
49598c8e9d2c9ae36c68a50460ae842ac8f43d98
[ "MIT" ]
71
2018-08-26T07:48:07.000Z
2022-01-20T16:09:09.000Z
pointcloud-fusion/src/dense_map/DepthPredictor.cc
NeteaseAI-CVLab/CNN-MonoFusion
49598c8e9d2c9ae36c68a50460ae842ac8f43d98
[ "MIT" ]
8
2018-10-29T06:41:30.000Z
2021-07-01T13:12:58.000Z
pointcloud-fusion/src/dense_map/DepthPredictor.cc
NeteaseAI-CVLab/CNN-MonoFusion
49598c8e9d2c9ae36c68a50460ae842ac8f43d98
[ "MIT" ]
8
2018-10-25T07:29:05.000Z
2019-05-29T01:58:31.000Z
#include "DepthPredictor.h" #include<iostream> #include<opencv2\core.hpp> #include<opencv2\highgui.hpp> #include<opencv2\imgproc.hpp> using namespace cv; DepthPredictor::DepthPredictor(ORB_SLAM2::Map* pMap, KeyFrameQueue* frame_queue, DenseMap* dense_map, std::string setting_file):mpOrbSlamMap(pMap), m_success(false), m_frame_queue(frame_queue), m_dense_map(dense_map), m_should_finish(false), m_is_finished(true) { FileStorage fs(setting_file, FileStorage::READ); m_img_width = fs["Camera.width"]; m_img_height = fs["Camera.height"]; m_focal_length = fs["Camera.fx"]; m_depth_grad_thr = fs["Camera.depth_grad_thr"]; m_net_width = fs["Camera.net_width"]; m_net_height = fs["Camera.net_height"]; m_covisible_keyframes = fs["DenseMap.CovisibleForKeyFrames"]; m_covisible_frames = fs["DenseMap.CovisibleForFrames"]; std::cout << "------------------------\nDenseMap DepthPredictor Params" << std::endl; std::cout << "- Covisible For KeyFrames: " << m_covisible_keyframes << std::endl; std::cout << "- Covisible For Frames: " << m_covisible_frames << std::endl; fs.release(); m_first_frameid = 0; m_success = true; } DepthPredictor::~DepthPredictor() { request_finish(); } void DepthPredictor::run() { set_finished(false); while(!should_finish()) { if(m_frame_queue->size() == 0) continue; std::unique_lock <std::mutex> lck(m_dense_map->system_running_mtx); while(!m_dense_map->get_system_running_status()) { m_dense_map->system_running_cv.wait(lck); } lck.unlock(); OrbKeyFrame curr_frame = m_frame_queue->dequeue(); if(vOrbKeyframes.empty()) { addKeyframe(curr_frame.frame_idx, curr_frame); m_dense_map->add_points_from_depth_map(curr_frame); m_first_frameid = curr_frame.frame_idx; std::cout << "First keyframe id in densemap: " << m_first_frameid << std::endl; } else { auto iter = vOrbKeyframes.end() - 1; OrbKeyFrame ref_keyframe = *iter; std::vector<OrbKeyFrame*> ref_neighs; ref_neighs.emplace_back(&ref_keyframe); if(curr_frame.isKeyframe) { //std::cout << "\nDenseMap keyframe size: " << vOrbKeyframes.size() // << ", keyframe id->" << ref_keyframe.frame_idx // << ", curr_frame id->" << curr_frame.frame_idx // << ", this is keyframe" << std::endl; ORB_SLAM2::KeyFrame *orbslam_kf = mpOrbSlamMap->getKeyframeByframeId(ref_keyframe.frame_idx); if(orbslam_kf != nullptr) { std::vector<ORB_SLAM2::KeyFrame*> vNeighs = orbslam_kf->GetBestCovisibilityKeyFrames(m_covisible_keyframes); for(auto iter_neigh = vNeighs.begin(); iter_neigh != vNeighs.end(); iter_neigh++) { long unsigned int neigh_id = (*iter_neigh)->mnFrameId; if(neigh_id > m_first_frameid && neigh_id < curr_frame.frame_idx) { // get OrbKeyFrame use orbslam neighs_frame_id long unsigned int neigh_kf_id = map_frameid_keyframeid[neigh_id]; ref_neighs.emplace_back(&vOrbKeyframes[neigh_kf_id]); } } } else { //std::cout << "**keyframe has delete by Map**" << std::endl; } //std::cout << "ref_neighs size: " << ref_neighs.size() << ", neigh id:"; //for(auto iter_neigh = ref_neighs.begin(); iter_neigh != ref_neighs.end(); iter_neigh++) //{ // std::cout << (*iter_neigh)->frame_idx << " "; //} //std::cout << "\n"; //if(ref_neighs.size() < 2) //{ // m_dense_map->cvlibs_greedy_fusion(ref_keyframe, curr_frame); //} //else //{ // m_dense_map->cvlibs_greedy_fusion_covisible(ref_neighs, curr_frame); //} // covisible m_dense_map->cvlibs_greedy_fusion_covisible(ref_neighs, curr_frame); // add keyframe to densemap keyframe manager addKeyframe(curr_frame.frame_idx, curr_frame); } else { //std::cout << "keyframe size: " << orbkeyframes.size() << ", keyframe id->" << ref_keyframe.frame_idx // << ", curr_frame id->" << curr_frame.frame_idx << std::endl; //m_dense_map->cvlibs_greedy_fusion_framewise(ref_keyframe, curr_frame); ORB_SLAM2::KeyFrame *orbslam_kf = mpOrbSlamMap->getKeyframeByframeId(ref_keyframe.frame_idx); if(orbslam_kf != nullptr) { std::vector<ORB_SLAM2::KeyFrame*> vNeighs = orbslam_kf->GetBestCovisibilityKeyFrames(m_covisible_frames); for(auto iter_neigh = vNeighs.begin(); iter_neigh != vNeighs.end(); iter_neigh++) { long unsigned int neigh_id = (*iter_neigh)->mnFrameId; if(neigh_id > m_first_frameid && neigh_id < curr_frame.frame_idx) { // get OrbKeyFrame use orbslam neighs_frame_id long unsigned int neigh_kf_id = map_frameid_keyframeid[neigh_id]; ref_neighs.emplace_back(&vOrbKeyframes[neigh_kf_id]); } } } else { //std::cout << "**keyframe has delete by Map**" << std::endl; } //std::cout << "refneighs num: "<< ref_neighs.size() << std::endl; m_dense_map->cvlibs_greedy_fusion_framewise_covisible(ref_neighs, curr_frame); m_dense_map->set_current_Tcw(curr_frame.Tcw); } } } set_finished(true); } void DepthPredictor::set_finished(bool status) { std::unique_lock<std::mutex> lock(m_mutex); m_is_finished = status; m_should_finish = status; } void DepthPredictor::request_finish() { std::unique_lock<std::mutex> lock(m_mutex); m_should_finish = true; } bool DepthPredictor::should_finish() { std::unique_lock<std::mutex> lock(m_mutex); return m_should_finish; }
38.566474
128
0.553357
NetEaseAI-CVLab
ca83591bea06e0eb6195504f983983b1546884c3
1,950
cpp
C++
src/data_symbols.cpp
k0zmo/evmc
e5d87d5c2cccdf766db2ed90f324e5e14d786ca2
[ "MIT" ]
1
2022-01-28T13:25:38.000Z
2022-01-28T13:25:38.000Z
src/data_symbols.cpp
k0zmo/evmc
e5d87d5c2cccdf766db2ed90f324e5e14d786ca2
[ "MIT" ]
null
null
null
src/data_symbols.cpp
k0zmo/evmc
e5d87d5c2cccdf766db2ed90f324e5e14d786ca2
[ "MIT" ]
1
2019-09-02T06:15:11.000Z
2019-09-02T06:15:11.000Z
#include "data_symbols.h" #include <cstring> void data_symbols::add(string symbol_name, const char* data) { check_duplicates(symbol_name); check_cached_zeros(); strm_ << data; strm_ << 0_b; symbols_.emplace_back(std::move(symbol_name), current_offset_); current_offset_ = incr_check_overflow(current_offset_, static_cast<dword>(strlen(data) + 1)); } void data_symbols::add(string symbol_name, std::istream& is, dword num_bytes) { check_duplicates(symbol_name); check_cached_zeros(); std::copy_n(std::istreambuf_iterator<char>(is), num_bytes, std::ostreambuf_iterator<char>(strm_)); symbols_.emplace_back(std::move(symbol_name), current_offset_); current_offset_ = incr_check_overflow(current_offset_, num_bytes); } dword data_symbols::raw_size() { return static_cast<dword>(strm_.tellp()); } dword data_symbols::virtual_size() { return incr_check_overflow(raw_size(), cached_zeros_); } vector<byte> data_symbols::build() { auto str = strm_.str(); return {begin(str), end(str)}; } dword data_symbols::symbol(const char* name) const { const auto needle = std::find_if(begin(symbols_), end(symbols_), [&](const auto& sym) { return sym.first == name; }); if (needle == end(symbols_)) throw std::runtime_error{"symbol with given does not exist"}; return incr_check_overflow(needle->second, virtual_addr_); } void data_symbols::check_duplicates(const std::string& symbol_name) { const auto needle = std::find_if(begin(symbols_), end(symbols_), [&](const auto& sym) { return sym.first == symbol_name; }); if (needle != end(symbols_)) throw std::runtime_error{"symbol with given name alread added"}; } void data_symbols::check_cached_zeros() { for (size_t i = 0; i < cached_zeros_; ++i) strm_ << (byte)0; cached_zeros_ = 0; }
30.952381
80
0.665128
k0zmo
ca8a4046ee63cb3d30f26b3b7e13cd82f2e2857d
3,322
cpp
C++
lib/Conversion/TorchToIREE/TorchToIREE.cpp
raikonenfnu/mlir-npcomp
29e1b2fe89848d58c9bc07e7df7ce651850a5244
[ "Apache-2.0" ]
null
null
null
lib/Conversion/TorchToIREE/TorchToIREE.cpp
raikonenfnu/mlir-npcomp
29e1b2fe89848d58c9bc07e7df7ce651850a5244
[ "Apache-2.0" ]
null
null
null
lib/Conversion/TorchToIREE/TorchToIREE.cpp
raikonenfnu/mlir-npcomp
29e1b2fe89848d58c9bc07e7df7ce651850a5244
[ "Apache-2.0" ]
null
null
null
//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "npcomp/Conversion/TorchToIREE/TorchToIREE.h" #include "../PassDetail.h" #include "iree-dialects/Dialect/IREE/IREEOps.h" #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/Traits.h" #include "mlir/IR/Matchers.h" #include "mlir/Transforms/DialectConversion.h" #include "npcomp/Dialect/Torch/IR/TorchOps.h" #include "npcomp/Dialect/TorchConversion/IR/TorchConversionDialect.h" #include "npcomp/Dialect/TorchConversion/Transforms/BackendTypeConversion.h" using namespace mlir; using namespace mlir::NPCOMP; using namespace mlir::NPCOMP::Torch; //===----------------------------------------------------------------------===// // The patterns //===----------------------------------------------------------------------===// namespace { class ConvertPrimListConstructOp : public OpConversionPattern<PrimListConstructOp> { public: using OpConversionPattern::OpConversionPattern; LogicalResult matchAndRewrite(PrimListConstructOp op, ArrayRef<Value> operands, ConversionPatternRewriter &rewriter) const override { auto type = getTypeConverter()->convertType(op.getType()); auto capacity = rewriter.create<ConstantIndexOp>(op.getLoc(), op->getNumOperands()); auto ireeList = rewriter.replaceOpWithNewOp<iree::ListCreateOp>(op, type, capacity); for (int i = 0, e = operands.size(); i != e; ++i) { auto index = rewriter.create<ConstantIndexOp>(op.getLoc(), i); rewriter.create<iree::ListSetOp>(op.getLoc(), ireeList, index, operands[i]); } return success(); } }; } // namespace //===----------------------------------------------------------------------===// // The pass //===----------------------------------------------------------------------===// namespace { class ConvertTorchToIREE : public ConvertTorchToIREEBase<ConvertTorchToIREE> { public: void getDependentDialects(DialectRegistry &registry) const override { registry.insert<StandardOpsDialect>(); TorchConversion::getBackendTypeConversionDependentDialects(registry); } void runOnOperation() override { MLIRContext *context = &getContext(); ConversionTarget target(*context); target.addLegalDialect<iree::IREEDialect>(); target.addLegalDialect<StandardOpsDialect>(); TypeConverter typeConverter; typeConverter.addConversion([](Type type) { return type; }); TorchConversion::setupBackendTypeConversion(target, typeConverter); RewritePatternSet patterns(context); patterns.add<ConvertPrimListConstructOp>(typeConverter, context); target.addIllegalOp<PrimListConstructOp>(); if (failed(applyPartialConversion(getOperation(), target, std::move(patterns)))) return signalPassFailure(); } }; } // namespace std::unique_ptr<OperationPass<FuncOp>> mlir::NPCOMP::createConvertTorchToIREEPass() { return std::make_unique<ConvertTorchToIREE>(); }
36.911111
80
0.62071
raikonenfnu
ca8b5ac687b1218fce1733ee8b56a306ab31e0ca
7,413
cc
C++
test/time_controller/external_time_controller.cc
wnpllrzodiac/webrtc_code_mirror
0e7b3a9dadc64266eba82b0fc1265b36b7794839
[ "BSD-3-Clause" ]
344
2016-07-03T11:45:20.000Z
2022-03-19T16:54:10.000Z
test/time_controller/external_time_controller.cc
wnpllrzodiac/webrtc_code_mirror
0e7b3a9dadc64266eba82b0fc1265b36b7794839
[ "BSD-3-Clause" ]
46
2019-03-30T07:28:41.000Z
2022-03-25T06:08:47.000Z
test/time_controller/external_time_controller.cc
wnpllrzodiac/webrtc_code_mirror
0e7b3a9dadc64266eba82b0fc1265b36b7794839
[ "BSD-3-Clause" ]
278
2016-04-26T07:37:12.000Z
2022-01-24T10:09:44.000Z
/* * Copyright 2019 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "test/time_controller/external_time_controller.h" #include <algorithm> #include <map> #include <memory> #include <utility> #include "api/task_queue/queued_task.h" #include "api/task_queue/task_queue_base.h" #include "api/task_queue/task_queue_factory.h" #include "api/units/time_delta.h" #include "api/units/timestamp.h" #include "modules/include/module.h" #include "modules/utility/include/process_thread.h" #include "rtc_base/checks.h" #include "rtc_base/synchronization/yield_policy.h" #include "test/time_controller/simulated_time_controller.h" namespace webrtc { // Wraps a ProcessThread so that it can reschedule the time controller whenever // an external call changes the ProcessThread's state. For example, when a new // module is registered, the ProcessThread may need to be called sooner than the // time controller's currently-scheduled deadline. class ExternalTimeController::ProcessThreadWrapper : public ProcessThread { public: ProcessThreadWrapper(ExternalTimeController* parent, std::unique_ptr<ProcessThread> thread) : parent_(parent), thread_(std::move(thread)) {} void Start() override { parent_->UpdateTime(); thread_->Start(); parent_->ScheduleNext(); } void Stop() override { parent_->UpdateTime(); thread_->Stop(); parent_->ScheduleNext(); } void WakeUp(Module* module) override { parent_->UpdateTime(); thread_->WakeUp(GetWrapper(module)); parent_->ScheduleNext(); } void PostTask(std::unique_ptr<QueuedTask> task) override { parent_->UpdateTime(); thread_->PostTask(std::move(task)); parent_->ScheduleNext(); } void PostDelayedTask(std::unique_ptr<QueuedTask> task, uint32_t milliseconds) override { parent_->UpdateTime(); thread_->PostDelayedTask(std::move(task), milliseconds); parent_->ScheduleNext(); } void RegisterModule(Module* module, const rtc::Location& from) override { parent_->UpdateTime(); module_wrappers_.emplace(module, new ModuleWrapper(module, this)); thread_->RegisterModule(GetWrapper(module), from); parent_->ScheduleNext(); } void DeRegisterModule(Module* module) override { parent_->UpdateTime(); thread_->DeRegisterModule(GetWrapper(module)); parent_->ScheduleNext(); module_wrappers_.erase(module); } private: class ModuleWrapper : public Module { public: ModuleWrapper(Module* module, ProcessThreadWrapper* thread) : module_(module), thread_(thread) {} int64_t TimeUntilNextProcess() override { return module_->TimeUntilNextProcess(); } void Process() override { module_->Process(); } void ProcessThreadAttached(ProcessThread* process_thread) override { if (process_thread) { module_->ProcessThreadAttached(thread_); } else { module_->ProcessThreadAttached(nullptr); } } private: Module* module_; ProcessThreadWrapper* thread_; }; void Delete() override { // ProcessThread shouldn't be deleted as a TaskQueue. RTC_NOTREACHED(); } ModuleWrapper* GetWrapper(Module* module) { auto it = module_wrappers_.find(module); RTC_DCHECK(it != module_wrappers_.end()); return it->second.get(); } ExternalTimeController* const parent_; std::unique_ptr<ProcessThread> thread_; std::map<Module*, std::unique_ptr<ModuleWrapper>> module_wrappers_; }; // Wraps a TaskQueue so that it can reschedule the time controller whenever // an external call schedules a new task. class ExternalTimeController::TaskQueueWrapper : public TaskQueueBase { public: TaskQueueWrapper(ExternalTimeController* parent, std::unique_ptr<TaskQueueBase, TaskQueueDeleter> base) : parent_(parent), base_(std::move(base)) {} void PostTask(std::unique_ptr<QueuedTask> task) override { parent_->UpdateTime(); base_->PostTask(std::make_unique<TaskWrapper>(std::move(task), this)); parent_->ScheduleNext(); } void PostDelayedTask(std::unique_ptr<QueuedTask> task, uint32_t ms) override { parent_->UpdateTime(); base_->PostDelayedTask(std::make_unique<TaskWrapper>(std::move(task), this), ms); parent_->ScheduleNext(); } void Delete() override { delete this; } private: class TaskWrapper : public QueuedTask { public: TaskWrapper(std::unique_ptr<QueuedTask> task, TaskQueueWrapper* queue) : task_(std::move(task)), queue_(queue) {} bool Run() override { CurrentTaskQueueSetter current(queue_); if (!task_->Run()) { task_.release(); } // The wrapper should always be deleted, even if it releases the inner // task, in order to avoid leaking wrappers. return true; } private: std::unique_ptr<QueuedTask> task_; TaskQueueWrapper* queue_; }; ExternalTimeController* const parent_; std::unique_ptr<TaskQueueBase, TaskQueueDeleter> base_; }; ExternalTimeController::ExternalTimeController(ControlledAlarmClock* alarm) : alarm_(alarm), impl_(alarm_->GetClock()->CurrentTime()), yield_policy_(&impl_) { global_clock_.SetTime(alarm_->GetClock()->CurrentTime()); alarm_->SetCallback([this] { Run(); }); } Clock* ExternalTimeController::GetClock() { return alarm_->GetClock(); } TaskQueueFactory* ExternalTimeController::GetTaskQueueFactory() { return this; } std::unique_ptr<ProcessThread> ExternalTimeController::CreateProcessThread( const char* thread_name) { return std::make_unique<ProcessThreadWrapper>( this, impl_.CreateProcessThread(thread_name)); } void ExternalTimeController::AdvanceTime(TimeDelta duration) { alarm_->Sleep(duration); } std::unique_ptr<rtc::Thread> ExternalTimeController::CreateThread( const std::string& name, std::unique_ptr<rtc::SocketServer> socket_server) { RTC_NOTREACHED(); return nullptr; } rtc::Thread* ExternalTimeController::GetMainThread() { RTC_NOTREACHED(); return nullptr; } std::unique_ptr<TaskQueueBase, TaskQueueDeleter> ExternalTimeController::CreateTaskQueue( absl::string_view name, TaskQueueFactory::Priority priority) const { return std::unique_ptr<TaskQueueBase, TaskQueueDeleter>( new TaskQueueWrapper(const_cast<ExternalTimeController*>(this), impl_.CreateTaskQueue(name, priority))); } void ExternalTimeController::Run() { rtc::ScopedYieldPolicy yield_policy(&impl_); UpdateTime(); impl_.RunReadyRunners(); ScheduleNext(); } void ExternalTimeController::UpdateTime() { Timestamp now = alarm_->GetClock()->CurrentTime(); impl_.AdvanceTime(now); global_clock_.SetTime(now); } void ExternalTimeController::ScheduleNext() { RTC_DCHECK_EQ(impl_.CurrentTime(), alarm_->GetClock()->CurrentTime()); TimeDelta delay = std::max(impl_.NextRunTime() - impl_.CurrentTime(), TimeDelta::Zero()); if (delay.IsFinite()) { alarm_->ScheduleAlarmAt(alarm_->GetClock()->CurrentTime() + delay); } } } // namespace webrtc
30.381148
80
0.711723
wnpllrzodiac
ca8b8095f0d1587130c2bb43b010b5c253a1915c
1,337
cpp
C++
Onboard-SDK/osdk-core/modules/src/filemgr/impl/mmap_file_buffer.cpp
dingpwen/osdk_flycontrol
583504bd4f9c73c5cb82223af8e5d7742d4f9c9d
[ "Apache-2.0" ]
null
null
null
Onboard-SDK/osdk-core/modules/src/filemgr/impl/mmap_file_buffer.cpp
dingpwen/osdk_flycontrol
583504bd4f9c73c5cb82223af8e5d7742d4f9c9d
[ "Apache-2.0" ]
null
null
null
Onboard-SDK/osdk-core/modules/src/filemgr/impl/mmap_file_buffer.cpp
dingpwen/osdk_flycontrol
583504bd4f9c73c5cb82223af8e5d7742d4f9c9d
[ "Apache-2.0" ]
null
null
null
// // Created by dji on 4/15/20. // #include "mmap_file_buffer.hpp" #include "dji_log.hpp" #include <string.h> namespace DJI { namespace OSDK { MmapFileBuffer::MmapFileBuffer() : fdAddr(NULL), curFilePos(0) {} MmapFileBuffer::~MmapFileBuffer() {} bool MmapFileBuffer::init(std::string path, uint64_t fileSize) { currentLogFilePath = path; fdAddrSize = fileSize; curFilePos = 0; printf("Preparing File : %s\n", this->currentLogFilePath.c_str()); fd = open(this->currentLogFilePath.c_str(), O_RDWR | O_CREAT, 0644); DSTATUS("fd = %d", fd); if (fd < 0) return false; ftruncate(fd, fdAddrSize); fdAddr = (char *) mmap(NULL, fdAddrSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (fdAddr) return true; else return false; } bool MmapFileBuffer::deInit() { DSTATUS("Deinit"); if (fd >= 0) close(fd); fd = -1; if (fdAddr) munmap(fdAddr, fdAddrSize); fdAddr = NULL; return true; } // flag 代表是否覆盖已有队列缓存 bool MmapFileBuffer::InsertBlock(const uint8_t *pack, uint32_t data_length, uint64_t index) { #if 0 static uint32_t tempAdaptingBufferCnt = 0; if (index == 1) tempAdaptingBufferCnt = data_length; #endif if ((data_length <= 0) || !fdAddr) { return false; } #if 0 index = index * tempAdaptingBufferCnt; #endif memcpy(fdAddr + index, pack, data_length); return true; } } }
21.918033
93
0.681376
dingpwen
ca8d3adc7a6941a4f707b96064354bcd423eb344
4,599
cc
C++
libqpdf/QPDF_String.cc
schwarzeSocke/qpdf
e8b845dd0344c797b58bfa31b810af53595d2599
[ "Artistic-2.0", "Unlicense" ]
null
null
null
libqpdf/QPDF_String.cc
schwarzeSocke/qpdf
e8b845dd0344c797b58bfa31b810af53595d2599
[ "Artistic-2.0", "Unlicense" ]
null
null
null
libqpdf/QPDF_String.cc
schwarzeSocke/qpdf
e8b845dd0344c797b58bfa31b810af53595d2599
[ "Artistic-2.0", "Unlicense" ]
null
null
null
#include <qpdf/QPDF_String.hh> #include <qpdf/QUtil.hh> #include <qpdf/QTC.hh> // DO NOT USE ctype -- it is locale dependent for some things, and // it's not worth the risk of including it in case it may accidentally // be used. #include <string.h> // See above about ctype. static bool is_ascii_printable(unsigned char ch) { return ((ch >= 32) && (ch <= 126)); } static bool is_iso_latin1_printable(unsigned char ch) { return (((ch >= 32) && (ch <= 126)) || (ch >= 160)); } QPDF_String::QPDF_String(std::string const& val) : val(val) { } QPDF_String::~QPDF_String() { } std::string QPDF_String::unparse() { return unparse(false); } QPDFObject::object_type_e QPDF_String::getTypeCode() const { return QPDFObject::ot_string; } char const* QPDF_String::getTypeName() const { return "string"; } std::string QPDF_String::unparse(bool force_binary) { bool use_hexstring = force_binary; if (! use_hexstring) { unsigned int nonprintable = 0; int consecutive_printable = 0; for (unsigned int i = 0; i < this->val.length(); ++i) { char ch = this->val.at(i); // Note: do not use locale to determine printability. The // PDF specification accepts arbitrary binary data. Some // locales imply multibyte characters. We'll consider // something printable if it is printable in 7-bit ASCII. // We'll code this manually rather than being rude and // setting locale. if ((ch == 0) || (! (is_ascii_printable(ch) || strchr("\n\r\t\b\f", ch)))) { ++nonprintable; consecutive_printable = 0; } else { if (++consecutive_printable > 5) { // If there are more than 5 consecutive printable // characters, I want to see them as such. nonprintable = 0; break; } } } // Use hex notation if more than 20% of the characters are not // printable in plain ASCII. if (5 * nonprintable > val.length()) { use_hexstring = true; } } std::string result; if (use_hexstring) { result += "<" + QUtil::hex_encode(this->val) + ">"; } else { result += "("; for (unsigned int i = 0; i < this->val.length(); ++i) { char ch = this->val.at(i); switch (ch) { case '\n': result += "\\n"; break; case '\r': result += "\\r"; break; case '\t': result += "\\t"; break; case '\b': result += "\\b"; break; case '\f': result += "\\f"; break; case '(': result += "\\("; break; case ')': result += "\\)"; break; case '\\': result += "\\\\"; break; default: if (is_iso_latin1_printable(ch)) { result += this->val.at(i); } else { result += "\\" + QUtil::int_to_string_base( static_cast<int>(static_cast<unsigned char>(ch)), 8, 3); } break; } } result += ")"; } return result; } std::string QPDF_String::getVal() const { return this->val; } std::string QPDF_String::getUTF8Val() const { std::string result; size_t len = this->val.length(); if ((len >= 2) && (len % 2 == 0) && (this->val.at(0) == '\xfe') && (this->val.at(1) == '\xff')) { // This is a Unicode string using big-endian UTF-16. This // code uses unsigned long and unsigned short to hold // codepoint values. It requires unsigned long to be at least // 32 bits and unsigned short to be at least 16 bits, but it // will work fine if they are larger. unsigned long codepoint = 0L; for (unsigned int i = 2; i < len; i += 2) { // Convert from UTF16-BE. If we get a malformed // codepoint, this code will generate incorrect output // without giving a warning. Specifically, a high // codepoint not followed by a low codepoint will be // discarded, and a low codepoint not preceded by a high // codepoint will just get its low 10 bits output. unsigned short bits = (static_cast<unsigned char>(this->val.at(i)) << 8) + static_cast<unsigned char>(this->val.at(i+1)); if ((bits & 0xFC00) == 0xD800) { codepoint = 0x10000 + ((bits & 0x3FF) << 10); continue; } else if ((bits & 0xFC00) == 0xDC00) { if (codepoint != 0) { QTC::TC("qpdf", "QPDF_String non-trivial UTF-16"); } codepoint += bits & 0x3FF; } else { codepoint = bits; } result += QUtil::toUTF8(codepoint); codepoint = 0; } } else { for (unsigned int i = 0; i < len; ++i) { result += QUtil::toUTF8(static_cast<unsigned char>(this->val.at(i))); } } return result; }
21.193548
74
0.581431
schwarzeSocke
ca8d82d92f241b5aec5e248eeed80fc0bc6852cb
500
cpp
C++
src/leetcode/1530/67700167_accepted_1520ms_97628000.cpp
lnkkerst/oj-codes
d778489182d644370b2a690aa92c3df6542cc306
[ "MIT" ]
null
null
null
src/leetcode/1530/67700167_accepted_1520ms_97628000.cpp
lnkkerst/oj-codes
d778489182d644370b2a690aa92c3df6542cc306
[ "MIT" ]
null
null
null
src/leetcode/1530/67700167_accepted_1520ms_97628000.cpp
lnkkerst/oj-codes
d778489182d644370b2a690aa92c3df6542cc306
[ "MIT" ]
null
null
null
class Solution { public: bool pdf(string s1, string s2) { set<long long> b; for(int i = 0; i < (int)s1.size(); ++i) b.insert((s1[i] << 20) + i); for(auto &i : s2) { // cout << i << ' ' << b.size() << endl; auto t = b.lower_bound(i << 20); if(t == b.end()) return false; else b.erase(t); } return true; } bool checkIfCanBreak(string s1, string s2) { return pdf(s1, s2) || pdf(s2, s1); } };
29.411765
76
0.448
lnkkerst
ca8e5ae21fc856240d8629d04664d526a7a7820a
8,880
cpp
C++
src/recording.cpp
nyamadan/shader_editor
477aa7165a6f6d721466a4d2fe4d326cf8c9b5df
[ "MIT" ]
4
2019-01-29T07:31:00.000Z
2020-02-18T16:19:08.000Z
src/recording.cpp
nyamadan/shader_editor
477aa7165a6f6d721466a4d2fe4d326cf8c9b5df
[ "MIT" ]
8
2019-02-03T14:15:15.000Z
2020-07-06T02:46:32.000Z
src/recording.cpp
nyamadan/shader_editor
477aa7165a6f6d721466a4d2fe4d326cf8c9b5df
[ "MIT" ]
null
null
null
#include "recording.hpp" #include "file_utils.hpp" #include <math.h> bool Recording::getIsRecording() { return isRecording; } void Recording::start(const int32_t bufferWidth, const int32_t bufferHeight, const std::string& fileName, const int32_t videoType, const int32_t webmBitrate, const unsigned long webmEncodeDeadline) { this->isRecording = true; this->videoType = videoType; this->bufferWidth = bufferWidth; this->bufferHeight = bufferHeight; const int32_t ySize = bufferWidth * bufferHeight; const int32_t uSize = ySize / 4; const int32_t vSize = uSize; yuvBuffer = std::make_unique<uint8_t[]>(ySize + uSize + vSize); switch (videoType) { case 0: { fp = fopen(fileName.c_str(), "wb"); fprintf(fp, "YUV4MPEG2 W%d H%d F30000:1001 Ip A0:0 C420 XYSCSS=420\n", bufferWidth, bufferHeight); } break; case 1: { pWebmEncoder = std::make_unique<WebmEncoder>( fileName, 1001, 30000, bufferWidth, bufferHeight, webmBitrate); } break; case 2: { fp = fopen(fileName.c_str(), "wb"); void* pEncoder = nullptr; h264encoder::CreateOpenH264Encoder(&pEncoder, &pMP4Muxer, &pMP4H264Writer, bufferWidth, bufferHeight, fp); delete pOpenH264Encoder; pOpenH264Encoder = pEncoder; } break; } } void Recording::update(bool isLastFrame, int64_t currentFrame, GLuint writeBuffer, GLuint readBuffer) { glBindBuffer(GL_PIXEL_PACK_BUFFER, writeBuffer); glReadPixels(0, 0, bufferWidth, bufferHeight, GL_RGBA, GL_UNSIGNED_BYTE, 0); if (currentFrame > 0) { glBindBuffer(GL_PIXEL_PACK_BUFFER, readBuffer); #ifdef __EMSCRIPTEN__ { auto size = bufferWidth * bufferHeight * 4; auto ptr = std::make_unique<uint8_t[]>(size); // clang-format on EM_ASM({ Module.ctx.getBufferSubData( Module.ctx.PIXEL_PACK_BUFFER, 0, HEAPU8.subarray($0, $0 + $1)); }, ptr.get(), size); // clang-format off writeOneFrame(ptr.get(), currentFrame); } #else { auto* ptr = static_cast<const uint8_t*>(glMapBufferRange( GL_PIXEL_PACK_BUFFER, 0, bufferWidth * bufferHeight * 4, GL_MAP_READ_BIT)); if (ptr != nullptr) { writeOneFrame(ptr, currentFrame); glUnmapBuffer(GL_PIXEL_PACK_BUFFER); ptr = nullptr; } } #endif } glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); if (isLastFrame) { glBindBuffer(GL_PIXEL_PACK_BUFFER, writeBuffer); #ifdef __EMSCRIPTEN__ { auto size = bufferWidth * bufferHeight * 4; auto ptr = std::make_unique<uint8_t[]>(size); EM_ASM({ Module.ctx.getBufferSubData(Module.ctx.PIXEL_PACK_BUFFER, 0, HEAPU8.subarray($0, $0 + $1)); }, ptr.get(), size); writeOneFrame(ptr.get(), currentFrame); } #else { auto* ptr = static_cast<const uint8_t*>(glMapBufferRange( GL_PIXEL_PACK_BUFFER, 0, bufferWidth * bufferHeight * 4, GL_MAP_READ_BIT)); if (ptr != nullptr) { writeOneFrame(ptr, currentFrame); glUnmapBuffer(GL_PIXEL_PACK_BUFFER); ptr = nullptr; } } #endif glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); switch (videoType) { case 0: { fclose(fp); fp = nullptr; #ifdef __EMSCRIPTEN__ { std::string buff; readText("video.y4m", buff); EM_ASM({ const a = document.createElement("a"); document.body.appendChild(a); a.style = "display: none"; const data =HEAPU8.subarray($0, $0 + $1); const blob = new Blob([data], { type: "octet/stream" }); const url = window.URL.createObjectURL(blob); a.href = url; a.download = "video.y4m"; a.click(); document.body.removeChild(a); window.URL.revokeObjectURL(url); }, buff.c_str(), buff.size()); } #endif } break; case 1: { pWebmEncoder->finalize(webmEncodeDeadline); #ifdef __EMSCRIPTEN__ { std::string buff; readText("video.webm", buff); EM_ASM({ const a = document.createElement("a"); document.body.appendChild(a); a.style = "display: none"; const data =HEAPU8.subarray($0, $0 + $1); const blob = new Blob([data], { type: "octet/stream" }); const url = window.URL.createObjectURL(blob); a.href = url; a.download = "video.webm"; a.click(); document.body.removeChild(a); window.URL.revokeObjectURL(url); }, buff.c_str(), buff.size()); } #endif } break; case 2: { if (pOpenH264Encoder != nullptr) { h264encoder::Finalize(pOpenH264Encoder, pMP4Muxer, pMP4H264Writer); fclose(fp); pOpenH264Encoder = nullptr; pMP4Muxer = nullptr; pMP4H264Writer = nullptr; fp = nullptr; #ifdef __EMSCRIPTEN__ { std::string buff; readText("video.mp4", buff); EM_ASM({ const a = document.createElement("a"); document.body.appendChild(a); a.style = "display: none"; const data =HEAPU8.subarray($0, $0 + $1); const blob = new Blob([data], { type: "octet/stream" }); const url = window.URL.createObjectURL(blob); a.href = url; a.download = "video.mp4"; a.click(); document.body.removeChild(a); window.URL.revokeObjectURL(url); }, buff.c_str(), buff.size()); } #endif } } break; } isRecording = false; } } void Recording::cleanup() { if (pOpenH264Encoder != nullptr) { h264encoder::DestroyOpenH264Encoder(pOpenH264Encoder); pOpenH264Encoder = nullptr; } } void Recording::writeOneFrame(const uint8_t* rgbaBuffer, int64_t currentFrame) { const int32_t ySize = bufferWidth * bufferHeight; const int32_t uSize = ySize / 4; const int32_t vSize = uSize; const int32_t yStride = bufferWidth; const int32_t uStride = bufferWidth / 2; const int32_t vStride = uStride; uint8_t* yBuffer = yuvBuffer.get(); uint8_t* uBuffer = yBuffer + ySize; uint8_t* vBuffer = uBuffer + uSize; switch (videoType) { case 0: { libyuv::ABGRToI420(rgbaBuffer, bufferWidth * 4, yBuffer, yStride, uBuffer, uStride, vBuffer, vStride, bufferWidth, -bufferHeight); fputs("FRAME\n", fp); fwrite(yuvBuffer.get(), sizeof(uint8_t), (int64_t)ySize + uSize + vSize, fp); } break; case 1: { pWebmEncoder->addRGBAFrame(rgbaBuffer, webmEncodeDeadline); } break; case 2: { if (pOpenH264Encoder != nullptr) { libyuv::ABGRToI420(rgbaBuffer, bufferWidth * 4, yBuffer, yStride, uBuffer, uStride, vBuffer, vStride, bufferWidth, -bufferHeight); int64_t timestamp = roundl((currentFrame + 1) * 1001 / 30000); h264encoder::EncodeFrame(pOpenH264Encoder, pMP4H264Writer, yuvBuffer.get(), bufferWidth, bufferHeight, timestamp); } } break; } } Recording::~Recording() { cleanup(); }
36.846473
133
0.488401
nyamadan
ca90199c1772317d58b2956be195724ba7d28254
7,749
cxx
C++
src/texture/RectTexture.cxx
rita0222/FK
bc5786a5da0dd732e2f411c1a953b331323ee432
[ "BSD-3-Clause" ]
4
2020-05-15T03:43:53.000Z
2021-06-05T16:21:31.000Z
src/texture/RectTexture.cxx
rita0222/FK
bc5786a5da0dd732e2f411c1a953b331323ee432
[ "BSD-3-Clause" ]
1
2020-05-19T09:27:16.000Z
2020-05-21T02:12:54.000Z
src/texture/RectTexture.cxx
rita0222/FK
bc5786a5da0dd732e2f411c1a953b331323ee432
[ "BSD-3-Clause" ]
null
null
null
#define FK_DEF_SIZETYPE #include <FK/RectTexture.h> #include <FK/Error.H> #include <FK/Window.h> using namespace std; using namespace FK; vector<GLuint> fk_RectTexture::_s_faceIndex = {0, 1, 3, 1, 2, 3}; GLuint fk_RectTexture::_s_faceIBO = 0; bool fk_RectTexture::_s_faceIndexFlg = false; fk_RectTexture::Member::Member(void) : repeatFlag(false) { return; } fk_RectTexture::fk_RectTexture(fk_Image *argImage) : fk_Texture(argImage), _m(make_unique<Member>()) { SetObjectType(fk_Type::RECTTEXTURE); GetFaceSize = []() { return 2; }; StatusUpdate = [this]() { SizeUpdate(); NormalUpdate(); TexCoordUpdate(); }; FaceIBOSetup = []() { if(_s_faceIBO == 0) { _s_faceIBO = GenBuffer(); _s_faceIndexFlg = true; } glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _s_faceIBO); if(_s_faceIndexFlg == true) { glBufferData(GL_ELEMENT_ARRAY_BUFFER, GLsizei(6*sizeof(GLuint)), _s_faceIndex.data(), GL_STATIC_DRAW); _s_faceIndexFlg = false; } }; _m->vertexPosition.setDim(3); _m->vertexPosition.resize(6); setShaderAttribute(vertexName, 3, _m->vertexPosition.getP()); _m->vertexNormal.setDim(3); _m->vertexNormal.resize(6); setShaderAttribute(normalName, 3, _m->vertexNormal.getP()); _m_texCoord->setDim(2); _m_texCoord->resize(6); setShaderAttribute(texCoordName, 2, _m_texCoord->getP()); init(); return; } fk_RectTexture::~fk_RectTexture() { return; } void fk_RectTexture::init(void) { BaseInit(); RectInit(); return; } void fk_RectTexture::RectInit(void) { _m->texSize.set(2.0, 2.0); setRepeatMode(false); _m->repeatParam.set(1.0, 1.0); _m->rectSE[0].set(0.0, 0.0); _m->rectSE[1].set(1.0, 1.0); SizeUpdate(); NormalUpdate(); TexCoordUpdate(); } void fk_RectTexture::SizeUpdate(void) { double tmpX = _m->texSize.x/2.0; double tmpY = _m->texSize.y/2.0; _m->vertexPosition.resize(4); _m->vertexPosition.set(0, -tmpX, -tmpY); _m->vertexPosition.set(1, tmpX, -tmpY); _m->vertexPosition.set(2, tmpX, tmpY); _m->vertexPosition.set(3, -tmpX, tmpY); modifyAttribute(vertexName); } void fk_RectTexture::NormalUpdate(void) { fk_Vector norm(0.0, 0.0, 1.0); _m->vertexNormal.resize(4); for(int i = 0; i < 4; i++) _m->vertexNormal.set(i, norm); modifyAttribute(normalName); } void fk_RectTexture::TexCoordUpdate(void) { fk_TexCoord s, e; const fk_Dimension *imageSize = getImageSize(); const fk_Dimension *bufSize = getBufferSize(); _m_texCoord->resize(4); if(bufSize == nullptr) return; if(bufSize->w < 64 || bufSize->h < 64) return; if(getRepeatMode() == true) { s.set(0.0, 0.0); e = getRepeatParam(); } else { double wScale = double(imageSize->w)/double(bufSize->w); double hScale = double(imageSize->h)/double(bufSize->h); s.set(wScale * _m->rectSE[0].x, hScale * _m->rectSE[0].y); e.set(wScale * _m->rectSE[1].x, hScale * _m->rectSE[1].y); } _m_texCoord->set(0, s.x, s.y); _m_texCoord->set(1, e.x, s.y); _m_texCoord->set(2, e.x, e.y); _m_texCoord->set(3, s.x, e.y); modifyAttribute(texCoordName); } bool fk_RectTexture::setTextureSize(double argX, double argY) { if(argX < -fk_Math::EPS || argY < -fk_Math::EPS) { return false; } _m->texSize.set(argX, argY); SizeUpdate(); return true; } fk_TexCoord fk_RectTexture::getTextureSize(void) { return _m->texSize; } void fk_RectTexture::setRepeatMode(bool argFlag) { _m->repeatFlag = argFlag; return; } bool fk_RectTexture::getRepeatMode(void) { return _m->repeatFlag; } void fk_RectTexture::setRepeatParam(double argS, double argT) { _m->repeatParam.set(argS, argT); TexCoordUpdate(); return; } fk_TexCoord fk_RectTexture::getRepeatParam(void) { return _m->repeatParam; } void fk_RectTexture::setTextureCoord(double argSU, double argSV, double argEU, double argEV) { if(argSU < -fk_Math::EPS || argSU > 1.0 + fk_Math::EPS || argSV < -fk_Math::EPS || argSV > 1.0 + fk_Math::EPS || argEU < -fk_Math::EPS || argEU > 1.0 + fk_Math::EPS || argEV < -fk_Math::EPS || argEV > 1.0 + fk_Math::EPS) { Error::Put("fk_RectTexture", "setTextureCoord", 1, "Texture Coord Error."); return; } _m->rectSE[0].set(argSU, argSV); _m->rectSE[1].set(argEU, argEV); TexCoordUpdate(); return; } void fk_RectTexture::setTextureCoord(const fk_TexCoord &argS, const fk_TexCoord &argE) { if(argS.x < -fk_Math::EPS || argS.x > 1.0 + fk_Math::EPS || argS.y < -fk_Math::EPS || argS.y > 1.0 + fk_Math::EPS || argE.x < -fk_Math::EPS || argE.x > 1.0 + fk_Math::EPS || argE.y < -fk_Math::EPS || argE.y > 1.0 + fk_Math::EPS) { Error::Put("fk_RectTexture", "setTextureCoord", 2, "Texture Coord Error."); return; } _m->rectSE[0].set(argS.x, argS.y); _m->rectSE[1].set(argE.x, argE.y); TexCoordUpdate(); return; } fk_TexCoord fk_RectTexture::getTextureCoord(int argID) { if(argID < 0 || argID > 1) { Error::Put("fk_RectTexture", "getTextureCoord", 1, "ID Error"); return fk_TexCoord(0.0, 0.0); } return _m->rectSE[argID]; } /**************************************************************************** * * Copyright (c) 1999-2020, Fine Kernel Project, All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided that the * following conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the * following disclaimer in the documentation and/or * other materials provided with the distribution. * * - Neither the name of the copyright holders 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. * ****************************************************************************/ /**************************************************************************** * * Copyright (c) 1999-2020, Fine Kernel Project, All rights reserved. * * 本ソフトウェアおよびソースコードのライセンスは、基本的に * 「修正 BSD ライセンス」に従います。以下にその詳細を記します。 * * ソースコード形式かバイナリ形式か、変更するかしないかを問わず、 * 以下の条件を満たす場合に限り、再頒布および使用が許可されます。 * * - ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、 * および下記免責条項を含めること。 * * - バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の * 資料に、上記の著作権表示、本条件一覧、および下記免責条項を * 含めること。 * * - 書面による特別の許可なしに、本ソフトウェアから派生した製品の * 宣伝または販売促進に、本ソフトウェアの著作権者の名前または * コントリビューターの名前を使用してはならない。 * * 本ソフトウェアは、著作権者およびコントリビューターによって「現 * 状のまま」提供されており、明示黙示を問わず、商業的な使用可能性、 * および特定の目的に対する適合性に関す暗黙の保証も含め、またそれ * に限定されない、いかなる保証もないものとします。著作権者もコン * トリビューターも、事由のいかんを問わず、損害発生の原因いかんを * 問わず、かつ責任の根拠が契約であるか厳格責任であるか(過失その * 他の)不法行為であるかを問わず、仮にそのような損害が発生する可 * 能性を知らされていたとしても、本ソフトウェアの使用によって発生 * した(代替品または代用サービスの調達、使用の喪失、データの喪失、 * 利益の喪失、業務の中断も含め、またそれに限定されない)直接損害、 * 間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害に * ついて、一切責任を負わないものとします。 * ****************************************************************************/
26.447099
78
0.675571
rita0222
ca93bdda2975b09e7f6415d4d15b6724259fdeca
14,922
hpp
C++
lib/crypto/crypto_CRC32.hpp
Bensuperpc/BenLib
1708a27e272a54f437cda50b2ca98ed92f03d721
[ "MIT" ]
5
2020-12-02T21:17:14.000Z
2021-05-24T19:57:42.000Z
lib/crypto/crypto_CRC32.hpp
bensuperpc/BenLib
1708a27e272a54f437cda50b2ca98ed92f03d721
[ "MIT" ]
null
null
null
lib/crypto/crypto_CRC32.hpp
bensuperpc/BenLib
1708a27e272a54f437cda50b2ca98ed92f03d721
[ "MIT" ]
1
2021-02-28T08:43:46.000Z
2021-02-28T08:43:46.000Z
////////////////////////////////////////////////////////////// // ____ // // | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ // // | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| // // | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ // // |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| // // |_| |_| // ////////////////////////////////////////////////////////////// // // // BenLib, 2021 // // Created: 04, March, 2021 // // Modified: 04, March, 2021 // // file: crypto.cpp // // Crypto // // Source: http://stackoverflow.com/questions/8710719/generating-an-alphabetic-sequence-in-java // // https://github.com/theo546/stuff // // https://stackoverflow.com/a/19299611/10152334 // // https://gms.tf/stdfind-and-memchr-optimizations.html // // https://medium.com/applied/applied-c-align-array-elements-32af40a768ee // // https://create.stephan-brumme.com/crc32/ // // https://rosettacode.org/wiki/Generate_lower_case_ASCII_alphabet // // https://www.codeproject.com/Articles/663443/Cplusplus-is-Fun-Optimal-Alphabetical-Order // // https://cppsecrets.com/users/960210997110103971089710711510497116484964103109971051084699111109/Given-integer-n-find-the-nth-string-in-this-sequence-A-B-C-Z-AA-AB-AC-ZZ-AAA-AAB-AAZ-ABA-.php // https://www.careercup.com/question?id=14276663 // // https://stackoverflow.com/a/55074804/10152334 // // https://stackoverflow.com/questions/26429360/crc32-vs-crc32c // // OS: ALL // // CPU: ALL // // // ////////////////////////////////////////////////////////////// #ifndef CRYPTO_CRC32_HPP_ #define CRYPTO_CRC32_HPP_ #include <boost/crc.hpp> /* CRC-32C (iSCSI) polynomial in reversed bit order. */ //#define POLY 0x82f63b78 /* CRC-32 (Ethernet, ZIP, etc.) polynomial in reversed bit order. */ #define POLY 0xEDB88320 #define CRC32_USE_LOOKUP_TABLE_BYTE #define CRC32_USE_LOOKUP_TABLE_SLICING_BY_4 #define CRC32_USE_LOOKUP_TABLE_SLICING_BY_8 #define CRC32_USE_LOOKUP_TABLE_SLICING_BY_16 namespace my { namespace crypto { /** * This function process CRC32 hash from string * @ingroup Crypto_CRC32 * @param my_string String text need to be calculate * @return uint32_t with CRC32 value * * @author Bensuperpc * * @see see also JAMCRC_Boost() */ uint32_t CRC32_Boost(std::string_view my_string); /** * This function process JAMCRC hash from string * @ingroup Crypto_JAMCRC * @param my_string text to process * @return uint32_t with JAMCRC value * * @author Bensuperpc * * @see see also CRC32_Boost() */ uint32_t JAMCRC_Boost(std::string_view my_string); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param buf void* text need to be calculate * @param len size_t text size * @param crc uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author Bensuperpc * * @see see also JAMCRC_Boost() */ uint32_t CRC32_Boost(const void *buf, size_t len, uint32_t crc); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param buf void* text need to be calculate * @param len size_t text size * @param crc uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author Bensuperpc * * @see see also CRC32_Boost() */ uint32_t JAMCRC_Boost(const void *buf, size_t len, uint32_t crc); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param buf void* text need to be calculate * @param len size_t text size * @param crc uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author ? * * @see see also JAMCRC_StackOverflow() */ uint32_t CRC32_StackOverflow(const void *buf, size_t len, uint32_t crc); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param buf void* text need to be calculate * @param len size_t text size * @param crc uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author ? * * @see see also CRC32_StackOverflow() */ uint32_t JAMCRC_StackOverflow(const void *buf, size_t len, uint32_t crc); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also JAMCRC_1byte_tableless() */ uint32_t CRC32_1byte_tableless(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also CRC32_1byte_tableless() */ uint32_t JAMCRC_1byte_tableless(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also JAMCRC_1byte_tableless2() */ uint32_t CRC32_1byte_tableless2(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also CRC32_1byte_tableless2() */ uint32_t JAMCRC_1byte_tableless2(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also JAMCRC_bitwise() */ uint32_t CRC32_bitwise(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also CRC32_bitwise() */ uint32_t JAMCRC_bitwise(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also JAMCRC_halfbyte() */ uint32_t CRC32_halfbyte(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also CRC32_halfbyte() */ uint32_t JAMCRC_halfbyte(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also JAMCRC_1byte() */ #ifdef CRC32_USE_LOOKUP_TABLE_BYTE uint32_t CRC32_1byte(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also CRC32_1byte() */ uint32_t JAMCRC_1byte(const void *data, size_t length, uint32_t previousCrc32); #endif #ifdef CRC32_USE_LOOKUP_TABLE_SLICING_BY_4 /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also JAMCRC_4bytes() */ uint32_t CRC32_4bytes(const void *data, size_t length, uint32_t previousCrc32 = 0); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also CRC32_4bytes() */ uint32_t JAMCRC_4bytes(const void *data, size_t length, uint32_t previousCrc32 = 0); #endif #ifdef CRC32_USE_LOOKUP_TABLE_SLICING_BY_8 /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also CRC32_4x8bytes() */ uint32_t CRC32_8bytes(const void *data, size_t length, uint32_t previousCrc32 = 0); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also CRC32_8bytes() */ uint32_t CRC32_4x8bytes(const void *data, size_t length, uint32_t previousCrc32 = 0); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with JAMCRC value * * @author stephan brumme * * @see see also CRC32_4x8bytes() */ uint32_t JAMCRC_8bytes(const void *data, size_t length, uint32_t previousCrc32 = 0); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with JAMCRC value * * @author stephan brumme * * @see see also CRC32_4x8bytes() */ uint32_t JAMCRC_4x8bytes(const void *data, size_t length, uint32_t previousCrc32 = 0); #endif #ifdef CRC32_USE_LOOKUP_TABLE_SLICING_BY_16 /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also JAMCRC_16bytes() */ uint32_t CRC32_16bytes(const void *data, size_t length, uint32_t previousCrc32 = 0); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @param prefetchAhead 256 by default * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also JAMCRC_16bytes_prefetch() */ uint32_t CRC32_16bytes_prefetch(const void *data, size_t length, uint32_t previousCrc32 = 0, size_t prefetchAhead = 256); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with JAMCRC value * * @author stephan brumme * * @see see also CRC32_16bytes() */ uint32_t JAMCRC_16bytes(const void *data, size_t length, uint32_t previousCrc32 = 0); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @param prefetchAhead 256 by default * @return uint32_t with JAMCRC value * * @author stephan brumme * * @see see also CRC32_16bytes_prefetch() */ uint32_t JAMCRC_16bytes_prefetch(const void *data, size_t length, uint32_t previousCrc32 = 0, size_t prefetchAhead = 256); #endif /** * This function process CRC32 hash from void * const * * @ingroup Crypto_CRC32 * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with CRC32 value * * @author stephan brumme * * @see see also JAMCRC_fast() */ uint32_t CRC32_fast(const void *data, size_t length, uint32_t previousCrc32); /** * This function process CRC32 hash from void * const * * @ingroup Crypto_JAMCRC * @param data void* text need to be calculate * @param length size_t text size * @param previousCrc32 uint32_t least crc (0x0 if is empty) * @return uint32_t with JAMCRC value * * @author stephan brumme * * @see see also CRC32_fast() */ uint32_t JAMCRC_fast(const void *data, size_t length, uint32_t previousCrc32); } // namespace crypto } // namespace my #endif
30.89441
201
0.656614
Bensuperpc
ca949ac10fe53519e6ee8e600979a5bc4f059ea8
7,980
cc
C++
tests/libtests/faults/obsolete/TestEqKinSrc.cc
Grant-Block/pylith
f6338261b17551eba879da998a5aaf2d91f5f658
[ "MIT" ]
93
2015-01-08T16:41:22.000Z
2022-02-25T13:40:02.000Z
tests/libtests/faults/obsolete/TestEqKinSrc.cc
Grant-Block/pylith
f6338261b17551eba879da998a5aaf2d91f5f658
[ "MIT" ]
277
2015-02-20T16:27:35.000Z
2022-03-30T21:13:09.000Z
tests/libtests/faults/obsolete/TestEqKinSrc.cc
Grant-Block/pylith
f6338261b17551eba879da998a5aaf2d91f5f658
[ "MIT" ]
71
2015-03-24T12:11:08.000Z
2022-03-03T04:26:02.000Z
// -*- C++ -*- // // ---------------------------------------------------------------------- // // Brad T. Aagaard, U.S. Geological Survey // Charles A. Williams, GNS Science // Matthew G. Knepley, University of Chicago // // This code was developed as part of the Computational Infrastructure // for Geodynamics (http://geodynamics.org). // // Copyright (c) 2010-2017 University of California, Davis // // See COPYING for license information. // // ---------------------------------------------------------------------- // #include <portinfo> #include "TestEqKinSrc.hh" // Implementation of class methods #include "pylith/faults/EqKinSrc.hh" // USES EqKinSrc #include "TestFaultMesh.hh" // USES createFaultMesh() #include "pylith/faults/BruneSlipFn.hh" // USES BruneSlipFn #include "pylith/faults/CohesiveTopology.hh" // USES CohesiveTopology #include "pylith/topology/Mesh.hh" // USES Mesh #include "pylith/topology/MeshOps.hh" // USES MeshOps::nondimensionalize() #include "pylith/topology/Field.hh" // USES Field #include "pylith/topology/Stratum.hh" // USES Stratum #include "pylith/topology/VisitorMesh.hh" // USES VecVisitorMesh #include "pylith/meshio/MeshIOAscii.hh" // USES MeshIOAscii #include "spatialdata/geocoords/CSCart.hh" // USES CSCart #include "spatialdata/spatialdb/SimpleDB.hh" // USES SimpleDB #include "spatialdata/spatialdb/SimpleIOAscii.hh" // USES SimpleIOAscii #include "spatialdata/units/Nondimensional.hh" // USES Nondimensional // ---------------------------------------------------------------------- CPPUNIT_TEST_SUITE_REGISTRATION( pylith::faults::TestEqKinSrc ); // ---------------------------------------------------------------------- namespace pylith { namespace faults { namespace _TestEqKinSrc { const PylithScalar lengthScale = 1.0e+3; const PylithScalar pressureScale = 2.25e+10; const PylithScalar timeScale = 1.0; const PylithScalar velocityScale = lengthScale / timeScale; const PylithScalar densityScale = pressureScale / (velocityScale*velocityScale); } // namespace _TestTractPerturbation } // faults } // pylith // ---------------------------------------------------------------------- // Test constructor. void pylith::faults::TestEqKinSrc::testConstructor(void) { // testConstructor PYLITH_METHOD_BEGIN; EqKinSrc eqsrc; PYLITH_METHOD_END; } // testConstructor // ---------------------------------------------------------------------- // Test slipFn(). void pylith::faults::TestEqKinSrc::testSlipFn(void) { // testSlipFn PYLITH_METHOD_BEGIN; BruneSlipFn slipfn; EqKinSrc eqsrc; eqsrc.slipfn(&slipfn); CPPUNIT_ASSERT(&slipfn == eqsrc._slipfn); PYLITH_METHOD_END; } // testSlipFn // ---------------------------------------------------------------------- // Test initialize(). Use 2-D mesh with Brune slip function to test // initialize(). void pylith::faults::TestEqKinSrc::testInitialize(void) { // testInitialize PYLITH_METHOD_BEGIN; topology::Mesh mesh; topology::Mesh faultMesh; EqKinSrc eqsrc; BruneSlipFn slipfn; const PylithScalar originTime = 2.45; _initialize(&mesh, &faultMesh, &eqsrc, &slipfn, originTime); // Don't have access to details of slip time function, so we can't // check parameters. Have to rely on test of slip() for verification // of results. PYLITH_METHOD_END; } // testInitialize // ---------------------------------------------------------------------- // Test slip(). void pylith::faults::TestEqKinSrc::testSlip(void) { // testSlip PYLITH_METHOD_BEGIN; const PylithScalar finalSlipE[4] = { 2.3, 0.1, 2.4, 0.2, }; const PylithScalar slipTimeE[2] = { 1.2, 1.3 }; const PylithScalar riseTimeE[2] = { 1.4, 1.5 }; const PylithScalar originTime = 2.42 / _TestEqKinSrc::timeScale; topology::Mesh mesh; topology::Mesh faultMesh; EqKinSrc eqsrc; BruneSlipFn slipfn; _initialize(&mesh, &faultMesh, &eqsrc, &slipfn, originTime); const spatialdata::geocoords::CoordSys* cs = faultMesh.coordsys();CPPUNIT_ASSERT(cs); const int spaceDim = cs->spaceDim(); topology::Field slip(faultMesh); slip.newSection(topology::FieldBase::VERTICES_FIELD, spaceDim); slip.allocate(); const PylithScalar t = 2.134 / _TestEqKinSrc::timeScale; eqsrc.slip(&slip, originTime+t); PetscDM dmMesh = faultMesh.dmMesh();CPPUNIT_ASSERT(dmMesh); topology::Stratum verticesStratum(dmMesh, topology::Stratum::DEPTH, 0); const PetscInt vStart = verticesStratum.begin(); const PetscInt vEnd = verticesStratum.end(); topology::VecVisitorMesh slipVisitor(slip); const PetscScalar* slipArray = slipVisitor.localArray();CPPUNIT_ASSERT(slipArray); const PylithScalar tolerance = 1.0e-06; for(PetscInt v = vStart, iPoint = 0; v < vEnd; ++v, ++iPoint) { PylithScalar slipMag = 0.0; for (int iDim=0; iDim < spaceDim; ++iDim) slipMag += pow(finalSlipE[iPoint*spaceDim+iDim], 2); slipMag = sqrt(slipMag); const PylithScalar peakRate = slipMag / riseTimeE[iPoint] * 1.745; const PylithScalar tau = slipMag / (exp(1.0) * peakRate); const PylithScalar t0 = slipTimeE[iPoint]; const PylithScalar slipNorm = 1.0 - exp(-(t-t0)/tau) * (1.0 + (t-t0)/tau); const PetscInt off = slipVisitor.sectionOffset(v); CPPUNIT_ASSERT_EQUAL(spaceDim, slipVisitor.sectionDof(v)); for(PetscInt d = 0; d < spaceDim; ++d) { const PylithScalar slipE = finalSlipE[iPoint*spaceDim+d] * slipNorm; CPPUNIT_ASSERT_DOUBLES_EQUAL(slipE, slipArray[off+d]*_TestEqKinSrc::lengthScale, tolerance); } // for } // for PYLITH_METHOD_END; } // testSlip // ---------------------------------------------------------------------- // Initialize EqKinSrc. void pylith::faults::TestEqKinSrc::_initialize(topology::Mesh* mesh, topology::Mesh* faultMesh, EqKinSrc* eqsrc, BruneSlipFn* slipfn, const PylithScalar originTime) { // _initialize PYLITH_METHOD_BEGIN; CPPUNIT_ASSERT(mesh); CPPUNIT_ASSERT(faultMesh); CPPUNIT_ASSERT(eqsrc); CPPUNIT_ASSERT(slipfn); PetscErrorCode err; const char* meshFilename = "data/tri3.mesh"; const char* faultLabel = "fault"; const int faultId = 2; const char* finalSlipFilename = "data/tri3_finalslip.spatialdb"; const char* slipTimeFilename = "data/tri3_sliptime.spatialdb"; const char* peakRateFilename = "data/tri3_risetime.spatialdb"; meshio::MeshIOAscii meshIO; meshIO.filename(meshFilename); meshIO.debug(false); meshIO.interpolate(false); meshIO.read(mesh); // Set up coordinates spatialdata::geocoords::CSCart cs; const int spaceDim = mesh->dimension(); cs.setSpaceDim(spaceDim); cs.initialize(); mesh->coordsys(&cs); // Set scales spatialdata::units::Nondimensional normalizer; normalizer.lengthScale(_TestEqKinSrc::lengthScale); normalizer.pressureScale(_TestEqKinSrc::pressureScale); normalizer.densityScale(_TestEqKinSrc::densityScale); normalizer.timeScale(_TestEqKinSrc::timeScale); topology::MeshOps::nondimensionalize(mesh, normalizer); // Create fault mesh TestFaultMesh::createFaultMesh(faultMesh, mesh, faultLabel, faultId); // Setup databases spatialdata::spatialdb::SimpleDB dbFinalSlip("final slip"); spatialdata::spatialdb::SimpleIOAscii ioFinalSlip; ioFinalSlip.filename(finalSlipFilename); dbFinalSlip.ioHandler(&ioFinalSlip); spatialdata::spatialdb::SimpleDB dbSlipTime("slip time"); spatialdata::spatialdb::SimpleIOAscii ioSlipTime; ioSlipTime.filename(slipTimeFilename); dbSlipTime.ioHandler(&ioSlipTime); spatialdata::spatialdb::SimpleDB dbRiseTime("rise time"); spatialdata::spatialdb::SimpleIOAscii ioRiseTime; ioRiseTime.filename(peakRateFilename); dbRiseTime.ioHandler(&ioRiseTime); // setup EqKinSrc slipfn->dbFinalSlip(&dbFinalSlip); slipfn->dbSlipTime(&dbSlipTime); slipfn->dbRiseTime(&dbRiseTime); eqsrc->originTime(originTime); eqsrc->slipfn(slipfn); eqsrc->initialize(*faultMesh, normalizer); PYLITH_METHOD_END; } // _initialize // End of file
32.571429
98
0.671303
Grant-Block
ca951c7596940c78e70007b91d19727ff4057ba7
463
cpp
C++
aashishgahlawat/codeforces/A/118-A/118-A-30513113.cpp
aashishgahlawat/CompetetiveProgramming
12d6b2682765ae05b622968b9a26b0b519e170aa
[ "MIT" ]
null
null
null
aashishgahlawat/codeforces/A/118-A/118-A-30513113.cpp
aashishgahlawat/CompetetiveProgramming
12d6b2682765ae05b622968b9a26b0b519e170aa
[ "MIT" ]
null
null
null
aashishgahlawat/codeforces/A/118-A/118-A-30513113.cpp
aashishgahlawat/CompetetiveProgramming
12d6b2682765ae05b622968b9a26b0b519e170aa
[ "MIT" ]
null
null
null
#include <iostream> #include <string.h> using namespace std; int main() { // your code goes here string text; string result=""; cin>>text; int textLength=text.length(); for(int i=0;i<textLength;++i){ char temp=text[i]; if(temp<97) temp+=32; if(temp=='a'|| temp=='e'|| temp=='i'|| temp=='o'|| temp=='u' || temp=='y'){ }else{result=result+'.'+temp;} } std::cout << result<<endl; return 0; }
21.045455
84
0.526998
aashishgahlawat
ca959a6bfe2f408fa9e2bc58a4c457026b1be35c
6,611
cpp
C++
Testing/Operations/albaASCIIImporterUtilityTest.cpp
IOR-BIC/ALBA
b574968b05d9a3a2756dd2ac61d015a0d20232a4
[ "Apache-2.0", "BSD-3-Clause" ]
9
2018-11-19T10:15:29.000Z
2021-08-30T11:52:07.000Z
Testing/Operations/albaASCIIImporterUtilityTest.cpp
IOR-BIC/ALBA
b574968b05d9a3a2756dd2ac61d015a0d20232a4
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
Testing/Operations/albaASCIIImporterUtilityTest.cpp
IOR-BIC/ALBA
b574968b05d9a3a2756dd2ac61d015a0d20232a4
[ "Apache-2.0", "BSD-3-Clause" ]
3
2018-06-10T22:56:29.000Z
2019-12-12T06:22:56.000Z
/*========================================================================= Program: ALBA (Agile Library for Biomedical Applications) Module: albaASCIIImporterUtilityTest Authors: Alberto Losi Copyright (c) BIC All rights reserved. See Copyright.txt or This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "albaDefines.h" //---------------------------------------------------------------------------- // NOTE: Every CPP file in the ALBA must include "albaDefines.h" as first. // This force to include Window,wxWidgets and VTK exactly in this order. // Failing in doing this will result in a run-time error saying: // "Failure#0: The value of ESP was not properly saved across a function call" //---------------------------------------------------------------------------- #include <cppunit/config/SourcePrefix.h> #include "albaASCIIImporterUtilityTest.h" #include "albaASCIIImporterUtility.h" #include "albaString.h" #include <vcl_fstream.h> #include <vnl/vnl_vector.h> #include <iostream> //---------------------------------------------------------------------------- void albaASCIIImporterUtilityTest::TestConstructor() //---------------------------------------------------------------------------- { albaASCIIImporterUtilityTest *utility = new albaASCIIImporterUtilityTest(); cppDEL(utility); } //---------------------------------------------------------------------------- void albaASCIIImporterUtilityTest::GetNumberOfRowsTest() //---------------------------------------------------------------------------- { albaASCIIImporterUtility *utility = new albaASCIIImporterUtility(); albaString filename = ALBA_DATA_ROOT; filename<<"/Test_ASCIIImporterUtility/matrix_01.txt"; utility->ReadFile(filename); CPPUNIT_ASSERT(utility->ReadFile(filename) == ALBA_OK); CPPUNIT_ASSERT(utility->GetNumberOfRows() == 3); cppDEL(utility); } //---------------------------------------------------------------------------- void albaASCIIImporterUtilityTest::GetNumberOfColsTest() //---------------------------------------------------------------------------- { albaASCIIImporterUtility *utility = new albaASCIIImporterUtility(); albaString filename = ALBA_DATA_ROOT; filename<<"/Test_ASCIIImporterUtility/matrix_01.txt"; utility->ReadFile(filename); CPPUNIT_ASSERT(utility->ReadFile(filename) == ALBA_OK); CPPUNIT_ASSERT(utility->GetNumberOfCols() == 3); cppDEL(utility); } //---------------------------------------------------------------------------- void albaASCIIImporterUtilityTest::GetNumberOfScalarsTest() //---------------------------------------------------------------------------- { albaASCIIImporterUtility *utility = new albaASCIIImporterUtility(); albaString filename = ALBA_DATA_ROOT; filename<<"/Test_ASCIIImporterUtility/matrix_01.txt"; utility->ReadFile(filename); CPPUNIT_ASSERT(utility->ReadFile(filename) == ALBA_OK); CPPUNIT_ASSERT(utility->GetNumberOfScalars() == 9); cppDEL(utility); } //---------------------------------------------------------------------------- void albaASCIIImporterUtilityTest::GetScalarTest() //---------------------------------------------------------------------------- { albaASCIIImporterUtility *utility = new albaASCIIImporterUtility(); albaString filename = ALBA_DATA_ROOT; filename<<"/Test_ASCIIImporterUtility/matrix_01.txt"; utility->ReadFile(filename); CPPUNIT_ASSERT(utility->ReadFile(filename) == ALBA_OK); CPPUNIT_ASSERT(utility->GetScalar(1,1) == 5.0); cppDEL(utility); } //---------------------------------------------------------------------------- void albaASCIIImporterUtilityTest::GetMatrixTest() //---------------------------------------------------------------------------- { albaASCIIImporterUtility *utility = new albaASCIIImporterUtility(); albaString filename = ALBA_DATA_ROOT; /* Create a Matrix equals to the one stored in the ASCII file; 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 */ double m1[3][3] = { {1,2,3},{4,5,6},{7,8,9} }; double row[3]; filename<<"/Test_ASCIIImporterUtility/matrix_01.txt"; utility->ReadFile(filename); CPPUNIT_ASSERT(utility->ReadFile(filename) == ALBA_OK); for (int i = 0; i < 3; i++) { utility->ExtractRow(i, row); for (int j = 0; j < 3; j++) CPPUNIT_ASSERT(row[j] == m1[i][j]); } cppDEL(utility); } //---------------------------------------------------------------------------- void albaASCIIImporterUtilityTest::ExtractRowTest() //---------------------------------------------------------------------------- { albaASCIIImporterUtility *utility = new albaASCIIImporterUtility(); albaString filename = ALBA_DATA_ROOT; std::vector<double> v1; double vd1[3]; /* Create a vector equals to the first row of the matrix stored in the ASCII file; 1.0 2.0 3.0 */ v1.push_back(1.0); v1.push_back(2.0); v1.push_back(3.0); vd1[0] = 1.0; vd1[1] = 2.0; vd1[2] = 3.0; filename<<"/Test_ASCIIImporterUtility/matrix_01.txt"; utility->ReadFile(filename); CPPUNIT_ASSERT(utility->ReadFile(filename) == ALBA_OK); std::vector<double> v2; utility->ExtractRow(0,v2); double vd2[3]; utility->ExtractRow(0,vd2); CPPUNIT_ASSERT((v1[0] == v2[0]) && (v1[1] == v2[1]) && (v1[2] == v2[2])); CPPUNIT_ASSERT((vd1[0] == vd2[0]) && (vd1[1] == vd2[1]) && (vd1[2] == vd2[2])); cppDEL(utility); } //---------------------------------------------------------------------------- void albaASCIIImporterUtilityTest::ExtractColumnTest() //---------------------------------------------------------------------------- { albaASCIIImporterUtility *utility = new albaASCIIImporterUtility(); albaString filename = ALBA_DATA_ROOT; std::vector<double> v1; double vd1[3]; /* Create a vector equals to the first column of the matrix stored in the ASCII file; 1.0 4.0 7.0 */ v1.push_back(1.0); v1.push_back(4.0); v1.push_back(7.0); vd1[0] = 1.0; vd1[1] = 4.0; vd1[2] = 7.0; filename<<"/Test_ASCIIImporterUtility/matrix_01.txt"; utility->ReadFile(filename); CPPUNIT_ASSERT(utility->ReadFile(filename) == ALBA_OK); std::vector<double> v2; utility->ExtractColumn(0,v2); double vd2[3]; utility->ExtractColumn(0,vd2); CPPUNIT_ASSERT((v1[0] == v2[0]) && (v1[1] == v2[1]) && (v1[2] == v2[2])); CPPUNIT_ASSERT((vd1[0] == vd2[0]) && (vd1[1] == vd2[1]) && (vd1[2] == vd2[2])); cppDEL(utility); }
29.513393
87
0.543488
IOR-BIC
ca95a26830ef766ea1e8f9929f3cb70c3e859a77
1,006
cpp
C++
chapter08/context/8.10left.cpp
chuckbruno/cpp
5df742c15d463a46351bd72b5c58144086b0a9d2
[ "Apache-2.0" ]
null
null
null
chapter08/context/8.10left.cpp
chuckbruno/cpp
5df742c15d463a46351bd72b5c58144086b0a9d2
[ "Apache-2.0" ]
null
null
null
chapter08/context/8.10left.cpp
chuckbruno/cpp
5df742c15d463a46351bd72b5c58144086b0a9d2
[ "Apache-2.0" ]
null
null
null
#include <iostream> unsigned long left(unsigned long num, unsigned int cf); char * left(const char* str, int n = 1); int main() { using namespace std; const char * trip = "Hawaii!!"; unsigned long n = 12345678; int i; char * temp; for(i=1; i < 10; i++) { cout << left(n, i) << endl; temp = left(trip, i); cout << temp << endl; delete[] temp; } return 0; } unsigned long left(unsigned long num, unsigned ct) { unsigned digits = 1; unsigned long n = num; if (ct == 0 || num == 0) return 0; while(n /= 10) digits++; if (digits > ct) { ct = digits - ct; while(ct--) num /= 10; return num; } else return num; } char* left(const char * str, int n) { if (n < 0) n = 0; char *p = new char[n+1]; int i; for (i=0; i < n&& str[i]; i++) p[i] = str[i]; while (i <= n) p[i++] = '\0'; return p; }
15.242424
55
0.461233
chuckbruno
ca95b270b3366162a82ff388988ab2340dd65333
17,125
cpp
C++
src/uti_phgrm/TiepRed/cAppliTiepRed.cpp
kikislater/micmac
3009dbdad62b3ad906ec882b74b85a3db86ca755
[ "CECILL-B" ]
451
2016-11-25T09:40:28.000Z
2022-03-30T04:20:42.000Z
src/uti_phgrm/TiepRed/cAppliTiepRed.cpp
kikislater/micmac
3009dbdad62b3ad906ec882b74b85a3db86ca755
[ "CECILL-B" ]
143
2016-11-25T20:35:57.000Z
2022-03-01T11:58:02.000Z
src/uti_phgrm/TiepRed/cAppliTiepRed.cpp
kikislater/micmac
3009dbdad62b3ad906ec882b74b85a3db86ca755
[ "CECILL-B" ]
139
2016-12-02T10:26:21.000Z
2022-03-10T19:40:29.000Z
/*Header-MicMac-eLiSe-25/06/2007 MicMac : Multi Image Correspondances par Methodes Automatiques de Correlation eLiSe : ELements of an Image Software Environnement www.micmac.ign.fr Copyright : Institut Geographique National Author : Marc Pierrot Deseilligny Contributors : Gregoire Maillet, Didier Boldo. [1] M. Pierrot-Deseilligny, N. Paparoditis. "A multiresolution and optimization-based image matching approach: An application to surface reconstruction from SPOT5-HRS stereo imagery." In IAPRS vol XXXVI-1/W41 in ISPRS Workshop On Topographic Mapping From Space (With Special Emphasis on Small Satellites), Ankara, Turquie, 02-2006. [2] M. Pierrot-Deseilligny, "MicMac, un lociel de mise en correspondance d'images, adapte au contexte geograhique" to appears in Bulletin d'information de l'Institut Geographique National, 2007. Francais : MicMac est un logiciel de mise en correspondance d'image adapte au contexte de recherche en information geographique. Il s'appuie sur la bibliotheque de manipulation d'image eLiSe. Il est distibue sous la licences Cecill-B. Voir en bas de fichier et http://www.cecill.info. English : MicMac is an open source software specialized in image matching for research in geographic information. MicMac is built on the eLiSe image library. MicMac is governed by the "Cecill-B licence". See below and http://www.cecill.info. Header-MicMac-eLiSe-25/06/2007*/ /* The RedTieP tool has been developed by Oscar Martinez-Rubi within the project Improving Open-Source Photogrammetric Workflows for Processing Big Datasets The project is funded by the Netherlands eScience Center */ #include "TiepRed.h" #if (!BUG_PUSH_XML_TIEP) bool cmpStringDesc(const pair<std::string, int> &p1, const pair<std::string, int> &p2) { return p1.first > p2.first; } bool cmpStringAsc(const pair<std::string, int> &p1, const pair<std::string, int> &p2) { return p1.first < p2.first; } bool cmpIntDesc(const pair<std::string, int> &p1, const pair<std::string, int> &p2) { return p1.second > p2.second; } bool cmpIntAsc(const pair<std::string, int> &p1, const pair<std::string, int> &p2) { return p1.second < p2.second; } /**********************************************************************/ /* */ /* cAppliTiepRed */ /* */ /**********************************************************************/ cAppliTiepRed::cAppliTiepRed(int argc,char **argv) : mNumCellsX(12), mNumCellsY(12), mAdaptive(false), mWeightAccGain(0.5), mImagesNames(0), mCallBack(false), mExpSubCom(false), mExpTxt(false), mSortByNum(false), mDesc(false), mGainMode(1), mMinNumHomol(20) { // Read parameters MMD_InitArgcArgv(argc,argv); ElInitArgMain(argc,argv, LArgMain() << EAMC(mPatImage, "Pattern of images", eSAM_IsPatFile), LArgMain() << EAM(mNumCellsX,"NumPointsX",true,"Target number of tie-points between 2 images in x axis of image space, def=12") << EAM(mNumCellsY,"NumPointsY",true,"Target number of tie-points between 2 images in y axis of image space, def=12") << EAM(mAdaptive,"Adaptive",true,"Use adaptive grids, def=false") << EAM(mSubcommandIndex,"SubcommandIndex",true,"Internal use") << EAM(mExpSubCom,"ExpSubCom",true,"Export the subcommands instead of executing them, def=false") << EAM(mExpTxt,"ExpTxt",true,"Export homol point in Ascii, def=false") << EAM(mSortByNum,"SortByNum",true,"Sort images by number of tie-points, determining the order in which the subcommands are executed, def=0 (sort by file name)") << EAM(mDesc,"Desc",true,"Use descending order in the sorting of images, def=0 (ascending)") << EAM(mWeightAccGain,"WeightAccGain",true,"Weight of median accuracy with respect to multiplicity (NumPairs) when computing Gain of multi-tie-point, i.e. K in formula Gain=NumPairs*(1/1 + (K*Acc/AccMed)^2) (if K=0 then Gain is NumPairs), def=0.5") << EAM(mMinNumHomol,"MinNumHomol",true,"Minimum number of tie-points for an image pair not to be excluded, def=20") ); // if mSubcommandIndex was set, this is not the parent process. // This is child running a task/subcommand, i.e. a tie-point reduction task of a master image and its related images mCallBack = EAMIsInit(&mSubcommandIndex); //Get the parent directory of the images mDir = DirOfFile(mPatImage); //Initializes the folder name manager mNM = cVirtInterf_NewO_NameManager::StdAlloc(mDir, ""); // Sets the Gain mode, if the weight is 0, then GainMode is 0. This means Gain = multiplicity (and we do not need to keep track of accuracies) if (mWeightAccGain == 0.){ mGainMode = 0; }else{ mGainMode = 1; } if (mCallBack){ //This is a child // We are running a subcommand. Read its configuration from a XML file given by the mSubcommandIndex mXmlParamSubcommand = StdGetFromPCP(NameParamSubcommand(mSubcommandIndex,true),Xml_ParamSubcommandTiepRed); // Read the images. mImagesNames[0] is the master image, the rest are related images to the master, i.e. they share tie-points mImagesNames = &(mXmlParamSubcommand.Images()); // Get the initital number of tie-points that the master image had before any subcommand was executed mNumInit = mXmlParamSubcommand.NumInit(); // Get the maximum number of related images for an image (this considers all the images, not only the ones related to this task) mMaxNumRelated = mXmlParamSubcommand.MaxNumRelated(); // Get the number of subcommands/tasks (only for logging purposes) int numSubcommands = mXmlParamSubcommand.NumSubcommands(); std::cout << "======================= KSubcommand=" << (mSubcommandIndex+1) << "/" << numSubcommands << " ===================\n"; } else { // This is the parent. We get the list of images from the pattern provided by the user cElemAppliSetFile anEASF(mPatImage); mImagesNames = anEASF.SetIm(); } } // Set some constants: temporal folder, output folder and JSON for commands (used for Noodles) const std::string cAppliTiepRed::TempFolderName = "Tmp-ReducTieP-Pwork/"; const std::string cAppliTiepRed::OutputFolderName = "Homol-Red/"; const std::string cAppliTiepRed::SubComFileName = "subcommands.json"; /* * Implement getters that depends on the previously defined constants */ std::string cAppliTiepRed::NameParamSubcommand(int aK,bool Bin) const{ return mDir+TempFolderName + "Param_" +ToString(aK) + (Bin ? ".xml" : ".dmp"); } std::string cAppliTiepRed::DirOneImage(const std::string &aName) const{ return mDir+OutputFolderName + "Pastis" + aName + "/"; } std::string cAppliTiepRed::DirOneImageTemp(const std::string &aName) const{ return mDir+TempFolderName + "Pastis" + aName + "/"; } std::string cAppliTiepRed::NameHomol(const std::string &aName1,const std::string &aName2) const{ return DirOneImage(aName1) + aName2 + (mExpTxt ? ".txt" : ".dat"); } std::string cAppliTiepRed::NameHomolTemp(const std::string &aName1,const std::string &aName2) const{ return DirOneImageTemp(aName1) + aName2 + (mExpTxt ? ".txt" : ".dat"); } void cAppliTiepRed::ExportSubcommands(std::vector<std::string> & aVSubcommands , std::vector<std::vector< int > > & aVRelatedSubcommandsIndexes){ // Opens the output file to write the subcommands ofstream scFile; std::string scFilePath = mDir+SubComFileName; scFile.open (scFilePath.c_str()); //Write in JSON format scFile << "[" << endl; for (std::size_t i = 0 ; i < aVSubcommands.size() ; i++){ scFile << " {" << endl; scFile << " \"id\": \"" << aVRelatedSubcommandsIndexes[i][0] << "\"," << endl; scFile << " \"exclude\": ["; for (std::size_t j = 1 ; j < aVRelatedSubcommandsIndexes[i].size() ; j++){ scFile << aVRelatedSubcommandsIndexes[i][j]; if (j < aVRelatedSubcommandsIndexes[i].size()-1) scFile << ","; } scFile << "]," << endl; scFile << " \"command\": \"" << aVSubcommands[i] << "\"" << endl; scFile << " }"; if (i < aVSubcommands.size()-1) scFile << ","; scFile << endl; } scFile << "]" << endl; scFile.close(); } void cAppliTiepRed::GenerateSubcommands(){ // Create temp folder (remove it first to delete possible old data) ELISE_fp::PurgeDirGen(mDir+TempFolderName, true); ELISE_fp::MkDirSvp(mDir+TempFolderName); // Create the output folder ELISE_fp::MkDirSvp(mDir+OutputFolderName); // Create one subfolder for each image in the output and the temp folders for (std::size_t i = 0 ; i<mImagesNames->size() ; i++) { const std::string & aNameIm = (*mImagesNames)[i]; ELISE_fp::MkDirSvp(DirOneImage(aNameIm)); ELISE_fp::MkDirSvp(DirOneImageTemp(aNameIm)); } // Fill a set of image names std::set<std::string>* mSetImagesNames = new std::set<std::string>(mImagesNames->begin(),mImagesNames->end()); //Map of the names of the related images of for each image std::map<std::string,std::vector<string> > relatedImagesMap; //Map of number of tie-points per image (if a tie-point is in two image pairs, it counts as 2) std::map<std::string,int> imagesNumPointsMap; // Fill in the map with list of related images per image, and the map with number of tie-points per image for (std::size_t i = 0 ; i < mImagesNames->size() ; i++){ // for all images // Get the image name const std::string & imageName = (*mImagesNames)[i]; // Get list of images sharing tie-points with imageName. We call these images related images std::list<std::string> relatedImagesNames = mNM->ListeImOrientedWith(imageName); // For each related image we load the shared tie-points and update the maps for (std::list<std::string>::const_iterator itRelatedImageName= relatedImagesNames.begin(); itRelatedImageName!=relatedImagesNames.end() ; itRelatedImageName++){ // Get the related image name const std::string & relatedImageName = *itRelatedImageName; // Test if the relatedImageName is in the initial set of images if (mSetImagesNames->find(relatedImageName) != mSetImagesNames->end()){ if (imageName < relatedImageName){ //We add this if to guarantee we do not load the same tie-points when doing the iteration for the related image // Load the tie-points std::vector<Pt2df> aVP1,aVP2; mNM->LoadHomFloats(imageName, relatedImageName, &aVP1, &aVP2); // Update the related image names map relatedImagesMap[imageName].push_back(relatedImageName); relatedImagesMap[relatedImageName].push_back(imageName); // Update the number of tie-points map imagesNumPointsMap[imageName]+=aVP1.size(); imagesNumPointsMap[relatedImageName]+=aVP2.size(); //should be same as aVP1 } } } } // Get the maximum number of related images int maxNumRelated = 0; for (std::size_t i = 0 ; i < mImagesNames->size() ; i++){ const std::string & imageName = (*mImagesNames)[i]; int numRelated = relatedImagesMap[imageName].size(); if (numRelated > maxNumRelated){ maxNumRelated = numRelated; } } // Convert the map with the number of tie-points per image to a vector of pairs // This is required to sort them std::vector<pair<std::string, int> > imagesNumPointsVP; std::copy(imagesNumPointsMap.begin(), imagesNumPointsMap.end(), back_inserter(imagesNumPointsVP)); // Sort the images by file name or by number or tie-points in ascending or descending order depending on user decision. if (mSortByNum == true){ if (mDesc == false) std::sort(imagesNumPointsVP.begin(), imagesNumPointsVP.end(), cmpIntAsc); else std::sort(imagesNumPointsVP.begin(), imagesNumPointsVP.end(), cmpIntDesc); }else{ if (mDesc == false) std::sort(imagesNumPointsVP.begin(), imagesNumPointsVP.end(), cmpStringAsc); else std::sort(imagesNumPointsVP.begin(), imagesNumPointsVP.end(), cmpStringDesc); } //Map containing for each image the order in the sorted list std::map<std::string,unsigned int> imagesOrderMap; for(std::size_t i = 0; i < imagesNumPointsVP.size(); ++i){ imagesOrderMap[imagesNumPointsVP[i].first] = i; } // The list of subcommands std::vector<std::string> aVSubcommands; // The list of subcommands dependencies (others subcommands which can NOT run in parallel) std::vector<std::vector< int > > aVRelatedSubcommandsIndexes; // We generate a subcommand per image for(std::size_t imageIndex = 0; imageIndex < imagesNumPointsVP.size(); ++imageIndex){ // the SubcommandIndex is the position of the master image in the list of sorted images (imagesNumPointsVP) int subcommandIndex = imageIndex; // Get the master image name and the list of related images const std::string & masterImageName = imagesNumPointsVP[imageIndex].first; const std::vector<string> & relatedImages = relatedImagesMap[masterImageName]; //Create a subcommand configuration structure cXml_ParamSubcommandTiepRed aParamSubcommand; // Create the list of related subcommands (commands that use as master images images used in the current subcommand) std::vector<int> relatedSubcommandsIndexes; // Fill-in the subcommand configuration structure aParamSubcommand.NumInit() = imagesNumPointsMap[masterImageName]; aParamSubcommand.NumSubcommands() = static_cast<int>(imagesNumPointsVP.size()); aParamSubcommand.Images().push_back(masterImageName); // Add master image to config relatedSubcommandsIndexes.push_back(static_cast<int>(imageIndex)); // Add the index of the current subcommand aParamSubcommand.MaxNumRelated() = maxNumRelated; for(std::size_t j = 0; j < relatedImages.size(); ++j){ const std::string & relatedImageName = relatedImages[j]; aParamSubcommand.Images().push_back(relatedImageName); // Add related image to config const unsigned int & relatedSubcommandIndex = imagesOrderMap[relatedImageName]; // Find out in which subcommand the related image will be master relatedSubcommandsIndexes.push_back(relatedSubcommandIndex); } // Save the file to XML MakeFileXML(aParamSubcommand,NameParamSubcommand(subcommandIndex,false)); MakeFileXML(aParamSubcommand,NameParamSubcommand(subcommandIndex,true)); // Generate the command line to process this image std::string aSubcommand = GlobArcArgv + " SubcommandIndex=" + ToString(subcommandIndex); // add to list to be executed aVSubcommands.push_back(aSubcommand); aVRelatedSubcommandsIndexes.push_back(relatedSubcommandsIndexes); } if (mExpSubCom == false){ // Execute the subcommands sequentially std::list<std::string> aLSubcommand(aVSubcommands.begin(), aVSubcommands.end()); cEl_GPAO::DoComInSerie(aLSubcommand); } else ExportSubcommands(aVSubcommands, aVRelatedSubcommandsIndexes); // Export them to run them in parallel using Noodles } void cAppliTiepRed::Exe() { if (mCallBack) DoReduce(); //If this is a child, we execute the reducing algorithm else GenerateSubcommands(); //If this is the parent, we generate the subcommands } int RedTieP_main(int argc,char **argv){ // Create the instance of the tool and executes it cAppliTiepRed * anAppli = new cAppliTiepRed(argc,argv); anAppli->Exe(); return EXIT_SUCCESS; } #else int RedTieP_main(int argc,char **argv){ return EXIT_SUCCESS; } #endif /*Footer-MicMac-eLiSe-25/06/2007 Ce logiciel est un programme informatique servant à la mise en correspondances d'images pour la reconstruction du relief. Ce logiciel est régi par la licence CeCILL-B soumise au droit français et respectant les principes de diffusion des logiciels libres. Vous pouvez utiliser, modifier et/ou redistribuer ce programme sous les conditions de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA sur le site "http://www.cecill.info". En contrepartie de l'accessibilité au code source et des droits de copie, de modification et de redistribution accordés par cette licence, il n'est offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, seule une responsabilité restreinte pèse sur l'auteur du programme, le titulaire des droits patrimoniaux et les concédants successifs. A cet égard l'attention de l'utilisateur est attirée sur les risques associés au chargement, à l'utilisation, à la modification et/ou au développement et à la reproduction du logiciel par l'utilisateur étant donné sa spécificité de logiciel libre, qui peut le rendre complexe à manipuler et qui le réserve donc à des développeurs et des professionnels avertis possédant des connaissances informatiques approfondies. Les utilisateurs sont donc invités à charger et tester l'adéquation du logiciel à leurs besoins dans des conditions permettant d'assurer la sécurité de leurs systèmes et ou de leurs données et, plus généralement, à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. Le fait que vous puissiez accéder à cet en-tête signifie que vous avez pris connaissance de la licence CeCILL-B, et que vous en avez accepté les termes. Footer-MicMac-eLiSe-25/06/2007*/
46.917808
264
0.714161
kikislater
ca99662d3c78af6d8914b66de7a7dde6f1da5138
408
hxx
C++
inc/html5xx.d/S.hxx
astrorigin/html5xx
cbaaeb232597a713630df7425752051036cf0cb2
[ "MIT" ]
null
null
null
inc/html5xx.d/S.hxx
astrorigin/html5xx
cbaaeb232597a713630df7425752051036cf0cb2
[ "MIT" ]
null
null
null
inc/html5xx.d/S.hxx
astrorigin/html5xx
cbaaeb232597a713630df7425752051036cf0cb2
[ "MIT" ]
null
null
null
/* * */ #ifndef _HTML5XX_S_HXX_ #define _HTML5XX_S_HXX_ #include "Element.hxx" #include "LineElement.hxx" using namespace std; namespace html { class S: public Element { public: S(): Element(Inline, "s") {} S( const string& text ): Element(Inline, "s") { put(new LineElement(text)); } }; } // end namespace html #endif // _HTML5XX_S_HXX_ // vi: set ai et sw=2 sts=2 ts=2 :
11.027027
34
0.627451
astrorigin
ca9cccc45fccf26be356907bdde968483f7c34e8
9,870
cpp
C++
C++/CNN3.cpp
FlorentCLMichel/CNN_in_Cpp
5568e71ec23c45be144a0673e2fc36d4c6f1c5de
[ "MIT" ]
null
null
null
C++/CNN3.cpp
FlorentCLMichel/CNN_in_Cpp
5568e71ec23c45be144a0673e2fc36d4c6f1c5de
[ "MIT" ]
null
null
null
C++/CNN3.cpp
FlorentCLMichel/CNN_in_Cpp
5568e71ec23c45be144a0673e2fc36d4c6f1c5de
[ "MIT" ]
null
null
null
#include <iostream> #include <fstream> #include <iomanip> #include <math.h> #include <vector> #include <random> #include <thread> #include <boost/multi_array.hpp> #include <boost/python.hpp> #include <boost/python/numpy.hpp> using namespace std; namespace p = boost::python; namespace np = boost::python::numpy; #include "Layers.cpp" // precision for floating numbers written in files constexpr int prec_write_file = 16; // define a standard normal distribution std::random_device rd; std::mt19937 gen(rd()); std::normal_distribution<> dis(0.,1.); // uniform dictribution std::uniform_real_distribution<> uni(0.,1.); struct double_and_int{ double d = 0.; int i = 0; }; class CNN3{ private: int num_CLs; // number of convolution layers int num_FCs; // number of FullCon layers int img_h_i; // image height int img_w_i; // image width int img_h; // image height before the fully connected layers int img_w; // image width before the fully connected layers int num_images; // number of images int num_labels; // number of different possible labels int n_channels; // number of channels vector<int> CL_size_filters; // Convolution layers: filter sizes vector<int> CL_num_filters; // Convolution layers: numbers of filters vector<int> MP_size; // Maxpool layers: pool sizes vector<int> FC_size; // FullCon layers: number of neurons // These four vectors will contain the layers vector<ConvLayer> CLs; // Convolution layers vector<ReLU> RLUs; // ReLU layers vector<MaxPool> MPs; // Maxpool layers vector<FullCon> FCs; // FullCon layers vector<SoftMax> SMs; // Softmax layers public: CNN3(){ np::initialize(); // required to create numpy arrays (otherwise leads to segmentation faults) } CNN3( int img_w_, // image width int img_h_, // image height int n_channels_, // number of channels p::list& CL_size_filters_, // list of filter sizes p::list& CL_num_filters_, // list of numbers of filters p::list& MP_size_, // list of pool sizes p::list& FC_size_, // list of FullCon sizes int num_labels_ // number of different possible labels ) { // initialization img_w_i = img_w_; img_h_i = img_h_; img_w = img_w_; img_h = img_h_; num_labels = num_labels_; n_channels = n_channels_; CL_size_filters = int_list_to_vector(CL_size_filters_); CL_num_filters = int_list_to_vector(CL_num_filters_); MP_size = int_list_to_vector(MP_size_); FC_size = int_list_to_vector(FC_size_); num_CLs = len(CL_size_filters_); num_FCs = len(FC_size_); num_images = n_channels; // tracks the number of images // build the layers for(int i=0; i<num_CLs; i++){ CLs.push_back(ConvLayer(CL_size_filters[i], num_images, CL_num_filters[i], gen, dis)); num_images = CL_num_filters[i]; img_w = img_w + 1 - CL_size_filters[i]; img_h = img_h + 1 - CL_size_filters[i]; RLUs.push_back(ReLU()); MPs.push_back(MaxPool(MP_size[i])); img_w = (int) img_w / MP_size[i]; img_h = (int) img_h / MP_size[i]; } long int n_inputs = num_images*img_h*img_w; for(int i=0; i<num_FCs; i++){ int n_neurons = FC_size[i]; FCs.push_back(FullCon(n_inputs, n_neurons, gen, dis)); n_inputs = n_neurons; } SMs.push_back(SoftMax(n_inputs, num_labels, gen, dis)); np::initialize(); // required to create numpy arrays (otherwise leads to segmentation faults) } // save the CNN parameters to a file void save(char* filename){ ofstream file; file.open(filename); file << fixed << setprecision(prec_write_file); file << num_CLs << sep_val << num_FCs << sep_val << n_channels << sep_val << img_w_i << sep_val << img_h_i << sep_val << img_w << sep_val << img_h << sep_val << num_images << sep_line; save_vector(CL_size_filters, file); save_vector(CL_num_filters, file); save_vector(MP_size, file); for(int i=0; i<num_CLs; i++){ CLs[i].save(file); RLUs[i].save(file); MPs[i].save(file); } for(int i=0; i<num_FCs; i++){ FCs[i].save(file); } SMs[0].save(file); file.close(); } // load the CNN parameters from a file void load(char* filename){ ifstream file; file.open(filename); char c; file >> num_CLs >> c >> num_FCs >> c >> n_channels >> c >> img_w_i >> c >> img_h_i >> c >> img_w >> c >> img_h >> c >> num_images >> c; CL_size_filters = load_vector<int>(file); CL_num_filters = load_vector<int>(file); MP_size = load_vector<int>(file); CLs.clear(); RLUs.clear(); CLs.clear(); SMs.clear(); for(int i=0; i<num_CLs; i++){ CLs.push_back(ConvLayer()); CLs[i].load(file); RLUs.push_back(ReLU()); RLUs[i].load(file); MPs.push_back(MaxPool()); MPs[i].load(file); } for(int i=0; i<num_FCs; i++){ FCs.push_back(FullCon()); FCs[i].load(file); } SMs.push_back(SoftMax()); SMs[0].load(file); file.close(); num_labels = SMs[0].output.size(); } // forward pass vector<double> forward(d3_array_type &input, double p_dropout = 0.){ // number and dimensions of images int nim = input.shape()[0]; int h = input.shape()[1]; int w = input.shape()[2]; if(h != img_h_i || w != img_w_i || nim != n_channels){ cout << "\nInvalid input dimensions!\n" << endl; } for(int i=0; i<num_CLs; i++){ d3_array_type output1 = CLs[i].forward(input); input.resize(boost::extents[output1.shape()[0]][output1.shape()[1]][output1.shape()[2]]); input = output1; d3_array_type output2 = MPs[i].forward(input); input.resize(boost::extents[output2.shape()[0]][output2.shape()[1]][output2.shape()[2]]); input = output2; d3_array_type output3 = RLUs[i].forward(input); input.resize(boost::extents[output3.shape()[0]][output3.shape()[1]][output3.shape()[2]]); input = output3; } vector<double> input_vec; auto input_shape = input.shape(); for(int i=0; i<num_images; i++){ for(int j=0; j<img_h; j++){ for(int k=0; k<img_w; k++){ input_vec.push_back(input[i][j][k]); } } } for(int i=0; i<num_FCs; i++){ input_vec = FCs[i].forward(input_vec, gen, uni, p_dropout); } return SMs[0].forward(input_vec); } // backpropagation void backprop(vector<double> d_L_d_out_i, double learn_rate){ d3_array_type d_L_d_in(boost::extents[num_images][img_h][img_w]); vector<double> d_L_d_in_vec = SMs[0].backprop(d_L_d_out_i, learn_rate); for(int i=num_FCs-1; i>=0; i--){ d_L_d_in_vec = FCs[i].backprop(d_L_d_in_vec, learn_rate); } for(int i=0; i<num_images; i++){ for(int j=0; j<img_h; j++){ for(int k=0; k<img_w; k++){ d_L_d_in[i][j][k] = d_L_d_in_vec[i*img_h*img_w + j*img_w + k]; } } } for(int i=num_CLs-1; i>=0; i--){ d3_array_type d_L_d_in3 = RLUs[i].backprop(d_L_d_in); auto shape = d_L_d_in3.shape(); d_L_d_in.resize(boost::extents[shape[0]][shape[1]][shape[2]]); d_L_d_in = d_L_d_in3; d3_array_type d_L_d_in2 = MPs[i].backprop(d_L_d_in); shape = d_L_d_in2.shape(); d_L_d_in.resize(boost::extents[shape[0]][shape[1]][shape[2]]); d_L_d_in = d_L_d_in2; d3_array_type d_L_d_in1 = CLs[i].backprop(d_L_d_in, learn_rate); shape = d_L_d_in1.shape(); d_L_d_in.resize(boost::extents[shape[0]][shape[1]][shape[2]]); d_L_d_in = d_L_d_in1; } } // loss function and accuracy (1 if correct answer, 0 otherwise) double_and_int loss_acc(vector<double> &output, int label){ double_and_int results; results.d = -log(output[label]); results.i = 1; for(int i=0; i<output.size(); i++){ if(output[i] > output[label]){ results.i = 0; } } return results; } // Completes a training step on the image 'image' with label 'label'. // Returns the corss-entropy and accuracy. double_and_int train(d3_array_type image, int label, double learn_rate = 0.005, double p_dropout = 0.) { // forward pass vector<double> output_forward = forward(image, p_dropout); // gradient of the loss function with respect to the output vector<double> d_L_d_out; for(int i=0; i<num_labels; i++){ d_L_d_out.push_back(0.); } d_L_d_out[label] = -1./output_forward[label]; // backpropagation backprop(d_L_d_out, learn_rate); // return loss and accuracy return loss_acc(output_forward, label); } // full forward propagation - Python wrapper // input: 2d numpy array np::ndarray forward_python(np::ndarray image){ d3_array_type input = d3_numpy_to_multi_array(image); return vector_to_numpy(forward(input)); } // forward - return loss and accuracy - Python wrapper p::list forward_la_python(np::ndarray image, int label){ d3_array_type input = d3_numpy_to_multi_array(image); vector<double> output = forward(input); double_and_int results = loss_acc(output, label); p::list results_p; results_p.append(results.d); results_p.append(results.i); return results_p; } // full backpropagation - Python wrapper void backprop_python(np::ndarray d_L_d_out, double learn_rate){ backprop(numpy_to_vector(d_L_d_out), learn_rate); } // train - Python wrapper p::list train_python(np::ndarray image, int label, double learn_rate, double p_dropout) { double_and_int results; results = train(d3_numpy_to_multi_array(image), label, learn_rate, p_dropout); p::list results_p; results_p.append(results.d); results_p.append(results.i); return results_p; } }; BOOST_PYTHON_MODULE(CNN3) { p::class_<CNN3>("CNN3", p::init<int, int, int, p::list&, p::list&, p::list&, p::list&, int>()) .def(p::init<>()) .def("forward", &CNN3::forward_python) .def("backprop", &CNN3::backprop_python) .def("train", &CNN3::train_python) .def("save", &CNN3::save) .def("load", &CNN3::load) .def("forward_la", &CNN3::forward_la_python) ; }
30.276074
187
0.659574
FlorentCLMichel
ca9de6ecb590ee2ddfcdb4aebd1ab84d8b159a27
13,726
cpp
C++
src/bert/bertMisc.cpp
mjziebarth/gimli
196ac4d6dd67e0326cccc44a87b367f64051e490
[ "Apache-2.0" ]
3
2021-07-10T00:56:59.000Z
2022-02-17T12:43:38.000Z
src/bert/bertMisc.cpp
ivek1312/gimli
5fafebb7c96dd0e04e2616df402fa27a01609d63
[ "Apache-2.0" ]
null
null
null
src/bert/bertMisc.cpp
ivek1312/gimli
5fafebb7c96dd0e04e2616df402fa27a01609d63
[ "Apache-2.0" ]
1
2022-03-29T04:28:40.000Z
2022-03-29T04:28:40.000Z
/****************************************************************************** * Copyright (C) 2006-2019 by the resistivity.net development team * * Carsten Rücker carsten@resistivity.net * * * * 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 "bertMisc.h" #include "bertDataContainer.h" #include "electrode.h" #include <mesh.h> #include <node.h> #include <numericbase.h> namespace GIMLI{ void initKWaveList(const Mesh & mesh, RVector & kValues, RVector & weights, bool verbose){ std::vector < RVector3 > sources; initKWaveList(mesh, kValues, weights, sources, verbose); } void initKWaveList(const Mesh & mesh, RVector & kValues, RVector & weights, const std::vector < RVector3 > & sources, bool verbose){ kValues.clear(); weights.clear(); if (mesh.dim() == 3){ kValues.resize(1, 0.0); weights.resize(1, 1.0); return ; } R3Vector sourcesPos; if (sources.empty()){ sourcesPos = mesh.positions(mesh.findNodesIdxByMarker(MARKER_NODE_ELECTRODE)); if (verbose) std::cout << "No sensors given for initializing the k wave list .. " " mesh contains " << sourcesPos.size() << " nodes with marker=-99" << std::endl; } else sourcesPos = sources; int nElecs = sourcesPos.size(); double rMin = MAX_DOUBLE, rMax = -MAX_DOUBLE, dist = 0; if (nElecs < 2) { std::cerr << WHERE_AM_I << " Warning! No sources found, taking some defaults" << std::endl; verbose = true; rMin = 1.0; rMax = (mesh.xmax() - mesh.xmin()) / 20.0; } else { for (int i = 0; i < nElecs; i ++){ for (int j = i + 1; j < nElecs; j ++){ dist = sourcesPos[i].dist(sourcesPos[j]); rMin = std::min(dist, rMin); rMax = std::max(dist, rMax); } } } rMin /= 2.0; rMax *= 2.0; if (verbose) std::cout << "rMin = " << rMin << ", rMax = " << rMax << std::endl; uint nGauLegendre = std::max(static_cast< int >(floor(6.0 * std::log10(rMax / rMin))), 4) ; uint nGauLaguerre = 4; //nGauLegendre = 10; nGauLaguerre = 10; initKWaveList(rMin, rMax, nGauLegendre, nGauLaguerre, kValues, weights); if (verbose) std::cout << "NGauLeg + NGauLag for inverse Fouriertransformation: " << nGauLegendre << " + " << nGauLaguerre << std::endl; } void initKWaveList(double rMin, double rMax, int nGauLegendre, int nGauLaguerre, RVector & kValues, RVector & weights){ RVector k, w; double k0 = 1.0 / (2.0 * rMin); GaussLegendre(0.0, 1.0, nGauLegendre, k, w); RVector kLeg(k0 * k * k); RVector wLeg(2.0 * k0 * k * w / PI); GaussLaguerre(nGauLaguerre, k, w); RVector kLag(k0 * (k + 1.0)); RVector wLag(k0 * exp(k) * w / PI); kValues = cat(kLeg, kLag); weights = cat(wLeg, wLag); // kValues.resize(nGauLegendre + nGauLaguerre); // weights.resize(nGauLegendre + nGauLaguerre); // GaussLegendre(0.0, 1.0, nGauLegendre, k, w); // for (int i = 0; i < nGauLegendre; i++){ // //** BackSubstitution der Gauss Integration // kValues[i] = (k0 * k[i] * k[i]); // //** BackSubst. GewichtsTERM Gauss Integration // weights[i] = (2.0 * k0 * k[i] * w[i] / PI); // } // GaussLaguerre(nGauLaguerre, k, w); // for (int i = 0; i < nGauLaguerre; i++){ // //** BackSubstitution der Gauss Integration // kValues[nGauLegendre + i] = (k0 * (k[i] + 1)); // //** BackSubst. GewichtsTERM Gauss Integration // weights[nGauLegendre + i] = (k0 * std::exp(k[i]) * w[i] / PI); // } // // std::cout << kValues << std::endl; // std::cout << cat(kLeg, kLag) << std::endl; // std::cout << weights << std::endl; // std::cout << cat(wLeg, wLag) << std::endl; } RVector geometricFactors(const DataContainerERT & data, int dim, bool forceFlatEarth){ RVector k(data.size()); if (dim == 2){ DataContainerERT tmp(data); for (Index i = 0; i < data.sensorCount(); i ++){ RVector3 p(tmp.sensorPosition(i)); // if y differ from 0 .. we assume its x|y -> 2D .. so switch y->z if (p[1] != 0.0){ p[2] = p[1]; p[1] = 0.; } tmp.setSensorPosition(i, p); } return geometricFactors(tmp, 3, forceFlatEarth); } if (forceFlatEarth){ DataContainerERT tmp(data); for (Index i = 0; i < data.sensorCount(); i ++){ RVector3 p(tmp.sensorPosition(i)); p[2] = 0.0; tmp.setSensorPosition(i, p); } return geometricFactors(tmp, false); } else { for (Index i = 0; i < k.size(); i ++){ double uam = 0.0, ubm = 0.0, uan = 0.0, ubn = 0.0; int a = data("a")[i]; int b = data("b")[i]; int m = data("m")[i]; int n = data("n")[i]; if (a > -1 && m > -1) uam = exactDCSolution(data.sensorPosition(a), data.sensorPosition(m)); if (b > -1 && m > -1) ubm = exactDCSolution(data.sensorPosition(b), data.sensorPosition(m)); if (a > -1 && n > -1) uan = exactDCSolution(data.sensorPosition(a), data.sensorPosition(n)); if (b > -1 && n > -1) ubn = exactDCSolution(data.sensorPosition(b), data.sensorPosition(n)); // std::cout << data(i).eA() << " " << data(i).eB() << " " << data(i).eM() // << " " << data(i).eN() << std::endl; // std::cout << uam << " " << ubm << " " << uan << " " << ubn << std::endl; k[i] = 1.0 / (uam - ubm - uan + ubn); } } return k; } double exactDCSolution(const RVector3 & pot, const RVector3 & src){ //pot, src, k, surfaceZ, fallback return exactDCSolution(pot, src, 0.0, 0.0, 1.0); } //#include <boost/math/special_functions/detail/bessel_k0.hpp> //#include <boost/math/tr1.hpp> double exactDCSolution(const RVector3 & v, const RVector3 & source, double k, double surfaceZ, double fallback){ double r = v.dist(source); if (r < TOLERANCE) return fallback; uint dim = 3; if (k > 0) dim = 2; RVector3 sourceMirror(source); sourceMirror[dim - 1] = 2.0 * surfaceZ - source[dim - 1]; if (surfaceZ == -MAX_DOUBLE || std::isnan(surfaceZ)){// ** asuming fullspace if (k == 0.0) { //** 3D fullspace return 1.0 / (4.0 * PI * r); } else { // std::cout<< "Fullspace" << " " << surfaceZ << std::endl; return (besselK0(r * k)) / (2.0 * PI); } } else { // halfspace with mirrorspace if (k == 0.0) { //** 3D mirrorspace // std::cout<< "Mirrorspace" << " " << sourceMirror // << " s:" << source // << " v:" << v // << " r:" << r << "rm:" << v.distance(sourceMirror) << std::endl; return (1.0 / r + 1.0 / v.distance(sourceMirror)) / (4.0 * PI) ; } else { //** just for performance issues read this again if (source == sourceMirror){ // std::cout<< "FlathEarth" << std::endl; //return std::tr1::cyl_bessel_k(0, r*k)/ (PI); // fac.3 slower return (besselK0(r * k)) / (PI); } else { // std::cout<< "Mirror" << std::endl; return (besselK0(r * k) + besselK0(v.distance(sourceMirror) * k)) / (2.0 * PI); } } } return fallback; } RVector exactDCSolution(const Mesh & mesh, const RVector3 & src, double k, double surfaceZ){ RVector solution(mesh.nodeCount()); double fallback = 0.0; uint i = 0; for (std::vector< Node * >::const_iterator it = mesh.nodes().begin(); it != mesh.nodes().end(); it ++){ solution[i] = exactDCSolution((*it)->pos(), src, k, surfaceZ, fallback); i++; } /* for (uint i = 0; i < mesh.nodeCount(); i ++){ solution[i] = exactDCSolution(mesh.node(i).pos(), src, k, surfaceZ, fallback); }*/ return solution; } RVector exactDCSolution(const Mesh & mesh, const Node * nA, const Node * nB, double k, double surfaceZ){ RVector solution; solution = exactDCSolution(mesh, nA->pos(), k, surfaceZ); solution -= exactDCSolution(mesh, nB->pos(), k, surfaceZ); return solution; } RVector exactDCSolution(const Mesh & mesh, const ElectrodeShape * elec, double k, double surfaceZ, bool setSingValue){ RVector solution(exactDCSolution(mesh, elec->pos(), k , surfaceZ)); if (setSingValue) elec->setSingValue(solution, 0.0, k); return solution; } RVector exactDCSolution(const Mesh & mesh, int aID, int bID, double k, double surfaceZ){ RVector solution(exactDCSolution(mesh, aID, k, surfaceZ)); if (bID > -1) solution -= exactDCSolution(mesh, bID, k, surfaceZ); return solution; } RVector exactDCSolution(const Mesh & mesh, int aID, double k, double surfaceZ){ return exactDCSolution(mesh, mesh.node(aID).pos(), k, surfaceZ); } int countKWave(const Mesh & mesh){ RVector kValues, weights; initKWaveList(mesh, kValues, weights, false); return kValues.size(); } void DCErrorEstimation(DataContainerERT & data, double errPerc, double errVolt, double defaultCurrent, bool verbose){ if (verbose) std::cout << "Estimate error: " << errPerc << "% + " << errVolt << "V" << std::endl; RVector voltage(abs(data("u"))); if (min(voltage) == 0.0) { voltage = abs(RVector(data("rhoa") / data("k"))); if (min(data("i")) > 0.0) voltage = voltage * data("i"); else voltage = voltage * defaultCurrent; } if (verbose) std::cout << "u min = " << min(voltage) << " V max = " << max(voltage) << " V" << std::endl; data.set("err", errVolt / voltage + errPerc / 100.0); } double DCParaDepth(const DataContainerERT & data){ double quasiInf = 1e5; RVector amq(data.size(), quasiInf), anq(data.size(), quasiInf); RVector bmq(data.size(), quasiInf), bnq(data.size(), quasiInf); for (size_t i = 0; i < data.size(); i ++){ int a = data("a")[i]; int b = data("b")[i]; int m = data("m")[i]; int n = data("n")[i]; if (a > -1 && m > -1) amq[i] = data.sensorPosition(a).distSquared(data.sensorPosition(m)); if (b > -1 && m > -1) bmq[i] = data.sensorPosition(b).distSquared(data.sensorPosition(m)); if (a > -1 && n > -1) anq[i] = data.sensorPosition(a).distSquared(data.sensorPosition(n)); if (b > -1 && n > -1) bnq[i] = data.sensorPosition(b).distSquared(data.sensorPosition(n)); } RVector scale((2.0 * PI) / geometricFactors(data)); RVector tmp(data.size()); double depth = 0.1, sens = 0.0; double depthQ = 4.0 * depth* depth; while (sens < 0.95){ depth = depth * 1.1; depthQ = 4.0 * depth * depth; tmp = 1.0 / sqrt(bnq + depthQ) - 1.0 / sqrt(bmq + depthQ) - 1.0 / sqrt(anq + depthQ) + 1.0 / sqrt(amq + depthQ); sens = sum (1.0 - tmp / scale) / data.size(); } return depth; } void setDefaultBERTBoundaryConditions(Mesh & mesh){ BoundingBox bbox(mesh.boundingBox()); mesh.createNeighbourInfos(); for (uint i = 0; i < mesh.boundaryCount(); i ++){ RVector3 cen(mesh.boundary(i).center()); for (uint dim = 0; dim < mesh.dimension(); dim++){ if (cen[dim] == bbox.min()[dim] || cen[dim] == bbox.max()[dim]){ mesh.boundary(i).setMarker(MARKER_BOUND_MIXED); } } if (cen[mesh.dimension() -1] == bbox.max()[mesh.dimension()-1]){ mesh.boundary(i).setMarker(MARKER_BOUND_HOMOGEN_NEUMANN); } } } void setAllNeumannBoundaryConditions(Mesh & mesh){ BoundingBox bbox(mesh.boundingBox()); mesh.createNeighbourInfos(); for (uint i = 0; i < mesh.boundaryCount(); i ++){ RVector3 cen(mesh.boundary(i).center()); for (uint dim = 0; dim < mesh.dimension(); dim++){ if (cen[dim] == bbox.min()[dim] || cen[dim] == bbox.max()[dim]){ mesh.boundary(i).setMarker(MARKER_BOUND_HOMOGEN_NEUMANN); } } } } RVector prepExportPotentialData(const RVector & data, double logdrop){ RVector tmp(data); for (uint i = 0; i < tmp.size(); i ++) { tmp[i] =std::fabs(tmp[i] / logdrop); if (tmp[i] < 1.0) tmp[i] = 1.0; } tmp = log10(tmp); tmp /= max(abs(tmp)) * sign(data); return tmp; } }
36.997305
140
0.52681
mjziebarth
ca9e27f73e2d659c8cf25b4f56db6533c9ee1bd8
18,611
cxx
C++
Remoting/Views/vtkSMCinemaVolumetricImageExtractWriterProxy.cxx
xj361685640/ParaView
0a27eef5abc5a0c0472ab0bc806c4db881156e64
[ "Apache-2.0", "BSD-3-Clause" ]
815
2015-01-03T02:14:04.000Z
2022-03-26T07:48:07.000Z
Remoting/Views/vtkSMCinemaVolumetricImageExtractWriterProxy.cxx
xj361685640/ParaView
0a27eef5abc5a0c0472ab0bc806c4db881156e64
[ "Apache-2.0", "BSD-3-Clause" ]
9
2015-04-28T20:10:37.000Z
2021-08-20T18:19:01.000Z
Remoting/Views/vtkSMCinemaVolumetricImageExtractWriterProxy.cxx
xj361685640/ParaView
0a27eef5abc5a0c0472ab0bc806c4db881156e64
[ "Apache-2.0", "BSD-3-Clause" ]
328
2015-01-22T23:11:46.000Z
2022-03-14T06:07:52.000Z
/*========================================================================= Program: ParaView Module: vtkSMCinemaVolumetricImageExtractWriterProxy.cxx Copyright (c) Kitware, Inc. All rights reserved. See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "vtkSMCinemaVolumetricImageExtractWriterProxy.h" #include "vtkCamera.h" #include "vtkMath.h" #include "vtkObjectFactory.h" #include "vtkPVSession.h" #include "vtkSMContextViewProxy.h" #include "vtkSMExtractsController.h" #include "vtkSMPVRepresentationProxy.h" #include "vtkSMPropertyHelper.h" #include "vtkSMRenderViewProxy.h" #include "vtkSMSaveScreenshotProxy.h" #include "vtkSMTransferFunctionManager.h" #include "vtkSMTransferFunctionProxy.h" #include <vtksys/SystemTools.hxx> #include <algorithm> #include <cassert> #include <sstream> #include <vector> namespace { bool IsClose(double v1, double v2, double tol) { return std::abs(v1 - v2) < tol; } // Based on algorithm at https://en.m.wikipedia.org/wiki/Combinatorial_number_system to figure // out which functions are active for this local_option. This is a recursive method. void AppendWhichFunctions( int local_option, int number_of_options, std::vector<int>& which_functions) { int counter = number_of_options - 1; int number_of_options_this_level = 0; int number_of_previous_options = 0; while (number_of_options_this_level <= local_option) { counter++; number_of_previous_options = number_of_options_this_level; vtkTypeInt64 tmp = vtkMath::Factorial(counter) / (vtkMath::Factorial(number_of_options) * vtkMath::Factorial(counter - number_of_options)); number_of_options_this_level = static_cast<int>(tmp); } if (counter > 0) { which_functions.push_back(counter - 1); } if (number_of_options > 0) { AppendWhichFunctions( local_option - number_of_previous_options, number_of_options - 1, which_functions); } } std::vector<double> GetOpacityTransferFunction(bool full_combination, int number_of_functions, int number_of_opacity_levels, int maximum_number_of_functions, int option, double* lut_range, double max_opacity_value) { if (full_combination) { if (number_of_opacity_levels > 1) { std::vector<int> opacity_levels; std::vector<double> scales; std::vector<int> which_triangles; int my_sum = 0; for (int r = 1; r < maximum_number_of_functions; r++) // ACB took out the +1 here { // numcombinationsthislevel is the number of combinations of functions only int num_combinations_this_level = vtkMath::Factorial(number_of_functions) / (vtkMath::Factorial(r) * vtkMath::Factorial(number_of_functions - r)); // num_options_this_level is the total number of options for the given number of active // functions // at this level. int num_options_this_level = num_combinations_this_level * std::pow(number_of_opacity_levels, r); if (my_sum + num_options_this_level > option) { // r is the number of non-zero functions int local_option = option - my_sum; // option for this number of functions int local_function_option = local_option / std::pow(number_of_opacity_levels, r); AppendWhichFunctions(local_function_option, r, which_triangles); std::reverse( which_triangles.begin(), which_triangles.end()); // ids were in highest to lowest order int local_opacity_option = local_option % static_cast<int>(std::pow(number_of_opacity_levels, r)); for (int i = 0; i < r; i++) { int opacity_level = local_opacity_option % number_of_opacity_levels; opacity_levels.push_back(opacity_level); double scale = max_opacity_value * static_cast<double>(1 + opacity_level) / number_of_opacity_levels; scales.push_back(scale); local_opacity_option = local_opacity_option / number_of_opacity_levels; } break; } my_sum += num_options_this_level; } // build up the opacity transfer functions (otf) now that we know which ones are active for // this option. // build the otf from smallest field value to largest field value double total_range = (lut_range[1] - lut_range[0]); double triangle_half_range = total_range / (number_of_functions - 1); std::vector<double> full_otf; // easiest algorithm is to add in all of the values and then remove unneeded duplicates int counter = 0; for (int i = 0; i < number_of_functions; i++) { if (std::find(which_triangles.begin(), which_triangles.end(), i) != which_triangles.end()) { full_otf.insert( full_otf.end(), { lut_range[0] + i * triangle_half_range, scales[counter], 0.5, 0 }); counter++; } else { full_otf.insert(full_otf.end(), { lut_range[0] + i * triangle_half_range, 0., 0.5, 0 }); } } std::vector<double> otf = { full_otf[0], full_otf[1], full_otf[2], full_otf[3] }; for (int i = 1; i < number_of_functions - 1; i++) { // if this one isn't the average of the one before and after in the full_otf then we need to // add it our // merged otf. the average works here since the points are equally spaced. double ave = 0.5 * (full_otf[(i - 1) * 4 + 1] + full_otf[(i + 1) * 4 + 1]); if (!::IsClose(ave, full_otf[i * 4 + 1], .001)) { // otf.push_back(full_otf[i*4:(i+1)*4]); // otf.push_back(fullotf[-4:]); otf.insert(otf.end(), &full_otf[i * 4], &full_otf[(i + 1) * 4]); otf.insert(otf.end(), full_otf.end() - 4, full_otf.end()); } } otf.insert(otf.end(), full_otf.end() - 4, full_otf.end()); return otf; // end full combination with number of opacity levels > 1 } double scale = max_opacity_value; // ACB had to make this change -- make it elsewhere too... std::vector<int> which_triangles; int my_sum = 0; for (int r = 1; r < maximum_number_of_functions; r++) { int num_combinations_this_level = vtkMath::Factorial(number_of_functions) / (vtkMath::Factorial(r) * vtkMath::Factorial(number_of_functions - r)); if (my_sum + num_combinations_this_level > option) { // r is the number of non-zero functions int local_option = option - my_sum; // option for this number of functions AppendWhichFunctions(local_option, r, which_triangles); std::reverse( which_triangles.begin(), which_triangles.end()); // ids were in highest to lowest order break; } my_sum += num_combinations_this_level; } // build up the opacity transfer functions (otf) now that we know which ones are active for this // option. // build the otf from smallest field value to largest field value double total_range = lut_range[1] - lut_range[0]; double triangle_half_range = total_range / (number_of_functions - 1); std::vector<double> full_otf; // easiest algorithm is to add in all of the values and then remove unneeded duplicates for (int i = 0; i < number_of_functions; i++) { if (std::find(which_triangles.begin(), which_triangles.end(), i) != which_triangles.end()) { full_otf.insert(full_otf.end(), { lut_range[0] + i * triangle_half_range, scale, 0.5, 0 }); } else { full_otf.insert(full_otf.end(), { lut_range[0] + i * triangle_half_range, 0., 0.5, 0 }); } } std::vector<double> otf = { full_otf[0], full_otf[1], full_otf[2], full_otf[3] }; for (int i = 1; i < number_of_functions - 1; i++) { // if this one isn't the same as the one before in the full_otf and after we need to add it // our // merged otf if (full_otf[(i - 1) * 4 + 1] != full_otf[i * 4 + 1] || full_otf[(i + 1) * 4 + 1] != full_otf[i * 4 + 1]) { otf.insert(otf.end(), &full_otf[i * 4], &full_otf[(i + 1) * 4]); } } otf.insert(otf.end(), full_otf.end() - 4, full_otf.end()); return otf; } else { // this is for only a single function that's ever active at a time with all of the // others inactive // numbering scheme is that the first number of opacity levels are for the triangle // at the lowest field value, then number of opacity levels for the next lowest // triangle field value, ... int opacity_level = 1; double scale = max_opacity_value; if (number_of_opacity_levels > 1) { opacity_level = option % number_of_opacity_levels; scale = max_opacity_value * static_cast<double>(1 + opacity_level) / number_of_opacity_levels; } double total_range = lut_range[1] - lut_range[0]; int which_triangle = option / number_of_opacity_levels; std::vector<double> otf; if (which_triangle == 0) { // half triangle with the maximum opacity at the minimum field value otf.insert(otf.end(), { lut_range[0], scale, 0.5, 0, total_range / (number_of_functions - 1) + lut_range[0], 0, 0.5, 0, lut_range[1], 0, 0.5, 0 }); } else if (which_triangle == number_of_functions - 1) { // half triangle with the maximum opacity at the maximum field value otf.insert(otf.end(), { lut_range[0], 0, 0.5, 0, lut_range[1] - total_range / (number_of_functions - 1), 0, 0.5, 0, lut_range[1], scale, 0.5, 0 }); } else { // full triangle with the maximum opacity between the minimum and maximum field value. // the triangle should also be essentially zero between the minimum and maximum field value. if (which_triangle != 1) { otf.insert(otf.end(), { lut_range[0], 0, 0.5, 0 }); } otf.insert(otf.end(), { lut_range[0] + (which_triangle - 1) * total_range / (number_of_functions - 1), 0, 0.5, 0, lut_range[0] + which_triangle * total_range / (number_of_functions - 1), scale, 0.5, 0, lut_range[0] + (which_triangle + 1) * total_range / (number_of_functions - 1), 0, 0.5, 0 }); if (which_triangle != number_of_functions - 2) { otf.insert(otf.end(), { lut_range[1], 0, 0.5, 0 }); } } return otf; } vtkGenericWarningMacro("vtkSMCinemaVolumetricImageExtractWriterProxy: ERROR couldn't compute a " "opacity transfer function"); std::vector<double> otf; return otf; } } vtkStandardNewMacro(vtkSMCinemaVolumetricImageExtractWriterProxy); //---------------------------------------------------------------------------- vtkSMCinemaVolumetricImageExtractWriterProxy::vtkSMCinemaVolumetricImageExtractWriterProxy() = default; //---------------------------------------------------------------------------- vtkSMCinemaVolumetricImageExtractWriterProxy::~vtkSMCinemaVolumetricImageExtractWriterProxy() = default; //---------------------------------------------------------------------------- bool vtkSMCinemaVolumetricImageExtractWriterProxy::WriteInternal( vtkSMExtractsController* extractor, const SummaryParametersT& params) { auto writer = vtkSMSaveScreenshotProxy::SafeDownCast(this->GetSubProxy("Writer")); assert(writer != nullptr); auto view = vtkSMViewProxy::SafeDownCast(vtkSMPropertyHelper(writer, "View").GetAsProxy()); assert(view != nullptr); // if we're doing cinema volume rendering we save the original transfer functions as well std::vector<double> old_otf, old_ctf; vtkSMTransferFunctionProxy* colorTFProxy = nullptr; vtkSMTransferFunctionProxy* opacityTFProxy = nullptr; std::vector<double> otf_points, ctf_rgbpoints; int number_of_otfs = 1; int number_of_functions = vtkSMPropertyHelper(this, "Functions").GetAsInt(); int number_of_opacity_levels = vtkSMPropertyHelper(this, "OpacityLevels").GetAsInt(); bool single_function_only = vtkSMPropertyHelper(this, "SingleFunctionOnly").GetAsInt() != 0; int maximum_number_of_functions = vtkSMPropertyHelper(this, "MaximumNumberOfFunctions").GetAsInt(); double maximum_opacity_value = vtkSMPropertyHelper(this, "MaximumOpacityValue").GetAsDouble(); bool specified_range = vtkSMPropertyHelper(this, "SpecifiedRange").GetAsInt() != 0; double lut_range[2] = { 0, 1 }; bool exportTransferFunctions = vtkSMPropertyHelper(this, "ExportTransferFunctions").GetAsInt() != 0; if (specified_range) { lut_range[0] = vtkSMPropertyHelper(this, "Range").GetAsDouble(0); lut_range[1] = vtkSMPropertyHelper(this, "Range").GetAsDouble(1); } if (single_function_only) { number_of_otfs = number_of_functions * number_of_opacity_levels; } else { // the total number of combinations is the sum of the number of active functions which is // "r" below and at // https://www.calculator.net/permutation-and-combination-calculator.html?cnv=6&crv=6&x=76&y=20. // "n" is the number_of_functions. for not single_function_only we have to do our sum over the // entire range of active // functions, e.g. only 1 active functions, then two active functions, ... // for when number_of_opacity_levels is greater than 1 that adds number_of_opacity_levels**r // for each combination // of functions if (maximum_number_of_functions > number_of_functions) { maximum_number_of_functions = number_of_functions; } int sum = 0; for (int r = 1; r < maximum_number_of_functions; r++) { vtkTypeInt64 tmp = vtkMath::Factorial(number_of_functions) / (vtkMath::Factorial(r) * vtkMath::Factorial(number_of_functions - r)); sum += std::pow(number_of_opacity_levels, r) * static_cast<int>(tmp); } number_of_otfs = sum; } bool status = true; SummaryParametersT tparams = params; for (int otf_index = 0; otf_index < number_of_otfs && status == true; otf_index++) { if (!colorTFProxy && !opacityTFProxy) { vtkSMPropertyHelper helper(view, "Representations"); for (unsigned int cc = 0, max = helper.GetNumberOfElements(); cc < max; ++cc) { if (vtkSMPVRepresentationProxy* repr = vtkSMPVRepresentationProxy::SafeDownCast(helper.GetAsProxy(cc))) { if (vtkSMPropertyHelper(repr, "Visibility", /*quiet*/ true).GetAsInt() == 1) // && (!reprType || (reprType && !strcmp(repr->GetXMLName(), reprType)))) { // repr->SetRepresentationType("Volume"); setter but not getter available vtkSMPropertyHelper helper2(repr, "Representation"); auto the_type = helper2.GetAsString(); if (the_type && strcmp(the_type, "Volume") == 0) { if (opacityTFProxy == nullptr && colorTFProxy == nullptr) { vtkSMPropertyHelper color_array_helper(repr, "ColorArrayName"); std::string color_array_name = color_array_helper.GetInputArrayNameToProcess(); vtkNew<vtkSMTransferFunctionManager> mgr; colorTFProxy = vtkSMTransferFunctionProxy::SafeDownCast(mgr->GetColorTransferFunction( color_array_name.c_str(), repr->GetSessionProxyManager())); opacityTFProxy = vtkSMTransferFunctionProxy::SafeDownCast(mgr->GetOpacityTransferFunction( color_array_name.c_str(), repr->GetSessionProxyManager())); } otf_points = vtkSMPropertyHelper(opacityTFProxy, "Points").GetDoubleArray(); ctf_rgbpoints = vtkSMPropertyHelper(colorTFProxy, "RGBPoints").GetDoubleArray(); if (!specified_range) { lut_range[0] = ctf_rgbpoints[0]; lut_range[1] = ctf_rgbpoints[ctf_rgbpoints.size() - 4]; } if (old_otf.empty()) { old_otf = otf_points; } if (old_ctf.empty()) { old_ctf = ctf_rgbpoints; } break; } } } } } // if (!colorTFProxy && !opacityTFProxy) otf_points = GetOpacityTransferFunction(!single_function_only, number_of_functions, number_of_opacity_levels, maximum_number_of_functions, otf_index, lut_range, maximum_opacity_value); vtkSMPropertyHelper otf_helper(opacityTFProxy, "Points"); otf_helper.SetNumberOfElements(static_cast<unsigned int>(otf_points.size())); otf_helper.Set(otf_points.data(), static_cast<unsigned int>(otf_points.size())); opacityTFProxy->UpdateVTKObjects(); if (exportTransferFunctions) { std::ostringstream str; str << "/cinemavolume_" << otf_index << ".json"; std::string name = vtksys::SystemTools::JoinPath({ extractor->GetRealExtractsOutputDirectory(), str.str() }); vtkSMTransferFunctionProxy::ExportTransferFunction( colorTFProxy, opacityTFProxy, "cinemavolume", name.c_str()); } tparams["opacity_transfer_function"] = std::to_string(otf_index); status = this->Superclass::WriteInternal(extractor, tparams); } if (!old_otf.empty()) { vtkSMPropertyHelper otf_helper(opacityTFProxy, "Points"); otf_helper.SetNumberOfElements(static_cast<unsigned int>(old_otf.size())); otf_helper.Set(old_otf.data(), static_cast<unsigned int>(old_otf.size())); opacityTFProxy->UpdateVTKObjects(); } if (!old_ctf.empty()) { vtkSMPropertyHelper ctf_helper(colorTFProxy, "RGBPoints"); ctf_helper.SetNumberOfElements(static_cast<unsigned int>(old_ctf.size())); ctf_helper.Set(old_ctf.data(), static_cast<unsigned int>(old_ctf.size())); colorTFProxy->UpdateVTKObjects(); } return status; } //---------------------------------------------------------------------------- const char* vtkSMCinemaVolumetricImageExtractWriterProxy::GetShortName(const std::string& key) const { if (key == "opacity_transfer_function") { return "otf"; } return this->Superclass::GetShortName(key); } //---------------------------------------------------------------------------- void vtkSMCinemaVolumetricImageExtractWriterProxy::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); }
40.993392
100
0.643544
xj361685640
ca9e47185b67d98bf48b3fc8eb29a824c8b54afb
55,374
cpp
C++
node/Salsa20.cpp
sundys/ZeroTierOne
269501eaa0c22bdc402e689b0d061325fb6ddbce
[ "RSA-MD" ]
8,205
2015-01-02T16:34:03.000Z
2022-03-31T18:18:28.000Z
node/Salsa20.cpp
sundys/ZeroTierOne
269501eaa0c22bdc402e689b0d061325fb6ddbce
[ "RSA-MD" ]
1,401
2015-01-01T05:45:53.000Z
2022-03-31T14:00:00.000Z
node/Salsa20.cpp
sundys/ZeroTierOne
269501eaa0c22bdc402e689b0d061325fb6ddbce
[ "RSA-MD" ]
1,243
2015-01-09T07:30:49.000Z
2022-03-31T12:36:48.000Z
/* * Based on public domain code available at: http://cr.yp.to/snuffle.html * * Modifications and C-native SSE macro based SSE implementation by * Adam Ierymenko <adam.ierymenko@zerotier.com>. * * Since the original was public domain, this is too. */ #include "Constants.hpp" #include "Salsa20.hpp" #define ROTATE(v,c) (((v) << (c)) | ((v) >> (32 - (c)))) #define XOR(v,w) ((v) ^ (w)) #define PLUS(v,w) ((uint32_t)((v) + (w))) // Set up load/store macros with appropriate endianness (we don't use these in SSE mode) #ifndef ZT_SALSA20_SSE #if __BYTE_ORDER == __LITTLE_ENDIAN #ifdef ZT_NO_TYPE_PUNNING // Slower version that does not use type punning #define U8TO32_LITTLE(p) ( ((uint32_t)(p)[0]) | ((uint32_t)(p)[1] << 8) | ((uint32_t)(p)[2] << 16) | ((uint32_t)(p)[3] << 24) ) static inline void U32TO8_LITTLE(uint8_t *const c,const uint32_t v) { c[0] = (uint8_t)v; c[1] = (uint8_t)(v >> 8); c[2] = (uint8_t)(v >> 16); c[3] = (uint8_t)(v >> 24); } #else // Fast version that just does 32-bit load/store #define U8TO32_LITTLE(p) (*((const uint32_t *)((const void *)(p)))) #define U32TO8_LITTLE(c,v) *((uint32_t *)((void *)(c))) = (v) #endif // ZT_NO_TYPE_PUNNING #else // __BYTE_ORDER == __BIG_ENDIAN (we don't support anything else... does MIDDLE_ENDIAN even still exist?) #ifdef __GNUC__ // Use GNUC builtin bswap macros on big-endian machines if available #define U8TO32_LITTLE(p) __builtin_bswap32(*((const uint32_t *)((const void *)(p)))) #define U32TO8_LITTLE(c,v) *((uint32_t *)((void *)(c))) = __builtin_bswap32((v)) #else // no __GNUC__ // Otherwise do it the slow, manual way on BE machines #define U8TO32_LITTLE(p) ( ((uint32_t)(p)[0]) | ((uint32_t)(p)[1] << 8) | ((uint32_t)(p)[2] << 16) | ((uint32_t)(p)[3] << 24) ) static inline void U32TO8_LITTLE(uint8_t *const c,const uint32_t v) { c[0] = (uint8_t)v; c[1] = (uint8_t)(v >> 8); c[2] = (uint8_t)(v >> 16); c[3] = (uint8_t)(v >> 24); } #endif // __GNUC__ or not #endif // __BYTE_ORDER little or big? #endif // !ZT_SALSA20_SSE // Statically compute and define SSE constants #ifdef ZT_SALSA20_SSE class _s20sseconsts { public: _s20sseconsts() { maskLo32 = _mm_shuffle_epi32(_mm_cvtsi32_si128(-1), _MM_SHUFFLE(1, 0, 1, 0)); maskHi32 = _mm_slli_epi64(maskLo32, 32); } __m128i maskLo32,maskHi32; }; static const _s20sseconsts _S20SSECONSTANTS; #endif namespace ZeroTier { void Salsa20::init(const void *key,const void *iv) { #ifdef ZT_SALSA20_SSE const uint32_t *const k = (const uint32_t *)key; _state.i[0] = 0x61707865; _state.i[1] = 0x3320646e; _state.i[2] = 0x79622d32; _state.i[3] = 0x6b206574; _state.i[4] = k[3]; _state.i[5] = 0; _state.i[6] = k[7]; _state.i[7] = k[2]; _state.i[8] = 0; _state.i[9] = k[6]; _state.i[10] = k[1]; _state.i[11] = ((const uint32_t *)iv)[1]; _state.i[12] = k[5]; _state.i[13] = k[0]; _state.i[14] = ((const uint32_t *)iv)[0]; _state.i[15] = k[4]; #else const char *const constants = "expand 32-byte k"; const uint8_t *const k = (const uint8_t *)key; _state.i[0] = U8TO32_LITTLE(constants + 0); _state.i[1] = U8TO32_LITTLE(k + 0); _state.i[2] = U8TO32_LITTLE(k + 4); _state.i[3] = U8TO32_LITTLE(k + 8); _state.i[4] = U8TO32_LITTLE(k + 12); _state.i[5] = U8TO32_LITTLE(constants + 4); _state.i[6] = U8TO32_LITTLE(((const uint8_t *)iv) + 0); _state.i[7] = U8TO32_LITTLE(((const uint8_t *)iv) + 4); _state.i[8] = 0; _state.i[9] = 0; _state.i[10] = U8TO32_LITTLE(constants + 8); _state.i[11] = U8TO32_LITTLE(k + 16); _state.i[12] = U8TO32_LITTLE(k + 20); _state.i[13] = U8TO32_LITTLE(k + 24); _state.i[14] = U8TO32_LITTLE(k + 28); _state.i[15] = U8TO32_LITTLE(constants + 12); #endif } void Salsa20::crypt12(const void *in,void *out,unsigned int bytes) { uint8_t tmp[64]; const uint8_t *m = (const uint8_t *)in; uint8_t *c = (uint8_t *)out; uint8_t *ctarget = c; unsigned int i; #ifndef ZT_SALSA20_SSE uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; uint32_t j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; #endif if (!bytes) return; #ifndef ZT_SALSA20_SSE j0 = _state.i[0]; j1 = _state.i[1]; j2 = _state.i[2]; j3 = _state.i[3]; j4 = _state.i[4]; j5 = _state.i[5]; j6 = _state.i[6]; j7 = _state.i[7]; j8 = _state.i[8]; j9 = _state.i[9]; j10 = _state.i[10]; j11 = _state.i[11]; j12 = _state.i[12]; j13 = _state.i[13]; j14 = _state.i[14]; j15 = _state.i[15]; #endif for (;;) { if (bytes < 64) { for (i = 0;i < bytes;++i) tmp[i] = m[i]; m = tmp; ctarget = c; c = tmp; } #ifdef ZT_SALSA20_SSE __m128i X0 = _mm_loadu_si128((const __m128i *)&(_state.v[0])); __m128i X1 = _mm_loadu_si128((const __m128i *)&(_state.v[1])); __m128i X2 = _mm_loadu_si128((const __m128i *)&(_state.v[2])); __m128i X3 = _mm_loadu_si128((const __m128i *)&(_state.v[3])); __m128i T; __m128i X0s = X0; __m128i X1s = X1; __m128i X2s = X2; __m128i X3s = X3; // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); X0 = _mm_add_epi32(X0s,X0); X1 = _mm_add_epi32(X1s,X1); X2 = _mm_add_epi32(X2s,X2); X3 = _mm_add_epi32(X3s,X3); __m128i k02 = _mm_shuffle_epi32(_mm_or_si128(_mm_slli_epi64(X0, 32), _mm_srli_epi64(X3, 32)), _MM_SHUFFLE(0, 1, 2, 3)); __m128i k13 = _mm_shuffle_epi32(_mm_or_si128(_mm_slli_epi64(X1, 32), _mm_srli_epi64(X0, 32)), _MM_SHUFFLE(0, 1, 2, 3)); __m128i k20 = _mm_or_si128(_mm_and_si128(X2, _S20SSECONSTANTS.maskLo32), _mm_and_si128(X1, _S20SSECONSTANTS.maskHi32)); __m128i k31 = _mm_or_si128(_mm_and_si128(X3, _S20SSECONSTANTS.maskLo32), _mm_and_si128(X2, _S20SSECONSTANTS.maskHi32)); _mm_storeu_ps(reinterpret_cast<float *>(c),_mm_castsi128_ps(_mm_xor_si128(_mm_unpackhi_epi64(k02,k20),_mm_castps_si128(_mm_loadu_ps(reinterpret_cast<const float *>(m)))))); _mm_storeu_ps(reinterpret_cast<float *>(c) + 4,_mm_castsi128_ps(_mm_xor_si128(_mm_unpackhi_epi64(k13,k31),_mm_castps_si128(_mm_loadu_ps(reinterpret_cast<const float *>(m) + 4))))); _mm_storeu_ps(reinterpret_cast<float *>(c) + 8,_mm_castsi128_ps(_mm_xor_si128(_mm_unpacklo_epi64(k20,k02),_mm_castps_si128(_mm_loadu_ps(reinterpret_cast<const float *>(m) + 8))))); _mm_storeu_ps(reinterpret_cast<float *>(c) + 12,_mm_castsi128_ps(_mm_xor_si128(_mm_unpacklo_epi64(k31,k13),_mm_castps_si128(_mm_loadu_ps(reinterpret_cast<const float *>(m) + 12))))); if (!(++_state.i[8])) { ++_state.i[5]; // state reordered for SSE /* stopping at 2^70 bytes per nonce is user's responsibility */ } #else x0 = j0; x1 = j1; x2 = j2; x3 = j3; x4 = j4; x5 = j5; x6 = j6; x7 = j7; x8 = j8; x9 = j9; x10 = j10; x11 = j11; x12 = j12; x13 = j13; x14 = j14; x15 = j15; // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); x0 = PLUS(x0,j0); x1 = PLUS(x1,j1); x2 = PLUS(x2,j2); x3 = PLUS(x3,j3); x4 = PLUS(x4,j4); x5 = PLUS(x5,j5); x6 = PLUS(x6,j6); x7 = PLUS(x7,j7); x8 = PLUS(x8,j8); x9 = PLUS(x9,j9); x10 = PLUS(x10,j10); x11 = PLUS(x11,j11); x12 = PLUS(x12,j12); x13 = PLUS(x13,j13); x14 = PLUS(x14,j14); x15 = PLUS(x15,j15); U32TO8_LITTLE(c + 0,XOR(x0,U8TO32_LITTLE(m + 0))); U32TO8_LITTLE(c + 4,XOR(x1,U8TO32_LITTLE(m + 4))); U32TO8_LITTLE(c + 8,XOR(x2,U8TO32_LITTLE(m + 8))); U32TO8_LITTLE(c + 12,XOR(x3,U8TO32_LITTLE(m + 12))); U32TO8_LITTLE(c + 16,XOR(x4,U8TO32_LITTLE(m + 16))); U32TO8_LITTLE(c + 20,XOR(x5,U8TO32_LITTLE(m + 20))); U32TO8_LITTLE(c + 24,XOR(x6,U8TO32_LITTLE(m + 24))); U32TO8_LITTLE(c + 28,XOR(x7,U8TO32_LITTLE(m + 28))); U32TO8_LITTLE(c + 32,XOR(x8,U8TO32_LITTLE(m + 32))); U32TO8_LITTLE(c + 36,XOR(x9,U8TO32_LITTLE(m + 36))); U32TO8_LITTLE(c + 40,XOR(x10,U8TO32_LITTLE(m + 40))); U32TO8_LITTLE(c + 44,XOR(x11,U8TO32_LITTLE(m + 44))); U32TO8_LITTLE(c + 48,XOR(x12,U8TO32_LITTLE(m + 48))); U32TO8_LITTLE(c + 52,XOR(x13,U8TO32_LITTLE(m + 52))); U32TO8_LITTLE(c + 56,XOR(x14,U8TO32_LITTLE(m + 56))); U32TO8_LITTLE(c + 60,XOR(x15,U8TO32_LITTLE(m + 60))); if (!(++j8)) { ++j9; /* stopping at 2^70 bytes per nonce is user's responsibility */ } #endif if (bytes <= 64) { if (bytes < 64) { for (i = 0;i < bytes;++i) ctarget[i] = c[i]; } #ifndef ZT_SALSA20_SSE _state.i[8] = j8; _state.i[9] = j9; #endif return; } bytes -= 64; c += 64; m += 64; } } void Salsa20::crypt20(const void *in,void *out,unsigned int bytes) { uint8_t tmp[64]; const uint8_t *m = (const uint8_t *)in; uint8_t *c = (uint8_t *)out; uint8_t *ctarget = c; unsigned int i; #ifndef ZT_SALSA20_SSE uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; uint32_t j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; #endif if (!bytes) return; #ifndef ZT_SALSA20_SSE j0 = _state.i[0]; j1 = _state.i[1]; j2 = _state.i[2]; j3 = _state.i[3]; j4 = _state.i[4]; j5 = _state.i[5]; j6 = _state.i[6]; j7 = _state.i[7]; j8 = _state.i[8]; j9 = _state.i[9]; j10 = _state.i[10]; j11 = _state.i[11]; j12 = _state.i[12]; j13 = _state.i[13]; j14 = _state.i[14]; j15 = _state.i[15]; #endif for (;;) { if (bytes < 64) { for (i = 0;i < bytes;++i) tmp[i] = m[i]; m = tmp; ctarget = c; c = tmp; } #ifdef ZT_SALSA20_SSE __m128i X0 = _mm_loadu_si128((const __m128i *)&(_state.v[0])); __m128i X1 = _mm_loadu_si128((const __m128i *)&(_state.v[1])); __m128i X2 = _mm_loadu_si128((const __m128i *)&(_state.v[2])); __m128i X3 = _mm_loadu_si128((const __m128i *)&(_state.v[3])); __m128i T; __m128i X0s = X0; __m128i X1s = X1; __m128i X2s = X2; __m128i X3s = X3; // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); // 2X round ------------------------------------------------------------- T = _mm_add_epi32(X0, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X1, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X3, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x93); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x39); T = _mm_add_epi32(X0, X1); X3 = _mm_xor_si128(_mm_xor_si128(X3, _mm_slli_epi32(T, 7)), _mm_srli_epi32(T, 25)); T = _mm_add_epi32(X3, X0); X2 = _mm_xor_si128(_mm_xor_si128(X2, _mm_slli_epi32(T, 9)), _mm_srli_epi32(T, 23)); T = _mm_add_epi32(X2, X3); X1 = _mm_xor_si128(_mm_xor_si128(X1, _mm_slli_epi32(T, 13)), _mm_srli_epi32(T, 19)); T = _mm_add_epi32(X1, X2); X0 = _mm_xor_si128(_mm_xor_si128(X0, _mm_slli_epi32(T, 18)), _mm_srli_epi32(T, 14)); X1 = _mm_shuffle_epi32(X1, 0x39); X2 = _mm_shuffle_epi32(X2, 0x4E); X3 = _mm_shuffle_epi32(X3, 0x93); X0 = _mm_add_epi32(X0s,X0); X1 = _mm_add_epi32(X1s,X1); X2 = _mm_add_epi32(X2s,X2); X3 = _mm_add_epi32(X3s,X3); __m128i k02 = _mm_shuffle_epi32(_mm_or_si128(_mm_slli_epi64(X0, 32), _mm_srli_epi64(X3, 32)), _MM_SHUFFLE(0, 1, 2, 3)); __m128i k13 = _mm_shuffle_epi32(_mm_or_si128(_mm_slli_epi64(X1, 32), _mm_srli_epi64(X0, 32)), _MM_SHUFFLE(0, 1, 2, 3)); __m128i k20 = _mm_or_si128(_mm_and_si128(X2, _S20SSECONSTANTS.maskLo32), _mm_and_si128(X1, _S20SSECONSTANTS.maskHi32)); __m128i k31 = _mm_or_si128(_mm_and_si128(X3, _S20SSECONSTANTS.maskLo32), _mm_and_si128(X2, _S20SSECONSTANTS.maskHi32)); _mm_storeu_ps(reinterpret_cast<float *>(c),_mm_castsi128_ps(_mm_xor_si128(_mm_unpackhi_epi64(k02,k20),_mm_castps_si128(_mm_loadu_ps(reinterpret_cast<const float *>(m)))))); _mm_storeu_ps(reinterpret_cast<float *>(c) + 4,_mm_castsi128_ps(_mm_xor_si128(_mm_unpackhi_epi64(k13,k31),_mm_castps_si128(_mm_loadu_ps(reinterpret_cast<const float *>(m) + 4))))); _mm_storeu_ps(reinterpret_cast<float *>(c) + 8,_mm_castsi128_ps(_mm_xor_si128(_mm_unpacklo_epi64(k20,k02),_mm_castps_si128(_mm_loadu_ps(reinterpret_cast<const float *>(m) + 8))))); _mm_storeu_ps(reinterpret_cast<float *>(c) + 12,_mm_castsi128_ps(_mm_xor_si128(_mm_unpacklo_epi64(k31,k13),_mm_castps_si128(_mm_loadu_ps(reinterpret_cast<const float *>(m) + 12))))); if (!(++_state.i[8])) { ++_state.i[5]; // state reordered for SSE /* stopping at 2^70 bytes per nonce is user's responsibility */ } #else x0 = j0; x1 = j1; x2 = j2; x3 = j3; x4 = j4; x5 = j5; x6 = j6; x7 = j7; x8 = j8; x9 = j9; x10 = j10; x11 = j11; x12 = j12; x13 = j13; x14 = j14; x15 = j15; // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); // 2X round ------------------------------------------------------------- x4 = XOR( x4,ROTATE(PLUS( x0,x12), 7)); x8 = XOR( x8,ROTATE(PLUS( x4, x0), 9)); x12 = XOR(x12,ROTATE(PLUS( x8, x4),13)); x0 = XOR( x0,ROTATE(PLUS(x12, x8),18)); x9 = XOR( x9,ROTATE(PLUS( x5, x1), 7)); x13 = XOR(x13,ROTATE(PLUS( x9, x5), 9)); x1 = XOR( x1,ROTATE(PLUS(x13, x9),13)); x5 = XOR( x5,ROTATE(PLUS( x1,x13),18)); x14 = XOR(x14,ROTATE(PLUS(x10, x6), 7)); x2 = XOR( x2,ROTATE(PLUS(x14,x10), 9)); x6 = XOR( x6,ROTATE(PLUS( x2,x14),13)); x10 = XOR(x10,ROTATE(PLUS( x6, x2),18)); x3 = XOR( x3,ROTATE(PLUS(x15,x11), 7)); x7 = XOR( x7,ROTATE(PLUS( x3,x15), 9)); x11 = XOR(x11,ROTATE(PLUS( x7, x3),13)); x15 = XOR(x15,ROTATE(PLUS(x11, x7),18)); x1 = XOR( x1,ROTATE(PLUS( x0, x3), 7)); x2 = XOR( x2,ROTATE(PLUS( x1, x0), 9)); x3 = XOR( x3,ROTATE(PLUS( x2, x1),13)); x0 = XOR( x0,ROTATE(PLUS( x3, x2),18)); x6 = XOR( x6,ROTATE(PLUS( x5, x4), 7)); x7 = XOR( x7,ROTATE(PLUS( x6, x5), 9)); x4 = XOR( x4,ROTATE(PLUS( x7, x6),13)); x5 = XOR( x5,ROTATE(PLUS( x4, x7),18)); x11 = XOR(x11,ROTATE(PLUS(x10, x9), 7)); x8 = XOR( x8,ROTATE(PLUS(x11,x10), 9)); x9 = XOR( x9,ROTATE(PLUS( x8,x11),13)); x10 = XOR(x10,ROTATE(PLUS( x9, x8),18)); x12 = XOR(x12,ROTATE(PLUS(x15,x14), 7)); x13 = XOR(x13,ROTATE(PLUS(x12,x15), 9)); x14 = XOR(x14,ROTATE(PLUS(x13,x12),13)); x15 = XOR(x15,ROTATE(PLUS(x14,x13),18)); x0 = PLUS(x0,j0); x1 = PLUS(x1,j1); x2 = PLUS(x2,j2); x3 = PLUS(x3,j3); x4 = PLUS(x4,j4); x5 = PLUS(x5,j5); x6 = PLUS(x6,j6); x7 = PLUS(x7,j7); x8 = PLUS(x8,j8); x9 = PLUS(x9,j9); x10 = PLUS(x10,j10); x11 = PLUS(x11,j11); x12 = PLUS(x12,j12); x13 = PLUS(x13,j13); x14 = PLUS(x14,j14); x15 = PLUS(x15,j15); U32TO8_LITTLE(c + 0,XOR(x0,U8TO32_LITTLE(m + 0))); U32TO8_LITTLE(c + 4,XOR(x1,U8TO32_LITTLE(m + 4))); U32TO8_LITTLE(c + 8,XOR(x2,U8TO32_LITTLE(m + 8))); U32TO8_LITTLE(c + 12,XOR(x3,U8TO32_LITTLE(m + 12))); U32TO8_LITTLE(c + 16,XOR(x4,U8TO32_LITTLE(m + 16))); U32TO8_LITTLE(c + 20,XOR(x5,U8TO32_LITTLE(m + 20))); U32TO8_LITTLE(c + 24,XOR(x6,U8TO32_LITTLE(m + 24))); U32TO8_LITTLE(c + 28,XOR(x7,U8TO32_LITTLE(m + 28))); U32TO8_LITTLE(c + 32,XOR(x8,U8TO32_LITTLE(m + 32))); U32TO8_LITTLE(c + 36,XOR(x9,U8TO32_LITTLE(m + 36))); U32TO8_LITTLE(c + 40,XOR(x10,U8TO32_LITTLE(m + 40))); U32TO8_LITTLE(c + 44,XOR(x11,U8TO32_LITTLE(m + 44))); U32TO8_LITTLE(c + 48,XOR(x12,U8TO32_LITTLE(m + 48))); U32TO8_LITTLE(c + 52,XOR(x13,U8TO32_LITTLE(m + 52))); U32TO8_LITTLE(c + 56,XOR(x14,U8TO32_LITTLE(m + 56))); U32TO8_LITTLE(c + 60,XOR(x15,U8TO32_LITTLE(m + 60))); if (!(++j8)) { ++j9; /* stopping at 2^70 bytes per nonce is user's responsibility */ } #endif if (bytes <= 64) { if (bytes < 64) { for (i = 0;i < bytes;++i) ctarget[i] = c[i]; } #ifndef ZT_SALSA20_SSE _state.i[8] = j8; _state.i[9] = j9; #endif return; } bytes -= 64; c += 64; m += 64; } } } // namespace ZeroTier
41.262295
184
0.605736
sundys
caa09ae8b80be858449d74a9109aa12068896dd6
326
cpp
C++
UEL/Lista do caralho/utilities.cpp
FlammaVulpes/random-crappy-stuff
c3fc38f8152393300ea6e8f4637c837a21379bd9
[ "MIT" ]
null
null
null
UEL/Lista do caralho/utilities.cpp
FlammaVulpes/random-crappy-stuff
c3fc38f8152393300ea6e8f4637c837a21379bd9
[ "MIT" ]
null
null
null
UEL/Lista do caralho/utilities.cpp
FlammaVulpes/random-crappy-stuff
c3fc38f8152393300ea6e8f4637c837a21379bd9
[ "MIT" ]
null
null
null
#include "header.hpp" using namespace std; void sudSort(int arr[9]){ for(int i = 0; i < 9; i++){ for(int j = 0; j < 9 - i; ++j){ if(arr[j] > arr[j+1]){ int temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } }
21.733333
40
0.349693
FlammaVulpes
caa400fb28139c1887905bd316cffe29aebe81bf
2,703
cc
C++
installer/cros_installer_main.cc
doitmovin/chromiumos-platform2
6462aaf43072307b5a40eb045a89e473381b5fda
[ "BSD-3-Clause" ]
null
null
null
installer/cros_installer_main.cc
doitmovin/chromiumos-platform2
6462aaf43072307b5a40eb045a89e473381b5fda
[ "BSD-3-Clause" ]
null
null
null
installer/cros_installer_main.cc
doitmovin/chromiumos-platform2
6462aaf43072307b5a40eb045a89e473381b5fda
[ "BSD-3-Clause" ]
2
2021-01-26T12:37:19.000Z
2021-05-18T13:37:57.000Z
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <getopt.h> #include <stdio.h> #include <stdlib.h> #include <string> #include "installer/chromeos_install_config.h" #include "installer/chromeos_legacy.h" #include "installer/chromeos_postinst.h" #include "installer/inst_util.h" using std::string; const char* usage = ( "cros_installer:\n" " --help\n" " --debug\n" " cros_installer postinst <install_dev> <mount_point> [ args ]\n" " --bios [ secure | legacy | efi | uboot ]\n" " --legacy\n" " --postcommit\n"); int showHelp() { printf("%s", usage); return 1; } int main(int argc, char** argv) { struct option long_options[] = { {"bios", required_argument, NULL, 'b'}, {"debug", no_argument, NULL, 'd'}, {"help", no_argument, NULL, 'h'}, {"postcommit", no_argument, NULL, 'p'}, {NULL, 0, NULL, 0}, }; // Unkown means we will attempt to autodetect later on. BiosType bios_type = kBiosTypeUnknown; while (true) { int option_index; int c = getopt_long(argc, argv, "h", long_options, &option_index); if (c == -1) break; switch (c) { case '?': // Unknown argument printf("\n"); return showHelp(); case 'h': // --help return showHelp(); case 'b': // Bios type has been explicitly given, don't autodetect if (!StrToBiosType(optarg, &bios_type)) return 1; break; case 'd': // I don't think this is used, but older update engines might // in some cases. So, it's present but ignored. break; case 'p': // This is an outdated argument. When we receive it, we just // exit with success right away. printf("Received --postcommit. This is a successful no-op.\n"); return 0; default: printf("Unknown argument %d - switch and struct out of sync\n\n", c); return showHelp(); } } if (argc - optind < 1) { printf("No command type present (postinst, etc)\n\n"); return showHelp(); } string command = argv[optind++]; // Run postinstall behavior if (command == "postinst") { if (argc - optind != 2) return showHelp(); string install_dir = argv[optind++]; string install_dev = argv[optind++]; int exit_code = 0; if (!RunPostInstall(install_dev, install_dir, bios_type, &exit_code)) { if (!exit_code) exit_code = 1; } return exit_code; } printf("Unknown command: '%s'\n\n", command.c_str()); return showHelp(); }
24.351351
77
0.594155
doitmovin
caa6d084ab236e59d258a0166ff365142c23a0ed
2,593
hpp
C++
ios/Pods/boost-for-react-native/boost/hana/adjust_if.hpp
rudylee/expo
b3e65a7a5b205f14a3eb6cd6fa8d13c8d663b1cc
[ "Apache-2.0", "MIT" ]
8,805
2015-11-03T00:52:29.000Z
2022-03-29T22:30:03.000Z
ios/Pods/boost-for-react-native/boost/hana/adjust_if.hpp
rudylee/expo
b3e65a7a5b205f14a3eb6cd6fa8d13c8d663b1cc
[ "Apache-2.0", "MIT" ]
14,694
2015-02-24T15:13:42.000Z
2022-03-31T13:16:45.000Z
ios/Pods/boost-for-react-native/boost/hana/adjust_if.hpp
rudylee/expo
b3e65a7a5b205f14a3eb6cd6fa8d13c8d663b1cc
[ "Apache-2.0", "MIT" ]
1,329
2015-11-03T20:25:51.000Z
2022-03-31T18:10:38.000Z
/*! @file Defines `boost::hana::adjust_if`. @copyright Louis Dionne 2013-2016 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_HANA_ADJUST_IF_HPP #define BOOST_HANA_ADJUST_IF_HPP #include <boost/hana/fwd/adjust_if.hpp> #include <boost/hana/bool.hpp> #include <boost/hana/concept/functor.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/if.hpp> #include <boost/hana/transform.hpp> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs, typename Pred, typename F> constexpr auto adjust_if_t::operator()(Xs&& xs, Pred const& pred, F const& f) const { using S = typename hana::tag_of<Xs>::type; using AdjustIf = BOOST_HANA_DISPATCH_IF(adjust_if_impl<S>, hana::Functor<S>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Functor<S>::value, "hana::adjust_if(xs, pred, f) requires 'xs' to be a Functor"); #endif return AdjustIf::apply(static_cast<Xs&&>(xs), pred, f); } //! @endcond namespace detail { template <typename Pred, typename F> struct apply_if { Pred const& pred; F const& f; template <typename X> constexpr decltype(auto) helper(bool cond, X&& x) const { return cond ? f(static_cast<X&&>(x)) : static_cast<X&&>(x); } template <typename X> constexpr decltype(auto) helper(hana::true_, X&& x) const { return f(static_cast<X&&>(x)); } template <typename X> constexpr decltype(auto) helper(hana::false_, X&& x) const { return static_cast<X&&>(x); } template <typename X> constexpr decltype(auto) operator()(X&& x) const { auto cond = hana::if_(pred(x), hana::true_c, hana::false_c); return this->helper(cond, static_cast<X&&>(x)); } }; } template <typename Fun, bool condition> struct adjust_if_impl<Fun, when<condition>> : default_ { template <typename Xs, typename Pred, typename F> static constexpr auto apply(Xs&& xs, Pred const& pred, F const& f) { return hana::transform(static_cast<Xs&&>(xs), detail::apply_if<Pred, F>{pred, f}); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_ADJUST_IF_HPP
32.822785
90
0.597763
rudylee
caa7fe636b2ebf5ee145e57a8a0b772e28ab55ae
518
hxx
C++
other/cpp/problems/algorithm/118pascal/cpp/pascal.hxx
sguzman/LeetCode
83cd945949cdbcafec91045d87e30549feb181f1
[ "MIT" ]
null
null
null
other/cpp/problems/algorithm/118pascal/cpp/pascal.hxx
sguzman/LeetCode
83cd945949cdbcafec91045d87e30549feb181f1
[ "MIT" ]
null
null
null
other/cpp/problems/algorithm/118pascal/cpp/pascal.hxx
sguzman/LeetCode
83cd945949cdbcafec91045d87e30549feb181f1
[ "MIT" ]
null
null
null
#pragma once #include <vector> using std::vector; class Solution { public: vector<vector<int>> generate(int nR) { unsigned long numRows{static_cast<unsigned long>(nR)}; vector<vector<int>> final; if (numRows >= 1) { final.push_back(vector<int>{1}); } for (unsigned long i = 1; i < numRows; ++i) { final.push_back(vector<int>{1}); for (unsigned long j = 1; j < i; ++j) { final[i].push_back(final[i - 1][j - 1] + final[i - 1][j]); } final[i].push_back(1); } return final; } };
17.266667
62
0.600386
sguzman
caa8436ece520bc6710797027c8322aae32e9fff
3,980
cc
C++
test/splittest.cc
aalto-speech/morphological-classes
a7dcdb0703b33765ed43a9a56a3ca453dc5ed5e3
[ "BSD-2-Clause" ]
null
null
null
test/splittest.cc
aalto-speech/morphological-classes
a7dcdb0703b33765ed43a9a56a3ca453dc5ed5e3
[ "BSD-2-Clause" ]
null
null
null
test/splittest.cc
aalto-speech/morphological-classes
a7dcdb0703b33765ed43a9a56a3ca453dc5ed5e3
[ "BSD-2-Clause" ]
null
null
null
#include <boost/test/unit_test.hpp> #include <iostream> #include <vector> #include <map> #include <ctime> #include <algorithm> #define private public #include "Splitting.hh" #undef private using namespace std; void _assert_same(Splitting& s1, Splitting& s2) { BOOST_CHECK_EQUAL(s1.m_num_classes, s2.m_num_classes); BOOST_CHECK(s1.m_vocabulary==s2.m_vocabulary); BOOST_CHECK(s1.m_vocabulary_lookup==s2.m_vocabulary_lookup); for (int i = 0; i<(int) s1.m_classes.size(); i++) if (s1.m_classes[i].size()>0) BOOST_CHECK(s1.m_classes[i]==s2.m_classes[i]); for (int i = 0; i<(int) s2.m_classes.size(); i++) if (s2.m_classes[i].size()>0) BOOST_CHECK(s1.m_classes[i]==s2.m_classes[i]); BOOST_CHECK(s1.m_word_classes==s2.m_word_classes); BOOST_CHECK(s1.m_word_counts==s2.m_word_counts); BOOST_CHECK(s1.m_word_bigram_counts==s2.m_word_bigram_counts); BOOST_CHECK(s1.m_word_rev_bigram_counts==s2.m_word_rev_bigram_counts); for (int i = 0; i<(int) s1.m_class_counts.size(); i++) if (s1.m_class_counts[i]!=0) BOOST_CHECK_EQUAL(s1.m_class_counts[i], s2.m_class_counts[i]); for (int i = 0; i<(int) s2.m_class_counts.size(); i++) if (s2.m_class_counts[i]!=0) BOOST_CHECK_EQUAL(s1.m_class_counts[i], s2.m_class_counts[i]); for (int i = 0; i<(int) s1.m_class_bigram_counts.size(); i++) for (int j = 0; j<(int) s1.m_class_bigram_counts[i].size(); j++) if (s1.m_class_bigram_counts[i][j]!=0) BOOST_CHECK_EQUAL(s1.m_class_bigram_counts[i][j], s2.m_class_bigram_counts[i][j]); for (int i = 0; i<(int) s2.m_class_bigram_counts.size(); i++) for (int j = 0; j<(int) s2.m_class_bigram_counts[i].size(); j++) if (s2.m_class_bigram_counts[i][j]!=0) BOOST_CHECK_EQUAL(s1.m_class_bigram_counts[i][j], s2.m_class_bigram_counts[i][j]); for (int i = 0; i<(int) s1.m_class_word_counts.size(); i++) for (auto wit = s1.m_class_word_counts[i].begin(); wit!=s1.m_class_word_counts[i].end(); ++wit) { BOOST_CHECK(wit->second!=0); BOOST_CHECK_EQUAL(wit->second, s2.m_class_word_counts[i][wit->first]); } for (int i = 0; i<(int) s2.m_class_word_counts.size(); i++) for (auto cit = s2.m_class_word_counts[i].begin(); cit!=s2.m_class_word_counts[i].end(); ++cit) { BOOST_CHECK(cit->second!=0); BOOST_CHECK_EQUAL(cit->second, s1.m_class_word_counts[i][cit->first]); } for (int i = 0; i<(int) s1.m_word_class_counts.size(); i++) for (auto cit = s1.m_word_class_counts[i].begin(); cit!=s1.m_word_class_counts[i].end(); ++cit) { BOOST_CHECK(cit->second!=0); BOOST_CHECK_EQUAL(cit->second, s2.m_word_class_counts[i][cit->first]); } for (int i = 0; i<(int) s2.m_word_class_counts.size(); i++) for (auto cit = s2.m_word_class_counts[i].begin(); cit!=s2.m_word_class_counts[i].end(); ++cit) { BOOST_CHECK(cit->second!=0); BOOST_CHECK_EQUAL(cit->second, s1.m_word_class_counts[i][cit->first]); } BOOST_CHECK_EQUAL(s1.log_likelihood(), s2.log_likelihood()); } // Test that splitting classes works BOOST_AUTO_TEST_CASE(DoSplit) { map<string, int>class_init_2 = {{"a", 2}, {"b", 3}, {"c", 3}, {"d", 2}, {"e", 3}}; Splitting splitting(2, class_init_2, "data/exchange1.txt"); set<int> class1_words, class2_words; class1_words.insert(splitting.m_vocabulary_lookup["b"]); class1_words.insert(splitting.m_vocabulary_lookup["e"]); class2_words.insert(splitting.m_vocabulary_lookup["c"]); splitting.do_split(3, class1_words, class2_words); map<string, int> class_init = {{ "a", 2 }, { "b", 3 }, { "c", 4 }, { "d", 2 }, { "e", 3 }}; Splitting splitting2(3, class_init, "data/exchange1.txt"); _assert_same(splitting, splitting2); }
41.894737
105
0.628894
aalto-speech
caa97883ba0471e8c6f8119830caa82742f4d4d9
699
cpp
C++
Source/DialogSystemRuntime/Private/Dialog/DialogNodes/DialogNode.cpp
n3td0g/DialogSystem
5c7919c5d69246c3798f2322b08f0c10c736d0dc
[ "Apache-2.0" ]
null
null
null
Source/DialogSystemRuntime/Private/Dialog/DialogNodes/DialogNode.cpp
n3td0g/DialogSystem
5c7919c5d69246c3798f2322b08f0c10c736d0dc
[ "Apache-2.0" ]
null
null
null
Source/DialogSystemRuntime/Private/Dialog/DialogNodes/DialogNode.cpp
n3td0g/DialogSystem
5c7919c5d69246c3798f2322b08f0c10c736d0dc
[ "Apache-2.0" ]
null
null
null
#include "Dialog/DialogNodes/DialogNode.h" #include "Dialog/DialogProcessor.h" #include "Dialog/DialogNodes/DialogPhraseNode.h" void UDialogNode::Invoke(UDialogProcessor* processor) { check(processor); for (auto child : Childs) { if (child->Check(processor)) { processor->SetCurrentNode(child); return; } } } bool UDialogNode::Check(UDialogProcessor* processor) { return true; } TArray<UDialogPhraseNode*> UDialogNode::GetNextPhrases(UDialogProcessor* processor) { check(processor); TArray<UDialogPhraseNode*> result; for (auto child : Childs) { if (child->Check(processor)) result.Append(child->GetNextPhrases(processor)); } return result; }
18.394737
83
0.715308
n3td0g
caaa8782fe992ed73bb074872440d018af84ec86
25,336
cpp
C++
code/wxWidgets/src/os2/notebook.cpp
Bloodknight/NeuTorsion
a5890e9ca145a8c1b6bec7b70047a43d9b1c29ea
[ "MIT" ]
38
2016-02-20T02:46:28.000Z
2021-11-17T11:39:57.000Z
code/wxWidgets/src/os2/notebook.cpp
Dwarf-King/TorsionEditor
e6887d1661ebaf4ccbf1d09f2690e2bf805fbb50
[ "MIT" ]
17
2016-02-20T02:19:55.000Z
2021-02-08T15:15:17.000Z
code/wxWidgets/src/os2/notebook.cpp
Dwarf-King/TorsionEditor
e6887d1661ebaf4ccbf1d09f2690e2bf805fbb50
[ "MIT" ]
46
2016-02-20T02:47:33.000Z
2021-01-31T15:46:05.000Z
/////////////////////////////////////////////////////////////////////////////// // Name: notebook.cpp // Purpose: implementation of wxNotebook // Author: David Webster // Modified by: // Created: 10/12/99 // RCS-ID: $Id: notebook.cpp,v 1.23.2.1 2006/01/03 17:02:46 SN Exp $ // Copyright: (c) David Webster // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #if wxUSE_NOTEBOOK // wxWidgets #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/dcclient.h" #include "wx/string.h" #include "wx/settings.h" #endif // WX_PRECOMP #include "wx/log.h" #include "wx/imaglist.h" #include "wx/event.h" #include "wx/control.h" #include "wx/notebook.h" #include "wx/os2/private.h" // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- // check that the page index is valid #define IS_VALID_PAGE(nPage) ( \ /* size_t is _always_ >= 0 */ \ /* ((nPage) >= 0) && */ \ ((nPage) < GetPageCount()) \ ) // hide the ugly cast #define m_hWnd (HWND)GetHWND() // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- // event table // ---------------------------------------------------------------------------- DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING) BEGIN_EVENT_TABLE(wxNotebook, wxControl) EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange) EVT_SIZE(wxNotebook::OnSize) EVT_SET_FOCUS(wxNotebook::OnSetFocus) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl) IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) // ============================================================================ // implementation // ============================================================================ // ---------------------------------------------------------------------------- // wxNotebook construction // ---------------------------------------------------------------------------- // // Common part of all ctors // void wxNotebook::Init() { m_imageList = NULL; m_nSelection = -1; m_nTabSize = 0; } // end of wxNotebook::Init // // Default for dynamic class // wxNotebook::wxNotebook() { Init(); } // end of wxNotebook::wxNotebook // // The same arguments as for wxControl // wxNotebook::wxNotebook( wxWindow* pParent , wxWindowID vId , const wxPoint& rPos , const wxSize& rSize , long lStyle , const wxString& rsName ) { Init(); Create( pParent ,vId ,rPos ,rSize ,lStyle ,rsName ); } // end of wxNotebook::wxNotebook // // Create() function // bool wxNotebook::Create( wxWindow* pParent, wxWindowID vId, const wxPoint& rPos, const wxSize& rSize, long lStyle, const wxString& rsName ) { // // Base init // if (!CreateControl( pParent ,vId ,rPos ,rSize ,lStyle ,wxDefaultValidator ,rsName )) return false; // // Notebook, so explicitly specify 0 as last parameter // if (!OS2CreateControl( wxT("NOTEBOOK") ,wxEmptyString ,rPos ,rSize ,lStyle | wxTAB_TRAVERSAL )) return false; SetBackgroundColour(wxColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE))); return true; } // end of wxNotebook::Create WXDWORD wxNotebook::OS2GetStyle ( long lStyle , WXDWORD* pdwExstyle ) const { WXDWORD dwTabStyle = wxControl::OS2GetStyle( lStyle ,pdwExstyle ); dwTabStyle |= WS_TABSTOP | BKS_SOLIDBIND | BKS_ROUNDEDTABS | BKS_TABTEXTCENTER | BKS_TABBEDDIALOG; if (lStyle & wxNB_BOTTOM) dwTabStyle |= BKS_MAJORTABBOTTOM | BKS_BACKPAGESBL; else if (lStyle & wxNB_RIGHT) dwTabStyle |= BKS_MAJORTABRIGHT | BKS_BACKPAGESBR; else if (lStyle & wxNB_LEFT) dwTabStyle |= BKS_MAJORTABLEFT | BKS_BACKPAGESTL; else // default to top dwTabStyle |= BKS_MAJORTABTOP | BKS_BACKPAGESTR; // // Ex style // if (pdwExstyle ) { // // Note that we never want to have the default WS_EX_CLIENTEDGE style // as it looks too ugly for the notebooks // *pdwExstyle = 0; } return dwTabStyle; } // end of wxNotebook::OS2GetStyle // ---------------------------------------------------------------------------- // wxNotebook accessors // ---------------------------------------------------------------------------- size_t wxNotebook::GetPageCount() const { // // Consistency check // wxASSERT((int)m_pages.Count() == (int)::WinSendMsg(GetHWND(), BKM_QUERYPAGECOUNT, (MPARAM)0, (MPARAM)BKA_END)); return m_pages.Count(); } // end of wxNotebook::GetPageCount int wxNotebook::GetRowCount() const { return (int)::WinSendMsg( GetHWND() ,BKM_QUERYPAGECOUNT ,(MPARAM)0 ,(MPARAM)BKA_MAJOR ); } // end of wxNotebook::GetRowCount int wxNotebook::SetSelection( size_t nPage ) { wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") ); if (nPage != (size_t)m_nSelection) { wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING ,m_windowId ); vEvent.SetSelection(nPage); vEvent.SetOldSelection(m_nSelection); vEvent.SetEventObject(this); if (!GetEventHandler()->ProcessEvent(vEvent) || vEvent.IsAllowed()) { // // Program allows the page change // vEvent.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED); GetEventHandler()->ProcessEvent(vEvent); ::WinSendMsg( GetHWND() ,BKM_TURNTOPAGE ,MPFROMLONG((ULONG)m_alPageId[nPage]) ,(MPARAM)0 ); } } m_nSelection = nPage; return nPage; } // end of wxNotebook::SetSelection bool wxNotebook::SetPageText( size_t nPage, const wxString& rsStrText ) { wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") ); return (bool)::WinSendMsg( m_hWnd ,BKM_SETTABTEXT ,MPFROMLONG((ULONG)m_alPageId[nPage]) ,MPFROMP((PSZ)rsStrText.c_str()) ); } // end of wxNotebook::SetPageText wxString wxNotebook::GetPageText ( size_t nPage ) const { BOOKTEXT vBookText; wxChar zBuf[256]; wxString sStr; ULONG ulRc; wxCHECK_MSG( IS_VALID_PAGE(nPage), wxT(""), wxT("notebook page out of range") ); memset(&vBookText, '\0', sizeof(BOOKTEXT)); vBookText.textLen = 0; // This will get the length ulRc = LONGFROMMR(::WinSendMsg( m_hWnd ,BKM_QUERYTABTEXT ,MPFROMLONG((ULONG)m_alPageId[nPage]) ,MPFROMP(&vBookText) )); if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS || ulRc == 0L) { if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS) { wxLogError(wxT("Invalid Page Id for page text querry.")); } return wxEmptyString; } vBookText.textLen = ulRc + 1; // To get the null terminator vBookText.pString = (char*)zBuf; // // Now get the actual text // ulRc = LONGFROMMR(::WinSendMsg( m_hWnd ,BKM_QUERYTABTEXT ,MPFROMLONG((ULONG)m_alPageId[nPage]) ,MPFROMP(&vBookText) )); if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS || ulRc == 0L) { return wxEmptyString; } if (ulRc > 255L) ulRc = 255L; vBookText.pString[ulRc] = '\0'; sStr = (wxChar*)vBookText.pString; return sStr; } // end of wxNotebook::GetPageText int wxNotebook::GetPageImage ( size_t nPage ) const { wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") ); // // For OS/2 just return the page // return nPage; } // end of wxNotebook::GetPageImage bool wxNotebook::SetPageImage ( size_t nPage , int nImage ) { wxBitmap vBitmap = (wxBitmap)m_imageList->GetBitmap(nImage); return (bool)::WinSendMsg( GetHWND() ,BKM_SETTABBITMAP ,MPFROMLONG((ULONG)m_alPageId[nPage]) ,(MPARAM)wxFlipBmp(vBitmap.GetHBITMAP()) ); } // end of wxNotebook::SetPageImage void wxNotebook::SetImageList ( wxImageList* pImageList ) { // // Does not really do anything yet, but at least we need to // update the base class. // wxNotebookBase::SetImageList(pImageList); } // end of wxNotebook::SetImageList // ---------------------------------------------------------------------------- // wxNotebook size settings // ---------------------------------------------------------------------------- void wxNotebook::SetPageSize ( const wxSize& rSize ) { SetSize(rSize); } // end of wxNotebook::SetPageSize void wxNotebook::SetPadding ( const wxSize& WXUNUSED(rPadding) ) { // // No padding in OS/2 // } // end of wxNotebook::SetPadding void wxNotebook::SetTabSize ( const wxSize& rSize ) { ::WinSendMsg( GetHWND() ,BKM_SETDIMENSIONS ,MPFROM2SHORT( (USHORT)rSize.x ,(USHORT)rSize.y ) ,(MPARAM)BKA_MAJORTAB ); } // end of wxNotebook::SetTabSize // ---------------------------------------------------------------------------- // wxNotebook operations // ---------------------------------------------------------------------------- // // Remove one page from the notebook, without deleting // wxNotebookPage* wxNotebook::DoRemovePage ( size_t nPage ) { wxNotebookPage* pPageRemoved = wxNotebookBase::DoRemovePage(nPage); if (!pPageRemoved) return NULL; ::WinSendMsg( GetHWND() ,BKM_DELETEPAGE ,MPFROMLONG((ULONG)m_alPageId[nPage]) ,(MPARAM)BKA_TAB ); if (m_pages.IsEmpty()) { // // No selection any more, the notebook becamse empty // m_nSelection = -1; } else // notebook still not empty { // // Change the selected page if it was deleted or became invalid // int nSelNew; if (m_nSelection == (int)GetPageCount()) { // // Last page deleted, make the new last page the new selection // nSelNew = m_nSelection - 1; } else if (nPage <= (size_t)m_nSelection) { // // We must show another page, even if it has the same index // nSelNew = m_nSelection; } else // nothing changes for the currently selected page { nSelNew = -1; // // We still must refresh the current page: this needs to be done // for some unknown reason if the tab control shows the up-down // control (i.e. when there are too many pages) -- otherwise after // deleting a page nothing at all is shown // m_pages[m_nSelection]->Refresh(); } if (nSelNew != -1) { // // m_nSelection must be always valid so reset it before calling // SetSelection() // m_nSelection = -1; SetSelection(nSelNew); } } return pPageRemoved; } // end of wxNotebook::DoRemovePage // // Remove all pages // bool wxNotebook::DeleteAllPages() { int nPageCount = GetPageCount(); int nPage; for (nPage = 0; nPage < nPageCount; nPage++) delete m_pages[nPage]; m_pages.Clear(); ::WinSendMsg( GetHWND() ,BKM_DELETEPAGE ,(MPARAM)0 ,(MPARAM)BKA_ALL ); m_nSelection = -1; return true; } // end of wxNotebook::DeleteAllPages // // Add a page to the notebook // bool wxNotebook::AddPage ( wxNotebookPage* pPage , const wxString& rStrText , bool bSelect , int nImageId ) { return InsertPage( GetPageCount() ,pPage ,rStrText ,bSelect ,nImageId ); } // end of wxNotebook::AddPage // // Same as AddPage() but does it at given position // bool wxNotebook::InsertPage ( size_t nPage, wxNotebookPage* pPage, const wxString& rsStrText, bool bSelect, int nImageId ) { ULONG ulApiPage; wxASSERT( pPage != NULL ); wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE ); // // Under OS/2 we can only insert FIRST, LAST, NEXT or PREV. Requires // two different calls to the API. Page 1 uses the BKA_FIRST. Subsequent // pages use the previous page ID coupled with a BKA_NEXT call. Unlike // Windows, OS/2 uses an internal Page ID to ID the pages. // // OS/2 also has a nice auto-size feature that automatically sizes the // the attached window so we don't have to worry about the size of the // window on the page. // if (nPage == 0) { ulApiPage = LONGFROMMR(::WinSendMsg( GetHWND() ,BKM_INSERTPAGE ,(MPARAM)0 ,MPFROM2SHORT(BKA_AUTOPAGESIZE | BKA_MAJOR, BKA_FIRST) )); if (ulApiPage == 0L) { ERRORID vError; wxString sError; vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); return FALSE; } m_alPageId.Insert((long)ulApiPage, nPage); } else { ulApiPage = LONGFROMMR(::WinSendMsg( GetHWND() ,BKM_INSERTPAGE ,MPFROMLONG((ULONG)m_alPageId[nPage - 1]) ,MPFROM2SHORT(BKA_AUTOPAGESIZE | BKA_MAJOR, BKA_NEXT) )); if (ulApiPage == 0L) { ERRORID vError; wxString sError; vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); return FALSE; } m_alPageId.Insert((long)ulApiPage, nPage); } // // Associate a window handle with the page // if (pPage) { if (!::WinSendMsg( GetHWND() ,BKM_SETPAGEWINDOWHWND ,MPFROMLONG((ULONG)m_alPageId[nPage]) ,MPFROMHWND(pPage->GetHWND()) )) return FALSE; } // // If the inserted page is before the selected one, we must update the // index of the selected page // if (nPage <= (size_t)m_nSelection) { // // One extra page added // m_nSelection++; } if (pPage) { // // Save the pointer to the page // m_pages.Insert( pPage ,nPage ); } // // Now set TAB dimenstions // wxWindowDC vDC(this); wxCoord nTextX; wxCoord nTextY; vDC.GetTextExtent(rsStrText, &nTextX, &nTextY); nTextY *= 2; nTextX = (wxCoord)(nTextX * 1.3); if (nTextX > m_nTabSize) { m_nTabSize = nTextX; ::WinSendMsg( GetHWND() ,BKM_SETDIMENSIONS ,MPFROM2SHORT((USHORT)m_nTabSize, (USHORT)nTextY) ,(MPARAM)BKA_MAJORTAB ); } // // Now set any TAB text // if (!rsStrText.empty()) { if (!SetPageText( nPage ,rsStrText )) return FALSE; } // // Now set any TAB bitmap image // if (nImageId != -1) { if (!SetPageImage( nPage ,nImageId )) return FALSE; } if (pPage) { // // Don't show pages by default (we'll need to adjust their size first) // HWND hWnd = GetWinHwnd(pPage); WinSetWindowULong( hWnd ,QWL_STYLE ,WinQueryWindowULong( hWnd ,QWL_STYLE ) & ~WS_VISIBLE ); // // This updates internal flag too - otherwise it will get out of sync // pPage->Show(FALSE); } // // Some page should be selected: either this one or the first one if there is // still no selection // int nSelNew = -1; if (bSelect) nSelNew = nPage; else if ( m_nSelection == -1 ) nSelNew = 0; if (nSelNew != -1) SetSelection(nSelNew); InvalidateBestSize(); return TRUE; } // end of wxNotebook::InsertPage // ---------------------------------------------------------------------------- // wxNotebook callbacks // ---------------------------------------------------------------------------- void wxNotebook::OnSize( wxSizeEvent& rEvent ) { rEvent.Skip(); } // end of wxNotebook::OnSize void wxNotebook::OnSelChange ( wxNotebookEvent& rEvent ) { // // Is it our tab control? // if (rEvent.GetEventObject() == this) { int nPageCount = GetPageCount(); int nSel; ULONG ulOS2Sel = (ULONG)rEvent.GetOldSelection(); bool bFound = FALSE; for (nSel = 0; nSel < nPageCount; nSel++) { if (ulOS2Sel == (ULONG)m_alPageId[nSel]) { bFound = TRUE; break; } } if (!bFound) return; m_pages[nSel]->Show(FALSE); ulOS2Sel = (ULONG)rEvent.GetSelection(); bFound = FALSE; for (nSel = 0; nSel < nPageCount; nSel++) { if (ulOS2Sel == (ULONG)m_alPageId[nSel]) { bFound = TRUE; break; } } if (!bFound) return; wxNotebookPage* pPage = m_pages[nSel]; pPage->Show(TRUE); m_nSelection = nSel; } // // We want to give others a chance to process this message as well // rEvent.Skip(); } // end of wxNotebook::OnSelChange void wxNotebook::OnSetFocus ( wxFocusEvent& rEvent ) { // // This function is only called when the focus is explicitly set (i.e. from // the program) to the notebook - in this case we don't need the // complicated OnNavigationKey() logic because the programmer knows better // what [s]he wants // // set focus to the currently selected page if any // if (m_nSelection != -1) m_pages[m_nSelection]->SetFocus(); rEvent.Skip(); } // end of wxNotebook::OnSetFocus void wxNotebook::OnNavigationKey ( wxNavigationKeyEvent& rEvent ) { if (rEvent.IsWindowChange()) { // // Change pages // AdvanceSelection(rEvent.GetDirection()); } else { // // We get this event in 2 cases // // a) one of our pages might have generated it because the user TABbed // out from it in which case we should propagate the event upwards and // our parent will take care of setting the focus to prev/next sibling // // or // // b) the parent panel wants to give the focus to us so that we // forward it to our selected page. We can't deal with this in // OnSetFocus() because we don't know which direction the focus came // from in this case and so can't choose between setting the focus to // first or last panel child // wxWindow* pParent = GetParent(); if (rEvent.GetEventObject() == pParent) { // // No, it doesn't come from child, case (b): forward to a page // if (m_nSelection != -1) { // // So that the page knows that the event comes from it's parent // and is being propagated downwards // rEvent.SetEventObject(this); wxWindow* pPage = m_pages[m_nSelection]; if (!pPage->GetEventHandler()->ProcessEvent(rEvent)) { pPage->SetFocus(); } //else: page manages focus inside it itself } else { // // We have no pages - still have to give focus to _something_ // SetFocus(); } } else { // // It comes from our child, case (a), pass to the parent // if (pParent) { rEvent.SetCurrentFocus(this); pParent->GetEventHandler()->ProcessEvent(rEvent); } } } } // end of wxNotebook::OnNavigationKey // ---------------------------------------------------------------------------- // wxNotebook base class virtuals // ---------------------------------------------------------------------------- // // Override these 2 functions to do nothing: everything is done in OnSize // void wxNotebook::SetConstraintSizes( bool WXUNUSED(bRecurse) ) { // // Don't set the sizes of the pages - their correct size is not yet known // wxControl::SetConstraintSizes(FALSE); } // end of wxNotebook::SetConstraintSizes bool wxNotebook::DoPhase ( int WXUNUSED(nPhase) ) { return TRUE; } // end of wxNotebook::DoPhase // ---------------------------------------------------------------------------- // wxNotebook Windows message handlers // ---------------------------------------------------------------------------- bool wxNotebook::OS2OnScroll ( int nOrientation, WXWORD wSBCode, WXWORD wPos, WXHWND wControl ) { // // Don't generate EVT_SCROLLWIN events for the WM_SCROLLs coming from the // up-down control // if (wControl) return FALSE; return wxNotebookBase::OS2OnScroll( nOrientation ,wSBCode ,wPos ,wControl ); } // end of wxNotebook::OS2OnScroll #endif // wxUSE_NOTEBOOK
29.529138
115
0.457018
Bloodknight
caaaa6478ddc44585c0f3e4b04eecde8dc93bd25
9,485
cc
C++
src/utils/oatpp.cc
pnsuau/deepdetect
655aa483c0f129a0a07c0da9be1f1ab8a465f1be
[ "Apache-2.0" ]
1
2022-01-31T01:10:17.000Z
2022-01-31T01:10:17.000Z
src/utils/oatpp.cc
maxpark/deepdetect
1dfd51f59013533cb74d38f5f7fae804046d747f
[ "Apache-2.0" ]
null
null
null
src/utils/oatpp.cc
maxpark/deepdetect
1dfd51f59013533cb74d38f5f7fae804046d747f
[ "Apache-2.0" ]
null
null
null
/** * DeepDetect * Copyright (c) 2021 Jolibrain SASU * Author: Louis Jean <louis.jean@jolibrain.com> * * This file is part of deepdetect. * * deepdetect is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * deepdetect 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 deepdetect. If not, see <http://www.gnu.org/licenses/>. */ #include "oatpp.hpp" #include "dto/ddtypes.hpp" namespace dd { namespace oatpp_utils { std::shared_ptr<oatpp::parser::json::mapping::ObjectMapper> createDDMapper() { std::shared_ptr<oatpp::parser::json::mapping::ObjectMapper> object_mapper = oatpp::parser::json::mapping::ObjectMapper::createShared(); auto deser = object_mapper->getDeserializer(); deser->setDeserializerMethod(DTO::GpuIds::Class::CLASS_ID, DTO::gpuIdsDeserialize); deser->setDeserializerMethod(DTO::DTOVector<double>::Class::CLASS_ID, DTO::vectorDeserialize<double>); deser->setDeserializerMethod(DTO::DTOVector<uint8_t>::Class::CLASS_ID, DTO::vectorDeserialize<uint8_t>); deser->setDeserializerMethod(DTO::DTOVector<bool>::Class::CLASS_ID, DTO::vectorDeserialize<bool>); auto ser = object_mapper->getSerializer(); ser->setSerializerMethod(DTO::GpuIds::Class::CLASS_ID, DTO::gpuIdsSerialize); ser->setSerializerMethod(DTO::DTOVector<double>::Class::CLASS_ID, DTO::vectorSerialize<double>); ser->setSerializerMethod(DTO::DTOVector<uint8_t>::Class::CLASS_ID, DTO::vectorSerialize<uint8_t>); ser->setSerializerMethod(DTO::DTOVector<bool>::Class::CLASS_ID, DTO::vectorSerialize<bool>); return object_mapper; } oatpp::UnorderedFields<oatpp::Any> dtoToUFields(const oatpp::Void &polymorph) { if (polymorph.valueType->classId.id != oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID.id) { return nullptr; } auto dispatcher = static_cast<const oatpp::data::mapping::type::__class:: AbstractObject::PolymorphicDispatcher *>( polymorph.valueType->polymorphicDispatcher); auto fields = dispatcher->getProperties()->getList(); auto object = static_cast<oatpp::BaseObject *>(polymorph.get()); oatpp::UnorderedFields<oatpp::Any> result({}); for (auto const &field : fields) { result->emplace(field->name, field->get(object)); } return result; } void dtoToJDoc(const oatpp::Void &polymorph, JDoc &jdoc, bool ignore_null) { dtoToJVal(polymorph, jdoc, jdoc, ignore_null); } void dtoToJVal(const oatpp::Void &polymorph, JDoc &jdoc, JVal &jval, bool ignore_null) { if (polymorph == nullptr) { return; } else if (polymorph.valueType == oatpp::Any::Class::getType()) { auto anyHandle = static_cast<oatpp::data::mapping::type::AnyHandle *>( polymorph.get()); dtoToJVal(oatpp::Void(anyHandle->ptr, anyHandle->type), jdoc, jval, ignore_null); } else if (polymorph.valueType == oatpp::String::Class::getType()) { auto str = polymorph.staticCast<oatpp::String>(); jval.SetString(str->c_str(), jdoc.GetAllocator()); } else if (polymorph.valueType == oatpp::Int32::Class::getType()) { int32_t i = polymorph.staticCast<oatpp::Int32>(); jval.SetInt(i); } else if (polymorph.valueType == oatpp::UInt32::Class::getType()) { uint32_t i = polymorph.staticCast<oatpp::UInt32>(); jval.SetUint(i); } else if (polymorph.valueType == oatpp::Int64::Class::getType()) { int64_t i = polymorph.staticCast<oatpp::Int64>(); jval.SetInt64(i); } else if (polymorph.valueType == oatpp::UInt64::Class::getType()) { uint64_t i = polymorph.staticCast<oatpp::UInt64>(); jval.SetUint64(i); } else if (polymorph.valueType == oatpp::Float32::Class::getType()) { float f = polymorph.staticCast<oatpp::Float32>(); jval.SetFloat(f); } else if (polymorph.valueType == oatpp::Float64::Class::getType()) { double f = polymorph.staticCast<oatpp::Float64>(); jval.SetDouble(f); } else if (polymorph.valueType == oatpp::Boolean::Class::getType()) { bool b = polymorph.staticCast<oatpp::Boolean>(); jval = JVal(b); } else if (polymorph.valueType == DTO::DTOVector<double>::Class::getType()) { auto vec = polymorph.staticCast<DTO::DTOVector<double>>(); jval = JVal(rapidjson::kArrayType); for (size_t i = 0; i < vec->size(); ++i) { jval.PushBack(vec->at(i), jdoc.GetAllocator()); } } else if (polymorph.valueType == DTO::DTOVector<uint8_t>::Class::getType()) { auto vec = polymorph.staticCast<DTO::DTOVector<uint8_t>>(); jval = JVal(rapidjson::kArrayType); for (size_t i = 0; i < vec->size(); ++i) { jval.PushBack(vec->at(i), jdoc.GetAllocator()); } } else if (polymorph.valueType == DTO::DTOVector<bool>::Class::getType()) { auto vec = polymorph.staticCast<DTO::DTOVector<bool>>(); jval = JVal(rapidjson::kArrayType); for (size_t i = 0; i < vec->size(); ++i) { jval.PushBack(JVal(bool(vec->at(i))), jdoc.GetAllocator()); } } else if (polymorph.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractVector::CLASS_ID .id) { auto vec = polymorph.staticCast<oatpp::AbstractVector>(); jval = JVal(rapidjson::kArrayType); for (size_t i = 0; i < vec->size(); ++i) { JVal elemJVal; dtoToJVal(vec->at(i), jdoc, elemJVal, ignore_null); jval.PushBack(elemJVal, jdoc.GetAllocator()); } } else if (polymorph.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractPairList:: CLASS_ID.id) { jval = JVal(rapidjson::kObjectType); auto fields = polymorph.staticCast<oatpp::AbstractFields>(); for (auto const &field : *fields) { JVal childJVal; dtoToJVal(field.second, jdoc, childJVal, ignore_null); if (childJVal.IsNull() && ignore_null) continue; jval.AddMember( JVal().SetString(field.first->c_str(), jdoc.GetAllocator()), childJVal, jdoc.GetAllocator()); } } else if (polymorph.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractUnorderedMap:: CLASS_ID.id) { jval = JVal(rapidjson::kObjectType); auto fields = polymorph.staticCast<oatpp::AbstractUnorderedFields>(); for (auto const &field : *fields) { JVal childJVal; dtoToJVal(field.second, jdoc, childJVal, ignore_null); if (childJVal.IsNull() && ignore_null) continue; jval.AddMember( JVal().SetString(field.first->c_str(), jdoc.GetAllocator()), childJVal, jdoc.GetAllocator()); } } else if (polymorph.valueType->classId.id == oatpp::data::mapping::type::__class::AbstractObject::CLASS_ID .id) { jval = JVal(rapidjson::kObjectType); auto dispatcher = static_cast<const oatpp::data::mapping::type::__class:: AbstractObject::PolymorphicDispatcher *>( polymorph.valueType->polymorphicDispatcher); auto fields = dispatcher->getProperties()->getList(); auto object = static_cast<oatpp::BaseObject *>(polymorph.get()); for (auto const &field : fields) { auto val = field->get(object); JVal childJVal; dtoToJVal(val, jdoc, childJVal, ignore_null); if (childJVal.IsNull() && ignore_null) continue; jval.AddMember( JVal().SetString(field->name, jdoc.GetAllocator()), childJVal, jdoc.GetAllocator()); } } else { throw std::runtime_error("dtoToJVal: Type not recognised"); } } } }
37.196078
79
0.557828
pnsuau
caaaa7b9d42aac4ffcb53377a17f3c34c011403a
198
cpp
C++
src/Core/p2/iMath.cpp
stravant/bfbbdecomp
2126be355a6bb8171b850f829c1f2731c8b5de08
[ "OLDAP-2.7" ]
1
2021-01-05T11:28:55.000Z
2021-01-05T11:28:55.000Z
src/Core/p2/iMath.cpp
sonich2401/bfbbdecomp
5f58b62505f8929a72ccf2aa118a1539eb3a5bd6
[ "OLDAP-2.7" ]
null
null
null
src/Core/p2/iMath.cpp
sonich2401/bfbbdecomp
5f58b62505f8929a72ccf2aa118a1539eb3a5bd6
[ "OLDAP-2.7" ]
1
2022-03-30T15:15:08.000Z
2022-03-30T15:15:08.000Z
#include "iMath.h" #include <cmath> float32 isin(float32 x) { return std::sinf(x); } float32 icos(float32 x) { return std::cosf(x); } float32 itan(float32 x) { return std::tanf(x); }
11
24
0.626263
stravant
caab829584acfdf7146919f1516fa9f31e7fe843
4,057
cpp
C++
test/MeLikeyCode-QtGameEngine-2a3d47c/example projects/example3/main.cpp
JamesMBallard/qmake-unity
cf5006a83e7fb1bbd173a9506771693a673d387f
[ "MIT" ]
16
2019-05-23T08:10:39.000Z
2021-12-21T11:20:37.000Z
test/MeLikeyCode-QtGameEngine-2a3d47c/example projects/example3/main.cpp
JamesMBallard/qmake-unity
cf5006a83e7fb1bbd173a9506771693a673d387f
[ "MIT" ]
null
null
null
test/MeLikeyCode-QtGameEngine-2a3d47c/example projects/example3/main.cpp
JamesMBallard/qmake-unity
cf5006a83e7fb1bbd173a9506771693a673d387f
[ "MIT" ]
2
2019-05-23T18:37:43.000Z
2021-08-24T21:29:40.000Z
// Moving/rotating entity // This example picks up where example 2 left of. I took all of the code that created the entity and its graphics and // put it into a function called getMinitaurEntity(). We will now take this entity and make it move in response // to the keyboard keys being pressed. We will also make the entity always face the mouse position. // // Have fun with it! I Hope you enjoy this example! // -Abdullah #include <QApplication> #include "qge/MapGrid.h" #include "qge/Map.h" #include "qge/Game.h" #include "qge/Entity.h" #include "qge/Utilities.h" #include "qge/EntitySprite.h" #include "qge/ECKeyboardMoverPerspective.h" #include "qge/ECMouseFacer.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); // create map qge::Map* map = new qge::Map(); // create map grid qge::MapGrid* mapGrid = new qge::MapGrid(1,1); mapGrid->setMapAtPos(map,0,0); // add map to map grid // create game qge::Game* game = new qge::Game(mapGrid,0,0); // create minitaur looking entity (we did this in example 2, I just moved all that code to a function called qge::getMinitaurEntity()) qge::Entity* entity = qge::getMinitaurEntity(); // add the entity into the map at position (300,300) entity->setPos(QPointF(300,300)); entity->setFacingAngle(0); map->addEntity(entity); // play the stand animation of the entity entity->sprite()->play("stand" ,-1 ,10 ,0); // == NEW STUFF (we've done all of the above code in previous tutorials) == // Let's make the entity move when the arrow keys are pressed. // The way you usually add behaviors like this to an entity is by attaching "EntityControllers" // to the entity. There are lots of built in EntityControllers that add lots of different // types of behaviors to entities. It might be beneficial to look up all (or at least some) of the // built in EntityControllers. // All entity controllers inherit from the class EntityController. // You can use the type hierarchy feature of Qt Creator or inhertence diagram of the doxygen // generated documentation to find all the classes that inherit from EntityController. // Lucky for you, there is a pre built EntityController called ECKeyboardMoverPerspective, // which moves its controlled entity in response to the arrow keys! All we gotta do is attach // the controller. qge::ECKeyboardMoverPerspective* keyboardMoverController = new qge::ECKeyboardMoverPerspective(entity); // That is all! When you construct EntityControllers, you pass the controlled entity into the constructor. // The controller then starts doing its thaaaaang. Run the game right now and pressed the arrow keys and // notice that when you press up, the entity moves forward, when you press down it moves backward, etc. // Look at how much work the entity controller did for you! It listens to keyboard events and in response // it moves the entity in the correct direction (relative to its facing angle), it even asks the entity // to play a "walk" animation! // Now, we want to make the entity always face the mouse. You guessed it, a built in entity controller // exists for that! qge::ECMouseFacer* mouseFacerController = new qge::ECMouseFacer(entity); // Run the game again. Move around the map. // That is all for this tutorial, hope you found it informative and fun! // BONUS: Hello folks, I'm back! I have a few things you can experiment with to earn some bonus pats on the back! // The ECKeyboardMoverPerspective* moves the entity relative to its current facing direction. So when the entity is // facing angle 20 degrees and you press up, it will move forward at that angle. The ECKeyboardMover4Directional // controller moves the entity relative to the screen, not its facing direction. // BONUS OBJECTIVE: Try out ECKeyboardMover4Directional and ECKeyboardMover8Directional (also skim their documentation). game->launch(); // launch game return a.exec(); }
43.623656
138
0.721962
JamesMBallard
caac791b71d9eccac1dec921f4cbd14620fb0ec6
199
hpp
C++
tests/cpp/Error_macro_arglist2.hpp
zaimoni/Z.C-
7ca97ec0af14d092c87a25e07d7ed486c7912266
[ "BSL-1.0" ]
null
null
null
tests/cpp/Error_macro_arglist2.hpp
zaimoni/Z.C-
7ca97ec0af14d092c87a25e07d7ed486c7912266
[ "BSL-1.0" ]
4
2019-12-07T08:08:29.000Z
2021-01-22T00:19:10.000Z
tests/cpp/Error_macro_arglist2.hpp
zaimoni/Z.C-
7ca97ec0af14d092c87a25e07d7ed486c7912266
[ "BSL-1.0" ]
null
null
null
// tests/cpp/Error_macro_arglist2.hpp // too many parameters for a macro is an error // (C)2009 Kenneth Boyd, license: MIT.txt #define UNWELCOME(A,B) 1 #if UNWELCOME(x,y,z) #else #endif
18.090909
47
0.683417
zaimoni
caad201851e378fc0a67abb4f799ad22289e2fa1
205
hpp
C++
Cfg.hpp
QuariumStackHS/QSR-Tool
f7fb94ebbc18892b536e4e4881a53faa4d9c1342
[ "Unlicense" ]
null
null
null
Cfg.hpp
QuariumStackHS/QSR-Tool
f7fb94ebbc18892b536e4e4881a53faa4d9c1342
[ "Unlicense" ]
null
null
null
Cfg.hpp
QuariumStackHS/QSR-Tool
f7fb94ebbc18892b536e4e4881a53faa4d9c1342
[ "Unlicense" ]
null
null
null
#include "QSR/includes/config.hpp" Configurator::Configurator() { this->buildtype = EXE; this->CPPLang = CPP17; this->ProgrameName = "QSR"; this->Termwidth=75; this->debug=1; } //#endif
20.5
34
0.643902
QuariumStackHS
caad6188476ecb6f8cdfce1dbd2930b28063ca5e
180
cpp
C++
SystemResource/Source/Font/FNT/FNTPage.cpp
BitPaw/BitFireEngine
2c02a4eae19276bf60ac925e4393966cec605112
[ "MIT" ]
5
2021-10-19T18:30:43.000Z
2022-03-19T22:02:02.000Z
SystemResource/Source/Font/FNT/FNTPage.cpp
BitPaw/BitFireEngine
2c02a4eae19276bf60ac925e4393966cec605112
[ "MIT" ]
12
2022-03-09T13:40:21.000Z
2022-03-31T12:47:48.000Z
SystemResource/Source/Font/FNT/FNTPage.cpp
BitPaw/BitFireEngine
2c02a4eae19276bf60ac925e4393966cec605112
[ "MIT" ]
null
null
null
#include "FNTPage.h" BF::FNTPage::FNTPage() { PageID = -1; PageFileName[0] = 0; CharacteListSize = 0; CharacteList = 0; } BF::FNTPage::~FNTPage() { delete[] CharacteList; }
12
23
0.644444
BitPaw
caae0a7eab790415c3d6a71f2cb5853a731e89c3
489
cc
C++
cef_widget.cc
cretz/qt_cef_poc
1aefe5d70908162c84ada9d1b6aa8b749ce0c8c6
[ "MIT" ]
25
2017-08-14T07:29:08.000Z
2021-12-29T12:44:19.000Z
cef_widget.cc
cretz/qt_cef_poc
1aefe5d70908162c84ada9d1b6aa8b749ce0c8c6
[ "MIT" ]
4
2017-07-02T19:33:32.000Z
2018-06-12T00:51:39.000Z
cef_widget.cc
cretz/qt_cef_poc
1aefe5d70908162c84ada9d1b6aa8b749ce0c8c6
[ "MIT" ]
6
2017-07-02T21:53:13.000Z
2020-05-14T15:33:43.000Z
#include "cef_widget.h" CefWidget::CefWidget(Cef *cef, QWidget *parent) : QWidget(parent), cef_(cef) {} CefWidget::~CefWidget() { if (browser_) { browser_->GetHost()->CloseBrowser(true); } } void CefWidget::LoadUrl(const QString &url) { if (browser_) { browser_->GetMainFrame()->LoadURL(CefString(url.toStdString())); } } void CefWidget::moveEvent(QMoveEvent *event) { this->UpdateSize(); } void CefWidget::resizeEvent(QResizeEvent *event) { this->UpdateSize(); }
20.375
79
0.685072
cretz
caaec3aba01983cb001bc21d6bf28d79de7152ce
1,210
cpp
C++
waterbox/bsnescore/bsnes/sfc/smp/serialization.cpp
Fortranm/BizHawk
8cb0ffb6f8964cc339bbe1784838918fb0aa7e27
[ "MIT" ]
1,414
2015-06-28T09:57:51.000Z
2021-10-14T03:51:10.000Z
waterbox/bsnescore/bsnes/sfc/smp/serialization.cpp
Fortranm/BizHawk
8cb0ffb6f8964cc339bbe1784838918fb0aa7e27
[ "MIT" ]
2,369
2015-06-25T01:45:44.000Z
2021-10-16T08:44:18.000Z
waterbox/bsnescore/bsnes/sfc/smp/serialization.cpp
Fortranm/BizHawk
8cb0ffb6f8964cc339bbe1784838918fb0aa7e27
[ "MIT" ]
430
2015-06-29T04:28:58.000Z
2021-10-05T18:24:17.000Z
auto SMP::serialize(serializer& s) -> void { SPC700::serialize(s); Thread::serialize(s); s.integer(io.clockCounter); s.integer(io.dspCounter); s.integer(io.apu0); s.integer(io.apu1); s.integer(io.apu2); s.integer(io.apu3); s.integer(io.timersDisable); s.integer(io.ramWritable); s.integer(io.ramDisable); s.integer(io.timersEnable); s.integer(io.externalWaitStates); s.integer(io.internalWaitStates); s.integer(io.iplromEnable); s.integer(io.dspAddr); s.integer(io.cpu0); s.integer(io.cpu1); s.integer(io.cpu2); s.integer(io.cpu3); s.integer(io.aux4); s.integer(io.aux5); s.integer(timer0.stage0); s.integer(timer0.stage1); s.integer(timer0.stage2); s.integer(timer0.stage3); s.boolean(timer0.line); s.boolean(timer0.enable); s.integer(timer0.target); s.integer(timer1.stage0); s.integer(timer1.stage1); s.integer(timer1.stage2); s.integer(timer1.stage3); s.boolean(timer1.line); s.boolean(timer1.enable); s.integer(timer1.target); s.integer(timer2.stage0); s.integer(timer2.stage1); s.integer(timer2.stage2); s.integer(timer2.stage3); s.boolean(timer2.line); s.boolean(timer2.enable); s.integer(timer2.target); }
21.607143
44
0.694215
Fortranm
cab74d3a0cfad5f110c0c5cd812810389e7fbb77
6,411
cpp
C++
src/blinkit/blink/renderer/core/animation/SVGLengthInterpolationType.cpp
titilima/blink
2de70073edfe0e1e0aaf2bb22b5d6abd9b776fad
[ "MIT" ]
13
2020-04-21T13:14:00.000Z
2021-11-13T14:55:12.000Z
src/blinkit/blink/renderer/core/animation/SVGLengthInterpolationType.cpp
titilima/blink
2de70073edfe0e1e0aaf2bb22b5d6abd9b776fad
[ "MIT" ]
null
null
null
src/blinkit/blink/renderer/core/animation/SVGLengthInterpolationType.cpp
titilima/blink
2de70073edfe0e1e0aaf2bb22b5d6abd9b776fad
[ "MIT" ]
4
2020-04-21T13:15:43.000Z
2021-11-13T14:55:00.000Z
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "core/animation/SVGLengthInterpolationType.h" #include "core/animation/InterpolationEnvironment.h" #include "core/animation/StringKeyframe.h" #include "core/css/CSSHelper.h" #include "core/svg/SVGElement.h" #include "core/svg/SVGLength.h" #include "core/svg/SVGLengthContext.h" namespace blink { namespace { enum LengthInterpolatedUnit { LengthInterpolatedNumber, LengthInterpolatedPercentage, LengthInterpolatedEMS, LengthInterpolatedEXS, LengthInterpolatedREMS, LengthInterpolatedCHS, }; static const CSSPrimitiveValue::UnitType unitTypes[] = { CSSPrimitiveValue::UnitType::UserUnits, CSSPrimitiveValue::UnitType::Percentage, CSSPrimitiveValue::UnitType::Ems, CSSPrimitiveValue::UnitType::Exs, CSSPrimitiveValue::UnitType::Rems, CSSPrimitiveValue::UnitType::Chs }; const size_t numLengthInterpolatedUnits = WTF_ARRAY_LENGTH(unitTypes); LengthInterpolatedUnit convertToInterpolatedUnit(CSSPrimitiveValue::UnitType unitType, double& value) { switch (unitType) { case CSSPrimitiveValue::UnitType::Unknown: default: ASSERT_NOT_REACHED(); case CSSPrimitiveValue::UnitType::Pixels: case CSSPrimitiveValue::UnitType::Number: case CSSPrimitiveValue::UnitType::UserUnits: return LengthInterpolatedNumber; case CSSPrimitiveValue::UnitType::Percentage: return LengthInterpolatedPercentage; case CSSPrimitiveValue::UnitType::Ems: return LengthInterpolatedEMS; case CSSPrimitiveValue::UnitType::Exs: return LengthInterpolatedEXS; case CSSPrimitiveValue::UnitType::Centimeters: value *= cssPixelsPerCentimeter; return LengthInterpolatedNumber; case CSSPrimitiveValue::UnitType::Millimeters: value *= cssPixelsPerMillimeter; return LengthInterpolatedNumber; case CSSPrimitiveValue::UnitType::Inches: value *= cssPixelsPerInch; return LengthInterpolatedNumber; case CSSPrimitiveValue::UnitType::Points: value *= cssPixelsPerPoint; return LengthInterpolatedNumber; case CSSPrimitiveValue::UnitType::Picas: value *= cssPixelsPerPica; return LengthInterpolatedNumber; case CSSPrimitiveValue::UnitType::Rems: return LengthInterpolatedREMS; case CSSPrimitiveValue::UnitType::Chs: return LengthInterpolatedCHS; } } } // namespace PassOwnPtr<InterpolableValue> SVGLengthInterpolationType::neutralInterpolableValue() { OwnPtr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); for (size_t i = 0; i < numLengthInterpolatedUnits; ++i) listOfValues->set(i, InterpolableNumber::create(0)); return listOfValues.release(); } InterpolationComponent SVGLengthInterpolationType::convertSVGLength(const SVGLength& length) { double value = length.valueInSpecifiedUnits(); LengthInterpolatedUnit unitType = convertToInterpolatedUnit(length.typeWithCalcResolved(), value); double values[numLengthInterpolatedUnits] = { }; values[unitType] = value; OwnPtr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits); for (size_t i = 0; i < numLengthInterpolatedUnits; ++i) listOfValues->set(i, InterpolableNumber::create(values[i])); return InterpolationComponent(listOfValues.release()); } PassRefPtrWillBeRawPtr<SVGLength> SVGLengthInterpolationType::resolveInterpolableSVGLength(const InterpolableValue& interpolableValue, const SVGLengthContext& lengthContext, SVGLengthMode unitMode, bool negativeValuesForbidden) { const InterpolableList& listOfValues = toInterpolableList(interpolableValue); double value = 0; CSSPrimitiveValue::UnitType unitType = CSSPrimitiveValue::UnitType::UserUnits; unsigned unitTypeCount = 0; // We optimise for the common case where only one unit type is involved. for (size_t i = 0; i < numLengthInterpolatedUnits; i++) { double entry = toInterpolableNumber(listOfValues.get(i))->value(); if (!entry) continue; unitTypeCount++; if (unitTypeCount > 1) break; value = entry; unitType = unitTypes[i]; } if (unitTypeCount > 1) { value = 0; unitType = CSSPrimitiveValue::UnitType::UserUnits; // SVGLength does not support calc expressions, so we convert to canonical units. for (size_t i = 0; i < numLengthInterpolatedUnits; i++) { double entry = toInterpolableNumber(listOfValues.get(i))->value(); if (entry) value += lengthContext.convertValueToUserUnits(entry, unitMode, unitTypes[i]); } } if (negativeValuesForbidden && value < 0) value = 0; RefPtrWillBeRawPtr<SVGLength> result = SVGLength::create(unitMode); // defaults to the length 0 result->newValueSpecifiedUnits(unitType, value); return result.release(); } PassOwnPtr<InterpolationValue> SVGLengthInterpolationType::maybeConvertNeutral(const UnderlyingValue&, ConversionCheckers&) const { return InterpolationValue::create(*this, neutralInterpolableValue()); } PassOwnPtr<InterpolationValue> SVGLengthInterpolationType::maybeConvertSVGValue(const SVGPropertyBase& svgValue) const { if (svgValue.type() != AnimatedLength) return nullptr; const SVGLength& length = toSVGLength(svgValue); InterpolationComponent component = convertSVGLength(length); return InterpolationValue::create(*this, component); } PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGLengthInterpolationType::appliedSVGValue(const InterpolableValue& interpolableValue, const NonInterpolableValue*) const { ASSERT_NOT_REACHED(); // This function is no longer called, because apply has been overridden. return nullptr; } void SVGLengthInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const { SVGElement& element = environment.svgElement(); SVGLengthContext lengthContext(&element); element.setWebAnimatedAttribute(attribute(), resolveInterpolableSVGLength(interpolableValue, lengthContext, m_unitMode, m_negativeValuesForbidden)); } } // namespace blink
37.273256
227
0.746373
titilima
cab87043ffcc6ac122d5deffb214fb0e5c9b176b
4,786
cc
C++
src/test/escape.cc
rpratap-bot/ceph
9834961a66927ae856935591f2fd51082e2ee484
[ "MIT" ]
4
2020-04-08T03:42:02.000Z
2020-10-01T20:34:48.000Z
src/test/escape.cc
rpratap-bot/ceph
9834961a66927ae856935591f2fd51082e2ee484
[ "MIT" ]
93
2020-03-26T14:29:14.000Z
2020-11-12T05:54:55.000Z
src/test/escape.cc
rpratap-bot/ceph
9834961a66927ae856935591f2fd51082e2ee484
[ "MIT" ]
23
2020-03-24T10:28:44.000Z
2020-09-24T09:42:19.000Z
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* * Ceph - scalable distributed file system * * Copyright (C) 2011 New Dream Network * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #include "common/escape.h" #include "gtest/gtest.h" #include <stdint.h> static std::string escape_xml_attrs(const char *str) { int len = escape_xml_attr_len(str); char out[len]; escape_xml_attr(str, out); return out; } static std::string escape_xml_stream(const char *str) { std::stringstream ss; ss << xml_stream_escaper(str); return ss.str(); } TEST(EscapeXml, PassThrough) { ASSERT_EQ(escape_xml_attrs("simplicity itself"), "simplicity itself"); ASSERT_EQ(escape_xml_stream("simplicity itself"), "simplicity itself"); ASSERT_EQ(escape_xml_attrs(""), ""); ASSERT_EQ(escape_xml_stream(""), ""); ASSERT_EQ(escape_xml_attrs("simple examples please!"), "simple examples please!"); ASSERT_EQ(escape_xml_stream("simple examples please!"), "simple examples please!"); } TEST(EscapeXml, EntityRefs1) { ASSERT_EQ(escape_xml_attrs("The \"scare quotes\""), "The &quot;scare quotes&quot;"); ASSERT_EQ(escape_xml_stream("The \"scare quotes\""), "The &quot;scare quotes&quot;"); ASSERT_EQ(escape_xml_attrs("I <3 XML"), "I &lt;3 XML"); ASSERT_EQ(escape_xml_stream("I <3 XML"), "I &lt;3 XML"); ASSERT_EQ(escape_xml_attrs("Some 'single' \"quotes\" here"), "Some &apos;single&apos; &quot;quotes&quot; here"); ASSERT_EQ(escape_xml_stream("Some 'single' \"quotes\" here"), "Some &apos;single&apos; &quot;quotes&quot; here"); } TEST(EscapeXml, ControlChars) { ASSERT_EQ(escape_xml_attrs("\x01\x02\x03"), "&#x01;&#x02;&#x03;"); ASSERT_EQ(escape_xml_stream("\x01\x02\x03"), "&#x01;&#x02;&#x03;"); ASSERT_EQ(escape_xml_attrs("abc\x7f"), "abc&#x7f;"); ASSERT_EQ(escape_xml_stream("abc\x7f"), "abc&#x7f;"); } TEST(EscapeXml, Utf8) { const char *cc1 = "\xe6\xb1\x89\xe5\xad\x97\n"; ASSERT_EQ(escape_xml_attrs(cc1), cc1); ASSERT_EQ(escape_xml_stream(cc1), cc1); ASSERT_EQ(escape_xml_attrs("<\xe6\xb1\x89\xe5\xad\x97>\n"), "&lt;\xe6\xb1\x89\xe5\xad\x97&gt;\n"); ASSERT_EQ(escape_xml_stream("<\xe6\xb1\x89\xe5\xad\x97>\n"), "&lt;\xe6\xb1\x89\xe5\xad\x97&gt;\n"); } static std::string escape_json_attrs(const char *str, size_t src_len = 0) { if (!src_len) src_len = strlen(str); int len = escape_json_attr_len(str, src_len); char out[len]; escape_json_attr(str, src_len, out); return out; } static std::string escape_json_stream(const char *str, size_t src_len = 0) { if (!src_len) src_len = strlen(str); std::stringstream ss; ss << json_stream_escaper(std::string_view(str, src_len)); return ss.str(); } TEST(EscapeJson, PassThrough) { ASSERT_EQ(escape_json_attrs("simplicity itself"), "simplicity itself"); ASSERT_EQ(escape_json_stream("simplicity itself"), "simplicity itself"); ASSERT_EQ(escape_json_attrs(""), ""); ASSERT_EQ(escape_json_stream(""), ""); ASSERT_EQ(escape_json_attrs("simple examples please!"), "simple examples please!"); ASSERT_EQ(escape_json_stream("simple examples please!"), "simple examples please!"); } TEST(EscapeJson, Escapes1) { ASSERT_EQ(escape_json_attrs("The \"scare quotes\""), "The \\\"scare quotes\\\""); ASSERT_EQ(escape_json_stream("The \"scare quotes\""), "The \\\"scare quotes\\\""); ASSERT_EQ(escape_json_attrs("I <3 JSON"), "I <3 JSON"); ASSERT_EQ(escape_json_stream("I <3 JSON"), "I <3 JSON"); ASSERT_EQ(escape_json_attrs("Some 'single' \"quotes\" here"), "Some 'single' \\\"quotes\\\" here"); ASSERT_EQ(escape_json_stream("Some 'single' \"quotes\" here"), "Some 'single' \\\"quotes\\\" here"); ASSERT_EQ(escape_json_attrs("tabs\tand\tnewlines\n, oh my"), "tabs\\tand\\tnewlines\\n, oh my"); ASSERT_EQ(escape_json_stream("tabs\tand\tnewlines\n, oh my"), "tabs\\tand\\tnewlines\\n, oh my"); } TEST(EscapeJson, ControlChars) { ASSERT_EQ(escape_json_attrs("\x01\x02\x03"), "\\u0001\\u0002\\u0003"); ASSERT_EQ(escape_json_stream("\x01\x02\x03"), "\\u0001\\u0002\\u0003"); ASSERT_EQ(escape_json_stream("\x00\x02\x03", 3), "\\u0000\\u0002\\u0003"); // json can't print binary data! ASSERT_EQ(escape_json_stream("\x00\x7f\xff", 3), "\\u0000\\u007f\xff"); ASSERT_EQ(escape_json_attrs("abc\x7f"), "abc\\u007f"); ASSERT_EQ(escape_json_stream("abc\x7f"), "abc\\u007f"); } TEST(EscapeJson, Utf8) { EXPECT_EQ(escape_json_attrs("\xe6\xb1\x89\xe5\xad\x97\n"), "\xe6\xb1\x89\xe5\xad\x97\\n"); EXPECT_EQ(escape_json_stream("\xe6\xb1\x89\xe5\xad\x97\n"), "\xe6\xb1\x89\xe5\xad\x97\\n"); }
37.100775
101
0.687631
rpratap-bot
cab9a98baaa96e753bde8c393a76acd970bbc359
809
hpp
C++
cslibs_math/include/cslibs_math/serialization/vector.hpp
lisilin013/cslibs_math
b1a1bc5bf5a85b2d7467911521806609ed3c16ee
[ "BSD-3-Clause" ]
null
null
null
cslibs_math/include/cslibs_math/serialization/vector.hpp
lisilin013/cslibs_math
b1a1bc5bf5a85b2d7467911521806609ed3c16ee
[ "BSD-3-Clause" ]
null
null
null
cslibs_math/include/cslibs_math/serialization/vector.hpp
lisilin013/cslibs_math
b1a1bc5bf5a85b2d7467911521806609ed3c16ee
[ "BSD-3-Clause" ]
null
null
null
#ifndef CSLIBS_MATH_SERIALIZATION_VECTOR_HPP #define CSLIBS_MATH_SERIALIZATION_VECTOR_HPP #include <cslibs_math/linear/vector.hpp> #include <yaml-cpp/yaml.h> namespace YAML { template<typename T, std::size_t Dim> struct convert<cslibs_math::linear::Vector<T, Dim>> { static Node encode(const cslibs_math::linear::Vector<T,Dim> &rhs) { Node n; for(std::size_t i = 0 ; i < Dim ; ++i) { n.push_back(rhs(i)); } return n; } static bool decode(const Node& n, cslibs_math::linear::Vector<T,Dim> &rhs) { if(!n.IsSequence() || n.size() != Dim) return false; for(std::size_t i = 0 ; i < Dim ; ++i) { rhs(i) = n[i].as<T>(); } return true; } }; } #endif // CSLIBS_MATH_SERIALIZATION_VECTOR_HPP
25.28125
78
0.594561
lisilin013
cabc6d0faedaa5d2437c8bd6213865db7d567a1e
8,960
cpp
C++
azClientFuncs.cpp
jflynn129/M18QxAzureIoT
f8a3a0ef4d16ddeca6235ab9174273ad0757e392
[ "MIT" ]
null
null
null
azClientFuncs.cpp
jflynn129/M18QxAzureIoT
f8a3a0ef4d16ddeca6235ab9174273ad0757e392
[ "MIT" ]
null
null
null
azClientFuncs.cpp
jflynn129/M18QxAzureIoT
f8a3a0ef4d16ddeca6235ab9174273ad0757e392
[ "MIT" ]
1
2021-01-22T22:42:16.000Z
2021-01-22T22:42:16.000Z
/** * copyright (c) 2018, James Flynn * SPDX-License-Identifier: MIT */ #include <stdlib.h> #include "iothub_client_core_common.h" #include "iothub_client_ll.h" #include "azure_c_shared_utility/platform.h" #include "azure_c_shared_utility/agenttime.h" #include "jsondecoder.h" #include "led.hpp" #include "lis2dw12.hpp" #include "adc.hpp" #include "barometer.hpp" #include "hts221.hpp" #include "gps.hpp" #include "azure_certs.h" #include "azIoTClient.h" #ifdef USE_MQTT #include "iothubtransportmqtt.h" #else #include "iothubtransporthttp.h" #endif //The following connection string must be updated for the individual users Azure IoT Device //static const char* connectionString = "HostName=XXXX;DeviceId=xxxx;SharedAccessKey=xxxx"; static const char* connectionString = "HostName=M18QxIoTClient.azure-devices.net;DeviceId=SK2-IMEI353087080010952;SharedAccessKey=3vyDD6lO1VRCfi1bCZ58QsTUsViEZ3Q4JBErtvQzBcA="; extern void sendMessage(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, char* buffer, size_t size); extern void prty_json(char* src, int srclen); char* send_sensrpt(void); char* send_devrpt(void); char* send_locrpt(void); char* send_temprpt(void); char* send_posrpt(void); char* send_envrpt(void); IOTHUBMESSAGE_DISPOSITION_RESULT receiveMessageCallback( IOTHUB_MESSAGE_HANDLE message, void *userContextCallback); void sendMessage(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, char* buffer, size_t size) { IOTHUB_MESSAGE_HANDLE messageHandle = IoTHubMessage_CreateFromByteArray((const unsigned char*)buffer, size); if (messageHandle == NULL) { printf("unable to create a new IoTHubMessage\r\n"); return; } if (IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messageHandle, NULL, NULL) != IOTHUB_CLIENT_OK) printf("FAILED to send!\n"); else printf("OK\n"); IoTHubMessage_Destroy(messageHandle); } IOTHUB_CLIENT_LL_HANDLE setup_azure(void) { /* Setup IoTHub client configuration */ #ifndef USE_MQTT IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, HTTP_Protocol); #else IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, MQTT_Protocol); #endif if (iotHubClientHandle == NULL) { printf("Failed on IoTHubClient_Create\r\n"); return NULL; } // add the certificate information if (IoTHubClient_LL_SetOption(iotHubClientHandle, "TrustedCerts", certificates) != IOTHUB_CLIENT_OK) { IoTHubClient_LL_Destroy(iotHubClientHandle); printf("failure to set option \"TrustedCerts\"\r\n"); return NULL; } // add the certificate information #ifndef USE_MQTT // polls will happen effectively at ~10 seconds. The default value of minimumPollingTime is 25 minutes. // For more information, see: // https://azure.microsoft.com/documentation/articles/iot-hub-devguide/#messaging unsigned int minimumPollingTime = 9; if (IoTHubClient_LL_SetOption(iotHubClientHandle, "MinimumPollingTime", &minimumPollingTime) != IOTHUB_CLIENT_OK) { IoTHubClient_LL_Destroy(iotHubClientHandle); printf("failure to set option \"MinimumPollingTime\"\r\n"); return NULL; } #endif // set C2D and device method callback IoTHubClient_LL_SetMessageCallback(iotHubClientHandle, receiveMessageCallback, NULL); return iotHubClientHandle; } //------------------------------------------------------------------ #define SENS_REPORT "{" \ "\"ObjectName\":\"sensor-report\"," \ "\"SOM\":[\"ADC\",\"LIS2DW12-TEMP\",\"LIS2DW12-POS\",\"GPS\"]," \ "\"CLICK\":[" char* send_sensrpt(void) { int len = sizeof(SENS_REPORT)+30; char* ptr = (char*)malloc(len); snprintf(ptr,len,SENS_REPORT); if( click_modules & (BAROMETER_CLICK|HTS221_CLICK) ) { if (click_modules & BAROMETER_CLICK ) strcat(ptr,"\"BAROMETER\""); if (click_modules & HTS221_CLICK ) strcat(ptr,",\"TEMP&HUMID\""); } else strcat(ptr,"\"NONE\""); strcat(ptr,"]}"); return ptr; } //------------------------------------------------------------------ #define DEV_REPORT "{" \ "\"ObjectName\":\"Device-Info\"," \ "\"ReportingDevice\":\"M18QWG/M18Q2FG-1\"," \ "\"DeviceICCID\":\"%s\"," \ "\"DeviceIMEI\":\"%s\"" \ "}" char* send_devrpt(void) { int len = sizeof(DEV_REPORT)+50; char* ptr = (char*)malloc(len); snprintf(ptr,len,DEV_REPORT, iccid, imei); return ptr; } //------------------------------------------------------------------ #define LOC_REPORT "{" \ "\"ObjectName\":\"location-report\"," \ "\"last GPS fix\":\"%s\"," \ "\"lat\":%.02f," \ "\"long\":%.02f" \ "}" char* send_locrpt(void) { gpsstatus *loc; char temp[25]; struct tm *ptm; int len = sizeof(LOC_REPORT)+35; char* ptr = (char*)malloc(len); loc = gps.getLocation(); ptm = gmtime(&loc->last_good); strftime(temp,25,"%a %F %X",ptm); snprintf(ptr,len, LOC_REPORT, temp, loc->last_pos.lat, loc->last_pos.lng); return ptr; } //------------------------------------------------------------------ #define TEMP_REPORT "{" \ "\"ObjectName\":\"temp-report\"," \ "\"Temperature\":%.02f" \ "}" char* send_temprpt(void) { int len = sizeof(TEMP_REPORT)+10; char* ptr = (char*)malloc(len); snprintf(ptr,len,TEMP_REPORT, mems.lis2dw12_getTemp()); return ptr; } //------------------------------------------------------------------ #define POS_REPORT "{" \ "\"ObjectName\":\"board-position\"," \ "\"Board Moved\":%d," \ "\"Board Position\":%d" \ "}" char* send_posrpt(void) { int len = sizeof(POS_REPORT)+10; char* ptr = (char*)malloc(len); snprintf(ptr,len,POS_REPORT, mems.movement_ocured(), mems.lis2dw12_getPosition()); return ptr; } //------------------------------------------------------------------ #define ENV_REPORT "{" \ "\"ObjectName\":\"enviroment-report\"," \ "\"Barometer\":%.02f," \ "\"Humidity\":%.01f" \ "}" char* send_envrpt(void) { int len = sizeof(ENV_REPORT)+15; char* ptr = (char*)malloc(len); snprintf(ptr,len,ENV_REPORT, (click_modules & BAROMETER_CLICK )? barom.get_pressure():0, (click_modules & HTS221_CLICK )? humid.readHumidity():0 ); return ptr; } IOTHUBMESSAGE_DISPOSITION_RESULT receiveMessageCallback( IOTHUB_MESSAGE_HANDLE message, void *userContextCallback) { const unsigned char *buffer = NULL; char* pmsg = NULL; size_t size = 0; if (IOTHUB_MESSAGE_OK != IoTHubMessage_GetByteArray(message, &buffer, &size)) return IOTHUBMESSAGE_ABANDONED; // message needs to be converted to zero terminated string char * temp = (char *)malloc(size + 1); if (temp == NULL) return IOTHUBMESSAGE_ABANDONED; strncpy(temp, (char*)buffer, size); temp[size] = '\0'; if( !strcmp(temp, "REPORT-SENSORS") ) pmsg = send_sensrpt(); else if( !strcmp(temp, "GET-DEV-INFO") ) pmsg = send_devrpt(); else if( !strcmp(temp, "GET-LOCATION") ) pmsg = send_locrpt(); else if( !strcmp(temp, "GET-TEMP") ) pmsg = send_temprpt(); else if( !strcmp(temp, "GET-POS") ) pmsg = send_posrpt(); else if( !strcmp(temp, "GET-ENV") ) pmsg = send_envrpt(); else if( !strcmp(temp, "LED-ON-MAGENTA") ){ status_led.action(Led::LED_ON,Led::MAGENTA); if( verbose ) printf("Turning LED on to Magenta.\n"); } else if( !strcmp(temp, "LED-BLINK-MAGENTA") ){ status_led.action(Led::LED_BLINK,Led::MAGENTA); if( verbose ) printf("Setting LED to blink Magenta\n"); } else if( !strcmp(temp, "LED-OFF") ){ status_led.action(Led::LED_OFF,Led::BLACK); if( verbose ) printf("Turning LED off.\n"); } else if( strstr(temp, "SET-PERIOD") ) { sscanf(temp,"SET-PERIOD %d",&report_period); int i=report_period % REPORT_PERIOD_RESOLUTION; if( i != 0 ) report_period += (REPORT_PERIOD_RESOLUTION-i); if( verbose ) printf("Report Period remotely set to %d.\n",report_period); } else printf("Received message: '%s'\r\n", temp); if( pmsg != NULL ) { printf("(----)Azure IoT Hub requested response sent - "); sendMessage(IoTHub_client_ll_handle, pmsg, strlen(pmsg)); if( verbose ) prty_json(pmsg,strlen(pmsg)); free(pmsg); } free(temp); return IOTHUBMESSAGE_ACCEPTED; }
31.328671
176
0.598549
jflynn129
cabc8aa51f8bc78ee5e15b09a23fac722f1529e7
248
cpp
C++
library/isceLib/src/Peg.cpp
vincentschut/isce2
1557a05b7b6a3e65abcfc32f89c982ccc9b65e3c
[ "ECL-2.0", "Apache-2.0" ]
1,133
2022-01-07T21:24:57.000Z
2022-01-07T21:33:08.000Z
library/isceLib/src/Peg.cpp
vincentschut/isce2
1557a05b7b6a3e65abcfc32f89c982ccc9b65e3c
[ "ECL-2.0", "Apache-2.0" ]
276
2019-02-10T07:18:28.000Z
2022-03-31T21:45:55.000Z
library/isceLib/src/Peg.cpp
vincentschut/isce2
1557a05b7b6a3e65abcfc32f89c982ccc9b65e3c
[ "ECL-2.0", "Apache-2.0" ]
235
2019-02-10T05:00:53.000Z
2022-03-18T07:37:24.000Z
// // Author: Joshua Cohen // Copyright 2017 // #include "Peg.h" using isceLib::Peg; Peg::Peg() { // Empty constructor return; } Peg::Peg(const Peg &p) { // Copy constructor lat = p.lat; lon = p.lon; hdg = p.hdg; }
11.272727
24
0.544355
vincentschut
cabf1c68839bdff822b88f1cd76fc6a87b883e94
4,478
cpp
C++
src/TrackTile.cpp
VictorieeMan/PianoGame_Compilable
da441618227c84a46eed9fed723ffded5f200dea
[ "MIT" ]
54
2016-05-25T07:39:10.000Z
2022-03-06T01:11:00.000Z
src/TrackTile.cpp
VictorieeMan/PianoGame_Compilable
da441618227c84a46eed9fed723ffded5f200dea
[ "MIT" ]
null
null
null
src/TrackTile.cpp
VictorieeMan/PianoGame_Compilable
da441618227c84a46eed9fed723ffded5f200dea
[ "MIT" ]
18
2018-03-09T12:50:19.000Z
2022-03-22T06:11:19.000Z
// Copyright (c)2007 Nicholas Piegdon // See license.txt for license information #include "TrackTile.h" #include "libmidi/Midi.h" #include "Renderer.h" #include "Tga.h" const static int GraphicWidth = 36; const static int GraphicHeight = 36; TrackTile::TrackTile(int x, int y, size_t track_id, Track::TrackColor color, Track::Mode mode) : m_x(x), m_y(y), m_track_id(track_id), m_color(color), m_mode(mode), m_preview_on(false) { // Initialize the size and position of each button whole_tile = ButtonState(0, 0, TrackTileWidth, TrackTileHeight); button_mode_left = ButtonState( 2, 68, GraphicWidth, GraphicHeight); button_mode_right = ButtonState(192, 68, GraphicWidth, GraphicHeight); button_color = ButtonState(228, 68, GraphicWidth, GraphicHeight); button_preview = ButtonState(264, 68, GraphicWidth, GraphicHeight); } void TrackTile::Update(const MouseInfo &translated_mouse) { // Update the mouse state of each button whole_tile.Update(translated_mouse); button_preview.Update(translated_mouse); button_color.Update(translated_mouse); button_mode_left.Update(translated_mouse); button_mode_right.Update(translated_mouse); if (button_mode_left.hit) { int mode = static_cast<int>(m_mode) - 1; if (mode < 0) mode = 3; m_mode = static_cast<Track::Mode>(mode); } if (button_mode_right.hit) { int mode = static_cast<int>(m_mode) + 1; if (mode > 3) mode = 0; m_mode = static_cast<Track::Mode>(mode); } if (button_preview.hit) { m_preview_on = !m_preview_on; } if (button_color.hit && m_mode != Track::ModeNotPlayed && m_mode != Track::ModePlayedButHidden) { int color = static_cast<int>(m_color) + 1; if (color >= Track::UserSelectableColorCount) color = 0; m_color = static_cast<Track::TrackColor>(color); } } int TrackTile::LookupGraphic(TrackTileGraphic graphic, bool button_hovering) const { // There are three sets of graphics // set 0: window lit, hovering // set 1: window lit, not-hovering // set 2: window unlit, (implied not-hovering) int graphic_set = 2; if (whole_tile.hovering) graphic_set--; if (button_hovering) graphic_set--; const int set_offset = GraphicWidth * Graphic_COUNT; const int graphic_offset = GraphicWidth * graphic; return (set_offset * graphic_set) + graphic_offset; } void TrackTile::Draw(Renderer &renderer, const Midi *midi, Tga *buttons, Tga *box) const { const MidiTrack &track = midi->Tracks()[m_track_id]; bool gray_out_buttons = false; Color light = Track::ColorNoteWhite[m_color]; Color medium = Track::ColorNoteBlack[m_color]; if (m_mode == Track::ModePlayedButHidden || m_mode == Track::ModeNotPlayed) { gray_out_buttons = true; light = Renderer::ToColor(0xB0,0xB0,0xB0); medium = Renderer::ToColor(0x70,0x70,0x70); } Color color_tile = medium; Color color_tile_hovered = light; renderer.SetOffset(m_x, m_y); renderer.SetColor(whole_tile.hovering ? color_tile_hovered : color_tile); renderer.DrawTga(box, -10, -6); renderer.SetColor(White); // Write song info to the tile TextWriter instrument(95, 12, renderer, false, 14); instrument << track.InstrumentName(); TextWriter note_count(95, 33, renderer, false, 14); note_count << static_cast<const unsigned int>(track.Notes().size()); int color_offset = GraphicHeight * static_cast<int>(m_color); if (gray_out_buttons) color_offset = GraphicHeight * Track::UserSelectableColorCount; renderer.DrawTga(buttons, BUTTON_RECT(button_mode_left), LookupGraphic(GraphicLeftArrow, button_mode_left.hovering), color_offset); renderer.DrawTga(buttons, BUTTON_RECT(button_mode_right), LookupGraphic(GraphicRightArrow, button_mode_right.hovering), color_offset); renderer.DrawTga(buttons, BUTTON_RECT(button_color), LookupGraphic(GraphicColor, button_color.hovering), color_offset); TrackTileGraphic preview_graphic = GraphicPreviewTurnOn; if (m_preview_on) preview_graphic = GraphicPreviewTurnOff; renderer.DrawTga(buttons, BUTTON_RECT(button_preview), LookupGraphic(preview_graphic, button_preview.hovering), color_offset); // Draw mode text TextWriter mode(42, 76, renderer, false, 14); mode << Track::ModeText[m_mode]; renderer.ResetOffset(); }
34.713178
138
0.698526
VictorieeMan
cac15c754870de7ae87825f8810b7ed8c9704a9c
1,883
cpp
C++
lib/src/checkers/tools/location-finder/main.cpp
USECAP/ci-tools
ad2300e3297266ff3ee6ed9118ccd16fc05291e3
[ "MIT" ]
null
null
null
lib/src/checkers/tools/location-finder/main.cpp
USECAP/ci-tools
ad2300e3297266ff3ee6ed9118ccd16fc05291e3
[ "MIT" ]
null
null
null
lib/src/checkers/tools/location-finder/main.cpp
USECAP/ci-tools
ad2300e3297266ff3ee6ed9118ccd16fc05291e3
[ "MIT" ]
null
null
null
/** * @file fuzzy_clang.cpp * @author Sirko Höer * @date 18.11.2017 * @brief Entrypoint for the fuzzy-clang ... * * @copyright Copyright (c) 2018 Code Intelligence. All rights reserved. */ #include <clang/Tooling/Tooling.h> #include <clang/Tooling/CommonOptionsParser.h> #include "PPContext.h" #include "LocationFinderAction.h" using namespace llvm; using namespace clang; using namespace clang::tooling; static cl::OptionCategory tool_category("location-finder-options"); static cl::opt<std::string> positionOption{"pos", cl::desc{"Startposition from function or element"}, cl::Optional, cl::cat{tool_category}}; static cl::opt<bool> jsonOption{"json", cl::desc{"Json output enable"}, cl::Optional, cl::cat{tool_category}}; int main(int argc, const char **argv) { // Initial CommonOptionParser with the args from the commandline CommonOptionsParser OptionsParser(argc, argv, tool_category); ClangTool Tool(OptionsParser.getCompilations(), OptionsParser.getSourcePathList()); // create und initialize the essential components for traversing an AST PPContext ppC{Tool, OptionsParser}; ppC.createPreprocessor(); ppC.createASTContext(); // Initialize a Rewriter Object and set the source manager Rewriter RW; RW.setSourceMgr( ppC.getCompilerInstance().getSourceManager(), ppC.getCompilerInstance().getLangOpts()); // Create a AST-Consumer LocationFinderASTConsumer TheASTConsumer(RW, positionOption.getValue()); // Set the AST-Consumer to the compiler instanze LocationFinderAction find_location(ppC); // start find location ... find_location.run(&TheASTConsumer); return 0; }
30.868852
94
0.653213
USECAP
cac166fde2d68f743a9e0ea6effd8bd943fec48f
2,575
hpp
C++
miniapps/solvers/lor_mms.hpp
adantra/mfem
e48b5ffa1a8cdb5a18c0c3c28ab48fbdcd7ad298
[ "BSD-3-Clause" ]
null
null
null
miniapps/solvers/lor_mms.hpp
adantra/mfem
e48b5ffa1a8cdb5a18c0c3c28ab48fbdcd7ad298
[ "BSD-3-Clause" ]
null
null
null
miniapps/solvers/lor_mms.hpp
adantra/mfem
e48b5ffa1a8cdb5a18c0c3c28ab48fbdcd7ad298
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2010-2022, Lawrence Livermore National Security, LLC. Produced // at the Lawrence Livermore National Laboratory. All Rights reserved. See files // LICENSE and NOTICE for details. LLNL-CODE-806117. // // This file is part of the MFEM library. For more information and source code // availability visit https://mfem.org. // // MFEM is free software; you can redistribute it and/or modify it under the // terms of the BSD-3 license. We welcome feedback and contributions, see file // CONTRIBUTING.md for details. #ifndef MFEM_LOR_MMS_HPP #define MFEM_LOR_MMS_HPP extern bool grad_div_problem; namespace mfem { static constexpr double pi = M_PI, pi2 = M_PI*M_PI; // Exact solution for definite Helmholtz problem with RHS corresponding to f // defined below. double u(const Vector &xvec) { int dim = xvec.Size(); double x = pi*xvec[0], y = pi*xvec[1]; if (dim == 2) { return sin(x)*sin(y); } else { double z = pi*xvec[2]; return sin(x)*sin(y)*sin(z); } } double f(const Vector &xvec) { int dim = xvec.Size(); double x = pi*xvec[0], y = pi*xvec[1]; if (dim == 2) { return sin(x)*sin(y) + 2*pi2*sin(x)*sin(y); } else // dim == 3 { double z = pi*xvec[2]; return sin(x)*sin(y)*sin(z) + 3*pi2*sin(x)*sin(y)*sin(z); } } // Exact solution for definite Maxwell and grad-div problems with RHS // corresponding to f_vec below. void u_vec(const Vector &xvec, Vector &u) { int dim = xvec.Size(); double x = pi*xvec[0], y = pi*xvec[1]; if (dim == 2) { u[0] = cos(x)*sin(y); u[1] = sin(x)*cos(y); } else // dim == 3 { double z = pi*xvec[2]; u[0] = cos(x)*sin(y)*sin(z); u[1] = sin(x)*cos(y)*sin(z); u[2] = sin(x)*sin(y)*cos(z); } } void f_vec(const Vector &xvec, Vector &f) { int dim = xvec.Size(); double x = pi*xvec[0], y = pi*xvec[1]; if (grad_div_problem) { if (dim == 2) { f[0] = (1 + 2*pi2)*cos(x)*sin(y); f[1] = (1 + 2*pi2)*cos(y)*sin(x); } else // dim == 3 { double z = pi*xvec[2]; f[0] = (1 + 3*pi2)*cos(x)*sin(y)*sin(z); f[1] = (1 + 3*pi2)*cos(y)*sin(x)*sin(z); f[2] = (1 + 3*pi2)*cos(z)*sin(x)*sin(y); } } else { if (dim == 2) { f[0] = cos(x)*sin(y); f[1] = sin(x)*cos(y); } else // dim == 3 { double z = pi*xvec[2]; f[0] = cos(x)*sin(y)*sin(z); f[1] = sin(x)*cos(y)*sin(z); f[2] = sin(x)*sin(y)*cos(z); } } } } // namespace mfem #endif
24.065421
80
0.546408
adantra
cac2563e46f2138efc6fe54934946099ef721ffd
1,924
cpp
C++
examples/eigen.cpp
bjornpiltz/CppCodeGenVar
4f4707c88202695300e55db8909af29107bdc157
[ "MIT" ]
6
2018-01-23T09:41:05.000Z
2021-11-03T05:44:14.000Z
examples/eigen.cpp
bjornpiltz/CppCodeGenVar
4f4707c88202695300e55db8909af29107bdc157
[ "MIT" ]
14
2018-01-18T13:16:20.000Z
2018-02-25T21:42:34.000Z
examples/eigen.cpp
bjornpiltz/CppCodeGenVar
4f4707c88202695300e55db8909af29107bdc157
[ "MIT" ]
null
null
null
#include <codegenvar/Eigen> #include <Eigen/Geometry> #include <iostream> using namespace codegenvar; int main() { const Symbol x("x"), y("y"), dx("dx"), dy("dy"), a("a"); const Vec2 p(x, y); const Vec3 P = p.homogeneous(); const Vec2 diff(dx, dy); std::cout << "p = " << p.transpose() << std::endl; std::cout << "translate by " << diff.transpose() << std::endl; std::cout << "rotate by " << a << std::endl << std::endl; std::cout << "P = " << P.transpose() << std::endl << std::endl; Mat23 t; t << Symbol(1), Symbol(0), diff(0), Symbol(0), Symbol(1), diff(1); std::cout << "p + diff = " << (p+diff).transpose() << std::endl << std::endl; std::cout << "t = " << std::endl << t << std::endl << std::endl; std::cout << "t*P = " << (t*P).transpose() << std::endl << std::endl; Mat3 T; T << t(0, 0), t(0, 1), t(0, 2), t(1, 0), t(1, 1), t(1, 2), Symbol(0), Symbol(0), Symbol(1); std::cout << "T = " << std::endl << T << std::endl << std::endl; std::cout << "T*P = " << (T*P).transpose() << std::endl << std::endl; Mat2 r; r << cos(a), -sin(a), sin(a), cos(a); std::cout << "r = " << std::endl << r << std::endl << std::endl; std::cout << "r*p = " << (r*p).transpose() << std::endl << std::endl; Mat3 R; R << r(0, 0) , r(0, 1), Symbol(0), r(1, 0) , r(1, 1), Symbol(0), Symbol(0), Symbol(0), Symbol(1); std::cout << "R = " << std::endl << R << std::endl << std::endl; std::cout << "R*P = " << (R*P).transpose() << std::endl << std::endl; std::cout << "T*R = " << std::endl << T*R << std::endl << std::endl; std::cout << "T*R*P = " << (T*R*P).transpose() << std::endl << std::endl; std::cout << "R*T = " << std::endl << R*T << std::endl << std::endl; std::cout << "R*T*P = " << (R*T*P).transpose() << std::endl << std::endl; return 0; }
33.172414
81
0.464137
bjornpiltz
cac2a31a88f5db4bfea02e6e8a36879a119b151a
1,728
cpp
C++
src/afk/component/ScriptsComponent.cpp
christocs/ICT397
5ff6e4ed8757effad19b88fdb91f36504208f942
[ "ISC" ]
null
null
null
src/afk/component/ScriptsComponent.cpp
christocs/ICT397
5ff6e4ed8757effad19b88fdb91f36504208f942
[ "ISC" ]
null
null
null
src/afk/component/ScriptsComponent.cpp
christocs/ICT397
5ff6e4ed8757effad19b88fdb91f36504208f942
[ "ISC" ]
null
null
null
#include "ScriptsComponent.hpp" #include <string> #include "afk/Afk.hpp" #include "afk/io/Log.hpp" #include "afk/io/Path.hpp" using Afk::ScriptsComponent; ScriptsComponent::ScriptsComponent(GameObject e, lua_State *lua_state) : loaded_files(), last_write(), lua(lua_state) { this->owning_entity = e; } auto ScriptsComponent::add_script(const path &script_path, EventManager *evt_mgr) -> ScriptsComponent & { const auto abs_path = Afk::get_absolute_path(script_path); auto lua_script = std::shared_ptr<LuaScript>(new LuaScript{evt_mgr, this->lua, this}); lua_script->load(abs_path); this->loaded_files.emplace(abs_path, lua_script); this->last_write.emplace(abs_path, std::filesystem::last_write_time(abs_path)); return *this; } auto ScriptsComponent::remove_script(const path &script_path) -> void { const auto abs_path = Afk::get_absolute_path(script_path); this->loaded_files.erase(abs_path); } auto ScriptsComponent::get_script_table(const std::string &script_path) -> LuaRef { const auto full_path = Afk::get_absolute_path(script_path); auto f = this->global_tables.find(full_path); if (f != this->global_tables.end()) { return f->second; } auto new_tbl = LuaRef::newTable(this->lua); this->global_tables.emplace(full_path, new_tbl); return new_tbl; } auto ScriptsComponent::check_live_reload() -> void { for (auto &script : this->loaded_files) { const auto &script_path = script.first; auto recent_write = std::filesystem::last_write_time(script_path); if (recent_write > this->last_write[script_path]) { script.second->unload(); script.second->load(script_path); this->last_write[script_path] = recent_write; } } }
33.230769
88
0.722801
christocs
cac2c52dbf199808bd21ffd4c08e38e9dbb238ed
4,664
cc
C++
webserver/webservd/log_manager_test.cc
strassek/chromiumos-platform2
12c953f41f48b8a6b0bd1c181d09bdb1de38325c
[ "BSD-3-Clause" ]
4
2020-07-24T06:54:16.000Z
2021-06-16T17:13:53.000Z
webserver/webservd/log_manager_test.cc
strassek/chromiumos-platform2
12c953f41f48b8a6b0bd1c181d09bdb1de38325c
[ "BSD-3-Clause" ]
1
2021-04-02T17:35:07.000Z
2021-04-02T17:35:07.000Z
webserver/webservd/log_manager_test.cc
strassek/chromiumos-platform2
12c953f41f48b8a6b0bd1c181d09bdb1de38325c
[ "BSD-3-Clause" ]
1
2020-11-04T22:31:45.000Z
2020-11-04T22:31:45.000Z
// Copyright 2015 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "webservd/log_manager.h" #include <arpa/inet.h> #include <netinet/in.h> #include <set> #include <vector> #include <base/files/file_enumerator.h> #include <base/files/file_util.h> #include <base/files/scoped_temp_dir.h> #include <base/strings/stringprintf.h> #include <gtest/gtest.h> namespace webservd { namespace { struct TestLogger : public LogManager::LoggerInterface { explicit TestLogger(std::string& last_entry) : last_entry_{last_entry} {} void Log(const base::Time& timestamp, const std::string& entry) override { last_entry_ = entry; } std::string& last_entry_; }; } // Anonymous namespace class LogManagerTest : public testing::Test { public: void SetUp() override { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); } // Adds a test log entry to the file corresponding to the give |timestamp|. void LogEntry(const base::Time& timestamp) { sockaddr_in client_addr = {}; client_addr.sin_family = AF_INET; client_addr.sin_port = 80; inet_aton("10.11.12.13", &client_addr.sin_addr); LogManager::OnRequestCompleted( timestamp, reinterpret_cast<const sockaddr*>(&client_addr), "POST", "/test", "HTTP/1.0", 200, 123456); } // Get the list of current log files in the test log directory. std::set<std::string> GetLogFiles() const { std::set<std::string> log_files; base::FileEnumerator enumerator{temp_dir.GetPath(), false, base::FileEnumerator::FILES, "*.log"}; base::FilePath file = enumerator.Next(); while (!file.empty()) { log_files.insert(file.BaseName().value()); file = enumerator.Next(); } return log_files; } base::ScopedTempDir temp_dir; }; TEST_F(LogManagerTest, OnRequestCompleted) { std::string last_entry; LogManager::SetLogger( std::unique_ptr<LogManager::LoggerInterface>(new TestLogger{last_entry})); base::Time timestamp = base::Time::Now(); LogEntry(timestamp); tm time_buf = {}; char str_buf[32] = {}; time_t time = timestamp.ToTimeT(); strftime(str_buf, sizeof(str_buf), "%d/%b/%Y:%H:%M:%S %z", localtime_r(&time, &time_buf)); std::string match = base::StringPrintf( "10.11.12.13 - - [%s] \"POST /test HTTP/1.0\" 200 123456\n", str_buf); EXPECT_EQ(match, last_entry); } TEST_F(LogManagerTest, LogFileManagement) { LogManager::Init(temp_dir.GetPath()); EXPECT_TRUE(GetLogFiles().empty()); // Feb 25, 2015, 0:00:00 Local time tm date = {0, 0, 0, 25, 1, 115, 2, 55, 0}; base::Time timestamp = base::Time::FromTimeT(mktime(&date)); for (size_t i = 0; i < 10; i++) { LogEntry(timestamp); LogEntry(timestamp); LogEntry(timestamp); LogEntry(timestamp); timestamp += base::TimeDelta::FromDays(1); } std::set<std::string> expected_files{ "2015-02-28.log", "2015-03-01.log", "2015-03-02.log", "2015-03-03.log", "2015-03-04.log", "2015-03-05.log", "2015-03-06.log", }; EXPECT_EQ(expected_files, GetLogFiles()); } TEST_F(LogManagerTest, LargeLogs) { const size_t log_line_len = 78; // Test log entries are 78 chars long. LogManager::Init(temp_dir.GetPath()); EXPECT_TRUE(GetLogFiles().empty()); // Feb 25, 2015, 0:00:00 Local time tm date = {0, 0, 0, 25, 1, 115, 2, 55, 0}; base::Time timestamp = base::Time::FromTimeT(mktime(&date)); // Create 2015-02-25.log LogEntry(timestamp); timestamp += base::TimeDelta::FromDays(1); // Write a large 2015-02-26.log but with enough room for one more log line. std::vector<char> data(1024 * 1024 - (log_line_len * 3 / 2), ' '); base::FilePath current_file = temp_dir.GetPath().Append("2015-02-26.log"); ASSERT_EQ(static_cast<int>(data.size()), base::WriteFile(current_file, data.data(), data.size())); // Add the line. Should still go to the same file. LogEntry(timestamp); std::set<std::string> expected_files{ "2015-02-25.log", "2015-02-26.log", }; EXPECT_EQ(expected_files, GetLogFiles()); // Now this log entry will not fit and will end up creating a new file. LogEntry(timestamp); expected_files = { "2015-02-25.log", "2015-02-26-a.log", "2015-02-26.log", }; EXPECT_EQ(expected_files, GetLogFiles()); // Add some more data to the current file. ASSERT_TRUE(base::AppendToFile(current_file, data.data(), data.size())); LogEntry(timestamp); expected_files = { "2015-02-25.log", "2015-02-26-a.log", "2015-02-26-b.log", "2015-02-26.log", }; } } // namespace webservd
32.84507
80
0.663379
strassek
cac619997c9d5acb0f49290d16422f14d0aa88c0
4,502
cpp
C++
LibCarla/source/carla/client/Waypoint.cpp
simon0628/carla
b49664f94f87291be36805315593571678c8da28
[ "MIT" ]
null
null
null
LibCarla/source/carla/client/Waypoint.cpp
simon0628/carla
b49664f94f87291be36805315593571678c8da28
[ "MIT" ]
null
null
null
LibCarla/source/carla/client/Waypoint.cpp
simon0628/carla
b49664f94f87291be36805315593571678c8da28
[ "MIT" ]
1
2019-05-28T18:49:44.000Z
2019-05-28T18:49:44.000Z
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma // de Barcelona (UAB). // // This work is licensed under the terms of the MIT license. // For a copy, see <https://opensource.org/licenses/MIT>. #include "carla/client/Waypoint.h" #include "carla/client/Map.h" namespace carla { namespace client { Waypoint::Waypoint(SharedPtr<const Map> parent, road::element::Waypoint waypoint) : _parent(std::move(parent)), _waypoint(std::move(waypoint)), _transform(_parent->GetMap().ComputeTransform(_waypoint)), _mark_record(_parent->GetMap().GetMarkRecord(_waypoint)) {} Waypoint::~Waypoint() = default; bool Waypoint::IsIntersection() const { return _parent->GetMap().IsJunction(_waypoint.road_id); } double Waypoint::GetLaneWidth() const { return _parent->GetMap().GetLaneWidth(_waypoint); } road::Lane::LaneType Waypoint::GetType() const { return _parent->GetMap().GetLaneType(_waypoint); } std::vector<SharedPtr<Waypoint>> Waypoint::GetNext(double distance) const { auto waypoints = _parent->GetMap().GetNext(_waypoint, distance); std::vector<SharedPtr<Waypoint>> result; result.reserve(waypoints.size()); for (auto &waypoint : waypoints) { result.emplace_back(SharedPtr<Waypoint>(new Waypoint(_parent, std::move(waypoint)))); } return result; } SharedPtr<Waypoint> Waypoint::GetRight() const { auto right_lane_waypoint = _parent->GetMap().GetRight(_waypoint); if (right_lane_waypoint.has_value()) { return SharedPtr<Waypoint>(new Waypoint(_parent, std::move(*right_lane_waypoint))); } return nullptr; } SharedPtr<Waypoint> Waypoint::GetLeft() const { auto left_lane_waypoint = _parent->GetMap().GetLeft(_waypoint); if (left_lane_waypoint.has_value()) { return SharedPtr<Waypoint>(new Waypoint(_parent, std::move(*left_lane_waypoint))); } return nullptr; } boost::optional<road::element::LaneMarking> Waypoint::GetRightLaneMarking() const { if (_mark_record.first != nullptr) { return road::element::LaneMarking(*_mark_record.first); } return boost::optional<road::element::LaneMarking>{}; } boost::optional<road::element::LaneMarking> Waypoint::GetLeftLaneMarking() const { if (_mark_record.first != nullptr) { return road::element::LaneMarking(*_mark_record.second); } return boost::optional<road::element::LaneMarking>{}; } template <typename EnumT> static EnumT operator&(EnumT lhs, EnumT rhs) { return static_cast<EnumT>( static_cast<typename std::underlying_type<EnumT>::type>(lhs) & static_cast<typename std::underlying_type<EnumT>::type>(rhs)); } template <typename EnumT> static EnumT operator|(EnumT lhs, EnumT rhs) { return static_cast<EnumT>( static_cast<typename std::underlying_type<EnumT>::type>(lhs) | static_cast<typename std::underlying_type<EnumT>::type>(rhs)); } road::element::LaneMarking::LaneChange Waypoint::GetLaneChange() const { using lane_change_type = road::element::LaneMarking::LaneChange; const auto lane_change_right_info = _mark_record.first; lane_change_type c_right; if (lane_change_right_info != nullptr) { const auto lane_change_right = lane_change_right_info->GetLaneChange(); c_right = static_cast<lane_change_type>(lane_change_right); } else { c_right = lane_change_type::Both; } const auto lane_change_left_info = _mark_record.second; lane_change_type c_left; if (lane_change_left_info != nullptr) { const auto lane_change_left = lane_change_left_info->GetLaneChange(); c_left = static_cast<lane_change_type>(lane_change_left); } else { c_left = lane_change_type::Both; } if (_waypoint.lane_id > 0) { // if road goes backward if (c_right == lane_change_type::Right) { c_right = lane_change_type::Left; } else if (c_right == lane_change_type::Left) { c_right = lane_change_type::Right; } } if (((_waypoint.lane_id > 0) ? _waypoint.lane_id - 1 : _waypoint.lane_id + 1) > 0) { // if road goes backward if (c_left == lane_change_type::Right) { c_left = lane_change_type::Left; } else if (c_left == lane_change_type::Left) { c_left = lane_change_type::Right; } } return (c_right & lane_change_type::Right) | (c_left & lane_change_type::Left); } } // namespace client } // namespace carla
33.348148
91
0.686806
simon0628
cac90e18423d20b1de43ed694fb3f2dc728eb82f
1,384
cpp
C++
101/oops/about_inheritance.cpp
hariharanragothaman/Learning-STL
7e5f58083212d04b93159d44e1812069171aa349
[ "MIT" ]
2
2021-04-21T07:59:45.000Z
2021-05-13T05:53:00.000Z
101/oops/about_inheritance.cpp
hariharanragothaman/Learning-STL
7e5f58083212d04b93159d44e1812069171aa349
[ "MIT" ]
null
null
null
101/oops/about_inheritance.cpp
hariharanragothaman/Learning-STL
7e5f58083212d04b93159d44e1812069171aa349
[ "MIT" ]
1
2021-04-17T15:32:18.000Z
2021-04-17T15:32:18.000Z
#include <iostream> using namespace std; /* * Inheritance provides a way to create a new class from an existing class * New class is a specialized version of existing class * * Base Class (Parent) : inherited by child class * Derived class (Child) : inherits from the base class */ /* Here Undergrad class inherits Student Class class Student { }; class Undergrad : public Student { }; */ /* Rules classification * * An object of the child has: * 1. All members defined in the child class. * 2. All members declared in the parent class. * * An object of the child class can use: * 1. All public members defined in the child class * 2. All public members defined in the parent class * * Protected Members: * -> Protected members is similar to private - but accessible by objects of derived class * -> allows derived class to know details of parents * */ // Base Class class Shape { public: Shape() { length = 0; } void setlength(int l) { length = l; } protected: int length; }; // Derived Class class Square: public Shape{ public: Square(): Shape() { length = 0; } int get_Area() { return (length*length); } }; int main() { Square sq; sq.setlength(5); cout << "The total area of the square is: " << sq.get_Area() << endl; return 0; }
16.47619
91
0.631503
hariharanragothaman
cac90f9778320bbbc544d5218bc94bfb2ee6de72
20,771
cpp
C++
src/texedit.cpp
SiriusTR/dle-experimental
2ee17b4277b68eef57960d5cf9762dd986eaa0d9
[ "MIT" ]
null
null
null
src/texedit.cpp
SiriusTR/dle-experimental
2ee17b4277b68eef57960d5cf9762dd986eaa0d9
[ "MIT" ]
3
2019-09-10T03:50:40.000Z
2019-09-23T04:20:14.000Z
src/texedit.cpp
SiriusTR/dle-experimental
2ee17b4277b68eef57960d5cf9762dd986eaa0d9
[ "MIT" ]
1
2021-10-02T14:16:28.000Z
2021-10-02T14:16:28.000Z
#include "stdafx.h" #include <string.h> #include <stdio.h> #include <string.h> #include <commdlg.h> #include <math.h> #include "mine.h" #include "dle-xp.h" #include "toolview.h" #include "PaletteManager.h" #include "TextureManager.h" //------------------------------------------------------------------------------ BEGIN_MESSAGE_MAP (CPaletteWnd, CWnd) #if 0 ON_WM_LBUTTONDOWN () ON_WM_RBUTTONDOWN () ON_WM_LBUTTONUP () ON_WM_RBUTTONUP () #endif END_MESSAGE_MAP () //------------------------------------------------------------------------------ BEGIN_MESSAGE_MAP (CTextureEdit, CDialog) ON_WM_PAINT () ON_WM_MOUSEMOVE () ON_WM_LBUTTONDOWN () ON_WM_RBUTTONDOWN () ON_WM_LBUTTONUP () ON_WM_RBUTTONUP () ON_BN_CLICKED (IDC_TEXEDIT_DEFAULT, OnDefault) ON_BN_CLICKED (IDC_TEXEDIT_UNDO, OnUndo) ON_BN_CLICKED (IDC_TEXEDIT_LOAD, OnLoad) ON_BN_CLICKED (IDC_TEXEDIT_SAVE, OnSave) END_MESSAGE_MAP () //------------------------------------------------------------------------------ CPaletteWnd::CPaletteWnd () { m_nWidth = m_nHeight = 0; m_pDC = null; m_pOldPal = null; } //------------------------------------------------------------------------------ CPaletteWnd::~CPaletteWnd () { } //------------------------------------------------------------------------------ #define MINRGB(rgb) (((rgb)->peRed < (rgb)->peGreen) ? ((rgb)->peRed < (rgb)->peBlue) ? (rgb)->peRed : (rgb)->peBlue : ((rgb)->peGreen < (rgb)->peBlue) ? (rgb)->peGreen : (rgb)->peBlue) #define MAXRGB(rgb) (((rgb)->peRed > (rgb)->peGreen) ? ((rgb)->peRed > (rgb)->peBlue) ? (rgb)->peRed : (rgb)->peBlue : ((rgb)->peGreen > (rgb)->peBlue) ? (rgb)->peGreen : (rgb)->peBlue) #define sqr(v) (((int)(v))*((int)(v))) int CPaletteWnd::CmpColors (PALETTEENTRY *c, PALETTEENTRY *m) { int i = c->peRed + c->peGreen + c->peBlue; //Luminance (c->peRed, c->peGreen, c->peBlue); int j = m->peRed + m->peGreen + m->peBlue; //Luminance (m->peRed, m->peGreen, m->peBlue); if (i < j) return -1; if (i > j) return 1; if (c->peRed < m->peRed) return -1; if (c->peRed > m->peRed) return 1; if (c->peGreen < m->peGreen) return -1; if (c->peGreen > m->peGreen) return 1; if (c->peBlue < m->peBlue) return -1; if (c->peBlue > m->peBlue) return 1; return 0; } //------------------------------------------------------------------------------ void CPaletteWnd::SortPalette (int left, int right) { int l = left, r = right; PALETTEENTRY m = m_palColors [(l + r) / 2]; do { while (CmpColors (m_palColors + l, &m) < 0) l++; while (CmpColors (m_palColors + r, &m) > 0) r--; if (l <= r) { if (l < r) { PALETTEENTRY h = m_palColors [l]; m_palColors [l] = h = m_palColors [r]; m_palColors [r] = h; ubyte i = m_nSortedPalIdx [l]; m_nSortedPalIdx [l] = m_nSortedPalIdx [r]; m_nSortedPalIdx [r] = i; } l++; r--; } } while (l <= r); if (left < r) SortPalette (left, r); if (l < right) SortPalette (l, right); } //------------------------------------------------------------------------------ void CPaletteWnd::CreatePalette () { for (int i = 0; i < 256; i++) { m_nSortedPalIdx [i] = i; RgbFromIndex (i, m_palColors [i]); } } //------------------------------------------------------------------------------ void CPaletteWnd::Update () { InvalidateRect (null); UpdateWindow (); } //------------------------------------------------------------------------------ int CPaletteWnd::Create (CWnd *pParentWnd, int nWidth, int nHeight) { CRect rc; m_pParentWnd = pParentWnd; pParentWnd->GetClientRect (rc); m_nWidth = nWidth; m_nHeight = nHeight; if (m_nWidth < 0) m_nWidth = rc.Width () / 8; if (m_nHeight < 0) { m_nHeight = rc.Height () / 8; if (m_nWidth * m_nHeight > 256) m_nHeight = (256 + m_nWidth - 1) / m_nWidth; } return CWnd::Create (null, null, WS_CHILD | WS_VISIBLE, rc, pParentWnd, 0); } //------------------------------------------------------------------------------ bool CPaletteWnd::SelectColor (CPoint& point, int& color, PALETTEENTRY *pRGB) { CRect rcPal; GetClientRect (rcPal); //ClientToScreen (rcPal); // if over palette, redefine foreground color if (PtInRect (rcPal, point)) { int x, y; // x = ((point.x - rcPal.left) >> 3)&127; // y = ((point.y - rcPal.top) >> 3)&31; x = (int) ((double) (point.x - rcPal.left) * ((double) m_nWidth / rcPal.Width ())); y = (int) ((double) (point.y - rcPal.top) * ((double) m_nHeight / rcPal.Height ())); int c = m_nWidth * y + x; if (c > 255) return false; color = m_nSortedPalIdx [c]; if (pRGB) *pRGB = m_palColors [c]; //RgbFromIndex (color, pRGB); return true; } return false; } //------------------------------------------------------------------------------ void CPaletteWnd::SetPalettePixel (int x, int y) { CRect rc; GetClientRect (&rc); int dx, dy; for (dy = 0; dy < 8; dy++) for (dx = 0; dx < 8; dx++) m_pDC->SetPixel ((x << 3) + dx + rc.left, (y << 3) + dy + rc.top, /*PALETTEINDEX*/ (y * m_nWidth + x)); } //------------------------------------------------------------------------------ void CPaletteWnd::DrawPalette (void) { if (!BeginPaint ()) return; CreatePalette (); //SortPalette (0, 255); CRect rc; GetClientRect (&rc); ubyte *bmPalette = new ubyte [m_nWidth * m_nHeight]; int h, i, c, w, x, y; for (c = 0, y = m_nHeight - 1; (y >= 0); y--) { for (x = 0, h = y * m_nWidth; x < m_nWidth; x++, h++) { if (!y) y = 0; bmPalette [h] = (c < 256) ? m_nSortedPalIdx [c++] : 0; } } BITMAPINFO* bmi = paletteManager.BMI (); bmi->bmiHeader.biWidth = m_nWidth; bmi->bmiHeader.biHeight = m_nHeight; bmi->bmiHeader.biBitCount = 8; bmi->bmiHeader.biClrUsed = 0; //CPalette *pOldPalette = m_pDC->SelectPalette (paletteManager.Render (), FALSE); //m_pDC->RealizePalette (); if (m_nWidth & 1) for (i = 0; i < m_nHeight; i++) { w = (i == m_nHeight - 1) ? 256 % m_nWidth : m_nWidth; StretchDIBits (m_pDC->m_hDC, 0, i * 8, w * 8, 8, 0, 0, w, 1, (void *) (bmPalette + (m_nHeight - i - 1) * m_nWidth), bmi, DIB_RGB_COLORS, SRCCOPY); } else StretchDIBits (m_pDC->m_hDC, 0, 0, m_nWidth * 8, m_nHeight * 8, 0, 0, m_nWidth, m_nHeight, (void *) bmPalette, bmi, DIB_RGB_COLORS, SRCCOPY); //m_pDC->SelectPalette (pOldPalette, FALSE); free (bmPalette); EndPaint (); } //------------------------------------------------------------------------------ bool CPaletteWnd::BeginPaint () { if (!IsWindow (m_hWnd)) return false; if (m_pDC) return false; if (!(m_pDC = GetDC ())) return false; m_pOldPal = m_pDC->SelectPalette (paletteManager.Render (), FALSE); m_pDC->RealizePalette (); return true; } //------------------------------------------------------------------------------ void CPaletteWnd::EndPaint () { if (m_pDC) { if (m_pOldPal) { m_pDC->SelectPalette (m_pOldPal, FALSE); m_pOldPal = null; } ReleaseDC (m_pDC); m_pDC = null; } Update (); } //------------------------------------------------------------------------------ #if 0 void CPaletteWnd::OnLButtonDown (UINT nFlags, CPoint point) { m_pParentWnd->SendMessage (WM_LBUTTONDOWN, (WPARAM) nFlags, (LPARAM) point.x + (((LPARAM) point.y) << 16)); } //------------------------------------------------------------------------------ void CPaletteWnd::OnRButtonDown (UINT nFlags, CPoint point) { m_pParentWnd->SendMessage (WM_RBUTTONDOWN, (WPARAM) nFlags, (LPARAM) point.x + (((LPARAM) point.y) << 16)); } //------------------------------------------------------------------------------ void CPaletteWnd::OnLButtonUp (UINT nFlags, CPoint point) { m_pParentWnd->SendMessage (WM_LBUTTONUP, (WPARAM) nFlags, (LPARAM) point.x + (((LPARAM) point.y) << 16)); } //------------------------------------------------------------------------------ void CPaletteWnd::OnRButtonUp (UINT nFlags, CPoint point) { m_pParentWnd->SendMessage (WM_RBUTTONUP, (WPARAM) nFlags, (LPARAM) point.x + (((LPARAM) point.y) << 16)); } #endif //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ CTextureEdit::CTextureEdit (const CTexture *pTexture, CWnd *pParent) : CDialog (IDD_EDITTEXTURE, pParent) { *m_szColors = '\0'; m_pDC = null; m_pPaintWnd = null; m_pOldPal = null; m_lBtnDown = m_rBtnDown = false; m_nTexAll = pTexture->Index (); strcpy_s (m_szName, sizeof (m_szName), pTexture->Name ()); _strlwr_s (m_szName, sizeof (m_szName)); } //------------------------------------------------------------------------------ CTextureEdit::~CTextureEdit () { m_texture [0].Clear (); m_texture [1].Clear (); } //------------------------------------------------------------------------------ BOOL CTextureEdit::OnInitDialog () { if (!textureManager.Available ()) return FALSE; CDialog::OnInitDialog (); CWnd* pWnd; CRect rc; const CTexture *pTexture = textureManager.TextureByIndex (m_nTexAll); pWnd = GetDlgItem (IDC_TEXEDIT_TEXTURE); pWnd->GetClientRect (rc); m_textureWnd.Create (null, null, WS_CHILD | WS_VISIBLE, rc, pWnd, 0); pWnd = GetDlgItem (IDC_TEXEDIT_PALETTE); pWnd->GetClientRect (rc); m_paletteWnd.Create (pWnd, 32, 8); pWnd = GetDlgItem (IDC_TEXEDIT_LAYERS); pWnd->GetClientRect (rc); m_layerWnd.Create (null, null, WS_CHILD | WS_VISIBLE, rc, pWnd, 0); // set cursor styles for bitmap windows SetCursor (LoadCursor (AfxGetInstanceHandle (), "PENCIL_CURSOR")); // PaletteButton->SetCursor(null, IDC_CROSS); m_fgColor = 0; // black m_bgColor = 1; // white m_lBtnDown = false; m_rBtnDown = false; m_bModified = false; m_bPendingRevert = false; if ((pTexture->Buffer () == null) || !pTexture->IsLoaded ()) { DEBUGMSG (" Texture tool: Invalid texture"); EndDialog (IDCANCEL); } else if (!m_texture [0].Copy (*pTexture)) { DEBUGMSG (" Texture tool: Not enough memory for texture editing"); EndDialog (IDCANCEL); } m_texture [1].Clear (); if (!m_texture [1].Copy (m_texture [0])) DEBUGMSG (" Texture tool: Not enough memory for undo function"); Backup (); Refresh (); m_nWidth = pTexture->Width (); m_nHeight = pTexture->Height (); return TRUE; } //------------------------------------------------------------------------------ void CTextureEdit::DoDataExchange (CDataExchange *pDX) { DDX_Text (pDX, IDC_TEXEDIT_COLORS, m_szColors, sizeof (m_szColors)); } //------------------------------------------------------------------------------ void CTextureEdit::Backup (void) { if (m_texture [1].Buffer ()) m_texture [1].Copy (m_texture [0]); } //------------------------------------------------------------------------------ bool CTextureEdit::PtInRect (CRect& rc, CPoint& pt) { return (pt.x >= rc.left) && (pt.x < rc.right) && (pt.y >= rc.top) && (pt.y < rc.bottom); } //------------------------------------------------------------------------------ void CTextureEdit::OnButtonDown (UINT nFlags, CPoint point, int& color) { CRect rcEdit, rcPal; GetClientRect (&m_textureWnd, rcEdit); GetClientRect (&m_paletteWnd, rcPal); if (PtInRect (rcEdit, point)) { Backup (); ColorPoint (nFlags, point, color); } else if (PtInRect (rcPal, point)) { point.x -= rcPal.left; point.y -= rcPal.top; if (m_paletteWnd.SelectColor (point, color)) DrawLayers (); } } //------------------------------------------------------------------------------ void CTextureEdit::OnOK () { if (m_bModified) textureManager.OverrideTexture (m_nTexAll, &m_texture [0]); else if (m_bPendingRevert) textureManager.RevertTexture (m_nTexAll); CDialog::OnOK (); } //------------------------------------------------------------------------------ void CTextureEdit::OnLButtonDown (UINT nFlags, CPoint point) { m_lBtnDown = TRUE; OnButtonDown (nFlags, point, m_fgColor); } //------------------------------------------------------------------------------ void CTextureEdit::OnRButtonDown (UINT nFlags, CPoint point) { m_rBtnDown = TRUE; OnButtonDown (nFlags, point, m_bgColor); } //------------------------------------------------------------------------------ void CTextureEdit::OnLButtonUp (UINT nFlags, CPoint point) { m_lBtnDown = FALSE; } //------------------------------------------------------------------------------ void CTextureEdit::OnRButtonUp (UINT nFlags, CPoint point) { m_rBtnDown = FALSE; } //------------------------------------------------------------------------------ void CTextureEdit::OnMouseMove (UINT nFlags, CPoint point) { if (m_lBtnDown) ColorPoint (nFlags, point, m_fgColor); else if (m_rBtnDown) ColorPoint (nFlags, point, m_bgColor); } //------------------------------------------------------------------------------ bool CTextureEdit::BeginPaint (CWnd *pWnd) { if (m_pDC) return false; if (!(m_pDC = pWnd->GetDC ())) return false; m_pPaintWnd = pWnd; m_pOldPal = m_pDC->SelectPalette (paletteManager.Render (), FALSE); m_pDC->RealizePalette (); return true; } //------------------------------------------------------------------------------ void CTextureEdit::EndPaint () { if (m_pPaintWnd) { if (m_pDC) { if (m_pOldPal) { m_pDC->SelectPalette (m_pOldPal, FALSE); m_pOldPal = null; } m_pPaintWnd->ReleaseDC (m_pDC); m_pDC = null; } Update (m_pPaintWnd); m_pPaintWnd = null; } } //------------------------------------------------------------------------------ void CTextureEdit::GetClientRect (CWnd *pWnd, CRect& rc) { CRect rcc; int dx, dy; pWnd->GetClientRect (&rcc); pWnd->GetWindowRect (rc); dx = rc.Width () - rcc.Width (); dy = rc.Height () - rcc.Height (); ScreenToClient (rc); rc.DeflateRect (dx / 2, dy / 2); } //------------------------------------------------------------------------------ // CTextureEdit - ColorPoint // // Action - Uses coordinates to determine which pixel mouse cursor is // over. If it is over the palette, the palette box will be updated with // the new color. If it is over the texture, the texture will be updated // with the color. // If control key is held down, color is defined by bitmap instead. //------------------------------------------------------------------------------ void CTextureEdit::ColorPoint (UINT nFlags, CPoint& point, int& color) { CRect rcEdit; GetClientRect (&m_textureWnd, rcEdit); if (m_texture [0].Format () == TGA) { m_lBtnDown = m_rBtnDown = false; ErrorMsg ("Cannot edit TGA images."); } else if (PtInRect (rcEdit, point)) { int x, y, nPixel; m_bModified = TRUE; // mark this as m_bModified // x = ((point.x - rcEdit.left) >> 2) & 63; // y = ((point.y - rcEdit.top) >> 2) & 63; x = (int) ((double) (point.x - rcEdit.left) * (double (m_nWidth) / rcEdit.Width ())); y = (int) ((double) (point.y - rcEdit.top) * (double (m_nHeight) / rcEdit.Height ())); nPixel = m_nWidth * (m_nHeight - 1 - y) + x; if (nFlags & MK_CONTROL) { color = paletteManager.ClosestColor (m_texture [0][nPixel]); DrawLayers (); } else if (BeginPaint (&m_textureWnd)) { m_texture [0][nPixel] = *paletteManager.Current (color); if (color >= 254) m_texture [0][nPixel].a = 0; SetTexturePixel (x, y); EndPaint (); } } } //------------------------------------------------------------------------------ void CTextureEdit::OnPaint () //EvDrawItem(UINT, DRAWITEMSTRUCT &) { CDialog::OnPaint (); Refresh (); } //------------------------------------------------------------------------------ void CTextureEdit::OnLoad () { char szFile [MAX_PATH] = {0}; const char *szDefExt = m_texture [0].Format () == BMP ? "bmp" : "tga"; CFileManager::tFileFilter filters [] = { { "Truevision Targa", "tga" }, { "256 color Bitmap Files", "bmp" } }; bool bFuncRes; sprintf_s (szFile, ARRAYSIZE (szFile), "*.%s", szDefExt); if (CFileManager::RunOpenFileDialog (szFile, ARRAYSIZE (szFile), filters, ARRAYSIZE (filters), m_hWnd)) { Backup (); bFuncRes = m_texture [0].LoadFromFile (szFile); if (bFuncRes) { Refresh (); m_nWidth = m_texture [0].Width (); m_nHeight = m_texture [0].Height (); m_nSize = m_texture [0].Size (); m_bModified = TRUE; } else OnUndo (); } } //------------------------------------------------------------------------------ void CTextureEdit::OnSave () { char szFile [MAX_PATH] = { 0 }; const char *szExt = m_texture [0].Format () == BMP ? "bmp" : "tga"; CFileManager::tFileFilter filters [] = { { "256 color Bitmap Files", "bmp" }, { "Truevision Targa", "tga" } }; CFileManager::tFileFilter *filter = m_texture [0].Format () == BMP ? &filters [0] : &filters [1]; sprintf_s (szFile, ARRAYSIZE (szFile), "%s.%s", m_szName, szExt); if (CFileManager::RunSaveFileDialog (szFile, ARRAYSIZE (szFile), filter, 1, m_hWnd)) { _strlwr_s (szFile, sizeof (szFile)); m_texture [0].Save (szFile); } } //------------------------------------------------------------------------------ void CTextureEdit::OnUndo () { if (m_texture [1].Buffer ()) { m_texture [0].Copy (m_texture [1]); // This combination should only happen immediately after OnDefault. // In this case we reverse it so the user is still prompted on save. if (m_bPendingRevert && !m_bModified) { m_bModified = true; m_bPendingRevert = false; } Refresh (); } } void CTextureEdit::Update (CWnd *pWnd) { pWnd->InvalidateRect (null); pWnd->UpdateWindow (); } //------------------------------------------------------------------------------ void CTextureEdit::OnDefault (void) { if (QueryMsg("Are you sure you want to restore this texture\n" "back to its original texture\n") == IDYES) { Backup (); m_texture [0].Copy (*textureManager.BaseTextures (m_nTexAll)); m_bModified = false; m_bPendingRevert = true; Refresh (); } } //------------------------------------------------------------------------------ void CTextureEdit::DrawTexture (void) { if (!BeginPaint (&m_textureWnd)) return; m_pDC->SetStretchBltMode (STRETCH_DELETESCANS); BITMAPINFO* bmi = paletteManager.BMI (); bmi->bmiHeader.biWidth = bmi->bmiHeader.biHeight = m_texture [0].RenderWidth (); bmi->bmiHeader.biBitCount = 32; //bmi->bmiHeader.biSizeImage = m_texture [0].BufSize (); bmi->bmiHeader.biClrUsed = 0; CRect rc; m_textureWnd.GetClientRect (&rc); StretchDIBits (m_pDC->m_hDC, 0, 0, rc.right, rc.bottom, 0, 0, m_texture [0].RenderWidth (), m_texture [0].RenderWidth (), (void *) m_texture [0].RenderBuffer (), bmi, DIB_RGB_COLORS, SRCCOPY); EndPaint (); } //------------------------------------------------------------------------------ void CTextureEdit::DrawPalette (void) { m_paletteWnd.DrawPalette (); } //------------------------------------------------------------------------------ void CTextureEdit::DrawLayers () { if (!BeginPaint (&m_layerWnd)) return; CRect rc; m_layerWnd.GetClientRect (&rc); rc.DeflateRect (10, 10); rc.right -= 10; rc.bottom -= 10; m_pDC->FillSolidRect (&rc, PALETTEINDEX (m_bgColor)); rc.OffsetRect (10, 10); m_pDC->FillSolidRect (&rc, PALETTEINDEX (m_fgColor)); EndPaint (); // set message char fg_color[30]; char bg_color[30]; switch(m_fgColor) { case 255: strcpy_s (fg_color, sizeof (fg_color), "transparent"); break; case 254: strcpy_s (fg_color, sizeof (fg_color), "see thru"); break; default : sprintf_s (fg_color, sizeof (fg_color), "color %d", m_fgColor); break; } switch(m_bgColor) { case 255: strcpy_s (bg_color, sizeof (bg_color), "transparent"); break; case 254: strcpy_s (bg_color, sizeof (bg_color), "see thru"); break; default : sprintf_s (bg_color, sizeof (bg_color), "color %d", m_bgColor); break; } sprintf_s (m_szColors, sizeof (m_szColors), "foreground = %s, background = %s.", fg_color, bg_color); UpdateData (FALSE); } //------------------------------------------------------------------------------ void CTextureEdit::Refresh (void) { DrawTexture (); DrawPalette (); DrawLayers (); } //------------------------------------------------------------------------------ void CTextureEdit::SetTexturePixel (int x, int y) { CRect rc; int cx, cy; double xs, ys; #ifdef _DEBUG CBGR& rgb = m_texture [0][(63 - y) * 64 + x]; int color = rgb.ColorRef (); #else int color = m_texture [0][(63 - y) * 64 + x].ColorRef (); #endif m_textureWnd.GetClientRect (&rc); cx = rc.Width (); cy = rc.Height (); xs = (double) cx / 64.0; ys = (double) cy / 64.0; x = rc.left + (int) ((double) x * xs); y = rc.top + (int) ((double) y * ys); int dx, dy; xs /= 4.0; ys /= 4.0; for (dy = 0; dy < 4; dy++) for (dx = 0; dx < 4; dx++) m_pDC->SetPixel (x + (int) ((double) dx * xs), y + (int) ((double) dy * ys), color); } //------------------------------------------------------------------------------ void CTextureEdit::SetPalettePixel (int x, int y) { CRect rc; m_paletteWnd.GetClientRect (&rc); int dx, dy; for (dy = 0; dy < 8; dy++) for (dx = 0; dx < 8; dx++) m_pDC->SetPixel ((x << 3) + dx + rc.left, (y << 3) + dy + rc.top, PALETTEINDEX (y * 32 + x)); } //------------------------------------------------------------------------------
26.940337
185
0.532088
SiriusTR
cac943660942cad7fa85c2ae48db7c5f5575ad5a
477
cpp
C++
hooks/hooks/hooked_lockcursor.cpp
DomesticTerrorist/Doubletap.Space-v3-SRC
caa2e09fc5e15a268ed735debe811a19fe96a08c
[ "MIT" ]
3
2021-08-18T10:19:25.000Z
2021-08-31T04:45:26.000Z
hooks/hooks/hooked_lockcursor.cpp
DomesticTerrorist/Doubletap.Space-v3-SRC
caa2e09fc5e15a268ed735debe811a19fe96a08c
[ "MIT" ]
null
null
null
hooks/hooks/hooked_lockcursor.cpp
DomesticTerrorist/Doubletap.Space-v3-SRC
caa2e09fc5e15a268ed735debe811a19fe96a08c
[ "MIT" ]
4
2021-08-18T06:57:26.000Z
2021-09-02T15:22:36.000Z
// This is an independent project of an individual developer. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com #include "..\hooks.hpp" using LockCursor_t = void(__thiscall*)(void*); void __stdcall hooks::hooked_lockcursor() { static auto original_fn = surface_hook->get_func_address <LockCursor_t> (67); if (!menu_open) return original_fn(m_surface()); m_surface()->UnlockCursor(); }
29.8125
96
0.706499
DomesticTerrorist
caca4a9ecead3a3890850baf60e5d226956eec49
2,967
hh
C++
src/SebastianBergmann/TextTemplate/Template.hh
isabella232/zynga-hhvm-phpunit
1690b9d5c6c711fde6d908cc84b014fa8e1a7ef0
[ "BSD-3-Clause" ]
3
2018-05-20T11:41:54.000Z
2020-08-20T14:55:09.000Z
src/SebastianBergmann/TextTemplate/Template.hh
zynga/zynga-hhvm-phpunit
1690b9d5c6c711fde6d908cc84b014fa8e1a7ef0
[ "BSD-3-Clause" ]
1
2021-02-24T01:22:04.000Z
2021-02-24T01:22:04.000Z
src/SebastianBergmann/TextTemplate/Template.hh
isabella232/zynga-hhvm-phpunit
1690b9d5c6c711fde6d908cc84b014fa8e1a7ef0
[ "BSD-3-Clause" ]
3
2018-07-30T23:04:34.000Z
2021-01-04T11:10:24.000Z
<?hh // strict namespace SebastianBergmann\TextTemplate; /* * This file is part of the Text_Template package. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ use \InvalidArgumentException; use \RuntimeException; /** * A simple template engine. * * @since Class available since Release 1.0.0 */ class Template { /** * @var string */ protected string $template = ''; /** * @var string */ protected string $openDelimiter = '{'; /** * @var string */ protected string $closeDelimiter = '}'; /** * Constructor. * * @param string $file * @throws InvalidArgumentException */ public function __construct( string $file = '', string $openDelimiter = '{', string $closeDelimiter = '}', ) { $this->setFile($file); $this->openDelimiter = $openDelimiter; $this->closeDelimiter = $closeDelimiter; } /** * Sets the template file. * * @param string $file * @throws InvalidArgumentException */ public function setFile(string $file, string $extension = '.dist'): void { $distFile = $file.$extension; if (file_exists($file)) { $this->template = file_get_contents($file); } else if (file_exists($distFile)) { $this->template = file_get_contents($distFile); } else { throw new InvalidArgumentException( 'Template file could not be loaded. file='.$file, ); } } public function setOpenDelimiter(string $delim): void { $this->openDelimiter = $delim; } public function setCloseDelimiter(string $delim): void { $this->closeDelimiter = $delim; } /** * Renders the template and returns the result. * * @return string */ public function render( Map<string, mixed> $values, bool $trimTemplate = false, ): string { $searchStrings = array(); $replaceValues = array(); foreach ($values as $key => $value) { $templateKey = $this->openDelimiter.$key.$this->closeDelimiter; $searchStrings[] = $templateKey; $replaceValues[] = $value; } $rendered = str_replace($searchStrings, $replaceValues, $this->template); if ($trimTemplate === true) { return trim($rendered); } return $rendered; } /** * Renders the template and writes the result to a file. * * @param string $target */ public function renderTo(string $target, Map<string, mixed> $values): void { $fp = @fopen($target, 'wt'); if (is_resource($fp)) { fwrite($fp, $this->render($values)); fclose($fp); } else { $error = error_get_last(); throw new RuntimeException( sprintf( 'Could not write to %s: %s', $target, substr($error['message'], strpos($error['message'], ':') + 2), ), ); } } }
21.656934
78
0.598247
isabella232
cacad8c4c3251d23466f21dbd63919f22841cd12
11,604
cc
C++
Alignment/CommonAlignmentAlgorithm/src/TkModuleGroupSelector.cc
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
Alignment/CommonAlignmentAlgorithm/src/TkModuleGroupSelector.cc
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
Alignment/CommonAlignmentAlgorithm/src/TkModuleGroupSelector.cc
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
/** * \file TkModuleGroupSelector.cc * * \author Joerg Behr * \date May 2013 * $Revision: 1.5 $ * $Date: 2013/06/19 08:33:03 $ * (last update by $Author: jbehr $) */ #include "Alignment/CommonAlignmentAlgorithm/interface/TkModuleGroupSelector.h" #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentParameterSelector.h" #include "Alignment/CommonAlignment/interface/Alignable.h" #include "DataFormats/DetId/interface/DetId.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include <vector> #include <map> #include <set> //============================================================================ TkModuleGroupSelector::TkModuleGroupSelector(AlignableTracker *aliTracker, const edm::ParameterSet &cfg, const std::vector<int> &sdets) : nparameters_(0), subdetids_(sdets) { //verify that all provided options are known std::vector<std::string> parameterNames = cfg.getParameterNames(); for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(); iParam != parameterNames.end(); ++iParam) { const std::string name = (*iParam); if (name != "RunRange" && name != "ReferenceRun" && name != "Granularity") { throw cms::Exception("BadConfig") << "@SUB=TkModuleGroupSelector::TkModuleGroupSelector:" << " Unknown parameter name '" << name << "' in PSet. Maybe a typo?"; } } //extract the reference run range if defined const edm::RunNumber_t defaultReferenceRun = (cfg.exists("ReferenceRun") ? cfg.getParameter<edm::RunNumber_t>("ReferenceRun") : 0); //extract run range to be used for all module groups (if not locally overwritten) const std::vector<edm::RunNumber_t> defaultRunRange = (cfg.exists("RunRange") ? cfg.getParameter<std::vector<edm::RunNumber_t> >("RunRange") : std::vector<edm::RunNumber_t>()); // finally create everything from configuration this->createModuleGroups( aliTracker, cfg.getParameter<edm::VParameterSet>("Granularity"), defaultRunRange, defaultReferenceRun); } //============================================================================ void TkModuleGroupSelector::fillDetIdMap(const unsigned int detid, const unsigned int groupid) { //only add new entries if (mapDetIdGroupId_.find(detid) == mapDetIdGroupId_.end()) { mapDetIdGroupId_.insert(std::pair<unsigned int, unsigned int>(detid, groupid)); } else { throw cms::Exception("BadConfig") << "@SUB=TkModuleGroupSelector:fillDetIdMap:" << " Module with det ID " << detid << " configured in group " << groupid << " but it was already selected" << " in group " << mapDetIdGroupId_[detid] << "."; } } //============================================================================ const bool TkModuleGroupSelector::testSplitOption(const edm::ParameterSet &pset) const { bool split = false; if (pset.exists("split")) { split = pset.getParameter<bool>("split"); } return split; } //============================================================================ bool TkModuleGroupSelector::createGroup(unsigned int &Id, const std::vector<edm::RunNumber_t> &range, const std::list<Alignable *> &selected_alis, const edm::RunNumber_t refrun) { bool modules_selected = false; referenceRun_.push_back(refrun); firstId_.push_back(Id); runRange_.push_back(range); for (std::list<Alignable *>::const_iterator it = selected_alis.begin(); it != selected_alis.end(); ++it) { this->fillDetIdMap((*it)->id(), firstId_.size() - 1); modules_selected = true; } if (refrun > 0 && !range.empty()) { //FIXME: last condition not really needed? Id += range.size() - 1; nparameters_ += range.size() - 1; } else { Id += range.size(); nparameters_ += range.size(); } if (refrun > 0 && range.front() > refrun) { //range.size() > 0 checked before throw cms::Exception("BadConfig") << "@SUB=TkModuleGroupSelector::createGroup:\n" << "Invalid combination of reference run number and specified run dependence" << "\n in module group " << firstId_.size() << "." << "\n Reference run number (" << refrun << ") is smaller than starting run " << "\n number (" << range.front() << ") of first IOV."; } return modules_selected; } //============================================================================ void TkModuleGroupSelector::verifyParameterNames(const edm::ParameterSet &pset, unsigned int psetnr) const { std::vector<std::string> parameterNames = pset.getParameterNames(); for (std::vector<std::string>::const_iterator iParam = parameterNames.begin(); iParam != parameterNames.end(); ++iParam) { const std::string name = (*iParam); if (name != "levels" && name != "RunRange" && name != "split" && name != "ReferenceRun") { throw cms::Exception("BadConfig") << "@SUB=TkModuleGroupSelector::verifyParameterNames:" << " Unknown parameter name '" << name << "' in PSet number " << psetnr << ". Maybe a typo?"; } } } //============================================================================ void TkModuleGroupSelector::createModuleGroups(AlignableTracker *aliTracker, const edm::VParameterSet &granularityConfig, const std::vector<edm::RunNumber_t> &defaultRunRange, edm::RunNumber_t defaultReferenceRun) { std::set<edm::RunNumber_t> localRunRange; nparameters_ = 0; unsigned int Id = 0; unsigned int psetnr = 0; //loop over all LA groups for (edm::VParameterSet::const_iterator pset = granularityConfig.begin(); pset != granularityConfig.end(); ++pset) { //test for unknown parameters this->verifyParameterNames((*pset), psetnr); psetnr++; bool modules_selected = false; //track whether at all a module has been selected in this group const std::vector<edm::RunNumber_t> range = ((*pset).exists("RunRange") ? pset->getParameter<std::vector<edm::RunNumber_t> >("RunRange") : defaultRunRange); if (range.empty()) { throw cms::Exception("BadConfig") << "@SUB=TkModuleGroupSelector::createModuleGroups:\n" << "Run range array empty!"; } const bool split = this->testSplitOption((*pset)); edm::RunNumber_t refrun = 0; if ((*pset).exists("ReferenceRun")) { refrun = (*pset).getParameter<edm::RunNumber_t>("ReferenceRun"); } else { refrun = defaultReferenceRun; } AlignmentParameterSelector selector(aliTracker); selector.clear(); selector.addSelections((*pset).getParameter<edm::ParameterSet>("levels")); const auto &alis = selector.selectedAlignables(); std::list<Alignable *> selected_alis; for (const auto &it : alis) { const auto &aliDaughts = it->deepComponents(); for (const auto &iD : aliDaughts) { if (iD->alignableObjectId() == align::AlignableDetUnit || iD->alignableObjectId() == align::AlignableDet) { if (split) { modules_selected = this->createGroup(Id, range, std::list<Alignable *>(1, iD), refrun); } else { selected_alis.push_back(iD); } } } } if (!split) { modules_selected = this->createGroup(Id, range, selected_alis, refrun); } edm::RunNumber_t firstRun = 0; for (std::vector<edm::RunNumber_t>::const_iterator iRun = range.begin(); iRun != range.end(); ++iRun) { localRunRange.insert((*iRun)); if ((*iRun) > firstRun) { firstRun = (*iRun); } else { throw cms::Exception("BadConfig") << "@SUB=TkModuleGroupSelector::createModuleGroups:" << " Run range not sorted."; } } if (!modules_selected) { throw cms::Exception("BadConfig") << "@SUB=TkModuleGroupSelector:createModuleGroups:" << " No module was selected in the module group selector in group " << (firstId_.size() - 1) << "."; } } //copy local set into the global vector of run boundaries for (std::set<edm::RunNumber_t>::const_iterator itRun = localRunRange.begin(); itRun != localRunRange.end(); ++itRun) { globalRunRange_.push_back((*itRun)); } } //============================================================================ unsigned int TkModuleGroupSelector::getNumberOfParameters() const { return nparameters_; } //============================================================================ unsigned int TkModuleGroupSelector::numIovs() const { return globalRunRange_.size(); } //============================================================================ edm::RunNumber_t TkModuleGroupSelector::firstRunOfIOV(unsigned int iovNum) const { return iovNum < this->numIovs() ? globalRunRange_.at(iovNum) : 0; } //====================================================================== int TkModuleGroupSelector::getParameterIndexFromDetId(unsigned int detId, edm::RunNumber_t run) const { // Return the index of the parameter that is used for this DetId. // If this DetId is not treated, return values < 0. const DetId temp_id(detId); int index = -1; bool sel = false; for (std::vector<int>::const_iterator itSubDets = subdetids_.begin(); itSubDets != subdetids_.end(); ++itSubDets) { if (temp_id.det() == DetId::Tracker && temp_id.subdetId() == (*itSubDets)) { sel = true; break; } } if (temp_id.det() != DetId::Tracker || !sel) return -1; std::map<unsigned int, unsigned int>::const_iterator it = mapDetIdGroupId_.find(detId); if (it != mapDetIdGroupId_.end()) { const unsigned int iAlignableGroup = (*it).second; const std::vector<edm::RunNumber_t> &runs = runRange_.at(iAlignableGroup); const unsigned int id0 = firstId_.at(iAlignableGroup); const edm::RunNumber_t refrun = referenceRun_.at(iAlignableGroup); unsigned int iovNum = 0; for (; iovNum < runs.size(); ++iovNum) { if (runs[iovNum] > run) break; } if (iovNum == 0) { throw cms::Exception("BadConfig") << "@SUB=TkModuleGroupSelector::getParameterIndexFromDetId:\n" << "Run " << run << " not foreseen for detid '" << detId << "'" << " in module group " << iAlignableGroup << "."; } else { --iovNum; } //test whether the iov contains the reference run if (refrun > 0) { //if > 0 a reference run number has been provided if (iovNum + 1 == runs.size()) { if (refrun >= runs[iovNum]) return -1; } else if ((iovNum + 1) < runs.size()) { if (refrun >= runs[iovNum] && refrun < runs[iovNum + 1]) { return -1; } } if (run > refrun) { //iovNum > 0 due to checks in createGroup(...) and createModuleGroups(...) //remove IOV in which the reference run can be found iovNum -= 1; } } index = id0 + iovNum; } return index; }
42.977778
120
0.562306
ckamtsikis
cacdb736bb7f0f1ef7ad295d8be1e0a09302874d
1,802
hh
C++
CXX/yapi.hh
packages-swi-to-yap/yap-6.3
8b1eab04eb14a55bcf7e733f2cc42c69808caa5c
[ "Artistic-1.0-Perl", "ClArtistic" ]
null
null
null
CXX/yapi.hh
packages-swi-to-yap/yap-6.3
8b1eab04eb14a55bcf7e733f2cc42c69808caa5c
[ "Artistic-1.0-Perl", "ClArtistic" ]
null
null
null
CXX/yapi.hh
packages-swi-to-yap/yap-6.3
8b1eab04eb14a55bcf7e733f2cc42c69808caa5c
[ "Artistic-1.0-Perl", "ClArtistic" ]
null
null
null
#define YAP_CPP_INTERFACE 1 #include <gmpxx.h> //! @{ /** * * @defgroup yap-cplus-interface An object oriented interface for YAP. * * @ingroup ChYInterface * @tableofcontents * * * C++ interface to YAP. Designed to be object oriented and to fit naturally * with the swig interface language generator. It uses ideas from the old YAP * interface and from the SWI foreign language interface. * */ #include <stdlib.h> #include <string> // Bad export from Python #include <config.h> extern "C" { #include <stddef.h> #include "Yap.h" #include "Yatom.h" #include "YapHeap.h" #include "clause.h" #include "yapio.h" #include "Foreign.h" #include "attvar.h" #include "YapText.h" #if HAVE_STDARG_H #include <stdarg.h> #endif #if HAVE_STDINT_H #include <stdint.h> #endif #if HAVE_STRING_H #include <string.h> #endif #if _MSC_VER || defined(__MINGW32__) //#include <windows.h> #endif // taken from yap_structs.h #include "iopreds.h" X_API void YAP_UserCPredicate(const char *, YAP_UserCPred, YAP_Arity arity); /* void UserCPredicateWithArgs(const char *name, int *fn(), unsigned int arity) */ X_API void YAP_UserCPredicateWithArgs(const char *, YAP_UserCPred, YAP_Arity, YAP_Term); /* void UserBackCPredicate(const char *name, int *init(), int *cont(), int arity, int extra) */ X_API void YAP_UserBackCPredicate(const char *, YAP_UserCPred, YAP_UserCPred, YAP_Arity, YAP_Arity); X_API Term Yap_StringToTerm(const char *s, size_t len, encoding_t *encp, int prio, Term *bindings_p); } class YAPEngine; class YAPAtom; class YAPFunctor; class YAPApplTerm; class YAPPairTerm; class YAPQuery; class YAPModule; class YAPError; class YAPPredicate; #include "yapa.hh" #include "yapie.hh" #include "yapt.hh" #include "yapdb.hh" #include "yapq.hh" /** * @} * */
17.161905
101
0.716426
packages-swi-to-yap
cad1bbcf0445d64543d6efff62dfa30713271cdd
245,899
cpp
C++
cisco-ios-xe/ydk/models/cisco_ios_xe/IP_MIB.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-xe/ydk/models/cisco_ios_xe/IP_MIB.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-xe/ydk/models/cisco_ios_xe/IP_MIB.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 "IP_MIB.hpp" using namespace ydk; namespace cisco_ios_xe { namespace IP_MIB { IPMIB::IPMIB() : ip(std::make_shared<IPMIB::Ip>()) , iptrafficstats(std::make_shared<IPMIB::IpTrafficStats>()) , icmp(std::make_shared<IPMIB::Icmp>()) , ipaddrtable(std::make_shared<IPMIB::IpAddrTable>()) , ipnettomediatable(std::make_shared<IPMIB::IpNetToMediaTable>()) , ipv4interfacetable(std::make_shared<IPMIB::Ipv4InterfaceTable>()) , ipv6interfacetable(std::make_shared<IPMIB::Ipv6InterfaceTable>()) , ipsystemstatstable(std::make_shared<IPMIB::IpSystemStatsTable>()) , ipifstatstable(std::make_shared<IPMIB::IpIfStatsTable>()) , ipaddressprefixtable(std::make_shared<IPMIB::IpAddressPrefixTable>()) , ipaddresstable(std::make_shared<IPMIB::IpAddressTable>()) , ipnettophysicaltable(std::make_shared<IPMIB::IpNetToPhysicalTable>()) , ipv6scopezoneindextable(std::make_shared<IPMIB::Ipv6ScopeZoneIndexTable>()) , ipdefaultroutertable(std::make_shared<IPMIB::IpDefaultRouterTable>()) , ipv6routeradverttable(std::make_shared<IPMIB::Ipv6RouterAdvertTable>()) , icmpstatstable(std::make_shared<IPMIB::IcmpStatsTable>()) , icmpmsgstatstable(std::make_shared<IPMIB::IcmpMsgStatsTable>()) { ip->parent = this; iptrafficstats->parent = this; icmp->parent = this; ipaddrtable->parent = this; ipnettomediatable->parent = this; ipv4interfacetable->parent = this; ipv6interfacetable->parent = this; ipsystemstatstable->parent = this; ipifstatstable->parent = this; ipaddressprefixtable->parent = this; ipaddresstable->parent = this; ipnettophysicaltable->parent = this; ipv6scopezoneindextable->parent = this; ipdefaultroutertable->parent = this; ipv6routeradverttable->parent = this; icmpstatstable->parent = this; icmpmsgstatstable->parent = this; yang_name = "IP-MIB"; yang_parent_name = "IP-MIB"; is_top_level_class = true; has_list_ancestor = false; } IPMIB::~IPMIB() { } bool IPMIB::has_data() const { if (is_presence_container) return true; return (ip != nullptr && ip->has_data()) || (iptrafficstats != nullptr && iptrafficstats->has_data()) || (icmp != nullptr && icmp->has_data()) || (ipaddrtable != nullptr && ipaddrtable->has_data()) || (ipnettomediatable != nullptr && ipnettomediatable->has_data()) || (ipv4interfacetable != nullptr && ipv4interfacetable->has_data()) || (ipv6interfacetable != nullptr && ipv6interfacetable->has_data()) || (ipsystemstatstable != nullptr && ipsystemstatstable->has_data()) || (ipifstatstable != nullptr && ipifstatstable->has_data()) || (ipaddressprefixtable != nullptr && ipaddressprefixtable->has_data()) || (ipaddresstable != nullptr && ipaddresstable->has_data()) || (ipnettophysicaltable != nullptr && ipnettophysicaltable->has_data()) || (ipv6scopezoneindextable != nullptr && ipv6scopezoneindextable->has_data()) || (ipdefaultroutertable != nullptr && ipdefaultroutertable->has_data()) || (ipv6routeradverttable != nullptr && ipv6routeradverttable->has_data()) || (icmpstatstable != nullptr && icmpstatstable->has_data()) || (icmpmsgstatstable != nullptr && icmpmsgstatstable->has_data()); } bool IPMIB::has_operation() const { return is_set(yfilter) || (ip != nullptr && ip->has_operation()) || (iptrafficstats != nullptr && iptrafficstats->has_operation()) || (icmp != nullptr && icmp->has_operation()) || (ipaddrtable != nullptr && ipaddrtable->has_operation()) || (ipnettomediatable != nullptr && ipnettomediatable->has_operation()) || (ipv4interfacetable != nullptr && ipv4interfacetable->has_operation()) || (ipv6interfacetable != nullptr && ipv6interfacetable->has_operation()) || (ipsystemstatstable != nullptr && ipsystemstatstable->has_operation()) || (ipifstatstable != nullptr && ipifstatstable->has_operation()) || (ipaddressprefixtable != nullptr && ipaddressprefixtable->has_operation()) || (ipaddresstable != nullptr && ipaddresstable->has_operation()) || (ipnettophysicaltable != nullptr && ipnettophysicaltable->has_operation()) || (ipv6scopezoneindextable != nullptr && ipv6scopezoneindextable->has_operation()) || (ipdefaultroutertable != nullptr && ipdefaultroutertable->has_operation()) || (ipv6routeradverttable != nullptr && ipv6routeradverttable->has_operation()) || (icmpstatstable != nullptr && icmpstatstable->has_operation()) || (icmpmsgstatstable != nullptr && icmpmsgstatstable->has_operation()); } std::string IPMIB::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ip") { if(ip == nullptr) { ip = std::make_shared<IPMIB::Ip>(); } return ip; } if(child_yang_name == "ipTrafficStats") { if(iptrafficstats == nullptr) { iptrafficstats = std::make_shared<IPMIB::IpTrafficStats>(); } return iptrafficstats; } if(child_yang_name == "icmp") { if(icmp == nullptr) { icmp = std::make_shared<IPMIB::Icmp>(); } return icmp; } if(child_yang_name == "ipAddrTable") { if(ipaddrtable == nullptr) { ipaddrtable = std::make_shared<IPMIB::IpAddrTable>(); } return ipaddrtable; } if(child_yang_name == "ipNetToMediaTable") { if(ipnettomediatable == nullptr) { ipnettomediatable = std::make_shared<IPMIB::IpNetToMediaTable>(); } return ipnettomediatable; } if(child_yang_name == "ipv4InterfaceTable") { if(ipv4interfacetable == nullptr) { ipv4interfacetable = std::make_shared<IPMIB::Ipv4InterfaceTable>(); } return ipv4interfacetable; } if(child_yang_name == "ipv6InterfaceTable") { if(ipv6interfacetable == nullptr) { ipv6interfacetable = std::make_shared<IPMIB::Ipv6InterfaceTable>(); } return ipv6interfacetable; } if(child_yang_name == "ipSystemStatsTable") { if(ipsystemstatstable == nullptr) { ipsystemstatstable = std::make_shared<IPMIB::IpSystemStatsTable>(); } return ipsystemstatstable; } if(child_yang_name == "ipIfStatsTable") { if(ipifstatstable == nullptr) { ipifstatstable = std::make_shared<IPMIB::IpIfStatsTable>(); } return ipifstatstable; } if(child_yang_name == "ipAddressPrefixTable") { if(ipaddressprefixtable == nullptr) { ipaddressprefixtable = std::make_shared<IPMIB::IpAddressPrefixTable>(); } return ipaddressprefixtable; } if(child_yang_name == "ipAddressTable") { if(ipaddresstable == nullptr) { ipaddresstable = std::make_shared<IPMIB::IpAddressTable>(); } return ipaddresstable; } if(child_yang_name == "ipNetToPhysicalTable") { if(ipnettophysicaltable == nullptr) { ipnettophysicaltable = std::make_shared<IPMIB::IpNetToPhysicalTable>(); } return ipnettophysicaltable; } if(child_yang_name == "ipv6ScopeZoneIndexTable") { if(ipv6scopezoneindextable == nullptr) { ipv6scopezoneindextable = std::make_shared<IPMIB::Ipv6ScopeZoneIndexTable>(); } return ipv6scopezoneindextable; } if(child_yang_name == "ipDefaultRouterTable") { if(ipdefaultroutertable == nullptr) { ipdefaultroutertable = std::make_shared<IPMIB::IpDefaultRouterTable>(); } return ipdefaultroutertable; } if(child_yang_name == "ipv6RouterAdvertTable") { if(ipv6routeradverttable == nullptr) { ipv6routeradverttable = std::make_shared<IPMIB::Ipv6RouterAdvertTable>(); } return ipv6routeradverttable; } if(child_yang_name == "icmpStatsTable") { if(icmpstatstable == nullptr) { icmpstatstable = std::make_shared<IPMIB::IcmpStatsTable>(); } return icmpstatstable; } if(child_yang_name == "icmpMsgStatsTable") { if(icmpmsgstatstable == nullptr) { icmpmsgstatstable = std::make_shared<IPMIB::IcmpMsgStatsTable>(); } return icmpmsgstatstable; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(ip != nullptr) { _children["ip"] = ip; } if(iptrafficstats != nullptr) { _children["ipTrafficStats"] = iptrafficstats; } if(icmp != nullptr) { _children["icmp"] = icmp; } if(ipaddrtable != nullptr) { _children["ipAddrTable"] = ipaddrtable; } if(ipnettomediatable != nullptr) { _children["ipNetToMediaTable"] = ipnettomediatable; } if(ipv4interfacetable != nullptr) { _children["ipv4InterfaceTable"] = ipv4interfacetable; } if(ipv6interfacetable != nullptr) { _children["ipv6InterfaceTable"] = ipv6interfacetable; } if(ipsystemstatstable != nullptr) { _children["ipSystemStatsTable"] = ipsystemstatstable; } if(ipifstatstable != nullptr) { _children["ipIfStatsTable"] = ipifstatstable; } if(ipaddressprefixtable != nullptr) { _children["ipAddressPrefixTable"] = ipaddressprefixtable; } if(ipaddresstable != nullptr) { _children["ipAddressTable"] = ipaddresstable; } if(ipnettophysicaltable != nullptr) { _children["ipNetToPhysicalTable"] = ipnettophysicaltable; } if(ipv6scopezoneindextable != nullptr) { _children["ipv6ScopeZoneIndexTable"] = ipv6scopezoneindextable; } if(ipdefaultroutertable != nullptr) { _children["ipDefaultRouterTable"] = ipdefaultroutertable; } if(ipv6routeradverttable != nullptr) { _children["ipv6RouterAdvertTable"] = ipv6routeradverttable; } if(icmpstatstable != nullptr) { _children["icmpStatsTable"] = icmpstatstable; } if(icmpmsgstatstable != nullptr) { _children["icmpMsgStatsTable"] = icmpmsgstatstable; } return _children; } void IPMIB::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::set_filter(const std::string & value_path, YFilter yfilter) { } std::shared_ptr<ydk::Entity> IPMIB::clone_ptr() const { return std::make_shared<IPMIB>(); } std::string IPMIB::get_bundle_yang_models_location() const { return ydk_cisco_ios_xe_models_path; } std::string IPMIB::get_bundle_name() const { return "cisco_ios_xe"; } augment_capabilities_function IPMIB::get_augment_capabilities_function() const { return cisco_ios_xe_augment_lookup_tables; } std::map<std::pair<std::string, std::string>, std::string> IPMIB::get_namespace_identity_lookup() const { return cisco_ios_xe_namespace_identity_lookup; } bool IPMIB::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ip" || name == "ipTrafficStats" || name == "icmp" || name == "ipAddrTable" || name == "ipNetToMediaTable" || name == "ipv4InterfaceTable" || name == "ipv6InterfaceTable" || name == "ipSystemStatsTable" || name == "ipIfStatsTable" || name == "ipAddressPrefixTable" || name == "ipAddressTable" || name == "ipNetToPhysicalTable" || name == "ipv6ScopeZoneIndexTable" || name == "ipDefaultRouterTable" || name == "ipv6RouterAdvertTable" || name == "icmpStatsTable" || name == "icmpMsgStatsTable") return true; return false; } IPMIB::Ip::Ip() : ipforwarding{YType::enumeration, "ipForwarding"}, ipdefaultttl{YType::int32, "ipDefaultTTL"}, ipinreceives{YType::uint32, "ipInReceives"}, ipinhdrerrors{YType::uint32, "ipInHdrErrors"}, ipinaddrerrors{YType::uint32, "ipInAddrErrors"}, ipforwdatagrams{YType::uint32, "ipForwDatagrams"}, ipinunknownprotos{YType::uint32, "ipInUnknownProtos"}, ipindiscards{YType::uint32, "ipInDiscards"}, ipindelivers{YType::uint32, "ipInDelivers"}, ipoutrequests{YType::uint32, "ipOutRequests"}, ipoutdiscards{YType::uint32, "ipOutDiscards"}, ipoutnoroutes{YType::uint32, "ipOutNoRoutes"}, ipreasmtimeout{YType::int32, "ipReasmTimeout"}, ipreasmreqds{YType::uint32, "ipReasmReqds"}, ipreasmoks{YType::uint32, "ipReasmOKs"}, ipreasmfails{YType::uint32, "ipReasmFails"}, ipfragoks{YType::uint32, "ipFragOKs"}, ipfragfails{YType::uint32, "ipFragFails"}, ipfragcreates{YType::uint32, "ipFragCreates"}, iproutingdiscards{YType::uint32, "ipRoutingDiscards"}, ipv6ipforwarding{YType::enumeration, "ipv6IpForwarding"}, ipv6ipdefaulthoplimit{YType::int32, "ipv6IpDefaultHopLimit"}, ipv4interfacetablelastchange{YType::uint32, "ipv4InterfaceTableLastChange"}, ipv6interfacetablelastchange{YType::uint32, "ipv6InterfaceTableLastChange"}, ipaddressspinlock{YType::int32, "ipAddressSpinLock"}, ipv6routeradvertspinlock{YType::int32, "ipv6RouterAdvertSpinLock"} { yang_name = "ip"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Ip::~Ip() { } bool IPMIB::Ip::has_data() const { if (is_presence_container) return true; return ipforwarding.is_set || ipdefaultttl.is_set || ipinreceives.is_set || ipinhdrerrors.is_set || ipinaddrerrors.is_set || ipforwdatagrams.is_set || ipinunknownprotos.is_set || ipindiscards.is_set || ipindelivers.is_set || ipoutrequests.is_set || ipoutdiscards.is_set || ipoutnoroutes.is_set || ipreasmtimeout.is_set || ipreasmreqds.is_set || ipreasmoks.is_set || ipreasmfails.is_set || ipfragoks.is_set || ipfragfails.is_set || ipfragcreates.is_set || iproutingdiscards.is_set || ipv6ipforwarding.is_set || ipv6ipdefaulthoplimit.is_set || ipv4interfacetablelastchange.is_set || ipv6interfacetablelastchange.is_set || ipaddressspinlock.is_set || ipv6routeradvertspinlock.is_set; } bool IPMIB::Ip::has_operation() const { return is_set(yfilter) || ydk::is_set(ipforwarding.yfilter) || ydk::is_set(ipdefaultttl.yfilter) || ydk::is_set(ipinreceives.yfilter) || ydk::is_set(ipinhdrerrors.yfilter) || ydk::is_set(ipinaddrerrors.yfilter) || ydk::is_set(ipforwdatagrams.yfilter) || ydk::is_set(ipinunknownprotos.yfilter) || ydk::is_set(ipindiscards.yfilter) || ydk::is_set(ipindelivers.yfilter) || ydk::is_set(ipoutrequests.yfilter) || ydk::is_set(ipoutdiscards.yfilter) || ydk::is_set(ipoutnoroutes.yfilter) || ydk::is_set(ipreasmtimeout.yfilter) || ydk::is_set(ipreasmreqds.yfilter) || ydk::is_set(ipreasmoks.yfilter) || ydk::is_set(ipreasmfails.yfilter) || ydk::is_set(ipfragoks.yfilter) || ydk::is_set(ipfragfails.yfilter) || ydk::is_set(ipfragcreates.yfilter) || ydk::is_set(iproutingdiscards.yfilter) || ydk::is_set(ipv6ipforwarding.yfilter) || ydk::is_set(ipv6ipdefaulthoplimit.yfilter) || ydk::is_set(ipv4interfacetablelastchange.yfilter) || ydk::is_set(ipv6interfacetablelastchange.yfilter) || ydk::is_set(ipaddressspinlock.yfilter) || ydk::is_set(ipv6routeradvertspinlock.yfilter); } std::string IPMIB::Ip::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Ip::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ip"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Ip::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipforwarding.is_set || is_set(ipforwarding.yfilter)) leaf_name_data.push_back(ipforwarding.get_name_leafdata()); if (ipdefaultttl.is_set || is_set(ipdefaultttl.yfilter)) leaf_name_data.push_back(ipdefaultttl.get_name_leafdata()); if (ipinreceives.is_set || is_set(ipinreceives.yfilter)) leaf_name_data.push_back(ipinreceives.get_name_leafdata()); if (ipinhdrerrors.is_set || is_set(ipinhdrerrors.yfilter)) leaf_name_data.push_back(ipinhdrerrors.get_name_leafdata()); if (ipinaddrerrors.is_set || is_set(ipinaddrerrors.yfilter)) leaf_name_data.push_back(ipinaddrerrors.get_name_leafdata()); if (ipforwdatagrams.is_set || is_set(ipforwdatagrams.yfilter)) leaf_name_data.push_back(ipforwdatagrams.get_name_leafdata()); if (ipinunknownprotos.is_set || is_set(ipinunknownprotos.yfilter)) leaf_name_data.push_back(ipinunknownprotos.get_name_leafdata()); if (ipindiscards.is_set || is_set(ipindiscards.yfilter)) leaf_name_data.push_back(ipindiscards.get_name_leafdata()); if (ipindelivers.is_set || is_set(ipindelivers.yfilter)) leaf_name_data.push_back(ipindelivers.get_name_leafdata()); if (ipoutrequests.is_set || is_set(ipoutrequests.yfilter)) leaf_name_data.push_back(ipoutrequests.get_name_leafdata()); if (ipoutdiscards.is_set || is_set(ipoutdiscards.yfilter)) leaf_name_data.push_back(ipoutdiscards.get_name_leafdata()); if (ipoutnoroutes.is_set || is_set(ipoutnoroutes.yfilter)) leaf_name_data.push_back(ipoutnoroutes.get_name_leafdata()); if (ipreasmtimeout.is_set || is_set(ipreasmtimeout.yfilter)) leaf_name_data.push_back(ipreasmtimeout.get_name_leafdata()); if (ipreasmreqds.is_set || is_set(ipreasmreqds.yfilter)) leaf_name_data.push_back(ipreasmreqds.get_name_leafdata()); if (ipreasmoks.is_set || is_set(ipreasmoks.yfilter)) leaf_name_data.push_back(ipreasmoks.get_name_leafdata()); if (ipreasmfails.is_set || is_set(ipreasmfails.yfilter)) leaf_name_data.push_back(ipreasmfails.get_name_leafdata()); if (ipfragoks.is_set || is_set(ipfragoks.yfilter)) leaf_name_data.push_back(ipfragoks.get_name_leafdata()); if (ipfragfails.is_set || is_set(ipfragfails.yfilter)) leaf_name_data.push_back(ipfragfails.get_name_leafdata()); if (ipfragcreates.is_set || is_set(ipfragcreates.yfilter)) leaf_name_data.push_back(ipfragcreates.get_name_leafdata()); if (iproutingdiscards.is_set || is_set(iproutingdiscards.yfilter)) leaf_name_data.push_back(iproutingdiscards.get_name_leafdata()); if (ipv6ipforwarding.is_set || is_set(ipv6ipforwarding.yfilter)) leaf_name_data.push_back(ipv6ipforwarding.get_name_leafdata()); if (ipv6ipdefaulthoplimit.is_set || is_set(ipv6ipdefaulthoplimit.yfilter)) leaf_name_data.push_back(ipv6ipdefaulthoplimit.get_name_leafdata()); if (ipv4interfacetablelastchange.is_set || is_set(ipv4interfacetablelastchange.yfilter)) leaf_name_data.push_back(ipv4interfacetablelastchange.get_name_leafdata()); if (ipv6interfacetablelastchange.is_set || is_set(ipv6interfacetablelastchange.yfilter)) leaf_name_data.push_back(ipv6interfacetablelastchange.get_name_leafdata()); if (ipaddressspinlock.is_set || is_set(ipaddressspinlock.yfilter)) leaf_name_data.push_back(ipaddressspinlock.get_name_leafdata()); if (ipv6routeradvertspinlock.is_set || is_set(ipv6routeradvertspinlock.yfilter)) leaf_name_data.push_back(ipv6routeradvertspinlock.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Ip::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>> IPMIB::Ip::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::Ip::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 == "ipForwarding") { ipforwarding = value; ipforwarding.value_namespace = name_space; ipforwarding.value_namespace_prefix = name_space_prefix; } if(value_path == "ipDefaultTTL") { ipdefaultttl = value; ipdefaultttl.value_namespace = name_space; ipdefaultttl.value_namespace_prefix = name_space_prefix; } if(value_path == "ipInReceives") { ipinreceives = value; ipinreceives.value_namespace = name_space; ipinreceives.value_namespace_prefix = name_space_prefix; } if(value_path == "ipInHdrErrors") { ipinhdrerrors = value; ipinhdrerrors.value_namespace = name_space; ipinhdrerrors.value_namespace_prefix = name_space_prefix; } if(value_path == "ipInAddrErrors") { ipinaddrerrors = value; ipinaddrerrors.value_namespace = name_space; ipinaddrerrors.value_namespace_prefix = name_space_prefix; } if(value_path == "ipForwDatagrams") { ipforwdatagrams = value; ipforwdatagrams.value_namespace = name_space; ipforwdatagrams.value_namespace_prefix = name_space_prefix; } if(value_path == "ipInUnknownProtos") { ipinunknownprotos = value; ipinunknownprotos.value_namespace = name_space; ipinunknownprotos.value_namespace_prefix = name_space_prefix; } if(value_path == "ipInDiscards") { ipindiscards = value; ipindiscards.value_namespace = name_space; ipindiscards.value_namespace_prefix = name_space_prefix; } if(value_path == "ipInDelivers") { ipindelivers = value; ipindelivers.value_namespace = name_space; ipindelivers.value_namespace_prefix = name_space_prefix; } if(value_path == "ipOutRequests") { ipoutrequests = value; ipoutrequests.value_namespace = name_space; ipoutrequests.value_namespace_prefix = name_space_prefix; } if(value_path == "ipOutDiscards") { ipoutdiscards = value; ipoutdiscards.value_namespace = name_space; ipoutdiscards.value_namespace_prefix = name_space_prefix; } if(value_path == "ipOutNoRoutes") { ipoutnoroutes = value; ipoutnoroutes.value_namespace = name_space; ipoutnoroutes.value_namespace_prefix = name_space_prefix; } if(value_path == "ipReasmTimeout") { ipreasmtimeout = value; ipreasmtimeout.value_namespace = name_space; ipreasmtimeout.value_namespace_prefix = name_space_prefix; } if(value_path == "ipReasmReqds") { ipreasmreqds = value; ipreasmreqds.value_namespace = name_space; ipreasmreqds.value_namespace_prefix = name_space_prefix; } if(value_path == "ipReasmOKs") { ipreasmoks = value; ipreasmoks.value_namespace = name_space; ipreasmoks.value_namespace_prefix = name_space_prefix; } if(value_path == "ipReasmFails") { ipreasmfails = value; ipreasmfails.value_namespace = name_space; ipreasmfails.value_namespace_prefix = name_space_prefix; } if(value_path == "ipFragOKs") { ipfragoks = value; ipfragoks.value_namespace = name_space; ipfragoks.value_namespace_prefix = name_space_prefix; } if(value_path == "ipFragFails") { ipfragfails = value; ipfragfails.value_namespace = name_space; ipfragfails.value_namespace_prefix = name_space_prefix; } if(value_path == "ipFragCreates") { ipfragcreates = value; ipfragcreates.value_namespace = name_space; ipfragcreates.value_namespace_prefix = name_space_prefix; } if(value_path == "ipRoutingDiscards") { iproutingdiscards = value; iproutingdiscards.value_namespace = name_space; iproutingdiscards.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6IpForwarding") { ipv6ipforwarding = value; ipv6ipforwarding.value_namespace = name_space; ipv6ipforwarding.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6IpDefaultHopLimit") { ipv6ipdefaulthoplimit = value; ipv6ipdefaulthoplimit.value_namespace = name_space; ipv6ipdefaulthoplimit.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv4InterfaceTableLastChange") { ipv4interfacetablelastchange = value; ipv4interfacetablelastchange.value_namespace = name_space; ipv4interfacetablelastchange.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6InterfaceTableLastChange") { ipv6interfacetablelastchange = value; ipv6interfacetablelastchange.value_namespace = name_space; ipv6interfacetablelastchange.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressSpinLock") { ipaddressspinlock = value; ipaddressspinlock.value_namespace = name_space; ipaddressspinlock.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertSpinLock") { ipv6routeradvertspinlock = value; ipv6routeradvertspinlock.value_namespace = name_space; ipv6routeradvertspinlock.value_namespace_prefix = name_space_prefix; } } void IPMIB::Ip::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipForwarding") { ipforwarding.yfilter = yfilter; } if(value_path == "ipDefaultTTL") { ipdefaultttl.yfilter = yfilter; } if(value_path == "ipInReceives") { ipinreceives.yfilter = yfilter; } if(value_path == "ipInHdrErrors") { ipinhdrerrors.yfilter = yfilter; } if(value_path == "ipInAddrErrors") { ipinaddrerrors.yfilter = yfilter; } if(value_path == "ipForwDatagrams") { ipforwdatagrams.yfilter = yfilter; } if(value_path == "ipInUnknownProtos") { ipinunknownprotos.yfilter = yfilter; } if(value_path == "ipInDiscards") { ipindiscards.yfilter = yfilter; } if(value_path == "ipInDelivers") { ipindelivers.yfilter = yfilter; } if(value_path == "ipOutRequests") { ipoutrequests.yfilter = yfilter; } if(value_path == "ipOutDiscards") { ipoutdiscards.yfilter = yfilter; } if(value_path == "ipOutNoRoutes") { ipoutnoroutes.yfilter = yfilter; } if(value_path == "ipReasmTimeout") { ipreasmtimeout.yfilter = yfilter; } if(value_path == "ipReasmReqds") { ipreasmreqds.yfilter = yfilter; } if(value_path == "ipReasmOKs") { ipreasmoks.yfilter = yfilter; } if(value_path == "ipReasmFails") { ipreasmfails.yfilter = yfilter; } if(value_path == "ipFragOKs") { ipfragoks.yfilter = yfilter; } if(value_path == "ipFragFails") { ipfragfails.yfilter = yfilter; } if(value_path == "ipFragCreates") { ipfragcreates.yfilter = yfilter; } if(value_path == "ipRoutingDiscards") { iproutingdiscards.yfilter = yfilter; } if(value_path == "ipv6IpForwarding") { ipv6ipforwarding.yfilter = yfilter; } if(value_path == "ipv6IpDefaultHopLimit") { ipv6ipdefaulthoplimit.yfilter = yfilter; } if(value_path == "ipv4InterfaceTableLastChange") { ipv4interfacetablelastchange.yfilter = yfilter; } if(value_path == "ipv6InterfaceTableLastChange") { ipv6interfacetablelastchange.yfilter = yfilter; } if(value_path == "ipAddressSpinLock") { ipaddressspinlock.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertSpinLock") { ipv6routeradvertspinlock.yfilter = yfilter; } } bool IPMIB::Ip::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipForwarding" || name == "ipDefaultTTL" || name == "ipInReceives" || name == "ipInHdrErrors" || name == "ipInAddrErrors" || name == "ipForwDatagrams" || name == "ipInUnknownProtos" || name == "ipInDiscards" || name == "ipInDelivers" || name == "ipOutRequests" || name == "ipOutDiscards" || name == "ipOutNoRoutes" || name == "ipReasmTimeout" || name == "ipReasmReqds" || name == "ipReasmOKs" || name == "ipReasmFails" || name == "ipFragOKs" || name == "ipFragFails" || name == "ipFragCreates" || name == "ipRoutingDiscards" || name == "ipv6IpForwarding" || name == "ipv6IpDefaultHopLimit" || name == "ipv4InterfaceTableLastChange" || name == "ipv6InterfaceTableLastChange" || name == "ipAddressSpinLock" || name == "ipv6RouterAdvertSpinLock") return true; return false; } IPMIB::IpTrafficStats::IpTrafficStats() : ipifstatstablelastchange{YType::uint32, "ipIfStatsTableLastChange"} { yang_name = "ipTrafficStats"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpTrafficStats::~IpTrafficStats() { } bool IPMIB::IpTrafficStats::has_data() const { if (is_presence_container) return true; return ipifstatstablelastchange.is_set; } bool IPMIB::IpTrafficStats::has_operation() const { return is_set(yfilter) || ydk::is_set(ipifstatstablelastchange.yfilter); } std::string IPMIB::IpTrafficStats::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpTrafficStats::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipTrafficStats"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpTrafficStats::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipifstatstablelastchange.is_set || is_set(ipifstatstablelastchange.yfilter)) leaf_name_data.push_back(ipifstatstablelastchange.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpTrafficStats::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>> IPMIB::IpTrafficStats::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IpTrafficStats::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 == "ipIfStatsTableLastChange") { ipifstatstablelastchange = value; ipifstatstablelastchange.value_namespace = name_space; ipifstatstablelastchange.value_namespace_prefix = name_space_prefix; } } void IPMIB::IpTrafficStats::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipIfStatsTableLastChange") { ipifstatstablelastchange.yfilter = yfilter; } } bool IPMIB::IpTrafficStats::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipIfStatsTableLastChange") return true; return false; } IPMIB::Icmp::Icmp() : icmpinmsgs{YType::uint32, "icmpInMsgs"}, icmpinerrors{YType::uint32, "icmpInErrors"}, icmpindestunreachs{YType::uint32, "icmpInDestUnreachs"}, icmpintimeexcds{YType::uint32, "icmpInTimeExcds"}, icmpinparmprobs{YType::uint32, "icmpInParmProbs"}, icmpinsrcquenchs{YType::uint32, "icmpInSrcQuenchs"}, icmpinredirects{YType::uint32, "icmpInRedirects"}, icmpinechos{YType::uint32, "icmpInEchos"}, icmpinechoreps{YType::uint32, "icmpInEchoReps"}, icmpintimestamps{YType::uint32, "icmpInTimestamps"}, icmpintimestampreps{YType::uint32, "icmpInTimestampReps"}, icmpinaddrmasks{YType::uint32, "icmpInAddrMasks"}, icmpinaddrmaskreps{YType::uint32, "icmpInAddrMaskReps"}, icmpoutmsgs{YType::uint32, "icmpOutMsgs"}, icmpouterrors{YType::uint32, "icmpOutErrors"}, icmpoutdestunreachs{YType::uint32, "icmpOutDestUnreachs"}, icmpouttimeexcds{YType::uint32, "icmpOutTimeExcds"}, icmpoutparmprobs{YType::uint32, "icmpOutParmProbs"}, icmpoutsrcquenchs{YType::uint32, "icmpOutSrcQuenchs"}, icmpoutredirects{YType::uint32, "icmpOutRedirects"}, icmpoutechos{YType::uint32, "icmpOutEchos"}, icmpoutechoreps{YType::uint32, "icmpOutEchoReps"}, icmpouttimestamps{YType::uint32, "icmpOutTimestamps"}, icmpouttimestampreps{YType::uint32, "icmpOutTimestampReps"}, icmpoutaddrmasks{YType::uint32, "icmpOutAddrMasks"}, icmpoutaddrmaskreps{YType::uint32, "icmpOutAddrMaskReps"} { yang_name = "icmp"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Icmp::~Icmp() { } bool IPMIB::Icmp::has_data() const { if (is_presence_container) return true; return icmpinmsgs.is_set || icmpinerrors.is_set || icmpindestunreachs.is_set || icmpintimeexcds.is_set || icmpinparmprobs.is_set || icmpinsrcquenchs.is_set || icmpinredirects.is_set || icmpinechos.is_set || icmpinechoreps.is_set || icmpintimestamps.is_set || icmpintimestampreps.is_set || icmpinaddrmasks.is_set || icmpinaddrmaskreps.is_set || icmpoutmsgs.is_set || icmpouterrors.is_set || icmpoutdestunreachs.is_set || icmpouttimeexcds.is_set || icmpoutparmprobs.is_set || icmpoutsrcquenchs.is_set || icmpoutredirects.is_set || icmpoutechos.is_set || icmpoutechoreps.is_set || icmpouttimestamps.is_set || icmpouttimestampreps.is_set || icmpoutaddrmasks.is_set || icmpoutaddrmaskreps.is_set; } bool IPMIB::Icmp::has_operation() const { return is_set(yfilter) || ydk::is_set(icmpinmsgs.yfilter) || ydk::is_set(icmpinerrors.yfilter) || ydk::is_set(icmpindestunreachs.yfilter) || ydk::is_set(icmpintimeexcds.yfilter) || ydk::is_set(icmpinparmprobs.yfilter) || ydk::is_set(icmpinsrcquenchs.yfilter) || ydk::is_set(icmpinredirects.yfilter) || ydk::is_set(icmpinechos.yfilter) || ydk::is_set(icmpinechoreps.yfilter) || ydk::is_set(icmpintimestamps.yfilter) || ydk::is_set(icmpintimestampreps.yfilter) || ydk::is_set(icmpinaddrmasks.yfilter) || ydk::is_set(icmpinaddrmaskreps.yfilter) || ydk::is_set(icmpoutmsgs.yfilter) || ydk::is_set(icmpouterrors.yfilter) || ydk::is_set(icmpoutdestunreachs.yfilter) || ydk::is_set(icmpouttimeexcds.yfilter) || ydk::is_set(icmpoutparmprobs.yfilter) || ydk::is_set(icmpoutsrcquenchs.yfilter) || ydk::is_set(icmpoutredirects.yfilter) || ydk::is_set(icmpoutechos.yfilter) || ydk::is_set(icmpoutechoreps.yfilter) || ydk::is_set(icmpouttimestamps.yfilter) || ydk::is_set(icmpouttimestampreps.yfilter) || ydk::is_set(icmpoutaddrmasks.yfilter) || ydk::is_set(icmpoutaddrmaskreps.yfilter); } std::string IPMIB::Icmp::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Icmp::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "icmp"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Icmp::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (icmpinmsgs.is_set || is_set(icmpinmsgs.yfilter)) leaf_name_data.push_back(icmpinmsgs.get_name_leafdata()); if (icmpinerrors.is_set || is_set(icmpinerrors.yfilter)) leaf_name_data.push_back(icmpinerrors.get_name_leafdata()); if (icmpindestunreachs.is_set || is_set(icmpindestunreachs.yfilter)) leaf_name_data.push_back(icmpindestunreachs.get_name_leafdata()); if (icmpintimeexcds.is_set || is_set(icmpintimeexcds.yfilter)) leaf_name_data.push_back(icmpintimeexcds.get_name_leafdata()); if (icmpinparmprobs.is_set || is_set(icmpinparmprobs.yfilter)) leaf_name_data.push_back(icmpinparmprobs.get_name_leafdata()); if (icmpinsrcquenchs.is_set || is_set(icmpinsrcquenchs.yfilter)) leaf_name_data.push_back(icmpinsrcquenchs.get_name_leafdata()); if (icmpinredirects.is_set || is_set(icmpinredirects.yfilter)) leaf_name_data.push_back(icmpinredirects.get_name_leafdata()); if (icmpinechos.is_set || is_set(icmpinechos.yfilter)) leaf_name_data.push_back(icmpinechos.get_name_leafdata()); if (icmpinechoreps.is_set || is_set(icmpinechoreps.yfilter)) leaf_name_data.push_back(icmpinechoreps.get_name_leafdata()); if (icmpintimestamps.is_set || is_set(icmpintimestamps.yfilter)) leaf_name_data.push_back(icmpintimestamps.get_name_leafdata()); if (icmpintimestampreps.is_set || is_set(icmpintimestampreps.yfilter)) leaf_name_data.push_back(icmpintimestampreps.get_name_leafdata()); if (icmpinaddrmasks.is_set || is_set(icmpinaddrmasks.yfilter)) leaf_name_data.push_back(icmpinaddrmasks.get_name_leafdata()); if (icmpinaddrmaskreps.is_set || is_set(icmpinaddrmaskreps.yfilter)) leaf_name_data.push_back(icmpinaddrmaskreps.get_name_leafdata()); if (icmpoutmsgs.is_set || is_set(icmpoutmsgs.yfilter)) leaf_name_data.push_back(icmpoutmsgs.get_name_leafdata()); if (icmpouterrors.is_set || is_set(icmpouterrors.yfilter)) leaf_name_data.push_back(icmpouterrors.get_name_leafdata()); if (icmpoutdestunreachs.is_set || is_set(icmpoutdestunreachs.yfilter)) leaf_name_data.push_back(icmpoutdestunreachs.get_name_leafdata()); if (icmpouttimeexcds.is_set || is_set(icmpouttimeexcds.yfilter)) leaf_name_data.push_back(icmpouttimeexcds.get_name_leafdata()); if (icmpoutparmprobs.is_set || is_set(icmpoutparmprobs.yfilter)) leaf_name_data.push_back(icmpoutparmprobs.get_name_leafdata()); if (icmpoutsrcquenchs.is_set || is_set(icmpoutsrcquenchs.yfilter)) leaf_name_data.push_back(icmpoutsrcquenchs.get_name_leafdata()); if (icmpoutredirects.is_set || is_set(icmpoutredirects.yfilter)) leaf_name_data.push_back(icmpoutredirects.get_name_leafdata()); if (icmpoutechos.is_set || is_set(icmpoutechos.yfilter)) leaf_name_data.push_back(icmpoutechos.get_name_leafdata()); if (icmpoutechoreps.is_set || is_set(icmpoutechoreps.yfilter)) leaf_name_data.push_back(icmpoutechoreps.get_name_leafdata()); if (icmpouttimestamps.is_set || is_set(icmpouttimestamps.yfilter)) leaf_name_data.push_back(icmpouttimestamps.get_name_leafdata()); if (icmpouttimestampreps.is_set || is_set(icmpouttimestampreps.yfilter)) leaf_name_data.push_back(icmpouttimestampreps.get_name_leafdata()); if (icmpoutaddrmasks.is_set || is_set(icmpoutaddrmasks.yfilter)) leaf_name_data.push_back(icmpoutaddrmasks.get_name_leafdata()); if (icmpoutaddrmaskreps.is_set || is_set(icmpoutaddrmaskreps.yfilter)) leaf_name_data.push_back(icmpoutaddrmaskreps.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Icmp::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>> IPMIB::Icmp::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::Icmp::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 == "icmpInMsgs") { icmpinmsgs = value; icmpinmsgs.value_namespace = name_space; icmpinmsgs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInErrors") { icmpinerrors = value; icmpinerrors.value_namespace = name_space; icmpinerrors.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInDestUnreachs") { icmpindestunreachs = value; icmpindestunreachs.value_namespace = name_space; icmpindestunreachs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInTimeExcds") { icmpintimeexcds = value; icmpintimeexcds.value_namespace = name_space; icmpintimeexcds.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInParmProbs") { icmpinparmprobs = value; icmpinparmprobs.value_namespace = name_space; icmpinparmprobs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInSrcQuenchs") { icmpinsrcquenchs = value; icmpinsrcquenchs.value_namespace = name_space; icmpinsrcquenchs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInRedirects") { icmpinredirects = value; icmpinredirects.value_namespace = name_space; icmpinredirects.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInEchos") { icmpinechos = value; icmpinechos.value_namespace = name_space; icmpinechos.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInEchoReps") { icmpinechoreps = value; icmpinechoreps.value_namespace = name_space; icmpinechoreps.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInTimestamps") { icmpintimestamps = value; icmpintimestamps.value_namespace = name_space; icmpintimestamps.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInTimestampReps") { icmpintimestampreps = value; icmpintimestampreps.value_namespace = name_space; icmpintimestampreps.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInAddrMasks") { icmpinaddrmasks = value; icmpinaddrmasks.value_namespace = name_space; icmpinaddrmasks.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpInAddrMaskReps") { icmpinaddrmaskreps = value; icmpinaddrmaskreps.value_namespace = name_space; icmpinaddrmaskreps.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutMsgs") { icmpoutmsgs = value; icmpoutmsgs.value_namespace = name_space; icmpoutmsgs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutErrors") { icmpouterrors = value; icmpouterrors.value_namespace = name_space; icmpouterrors.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutDestUnreachs") { icmpoutdestunreachs = value; icmpoutdestunreachs.value_namespace = name_space; icmpoutdestunreachs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutTimeExcds") { icmpouttimeexcds = value; icmpouttimeexcds.value_namespace = name_space; icmpouttimeexcds.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutParmProbs") { icmpoutparmprobs = value; icmpoutparmprobs.value_namespace = name_space; icmpoutparmprobs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutSrcQuenchs") { icmpoutsrcquenchs = value; icmpoutsrcquenchs.value_namespace = name_space; icmpoutsrcquenchs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutRedirects") { icmpoutredirects = value; icmpoutredirects.value_namespace = name_space; icmpoutredirects.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutEchos") { icmpoutechos = value; icmpoutechos.value_namespace = name_space; icmpoutechos.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutEchoReps") { icmpoutechoreps = value; icmpoutechoreps.value_namespace = name_space; icmpoutechoreps.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutTimestamps") { icmpouttimestamps = value; icmpouttimestamps.value_namespace = name_space; icmpouttimestamps.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutTimestampReps") { icmpouttimestampreps = value; icmpouttimestampreps.value_namespace = name_space; icmpouttimestampreps.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutAddrMasks") { icmpoutaddrmasks = value; icmpoutaddrmasks.value_namespace = name_space; icmpoutaddrmasks.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpOutAddrMaskReps") { icmpoutaddrmaskreps = value; icmpoutaddrmaskreps.value_namespace = name_space; icmpoutaddrmaskreps.value_namespace_prefix = name_space_prefix; } } void IPMIB::Icmp::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "icmpInMsgs") { icmpinmsgs.yfilter = yfilter; } if(value_path == "icmpInErrors") { icmpinerrors.yfilter = yfilter; } if(value_path == "icmpInDestUnreachs") { icmpindestunreachs.yfilter = yfilter; } if(value_path == "icmpInTimeExcds") { icmpintimeexcds.yfilter = yfilter; } if(value_path == "icmpInParmProbs") { icmpinparmprobs.yfilter = yfilter; } if(value_path == "icmpInSrcQuenchs") { icmpinsrcquenchs.yfilter = yfilter; } if(value_path == "icmpInRedirects") { icmpinredirects.yfilter = yfilter; } if(value_path == "icmpInEchos") { icmpinechos.yfilter = yfilter; } if(value_path == "icmpInEchoReps") { icmpinechoreps.yfilter = yfilter; } if(value_path == "icmpInTimestamps") { icmpintimestamps.yfilter = yfilter; } if(value_path == "icmpInTimestampReps") { icmpintimestampreps.yfilter = yfilter; } if(value_path == "icmpInAddrMasks") { icmpinaddrmasks.yfilter = yfilter; } if(value_path == "icmpInAddrMaskReps") { icmpinaddrmaskreps.yfilter = yfilter; } if(value_path == "icmpOutMsgs") { icmpoutmsgs.yfilter = yfilter; } if(value_path == "icmpOutErrors") { icmpouterrors.yfilter = yfilter; } if(value_path == "icmpOutDestUnreachs") { icmpoutdestunreachs.yfilter = yfilter; } if(value_path == "icmpOutTimeExcds") { icmpouttimeexcds.yfilter = yfilter; } if(value_path == "icmpOutParmProbs") { icmpoutparmprobs.yfilter = yfilter; } if(value_path == "icmpOutSrcQuenchs") { icmpoutsrcquenchs.yfilter = yfilter; } if(value_path == "icmpOutRedirects") { icmpoutredirects.yfilter = yfilter; } if(value_path == "icmpOutEchos") { icmpoutechos.yfilter = yfilter; } if(value_path == "icmpOutEchoReps") { icmpoutechoreps.yfilter = yfilter; } if(value_path == "icmpOutTimestamps") { icmpouttimestamps.yfilter = yfilter; } if(value_path == "icmpOutTimestampReps") { icmpouttimestampreps.yfilter = yfilter; } if(value_path == "icmpOutAddrMasks") { icmpoutaddrmasks.yfilter = yfilter; } if(value_path == "icmpOutAddrMaskReps") { icmpoutaddrmaskreps.yfilter = yfilter; } } bool IPMIB::Icmp::has_leaf_or_child_of_name(const std::string & name) const { if(name == "icmpInMsgs" || name == "icmpInErrors" || name == "icmpInDestUnreachs" || name == "icmpInTimeExcds" || name == "icmpInParmProbs" || name == "icmpInSrcQuenchs" || name == "icmpInRedirects" || name == "icmpInEchos" || name == "icmpInEchoReps" || name == "icmpInTimestamps" || name == "icmpInTimestampReps" || name == "icmpInAddrMasks" || name == "icmpInAddrMaskReps" || name == "icmpOutMsgs" || name == "icmpOutErrors" || name == "icmpOutDestUnreachs" || name == "icmpOutTimeExcds" || name == "icmpOutParmProbs" || name == "icmpOutSrcQuenchs" || name == "icmpOutRedirects" || name == "icmpOutEchos" || name == "icmpOutEchoReps" || name == "icmpOutTimestamps" || name == "icmpOutTimestampReps" || name == "icmpOutAddrMasks" || name == "icmpOutAddrMaskReps") return true; return false; } IPMIB::IpAddrTable::IpAddrTable() : ipaddrentry(this, {"ipadentaddr"}) { yang_name = "ipAddrTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpAddrTable::~IpAddrTable() { } bool IPMIB::IpAddrTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipaddrentry.len(); index++) { if(ipaddrentry[index]->has_data()) return true; } return false; } bool IPMIB::IpAddrTable::has_operation() const { for (std::size_t index=0; index<ipaddrentry.len(); index++) { if(ipaddrentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IpAddrTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpAddrTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipAddrTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpAddrTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpAddrTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipAddrEntry") { auto ent_ = std::make_shared<IPMIB::IpAddrTable::IpAddrEntry>(); ent_->parent = this; ipaddrentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IpAddrTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipaddrentry.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 IPMIB::IpAddrTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IpAddrTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IpAddrTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipAddrEntry") return true; return false; } IPMIB::IpAddrTable::IpAddrEntry::IpAddrEntry() : ipadentaddr{YType::str, "ipAdEntAddr"}, ipadentifindex{YType::int32, "ipAdEntIfIndex"}, ipadentnetmask{YType::str, "ipAdEntNetMask"}, ipadentbcastaddr{YType::int32, "ipAdEntBcastAddr"}, ipadentreasmmaxsize{YType::int32, "ipAdEntReasmMaxSize"} { yang_name = "ipAddrEntry"; yang_parent_name = "ipAddrTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpAddrTable::IpAddrEntry::~IpAddrEntry() { } bool IPMIB::IpAddrTable::IpAddrEntry::has_data() const { if (is_presence_container) return true; return ipadentaddr.is_set || ipadentifindex.is_set || ipadentnetmask.is_set || ipadentbcastaddr.is_set || ipadentreasmmaxsize.is_set; } bool IPMIB::IpAddrTable::IpAddrEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipadentaddr.yfilter) || ydk::is_set(ipadentifindex.yfilter) || ydk::is_set(ipadentnetmask.yfilter) || ydk::is_set(ipadentbcastaddr.yfilter) || ydk::is_set(ipadentreasmmaxsize.yfilter); } std::string IPMIB::IpAddrTable::IpAddrEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipAddrTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpAddrTable::IpAddrEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipAddrEntry"; ADD_KEY_TOKEN(ipadentaddr, "ipAdEntAddr"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpAddrTable::IpAddrEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipadentaddr.is_set || is_set(ipadentaddr.yfilter)) leaf_name_data.push_back(ipadentaddr.get_name_leafdata()); if (ipadentifindex.is_set || is_set(ipadentifindex.yfilter)) leaf_name_data.push_back(ipadentifindex.get_name_leafdata()); if (ipadentnetmask.is_set || is_set(ipadentnetmask.yfilter)) leaf_name_data.push_back(ipadentnetmask.get_name_leafdata()); if (ipadentbcastaddr.is_set || is_set(ipadentbcastaddr.yfilter)) leaf_name_data.push_back(ipadentbcastaddr.get_name_leafdata()); if (ipadentreasmmaxsize.is_set || is_set(ipadentreasmmaxsize.yfilter)) leaf_name_data.push_back(ipadentreasmmaxsize.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpAddrTable::IpAddrEntry::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>> IPMIB::IpAddrTable::IpAddrEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IpAddrTable::IpAddrEntry::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 == "ipAdEntAddr") { ipadentaddr = value; ipadentaddr.value_namespace = name_space; ipadentaddr.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAdEntIfIndex") { ipadentifindex = value; ipadentifindex.value_namespace = name_space; ipadentifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAdEntNetMask") { ipadentnetmask = value; ipadentnetmask.value_namespace = name_space; ipadentnetmask.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAdEntBcastAddr") { ipadentbcastaddr = value; ipadentbcastaddr.value_namespace = name_space; ipadentbcastaddr.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAdEntReasmMaxSize") { ipadentreasmmaxsize = value; ipadentreasmmaxsize.value_namespace = name_space; ipadentreasmmaxsize.value_namespace_prefix = name_space_prefix; } } void IPMIB::IpAddrTable::IpAddrEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipAdEntAddr") { ipadentaddr.yfilter = yfilter; } if(value_path == "ipAdEntIfIndex") { ipadentifindex.yfilter = yfilter; } if(value_path == "ipAdEntNetMask") { ipadentnetmask.yfilter = yfilter; } if(value_path == "ipAdEntBcastAddr") { ipadentbcastaddr.yfilter = yfilter; } if(value_path == "ipAdEntReasmMaxSize") { ipadentreasmmaxsize.yfilter = yfilter; } } bool IPMIB::IpAddrTable::IpAddrEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipAdEntAddr" || name == "ipAdEntIfIndex" || name == "ipAdEntNetMask" || name == "ipAdEntBcastAddr" || name == "ipAdEntReasmMaxSize") return true; return false; } IPMIB::IpNetToMediaTable::IpNetToMediaTable() : ipnettomediaentry(this, {"ipnettomediaifindex", "ipnettomedianetaddress"}) { yang_name = "ipNetToMediaTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpNetToMediaTable::~IpNetToMediaTable() { } bool IPMIB::IpNetToMediaTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipnettomediaentry.len(); index++) { if(ipnettomediaentry[index]->has_data()) return true; } return false; } bool IPMIB::IpNetToMediaTable::has_operation() const { for (std::size_t index=0; index<ipnettomediaentry.len(); index++) { if(ipnettomediaentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IpNetToMediaTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpNetToMediaTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipNetToMediaTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpNetToMediaTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpNetToMediaTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipNetToMediaEntry") { auto ent_ = std::make_shared<IPMIB::IpNetToMediaTable::IpNetToMediaEntry>(); ent_->parent = this; ipnettomediaentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IpNetToMediaTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipnettomediaentry.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 IPMIB::IpNetToMediaTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IpNetToMediaTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IpNetToMediaTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipNetToMediaEntry") return true; return false; } IPMIB::IpNetToMediaTable::IpNetToMediaEntry::IpNetToMediaEntry() : ipnettomediaifindex{YType::int32, "ipNetToMediaIfIndex"}, ipnettomedianetaddress{YType::str, "ipNetToMediaNetAddress"}, ipnettomediaphysaddress{YType::str, "ipNetToMediaPhysAddress"}, ipnettomediatype{YType::enumeration, "ipNetToMediaType"} { yang_name = "ipNetToMediaEntry"; yang_parent_name = "ipNetToMediaTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpNetToMediaTable::IpNetToMediaEntry::~IpNetToMediaEntry() { } bool IPMIB::IpNetToMediaTable::IpNetToMediaEntry::has_data() const { if (is_presence_container) return true; return ipnettomediaifindex.is_set || ipnettomedianetaddress.is_set || ipnettomediaphysaddress.is_set || ipnettomediatype.is_set; } bool IPMIB::IpNetToMediaTable::IpNetToMediaEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipnettomediaifindex.yfilter) || ydk::is_set(ipnettomedianetaddress.yfilter) || ydk::is_set(ipnettomediaphysaddress.yfilter) || ydk::is_set(ipnettomediatype.yfilter); } std::string IPMIB::IpNetToMediaTable::IpNetToMediaEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipNetToMediaTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpNetToMediaTable::IpNetToMediaEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipNetToMediaEntry"; ADD_KEY_TOKEN(ipnettomediaifindex, "ipNetToMediaIfIndex"); ADD_KEY_TOKEN(ipnettomedianetaddress, "ipNetToMediaNetAddress"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpNetToMediaTable::IpNetToMediaEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipnettomediaifindex.is_set || is_set(ipnettomediaifindex.yfilter)) leaf_name_data.push_back(ipnettomediaifindex.get_name_leafdata()); if (ipnettomedianetaddress.is_set || is_set(ipnettomedianetaddress.yfilter)) leaf_name_data.push_back(ipnettomedianetaddress.get_name_leafdata()); if (ipnettomediaphysaddress.is_set || is_set(ipnettomediaphysaddress.yfilter)) leaf_name_data.push_back(ipnettomediaphysaddress.get_name_leafdata()); if (ipnettomediatype.is_set || is_set(ipnettomediatype.yfilter)) leaf_name_data.push_back(ipnettomediatype.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpNetToMediaTable::IpNetToMediaEntry::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>> IPMIB::IpNetToMediaTable::IpNetToMediaEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IpNetToMediaTable::IpNetToMediaEntry::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 == "ipNetToMediaIfIndex") { ipnettomediaifindex = value; ipnettomediaifindex.value_namespace = name_space; ipnettomediaifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToMediaNetAddress") { ipnettomedianetaddress = value; ipnettomedianetaddress.value_namespace = name_space; ipnettomedianetaddress.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToMediaPhysAddress") { ipnettomediaphysaddress = value; ipnettomediaphysaddress.value_namespace = name_space; ipnettomediaphysaddress.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToMediaType") { ipnettomediatype = value; ipnettomediatype.value_namespace = name_space; ipnettomediatype.value_namespace_prefix = name_space_prefix; } } void IPMIB::IpNetToMediaTable::IpNetToMediaEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipNetToMediaIfIndex") { ipnettomediaifindex.yfilter = yfilter; } if(value_path == "ipNetToMediaNetAddress") { ipnettomedianetaddress.yfilter = yfilter; } if(value_path == "ipNetToMediaPhysAddress") { ipnettomediaphysaddress.yfilter = yfilter; } if(value_path == "ipNetToMediaType") { ipnettomediatype.yfilter = yfilter; } } bool IPMIB::IpNetToMediaTable::IpNetToMediaEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipNetToMediaIfIndex" || name == "ipNetToMediaNetAddress" || name == "ipNetToMediaPhysAddress" || name == "ipNetToMediaType") return true; return false; } IPMIB::Ipv4InterfaceTable::Ipv4InterfaceTable() : ipv4interfaceentry(this, {"ipv4interfaceifindex"}) { yang_name = "ipv4InterfaceTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Ipv4InterfaceTable::~Ipv4InterfaceTable() { } bool IPMIB::Ipv4InterfaceTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipv4interfaceentry.len(); index++) { if(ipv4interfaceentry[index]->has_data()) return true; } return false; } bool IPMIB::Ipv4InterfaceTable::has_operation() const { for (std::size_t index=0; index<ipv4interfaceentry.len(); index++) { if(ipv4interfaceentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::Ipv4InterfaceTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Ipv4InterfaceTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv4InterfaceTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Ipv4InterfaceTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Ipv4InterfaceTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipv4InterfaceEntry") { auto ent_ = std::make_shared<IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry>(); ent_->parent = this; ipv4interfaceentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::Ipv4InterfaceTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipv4interfaceentry.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 IPMIB::Ipv4InterfaceTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::Ipv4InterfaceTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::Ipv4InterfaceTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv4InterfaceEntry") return true; return false; } IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::Ipv4InterfaceEntry() : ipv4interfaceifindex{YType::int32, "ipv4InterfaceIfIndex"}, ipv4interfacereasmmaxsize{YType::int32, "ipv4InterfaceReasmMaxSize"}, ipv4interfaceenablestatus{YType::enumeration, "ipv4InterfaceEnableStatus"}, ipv4interfaceretransmittime{YType::uint32, "ipv4InterfaceRetransmitTime"} { yang_name = "ipv4InterfaceEntry"; yang_parent_name = "ipv4InterfaceTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::~Ipv4InterfaceEntry() { } bool IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::has_data() const { if (is_presence_container) return true; return ipv4interfaceifindex.is_set || ipv4interfacereasmmaxsize.is_set || ipv4interfaceenablestatus.is_set || ipv4interfaceretransmittime.is_set; } bool IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv4interfaceifindex.yfilter) || ydk::is_set(ipv4interfacereasmmaxsize.yfilter) || ydk::is_set(ipv4interfaceenablestatus.yfilter) || ydk::is_set(ipv4interfaceretransmittime.yfilter); } std::string IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipv4InterfaceTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv4InterfaceEntry"; ADD_KEY_TOKEN(ipv4interfaceifindex, "ipv4InterfaceIfIndex"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv4interfaceifindex.is_set || is_set(ipv4interfaceifindex.yfilter)) leaf_name_data.push_back(ipv4interfaceifindex.get_name_leafdata()); if (ipv4interfacereasmmaxsize.is_set || is_set(ipv4interfacereasmmaxsize.yfilter)) leaf_name_data.push_back(ipv4interfacereasmmaxsize.get_name_leafdata()); if (ipv4interfaceenablestatus.is_set || is_set(ipv4interfaceenablestatus.yfilter)) leaf_name_data.push_back(ipv4interfaceenablestatus.get_name_leafdata()); if (ipv4interfaceretransmittime.is_set || is_set(ipv4interfaceretransmittime.yfilter)) leaf_name_data.push_back(ipv4interfaceretransmittime.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::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>> IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::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 == "ipv4InterfaceIfIndex") { ipv4interfaceifindex = value; ipv4interfaceifindex.value_namespace = name_space; ipv4interfaceifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv4InterfaceReasmMaxSize") { ipv4interfacereasmmaxsize = value; ipv4interfacereasmmaxsize.value_namespace = name_space; ipv4interfacereasmmaxsize.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv4InterfaceEnableStatus") { ipv4interfaceenablestatus = value; ipv4interfaceenablestatus.value_namespace = name_space; ipv4interfaceenablestatus.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv4InterfaceRetransmitTime") { ipv4interfaceretransmittime = value; ipv4interfaceretransmittime.value_namespace = name_space; ipv4interfaceretransmittime.value_namespace_prefix = name_space_prefix; } } void IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv4InterfaceIfIndex") { ipv4interfaceifindex.yfilter = yfilter; } if(value_path == "ipv4InterfaceReasmMaxSize") { ipv4interfacereasmmaxsize.yfilter = yfilter; } if(value_path == "ipv4InterfaceEnableStatus") { ipv4interfaceenablestatus.yfilter = yfilter; } if(value_path == "ipv4InterfaceRetransmitTime") { ipv4interfaceretransmittime.yfilter = yfilter; } } bool IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv4InterfaceIfIndex" || name == "ipv4InterfaceReasmMaxSize" || name == "ipv4InterfaceEnableStatus" || name == "ipv4InterfaceRetransmitTime") return true; return false; } IPMIB::Ipv6InterfaceTable::Ipv6InterfaceTable() : ipv6interfaceentry(this, {"ipv6interfaceifindex"}) { yang_name = "ipv6InterfaceTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Ipv6InterfaceTable::~Ipv6InterfaceTable() { } bool IPMIB::Ipv6InterfaceTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipv6interfaceentry.len(); index++) { if(ipv6interfaceentry[index]->has_data()) return true; } return false; } bool IPMIB::Ipv6InterfaceTable::has_operation() const { for (std::size_t index=0; index<ipv6interfaceentry.len(); index++) { if(ipv6interfaceentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::Ipv6InterfaceTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Ipv6InterfaceTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv6InterfaceTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Ipv6InterfaceTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Ipv6InterfaceTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipv6InterfaceEntry") { auto ent_ = std::make_shared<IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry>(); ent_->parent = this; ipv6interfaceentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::Ipv6InterfaceTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipv6interfaceentry.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 IPMIB::Ipv6InterfaceTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::Ipv6InterfaceTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::Ipv6InterfaceTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6InterfaceEntry") return true; return false; } IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::Ipv6InterfaceEntry() : ipv6interfaceifindex{YType::int32, "ipv6InterfaceIfIndex"}, ipv6interfacereasmmaxsize{YType::uint32, "ipv6InterfaceReasmMaxSize"}, ipv6interfaceidentifier{YType::str, "ipv6InterfaceIdentifier"}, ipv6interfaceenablestatus{YType::enumeration, "ipv6InterfaceEnableStatus"}, ipv6interfacereachabletime{YType::uint32, "ipv6InterfaceReachableTime"}, ipv6interfaceretransmittime{YType::uint32, "ipv6InterfaceRetransmitTime"}, ipv6interfaceforwarding{YType::enumeration, "ipv6InterfaceForwarding"} { yang_name = "ipv6InterfaceEntry"; yang_parent_name = "ipv6InterfaceTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::~Ipv6InterfaceEntry() { } bool IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::has_data() const { if (is_presence_container) return true; return ipv6interfaceifindex.is_set || ipv6interfacereasmmaxsize.is_set || ipv6interfaceidentifier.is_set || ipv6interfaceenablestatus.is_set || ipv6interfacereachabletime.is_set || ipv6interfaceretransmittime.is_set || ipv6interfaceforwarding.is_set; } bool IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv6interfaceifindex.yfilter) || ydk::is_set(ipv6interfacereasmmaxsize.yfilter) || ydk::is_set(ipv6interfaceidentifier.yfilter) || ydk::is_set(ipv6interfaceenablestatus.yfilter) || ydk::is_set(ipv6interfacereachabletime.yfilter) || ydk::is_set(ipv6interfaceretransmittime.yfilter) || ydk::is_set(ipv6interfaceforwarding.yfilter); } std::string IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipv6InterfaceTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv6InterfaceEntry"; ADD_KEY_TOKEN(ipv6interfaceifindex, "ipv6InterfaceIfIndex"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv6interfaceifindex.is_set || is_set(ipv6interfaceifindex.yfilter)) leaf_name_data.push_back(ipv6interfaceifindex.get_name_leafdata()); if (ipv6interfacereasmmaxsize.is_set || is_set(ipv6interfacereasmmaxsize.yfilter)) leaf_name_data.push_back(ipv6interfacereasmmaxsize.get_name_leafdata()); if (ipv6interfaceidentifier.is_set || is_set(ipv6interfaceidentifier.yfilter)) leaf_name_data.push_back(ipv6interfaceidentifier.get_name_leafdata()); if (ipv6interfaceenablestatus.is_set || is_set(ipv6interfaceenablestatus.yfilter)) leaf_name_data.push_back(ipv6interfaceenablestatus.get_name_leafdata()); if (ipv6interfacereachabletime.is_set || is_set(ipv6interfacereachabletime.yfilter)) leaf_name_data.push_back(ipv6interfacereachabletime.get_name_leafdata()); if (ipv6interfaceretransmittime.is_set || is_set(ipv6interfaceretransmittime.yfilter)) leaf_name_data.push_back(ipv6interfaceretransmittime.get_name_leafdata()); if (ipv6interfaceforwarding.is_set || is_set(ipv6interfaceforwarding.yfilter)) leaf_name_data.push_back(ipv6interfaceforwarding.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::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>> IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::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 == "ipv6InterfaceIfIndex") { ipv6interfaceifindex = value; ipv6interfaceifindex.value_namespace = name_space; ipv6interfaceifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6InterfaceReasmMaxSize") { ipv6interfacereasmmaxsize = value; ipv6interfacereasmmaxsize.value_namespace = name_space; ipv6interfacereasmmaxsize.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6InterfaceIdentifier") { ipv6interfaceidentifier = value; ipv6interfaceidentifier.value_namespace = name_space; ipv6interfaceidentifier.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6InterfaceEnableStatus") { ipv6interfaceenablestatus = value; ipv6interfaceenablestatus.value_namespace = name_space; ipv6interfaceenablestatus.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6InterfaceReachableTime") { ipv6interfacereachabletime = value; ipv6interfacereachabletime.value_namespace = name_space; ipv6interfacereachabletime.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6InterfaceRetransmitTime") { ipv6interfaceretransmittime = value; ipv6interfaceretransmittime.value_namespace = name_space; ipv6interfaceretransmittime.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6InterfaceForwarding") { ipv6interfaceforwarding = value; ipv6interfaceforwarding.value_namespace = name_space; ipv6interfaceforwarding.value_namespace_prefix = name_space_prefix; } } void IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv6InterfaceIfIndex") { ipv6interfaceifindex.yfilter = yfilter; } if(value_path == "ipv6InterfaceReasmMaxSize") { ipv6interfacereasmmaxsize.yfilter = yfilter; } if(value_path == "ipv6InterfaceIdentifier") { ipv6interfaceidentifier.yfilter = yfilter; } if(value_path == "ipv6InterfaceEnableStatus") { ipv6interfaceenablestatus.yfilter = yfilter; } if(value_path == "ipv6InterfaceReachableTime") { ipv6interfacereachabletime.yfilter = yfilter; } if(value_path == "ipv6InterfaceRetransmitTime") { ipv6interfaceretransmittime.yfilter = yfilter; } if(value_path == "ipv6InterfaceForwarding") { ipv6interfaceforwarding.yfilter = yfilter; } } bool IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6InterfaceIfIndex" || name == "ipv6InterfaceReasmMaxSize" || name == "ipv6InterfaceIdentifier" || name == "ipv6InterfaceEnableStatus" || name == "ipv6InterfaceReachableTime" || name == "ipv6InterfaceRetransmitTime" || name == "ipv6InterfaceForwarding") return true; return false; } IPMIB::IpSystemStatsTable::IpSystemStatsTable() : ipsystemstatsentry(this, {"ipsystemstatsipversion"}) { yang_name = "ipSystemStatsTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpSystemStatsTable::~IpSystemStatsTable() { } bool IPMIB::IpSystemStatsTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipsystemstatsentry.len(); index++) { if(ipsystemstatsentry[index]->has_data()) return true; } return false; } bool IPMIB::IpSystemStatsTable::has_operation() const { for (std::size_t index=0; index<ipsystemstatsentry.len(); index++) { if(ipsystemstatsentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IpSystemStatsTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpSystemStatsTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipSystemStatsTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpSystemStatsTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpSystemStatsTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipSystemStatsEntry") { auto ent_ = std::make_shared<IPMIB::IpSystemStatsTable::IpSystemStatsEntry>(); ent_->parent = this; ipsystemstatsentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IpSystemStatsTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipsystemstatsentry.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 IPMIB::IpSystemStatsTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IpSystemStatsTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IpSystemStatsTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipSystemStatsEntry") return true; return false; } IPMIB::IpSystemStatsTable::IpSystemStatsEntry::IpSystemStatsEntry() : ipsystemstatsipversion{YType::enumeration, "ipSystemStatsIPVersion"}, ipsystemstatsinreceives{YType::uint32, "ipSystemStatsInReceives"}, ipsystemstatshcinreceives{YType::uint64, "ipSystemStatsHCInReceives"}, ipsystemstatsinoctets{YType::uint32, "ipSystemStatsInOctets"}, ipsystemstatshcinoctets{YType::uint64, "ipSystemStatsHCInOctets"}, ipsystemstatsinhdrerrors{YType::uint32, "ipSystemStatsInHdrErrors"}, ipsystemstatsinnoroutes{YType::uint32, "ipSystemStatsInNoRoutes"}, ipsystemstatsinaddrerrors{YType::uint32, "ipSystemStatsInAddrErrors"}, ipsystemstatsinunknownprotos{YType::uint32, "ipSystemStatsInUnknownProtos"}, ipsystemstatsintruncatedpkts{YType::uint32, "ipSystemStatsInTruncatedPkts"}, ipsystemstatsinforwdatagrams{YType::uint32, "ipSystemStatsInForwDatagrams"}, ipsystemstatshcinforwdatagrams{YType::uint64, "ipSystemStatsHCInForwDatagrams"}, ipsystemstatsreasmreqds{YType::uint32, "ipSystemStatsReasmReqds"}, ipsystemstatsreasmoks{YType::uint32, "ipSystemStatsReasmOKs"}, ipsystemstatsreasmfails{YType::uint32, "ipSystemStatsReasmFails"}, ipsystemstatsindiscards{YType::uint32, "ipSystemStatsInDiscards"}, ipsystemstatsindelivers{YType::uint32, "ipSystemStatsInDelivers"}, ipsystemstatshcindelivers{YType::uint64, "ipSystemStatsHCInDelivers"}, ipsystemstatsoutrequests{YType::uint32, "ipSystemStatsOutRequests"}, ipsystemstatshcoutrequests{YType::uint64, "ipSystemStatsHCOutRequests"}, ipsystemstatsoutnoroutes{YType::uint32, "ipSystemStatsOutNoRoutes"}, ipsystemstatsoutforwdatagrams{YType::uint32, "ipSystemStatsOutForwDatagrams"}, ipsystemstatshcoutforwdatagrams{YType::uint64, "ipSystemStatsHCOutForwDatagrams"}, ipsystemstatsoutdiscards{YType::uint32, "ipSystemStatsOutDiscards"}, ipsystemstatsoutfragreqds{YType::uint32, "ipSystemStatsOutFragReqds"}, ipsystemstatsoutfragoks{YType::uint32, "ipSystemStatsOutFragOKs"}, ipsystemstatsoutfragfails{YType::uint32, "ipSystemStatsOutFragFails"}, ipsystemstatsoutfragcreates{YType::uint32, "ipSystemStatsOutFragCreates"}, ipsystemstatsouttransmits{YType::uint32, "ipSystemStatsOutTransmits"}, ipsystemstatshcouttransmits{YType::uint64, "ipSystemStatsHCOutTransmits"}, ipsystemstatsoutoctets{YType::uint32, "ipSystemStatsOutOctets"}, ipsystemstatshcoutoctets{YType::uint64, "ipSystemStatsHCOutOctets"}, ipsystemstatsinmcastpkts{YType::uint32, "ipSystemStatsInMcastPkts"}, ipsystemstatshcinmcastpkts{YType::uint64, "ipSystemStatsHCInMcastPkts"}, ipsystemstatsinmcastoctets{YType::uint32, "ipSystemStatsInMcastOctets"}, ipsystemstatshcinmcastoctets{YType::uint64, "ipSystemStatsHCInMcastOctets"}, ipsystemstatsoutmcastpkts{YType::uint32, "ipSystemStatsOutMcastPkts"}, ipsystemstatshcoutmcastpkts{YType::uint64, "ipSystemStatsHCOutMcastPkts"}, ipsystemstatsoutmcastoctets{YType::uint32, "ipSystemStatsOutMcastOctets"}, ipsystemstatshcoutmcastoctets{YType::uint64, "ipSystemStatsHCOutMcastOctets"}, ipsystemstatsinbcastpkts{YType::uint32, "ipSystemStatsInBcastPkts"}, ipsystemstatshcinbcastpkts{YType::uint64, "ipSystemStatsHCInBcastPkts"}, ipsystemstatsoutbcastpkts{YType::uint32, "ipSystemStatsOutBcastPkts"}, ipsystemstatshcoutbcastpkts{YType::uint64, "ipSystemStatsHCOutBcastPkts"}, ipsystemstatsdiscontinuitytime{YType::uint32, "ipSystemStatsDiscontinuityTime"}, ipsystemstatsrefreshrate{YType::uint32, "ipSystemStatsRefreshRate"} { yang_name = "ipSystemStatsEntry"; yang_parent_name = "ipSystemStatsTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpSystemStatsTable::IpSystemStatsEntry::~IpSystemStatsEntry() { } bool IPMIB::IpSystemStatsTable::IpSystemStatsEntry::has_data() const { if (is_presence_container) return true; return ipsystemstatsipversion.is_set || ipsystemstatsinreceives.is_set || ipsystemstatshcinreceives.is_set || ipsystemstatsinoctets.is_set || ipsystemstatshcinoctets.is_set || ipsystemstatsinhdrerrors.is_set || ipsystemstatsinnoroutes.is_set || ipsystemstatsinaddrerrors.is_set || ipsystemstatsinunknownprotos.is_set || ipsystemstatsintruncatedpkts.is_set || ipsystemstatsinforwdatagrams.is_set || ipsystemstatshcinforwdatagrams.is_set || ipsystemstatsreasmreqds.is_set || ipsystemstatsreasmoks.is_set || ipsystemstatsreasmfails.is_set || ipsystemstatsindiscards.is_set || ipsystemstatsindelivers.is_set || ipsystemstatshcindelivers.is_set || ipsystemstatsoutrequests.is_set || ipsystemstatshcoutrequests.is_set || ipsystemstatsoutnoroutes.is_set || ipsystemstatsoutforwdatagrams.is_set || ipsystemstatshcoutforwdatagrams.is_set || ipsystemstatsoutdiscards.is_set || ipsystemstatsoutfragreqds.is_set || ipsystemstatsoutfragoks.is_set || ipsystemstatsoutfragfails.is_set || ipsystemstatsoutfragcreates.is_set || ipsystemstatsouttransmits.is_set || ipsystemstatshcouttransmits.is_set || ipsystemstatsoutoctets.is_set || ipsystemstatshcoutoctets.is_set || ipsystemstatsinmcastpkts.is_set || ipsystemstatshcinmcastpkts.is_set || ipsystemstatsinmcastoctets.is_set || ipsystemstatshcinmcastoctets.is_set || ipsystemstatsoutmcastpkts.is_set || ipsystemstatshcoutmcastpkts.is_set || ipsystemstatsoutmcastoctets.is_set || ipsystemstatshcoutmcastoctets.is_set || ipsystemstatsinbcastpkts.is_set || ipsystemstatshcinbcastpkts.is_set || ipsystemstatsoutbcastpkts.is_set || ipsystemstatshcoutbcastpkts.is_set || ipsystemstatsdiscontinuitytime.is_set || ipsystemstatsrefreshrate.is_set; } bool IPMIB::IpSystemStatsTable::IpSystemStatsEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipsystemstatsipversion.yfilter) || ydk::is_set(ipsystemstatsinreceives.yfilter) || ydk::is_set(ipsystemstatshcinreceives.yfilter) || ydk::is_set(ipsystemstatsinoctets.yfilter) || ydk::is_set(ipsystemstatshcinoctets.yfilter) || ydk::is_set(ipsystemstatsinhdrerrors.yfilter) || ydk::is_set(ipsystemstatsinnoroutes.yfilter) || ydk::is_set(ipsystemstatsinaddrerrors.yfilter) || ydk::is_set(ipsystemstatsinunknownprotos.yfilter) || ydk::is_set(ipsystemstatsintruncatedpkts.yfilter) || ydk::is_set(ipsystemstatsinforwdatagrams.yfilter) || ydk::is_set(ipsystemstatshcinforwdatagrams.yfilter) || ydk::is_set(ipsystemstatsreasmreqds.yfilter) || ydk::is_set(ipsystemstatsreasmoks.yfilter) || ydk::is_set(ipsystemstatsreasmfails.yfilter) || ydk::is_set(ipsystemstatsindiscards.yfilter) || ydk::is_set(ipsystemstatsindelivers.yfilter) || ydk::is_set(ipsystemstatshcindelivers.yfilter) || ydk::is_set(ipsystemstatsoutrequests.yfilter) || ydk::is_set(ipsystemstatshcoutrequests.yfilter) || ydk::is_set(ipsystemstatsoutnoroutes.yfilter) || ydk::is_set(ipsystemstatsoutforwdatagrams.yfilter) || ydk::is_set(ipsystemstatshcoutforwdatagrams.yfilter) || ydk::is_set(ipsystemstatsoutdiscards.yfilter) || ydk::is_set(ipsystemstatsoutfragreqds.yfilter) || ydk::is_set(ipsystemstatsoutfragoks.yfilter) || ydk::is_set(ipsystemstatsoutfragfails.yfilter) || ydk::is_set(ipsystemstatsoutfragcreates.yfilter) || ydk::is_set(ipsystemstatsouttransmits.yfilter) || ydk::is_set(ipsystemstatshcouttransmits.yfilter) || ydk::is_set(ipsystemstatsoutoctets.yfilter) || ydk::is_set(ipsystemstatshcoutoctets.yfilter) || ydk::is_set(ipsystemstatsinmcastpkts.yfilter) || ydk::is_set(ipsystemstatshcinmcastpkts.yfilter) || ydk::is_set(ipsystemstatsinmcastoctets.yfilter) || ydk::is_set(ipsystemstatshcinmcastoctets.yfilter) || ydk::is_set(ipsystemstatsoutmcastpkts.yfilter) || ydk::is_set(ipsystemstatshcoutmcastpkts.yfilter) || ydk::is_set(ipsystemstatsoutmcastoctets.yfilter) || ydk::is_set(ipsystemstatshcoutmcastoctets.yfilter) || ydk::is_set(ipsystemstatsinbcastpkts.yfilter) || ydk::is_set(ipsystemstatshcinbcastpkts.yfilter) || ydk::is_set(ipsystemstatsoutbcastpkts.yfilter) || ydk::is_set(ipsystemstatshcoutbcastpkts.yfilter) || ydk::is_set(ipsystemstatsdiscontinuitytime.yfilter) || ydk::is_set(ipsystemstatsrefreshrate.yfilter); } std::string IPMIB::IpSystemStatsTable::IpSystemStatsEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipSystemStatsTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpSystemStatsTable::IpSystemStatsEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipSystemStatsEntry"; ADD_KEY_TOKEN(ipsystemstatsipversion, "ipSystemStatsIPVersion"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpSystemStatsTable::IpSystemStatsEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipsystemstatsipversion.is_set || is_set(ipsystemstatsipversion.yfilter)) leaf_name_data.push_back(ipsystemstatsipversion.get_name_leafdata()); if (ipsystemstatsinreceives.is_set || is_set(ipsystemstatsinreceives.yfilter)) leaf_name_data.push_back(ipsystemstatsinreceives.get_name_leafdata()); if (ipsystemstatshcinreceives.is_set || is_set(ipsystemstatshcinreceives.yfilter)) leaf_name_data.push_back(ipsystemstatshcinreceives.get_name_leafdata()); if (ipsystemstatsinoctets.is_set || is_set(ipsystemstatsinoctets.yfilter)) leaf_name_data.push_back(ipsystemstatsinoctets.get_name_leafdata()); if (ipsystemstatshcinoctets.is_set || is_set(ipsystemstatshcinoctets.yfilter)) leaf_name_data.push_back(ipsystemstatshcinoctets.get_name_leafdata()); if (ipsystemstatsinhdrerrors.is_set || is_set(ipsystemstatsinhdrerrors.yfilter)) leaf_name_data.push_back(ipsystemstatsinhdrerrors.get_name_leafdata()); if (ipsystemstatsinnoroutes.is_set || is_set(ipsystemstatsinnoroutes.yfilter)) leaf_name_data.push_back(ipsystemstatsinnoroutes.get_name_leafdata()); if (ipsystemstatsinaddrerrors.is_set || is_set(ipsystemstatsinaddrerrors.yfilter)) leaf_name_data.push_back(ipsystemstatsinaddrerrors.get_name_leafdata()); if (ipsystemstatsinunknownprotos.is_set || is_set(ipsystemstatsinunknownprotos.yfilter)) leaf_name_data.push_back(ipsystemstatsinunknownprotos.get_name_leafdata()); if (ipsystemstatsintruncatedpkts.is_set || is_set(ipsystemstatsintruncatedpkts.yfilter)) leaf_name_data.push_back(ipsystemstatsintruncatedpkts.get_name_leafdata()); if (ipsystemstatsinforwdatagrams.is_set || is_set(ipsystemstatsinforwdatagrams.yfilter)) leaf_name_data.push_back(ipsystemstatsinforwdatagrams.get_name_leafdata()); if (ipsystemstatshcinforwdatagrams.is_set || is_set(ipsystemstatshcinforwdatagrams.yfilter)) leaf_name_data.push_back(ipsystemstatshcinforwdatagrams.get_name_leafdata()); if (ipsystemstatsreasmreqds.is_set || is_set(ipsystemstatsreasmreqds.yfilter)) leaf_name_data.push_back(ipsystemstatsreasmreqds.get_name_leafdata()); if (ipsystemstatsreasmoks.is_set || is_set(ipsystemstatsreasmoks.yfilter)) leaf_name_data.push_back(ipsystemstatsreasmoks.get_name_leafdata()); if (ipsystemstatsreasmfails.is_set || is_set(ipsystemstatsreasmfails.yfilter)) leaf_name_data.push_back(ipsystemstatsreasmfails.get_name_leafdata()); if (ipsystemstatsindiscards.is_set || is_set(ipsystemstatsindiscards.yfilter)) leaf_name_data.push_back(ipsystemstatsindiscards.get_name_leafdata()); if (ipsystemstatsindelivers.is_set || is_set(ipsystemstatsindelivers.yfilter)) leaf_name_data.push_back(ipsystemstatsindelivers.get_name_leafdata()); if (ipsystemstatshcindelivers.is_set || is_set(ipsystemstatshcindelivers.yfilter)) leaf_name_data.push_back(ipsystemstatshcindelivers.get_name_leafdata()); if (ipsystemstatsoutrequests.is_set || is_set(ipsystemstatsoutrequests.yfilter)) leaf_name_data.push_back(ipsystemstatsoutrequests.get_name_leafdata()); if (ipsystemstatshcoutrequests.is_set || is_set(ipsystemstatshcoutrequests.yfilter)) leaf_name_data.push_back(ipsystemstatshcoutrequests.get_name_leafdata()); if (ipsystemstatsoutnoroutes.is_set || is_set(ipsystemstatsoutnoroutes.yfilter)) leaf_name_data.push_back(ipsystemstatsoutnoroutes.get_name_leafdata()); if (ipsystemstatsoutforwdatagrams.is_set || is_set(ipsystemstatsoutforwdatagrams.yfilter)) leaf_name_data.push_back(ipsystemstatsoutforwdatagrams.get_name_leafdata()); if (ipsystemstatshcoutforwdatagrams.is_set || is_set(ipsystemstatshcoutforwdatagrams.yfilter)) leaf_name_data.push_back(ipsystemstatshcoutforwdatagrams.get_name_leafdata()); if (ipsystemstatsoutdiscards.is_set || is_set(ipsystemstatsoutdiscards.yfilter)) leaf_name_data.push_back(ipsystemstatsoutdiscards.get_name_leafdata()); if (ipsystemstatsoutfragreqds.is_set || is_set(ipsystemstatsoutfragreqds.yfilter)) leaf_name_data.push_back(ipsystemstatsoutfragreqds.get_name_leafdata()); if (ipsystemstatsoutfragoks.is_set || is_set(ipsystemstatsoutfragoks.yfilter)) leaf_name_data.push_back(ipsystemstatsoutfragoks.get_name_leafdata()); if (ipsystemstatsoutfragfails.is_set || is_set(ipsystemstatsoutfragfails.yfilter)) leaf_name_data.push_back(ipsystemstatsoutfragfails.get_name_leafdata()); if (ipsystemstatsoutfragcreates.is_set || is_set(ipsystemstatsoutfragcreates.yfilter)) leaf_name_data.push_back(ipsystemstatsoutfragcreates.get_name_leafdata()); if (ipsystemstatsouttransmits.is_set || is_set(ipsystemstatsouttransmits.yfilter)) leaf_name_data.push_back(ipsystemstatsouttransmits.get_name_leafdata()); if (ipsystemstatshcouttransmits.is_set || is_set(ipsystemstatshcouttransmits.yfilter)) leaf_name_data.push_back(ipsystemstatshcouttransmits.get_name_leafdata()); if (ipsystemstatsoutoctets.is_set || is_set(ipsystemstatsoutoctets.yfilter)) leaf_name_data.push_back(ipsystemstatsoutoctets.get_name_leafdata()); if (ipsystemstatshcoutoctets.is_set || is_set(ipsystemstatshcoutoctets.yfilter)) leaf_name_data.push_back(ipsystemstatshcoutoctets.get_name_leafdata()); if (ipsystemstatsinmcastpkts.is_set || is_set(ipsystemstatsinmcastpkts.yfilter)) leaf_name_data.push_back(ipsystemstatsinmcastpkts.get_name_leafdata()); if (ipsystemstatshcinmcastpkts.is_set || is_set(ipsystemstatshcinmcastpkts.yfilter)) leaf_name_data.push_back(ipsystemstatshcinmcastpkts.get_name_leafdata()); if (ipsystemstatsinmcastoctets.is_set || is_set(ipsystemstatsinmcastoctets.yfilter)) leaf_name_data.push_back(ipsystemstatsinmcastoctets.get_name_leafdata()); if (ipsystemstatshcinmcastoctets.is_set || is_set(ipsystemstatshcinmcastoctets.yfilter)) leaf_name_data.push_back(ipsystemstatshcinmcastoctets.get_name_leafdata()); if (ipsystemstatsoutmcastpkts.is_set || is_set(ipsystemstatsoutmcastpkts.yfilter)) leaf_name_data.push_back(ipsystemstatsoutmcastpkts.get_name_leafdata()); if (ipsystemstatshcoutmcastpkts.is_set || is_set(ipsystemstatshcoutmcastpkts.yfilter)) leaf_name_data.push_back(ipsystemstatshcoutmcastpkts.get_name_leafdata()); if (ipsystemstatsoutmcastoctets.is_set || is_set(ipsystemstatsoutmcastoctets.yfilter)) leaf_name_data.push_back(ipsystemstatsoutmcastoctets.get_name_leafdata()); if (ipsystemstatshcoutmcastoctets.is_set || is_set(ipsystemstatshcoutmcastoctets.yfilter)) leaf_name_data.push_back(ipsystemstatshcoutmcastoctets.get_name_leafdata()); if (ipsystemstatsinbcastpkts.is_set || is_set(ipsystemstatsinbcastpkts.yfilter)) leaf_name_data.push_back(ipsystemstatsinbcastpkts.get_name_leafdata()); if (ipsystemstatshcinbcastpkts.is_set || is_set(ipsystemstatshcinbcastpkts.yfilter)) leaf_name_data.push_back(ipsystemstatshcinbcastpkts.get_name_leafdata()); if (ipsystemstatsoutbcastpkts.is_set || is_set(ipsystemstatsoutbcastpkts.yfilter)) leaf_name_data.push_back(ipsystemstatsoutbcastpkts.get_name_leafdata()); if (ipsystemstatshcoutbcastpkts.is_set || is_set(ipsystemstatshcoutbcastpkts.yfilter)) leaf_name_data.push_back(ipsystemstatshcoutbcastpkts.get_name_leafdata()); if (ipsystemstatsdiscontinuitytime.is_set || is_set(ipsystemstatsdiscontinuitytime.yfilter)) leaf_name_data.push_back(ipsystemstatsdiscontinuitytime.get_name_leafdata()); if (ipsystemstatsrefreshrate.is_set || is_set(ipsystemstatsrefreshrate.yfilter)) leaf_name_data.push_back(ipsystemstatsrefreshrate.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpSystemStatsTable::IpSystemStatsEntry::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>> IPMIB::IpSystemStatsTable::IpSystemStatsEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IpSystemStatsTable::IpSystemStatsEntry::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 == "ipSystemStatsIPVersion") { ipsystemstatsipversion = value; ipsystemstatsipversion.value_namespace = name_space; ipsystemstatsipversion.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInReceives") { ipsystemstatsinreceives = value; ipsystemstatsinreceives.value_namespace = name_space; ipsystemstatsinreceives.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCInReceives") { ipsystemstatshcinreceives = value; ipsystemstatshcinreceives.value_namespace = name_space; ipsystemstatshcinreceives.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInOctets") { ipsystemstatsinoctets = value; ipsystemstatsinoctets.value_namespace = name_space; ipsystemstatsinoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCInOctets") { ipsystemstatshcinoctets = value; ipsystemstatshcinoctets.value_namespace = name_space; ipsystemstatshcinoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInHdrErrors") { ipsystemstatsinhdrerrors = value; ipsystemstatsinhdrerrors.value_namespace = name_space; ipsystemstatsinhdrerrors.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInNoRoutes") { ipsystemstatsinnoroutes = value; ipsystemstatsinnoroutes.value_namespace = name_space; ipsystemstatsinnoroutes.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInAddrErrors") { ipsystemstatsinaddrerrors = value; ipsystemstatsinaddrerrors.value_namespace = name_space; ipsystemstatsinaddrerrors.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInUnknownProtos") { ipsystemstatsinunknownprotos = value; ipsystemstatsinunknownprotos.value_namespace = name_space; ipsystemstatsinunknownprotos.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInTruncatedPkts") { ipsystemstatsintruncatedpkts = value; ipsystemstatsintruncatedpkts.value_namespace = name_space; ipsystemstatsintruncatedpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInForwDatagrams") { ipsystemstatsinforwdatagrams = value; ipsystemstatsinforwdatagrams.value_namespace = name_space; ipsystemstatsinforwdatagrams.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCInForwDatagrams") { ipsystemstatshcinforwdatagrams = value; ipsystemstatshcinforwdatagrams.value_namespace = name_space; ipsystemstatshcinforwdatagrams.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsReasmReqds") { ipsystemstatsreasmreqds = value; ipsystemstatsreasmreqds.value_namespace = name_space; ipsystemstatsreasmreqds.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsReasmOKs") { ipsystemstatsreasmoks = value; ipsystemstatsreasmoks.value_namespace = name_space; ipsystemstatsreasmoks.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsReasmFails") { ipsystemstatsreasmfails = value; ipsystemstatsreasmfails.value_namespace = name_space; ipsystemstatsreasmfails.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInDiscards") { ipsystemstatsindiscards = value; ipsystemstatsindiscards.value_namespace = name_space; ipsystemstatsindiscards.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInDelivers") { ipsystemstatsindelivers = value; ipsystemstatsindelivers.value_namespace = name_space; ipsystemstatsindelivers.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCInDelivers") { ipsystemstatshcindelivers = value; ipsystemstatshcindelivers.value_namespace = name_space; ipsystemstatshcindelivers.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutRequests") { ipsystemstatsoutrequests = value; ipsystemstatsoutrequests.value_namespace = name_space; ipsystemstatsoutrequests.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCOutRequests") { ipsystemstatshcoutrequests = value; ipsystemstatshcoutrequests.value_namespace = name_space; ipsystemstatshcoutrequests.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutNoRoutes") { ipsystemstatsoutnoroutes = value; ipsystemstatsoutnoroutes.value_namespace = name_space; ipsystemstatsoutnoroutes.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutForwDatagrams") { ipsystemstatsoutforwdatagrams = value; ipsystemstatsoutforwdatagrams.value_namespace = name_space; ipsystemstatsoutforwdatagrams.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCOutForwDatagrams") { ipsystemstatshcoutforwdatagrams = value; ipsystemstatshcoutforwdatagrams.value_namespace = name_space; ipsystemstatshcoutforwdatagrams.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutDiscards") { ipsystemstatsoutdiscards = value; ipsystemstatsoutdiscards.value_namespace = name_space; ipsystemstatsoutdiscards.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutFragReqds") { ipsystemstatsoutfragreqds = value; ipsystemstatsoutfragreqds.value_namespace = name_space; ipsystemstatsoutfragreqds.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutFragOKs") { ipsystemstatsoutfragoks = value; ipsystemstatsoutfragoks.value_namespace = name_space; ipsystemstatsoutfragoks.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutFragFails") { ipsystemstatsoutfragfails = value; ipsystemstatsoutfragfails.value_namespace = name_space; ipsystemstatsoutfragfails.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutFragCreates") { ipsystemstatsoutfragcreates = value; ipsystemstatsoutfragcreates.value_namespace = name_space; ipsystemstatsoutfragcreates.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutTransmits") { ipsystemstatsouttransmits = value; ipsystemstatsouttransmits.value_namespace = name_space; ipsystemstatsouttransmits.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCOutTransmits") { ipsystemstatshcouttransmits = value; ipsystemstatshcouttransmits.value_namespace = name_space; ipsystemstatshcouttransmits.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutOctets") { ipsystemstatsoutoctets = value; ipsystemstatsoutoctets.value_namespace = name_space; ipsystemstatsoutoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCOutOctets") { ipsystemstatshcoutoctets = value; ipsystemstatshcoutoctets.value_namespace = name_space; ipsystemstatshcoutoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInMcastPkts") { ipsystemstatsinmcastpkts = value; ipsystemstatsinmcastpkts.value_namespace = name_space; ipsystemstatsinmcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCInMcastPkts") { ipsystemstatshcinmcastpkts = value; ipsystemstatshcinmcastpkts.value_namespace = name_space; ipsystemstatshcinmcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInMcastOctets") { ipsystemstatsinmcastoctets = value; ipsystemstatsinmcastoctets.value_namespace = name_space; ipsystemstatsinmcastoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCInMcastOctets") { ipsystemstatshcinmcastoctets = value; ipsystemstatshcinmcastoctets.value_namespace = name_space; ipsystemstatshcinmcastoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutMcastPkts") { ipsystemstatsoutmcastpkts = value; ipsystemstatsoutmcastpkts.value_namespace = name_space; ipsystemstatsoutmcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCOutMcastPkts") { ipsystemstatshcoutmcastpkts = value; ipsystemstatshcoutmcastpkts.value_namespace = name_space; ipsystemstatshcoutmcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutMcastOctets") { ipsystemstatsoutmcastoctets = value; ipsystemstatsoutmcastoctets.value_namespace = name_space; ipsystemstatsoutmcastoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCOutMcastOctets") { ipsystemstatshcoutmcastoctets = value; ipsystemstatshcoutmcastoctets.value_namespace = name_space; ipsystemstatshcoutmcastoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsInBcastPkts") { ipsystemstatsinbcastpkts = value; ipsystemstatsinbcastpkts.value_namespace = name_space; ipsystemstatsinbcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCInBcastPkts") { ipsystemstatshcinbcastpkts = value; ipsystemstatshcinbcastpkts.value_namespace = name_space; ipsystemstatshcinbcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsOutBcastPkts") { ipsystemstatsoutbcastpkts = value; ipsystemstatsoutbcastpkts.value_namespace = name_space; ipsystemstatsoutbcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsHCOutBcastPkts") { ipsystemstatshcoutbcastpkts = value; ipsystemstatshcoutbcastpkts.value_namespace = name_space; ipsystemstatshcoutbcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsDiscontinuityTime") { ipsystemstatsdiscontinuitytime = value; ipsystemstatsdiscontinuitytime.value_namespace = name_space; ipsystemstatsdiscontinuitytime.value_namespace_prefix = name_space_prefix; } if(value_path == "ipSystemStatsRefreshRate") { ipsystemstatsrefreshrate = value; ipsystemstatsrefreshrate.value_namespace = name_space; ipsystemstatsrefreshrate.value_namespace_prefix = name_space_prefix; } } void IPMIB::IpSystemStatsTable::IpSystemStatsEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipSystemStatsIPVersion") { ipsystemstatsipversion.yfilter = yfilter; } if(value_path == "ipSystemStatsInReceives") { ipsystemstatsinreceives.yfilter = yfilter; } if(value_path == "ipSystemStatsHCInReceives") { ipsystemstatshcinreceives.yfilter = yfilter; } if(value_path == "ipSystemStatsInOctets") { ipsystemstatsinoctets.yfilter = yfilter; } if(value_path == "ipSystemStatsHCInOctets") { ipsystemstatshcinoctets.yfilter = yfilter; } if(value_path == "ipSystemStatsInHdrErrors") { ipsystemstatsinhdrerrors.yfilter = yfilter; } if(value_path == "ipSystemStatsInNoRoutes") { ipsystemstatsinnoroutes.yfilter = yfilter; } if(value_path == "ipSystemStatsInAddrErrors") { ipsystemstatsinaddrerrors.yfilter = yfilter; } if(value_path == "ipSystemStatsInUnknownProtos") { ipsystemstatsinunknownprotos.yfilter = yfilter; } if(value_path == "ipSystemStatsInTruncatedPkts") { ipsystemstatsintruncatedpkts.yfilter = yfilter; } if(value_path == "ipSystemStatsInForwDatagrams") { ipsystemstatsinforwdatagrams.yfilter = yfilter; } if(value_path == "ipSystemStatsHCInForwDatagrams") { ipsystemstatshcinforwdatagrams.yfilter = yfilter; } if(value_path == "ipSystemStatsReasmReqds") { ipsystemstatsreasmreqds.yfilter = yfilter; } if(value_path == "ipSystemStatsReasmOKs") { ipsystemstatsreasmoks.yfilter = yfilter; } if(value_path == "ipSystemStatsReasmFails") { ipsystemstatsreasmfails.yfilter = yfilter; } if(value_path == "ipSystemStatsInDiscards") { ipsystemstatsindiscards.yfilter = yfilter; } if(value_path == "ipSystemStatsInDelivers") { ipsystemstatsindelivers.yfilter = yfilter; } if(value_path == "ipSystemStatsHCInDelivers") { ipsystemstatshcindelivers.yfilter = yfilter; } if(value_path == "ipSystemStatsOutRequests") { ipsystemstatsoutrequests.yfilter = yfilter; } if(value_path == "ipSystemStatsHCOutRequests") { ipsystemstatshcoutrequests.yfilter = yfilter; } if(value_path == "ipSystemStatsOutNoRoutes") { ipsystemstatsoutnoroutes.yfilter = yfilter; } if(value_path == "ipSystemStatsOutForwDatagrams") { ipsystemstatsoutforwdatagrams.yfilter = yfilter; } if(value_path == "ipSystemStatsHCOutForwDatagrams") { ipsystemstatshcoutforwdatagrams.yfilter = yfilter; } if(value_path == "ipSystemStatsOutDiscards") { ipsystemstatsoutdiscards.yfilter = yfilter; } if(value_path == "ipSystemStatsOutFragReqds") { ipsystemstatsoutfragreqds.yfilter = yfilter; } if(value_path == "ipSystemStatsOutFragOKs") { ipsystemstatsoutfragoks.yfilter = yfilter; } if(value_path == "ipSystemStatsOutFragFails") { ipsystemstatsoutfragfails.yfilter = yfilter; } if(value_path == "ipSystemStatsOutFragCreates") { ipsystemstatsoutfragcreates.yfilter = yfilter; } if(value_path == "ipSystemStatsOutTransmits") { ipsystemstatsouttransmits.yfilter = yfilter; } if(value_path == "ipSystemStatsHCOutTransmits") { ipsystemstatshcouttransmits.yfilter = yfilter; } if(value_path == "ipSystemStatsOutOctets") { ipsystemstatsoutoctets.yfilter = yfilter; } if(value_path == "ipSystemStatsHCOutOctets") { ipsystemstatshcoutoctets.yfilter = yfilter; } if(value_path == "ipSystemStatsInMcastPkts") { ipsystemstatsinmcastpkts.yfilter = yfilter; } if(value_path == "ipSystemStatsHCInMcastPkts") { ipsystemstatshcinmcastpkts.yfilter = yfilter; } if(value_path == "ipSystemStatsInMcastOctets") { ipsystemstatsinmcastoctets.yfilter = yfilter; } if(value_path == "ipSystemStatsHCInMcastOctets") { ipsystemstatshcinmcastoctets.yfilter = yfilter; } if(value_path == "ipSystemStatsOutMcastPkts") { ipsystemstatsoutmcastpkts.yfilter = yfilter; } if(value_path == "ipSystemStatsHCOutMcastPkts") { ipsystemstatshcoutmcastpkts.yfilter = yfilter; } if(value_path == "ipSystemStatsOutMcastOctets") { ipsystemstatsoutmcastoctets.yfilter = yfilter; } if(value_path == "ipSystemStatsHCOutMcastOctets") { ipsystemstatshcoutmcastoctets.yfilter = yfilter; } if(value_path == "ipSystemStatsInBcastPkts") { ipsystemstatsinbcastpkts.yfilter = yfilter; } if(value_path == "ipSystemStatsHCInBcastPkts") { ipsystemstatshcinbcastpkts.yfilter = yfilter; } if(value_path == "ipSystemStatsOutBcastPkts") { ipsystemstatsoutbcastpkts.yfilter = yfilter; } if(value_path == "ipSystemStatsHCOutBcastPkts") { ipsystemstatshcoutbcastpkts.yfilter = yfilter; } if(value_path == "ipSystemStatsDiscontinuityTime") { ipsystemstatsdiscontinuitytime.yfilter = yfilter; } if(value_path == "ipSystemStatsRefreshRate") { ipsystemstatsrefreshrate.yfilter = yfilter; } } bool IPMIB::IpSystemStatsTable::IpSystemStatsEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipSystemStatsIPVersion" || name == "ipSystemStatsInReceives" || name == "ipSystemStatsHCInReceives" || name == "ipSystemStatsInOctets" || name == "ipSystemStatsHCInOctets" || name == "ipSystemStatsInHdrErrors" || name == "ipSystemStatsInNoRoutes" || name == "ipSystemStatsInAddrErrors" || name == "ipSystemStatsInUnknownProtos" || name == "ipSystemStatsInTruncatedPkts" || name == "ipSystemStatsInForwDatagrams" || name == "ipSystemStatsHCInForwDatagrams" || name == "ipSystemStatsReasmReqds" || name == "ipSystemStatsReasmOKs" || name == "ipSystemStatsReasmFails" || name == "ipSystemStatsInDiscards" || name == "ipSystemStatsInDelivers" || name == "ipSystemStatsHCInDelivers" || name == "ipSystemStatsOutRequests" || name == "ipSystemStatsHCOutRequests" || name == "ipSystemStatsOutNoRoutes" || name == "ipSystemStatsOutForwDatagrams" || name == "ipSystemStatsHCOutForwDatagrams" || name == "ipSystemStatsOutDiscards" || name == "ipSystemStatsOutFragReqds" || name == "ipSystemStatsOutFragOKs" || name == "ipSystemStatsOutFragFails" || name == "ipSystemStatsOutFragCreates" || name == "ipSystemStatsOutTransmits" || name == "ipSystemStatsHCOutTransmits" || name == "ipSystemStatsOutOctets" || name == "ipSystemStatsHCOutOctets" || name == "ipSystemStatsInMcastPkts" || name == "ipSystemStatsHCInMcastPkts" || name == "ipSystemStatsInMcastOctets" || name == "ipSystemStatsHCInMcastOctets" || name == "ipSystemStatsOutMcastPkts" || name == "ipSystemStatsHCOutMcastPkts" || name == "ipSystemStatsOutMcastOctets" || name == "ipSystemStatsHCOutMcastOctets" || name == "ipSystemStatsInBcastPkts" || name == "ipSystemStatsHCInBcastPkts" || name == "ipSystemStatsOutBcastPkts" || name == "ipSystemStatsHCOutBcastPkts" || name == "ipSystemStatsDiscontinuityTime" || name == "ipSystemStatsRefreshRate") return true; return false; } IPMIB::IpIfStatsTable::IpIfStatsTable() : ipifstatsentry(this, {"ipifstatsipversion", "ipifstatsifindex"}) { yang_name = "ipIfStatsTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpIfStatsTable::~IpIfStatsTable() { } bool IPMIB::IpIfStatsTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipifstatsentry.len(); index++) { if(ipifstatsentry[index]->has_data()) return true; } return false; } bool IPMIB::IpIfStatsTable::has_operation() const { for (std::size_t index=0; index<ipifstatsentry.len(); index++) { if(ipifstatsentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IpIfStatsTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpIfStatsTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipIfStatsTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpIfStatsTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpIfStatsTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipIfStatsEntry") { auto ent_ = std::make_shared<IPMIB::IpIfStatsTable::IpIfStatsEntry>(); ent_->parent = this; ipifstatsentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IpIfStatsTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipifstatsentry.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 IPMIB::IpIfStatsTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IpIfStatsTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IpIfStatsTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipIfStatsEntry") return true; return false; } IPMIB::IpIfStatsTable::IpIfStatsEntry::IpIfStatsEntry() : ipifstatsipversion{YType::enumeration, "ipIfStatsIPVersion"}, ipifstatsifindex{YType::int32, "ipIfStatsIfIndex"}, ipifstatsinreceives{YType::uint32, "ipIfStatsInReceives"}, ipifstatshcinreceives{YType::uint64, "ipIfStatsHCInReceives"}, ipifstatsinoctets{YType::uint32, "ipIfStatsInOctets"}, ipifstatshcinoctets{YType::uint64, "ipIfStatsHCInOctets"}, ipifstatsinhdrerrors{YType::uint32, "ipIfStatsInHdrErrors"}, ipifstatsinnoroutes{YType::uint32, "ipIfStatsInNoRoutes"}, ipifstatsinaddrerrors{YType::uint32, "ipIfStatsInAddrErrors"}, ipifstatsinunknownprotos{YType::uint32, "ipIfStatsInUnknownProtos"}, ipifstatsintruncatedpkts{YType::uint32, "ipIfStatsInTruncatedPkts"}, ipifstatsinforwdatagrams{YType::uint32, "ipIfStatsInForwDatagrams"}, ipifstatshcinforwdatagrams{YType::uint64, "ipIfStatsHCInForwDatagrams"}, ipifstatsreasmreqds{YType::uint32, "ipIfStatsReasmReqds"}, ipifstatsreasmoks{YType::uint32, "ipIfStatsReasmOKs"}, ipifstatsreasmfails{YType::uint32, "ipIfStatsReasmFails"}, ipifstatsindiscards{YType::uint32, "ipIfStatsInDiscards"}, ipifstatsindelivers{YType::uint32, "ipIfStatsInDelivers"}, ipifstatshcindelivers{YType::uint64, "ipIfStatsHCInDelivers"}, ipifstatsoutrequests{YType::uint32, "ipIfStatsOutRequests"}, ipifstatshcoutrequests{YType::uint64, "ipIfStatsHCOutRequests"}, ipifstatsoutforwdatagrams{YType::uint32, "ipIfStatsOutForwDatagrams"}, ipifstatshcoutforwdatagrams{YType::uint64, "ipIfStatsHCOutForwDatagrams"}, ipifstatsoutdiscards{YType::uint32, "ipIfStatsOutDiscards"}, ipifstatsoutfragreqds{YType::uint32, "ipIfStatsOutFragReqds"}, ipifstatsoutfragoks{YType::uint32, "ipIfStatsOutFragOKs"}, ipifstatsoutfragfails{YType::uint32, "ipIfStatsOutFragFails"}, ipifstatsoutfragcreates{YType::uint32, "ipIfStatsOutFragCreates"}, ipifstatsouttransmits{YType::uint32, "ipIfStatsOutTransmits"}, ipifstatshcouttransmits{YType::uint64, "ipIfStatsHCOutTransmits"}, ipifstatsoutoctets{YType::uint32, "ipIfStatsOutOctets"}, ipifstatshcoutoctets{YType::uint64, "ipIfStatsHCOutOctets"}, ipifstatsinmcastpkts{YType::uint32, "ipIfStatsInMcastPkts"}, ipifstatshcinmcastpkts{YType::uint64, "ipIfStatsHCInMcastPkts"}, ipifstatsinmcastoctets{YType::uint32, "ipIfStatsInMcastOctets"}, ipifstatshcinmcastoctets{YType::uint64, "ipIfStatsHCInMcastOctets"}, ipifstatsoutmcastpkts{YType::uint32, "ipIfStatsOutMcastPkts"}, ipifstatshcoutmcastpkts{YType::uint64, "ipIfStatsHCOutMcastPkts"}, ipifstatsoutmcastoctets{YType::uint32, "ipIfStatsOutMcastOctets"}, ipifstatshcoutmcastoctets{YType::uint64, "ipIfStatsHCOutMcastOctets"}, ipifstatsinbcastpkts{YType::uint32, "ipIfStatsInBcastPkts"}, ipifstatshcinbcastpkts{YType::uint64, "ipIfStatsHCInBcastPkts"}, ipifstatsoutbcastpkts{YType::uint32, "ipIfStatsOutBcastPkts"}, ipifstatshcoutbcastpkts{YType::uint64, "ipIfStatsHCOutBcastPkts"}, ipifstatsdiscontinuitytime{YType::uint32, "ipIfStatsDiscontinuityTime"}, ipifstatsrefreshrate{YType::uint32, "ipIfStatsRefreshRate"} { yang_name = "ipIfStatsEntry"; yang_parent_name = "ipIfStatsTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpIfStatsTable::IpIfStatsEntry::~IpIfStatsEntry() { } bool IPMIB::IpIfStatsTable::IpIfStatsEntry::has_data() const { if (is_presence_container) return true; return ipifstatsipversion.is_set || ipifstatsifindex.is_set || ipifstatsinreceives.is_set || ipifstatshcinreceives.is_set || ipifstatsinoctets.is_set || ipifstatshcinoctets.is_set || ipifstatsinhdrerrors.is_set || ipifstatsinnoroutes.is_set || ipifstatsinaddrerrors.is_set || ipifstatsinunknownprotos.is_set || ipifstatsintruncatedpkts.is_set || ipifstatsinforwdatagrams.is_set || ipifstatshcinforwdatagrams.is_set || ipifstatsreasmreqds.is_set || ipifstatsreasmoks.is_set || ipifstatsreasmfails.is_set || ipifstatsindiscards.is_set || ipifstatsindelivers.is_set || ipifstatshcindelivers.is_set || ipifstatsoutrequests.is_set || ipifstatshcoutrequests.is_set || ipifstatsoutforwdatagrams.is_set || ipifstatshcoutforwdatagrams.is_set || ipifstatsoutdiscards.is_set || ipifstatsoutfragreqds.is_set || ipifstatsoutfragoks.is_set || ipifstatsoutfragfails.is_set || ipifstatsoutfragcreates.is_set || ipifstatsouttransmits.is_set || ipifstatshcouttransmits.is_set || ipifstatsoutoctets.is_set || ipifstatshcoutoctets.is_set || ipifstatsinmcastpkts.is_set || ipifstatshcinmcastpkts.is_set || ipifstatsinmcastoctets.is_set || ipifstatshcinmcastoctets.is_set || ipifstatsoutmcastpkts.is_set || ipifstatshcoutmcastpkts.is_set || ipifstatsoutmcastoctets.is_set || ipifstatshcoutmcastoctets.is_set || ipifstatsinbcastpkts.is_set || ipifstatshcinbcastpkts.is_set || ipifstatsoutbcastpkts.is_set || ipifstatshcoutbcastpkts.is_set || ipifstatsdiscontinuitytime.is_set || ipifstatsrefreshrate.is_set; } bool IPMIB::IpIfStatsTable::IpIfStatsEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipifstatsipversion.yfilter) || ydk::is_set(ipifstatsifindex.yfilter) || ydk::is_set(ipifstatsinreceives.yfilter) || ydk::is_set(ipifstatshcinreceives.yfilter) || ydk::is_set(ipifstatsinoctets.yfilter) || ydk::is_set(ipifstatshcinoctets.yfilter) || ydk::is_set(ipifstatsinhdrerrors.yfilter) || ydk::is_set(ipifstatsinnoroutes.yfilter) || ydk::is_set(ipifstatsinaddrerrors.yfilter) || ydk::is_set(ipifstatsinunknownprotos.yfilter) || ydk::is_set(ipifstatsintruncatedpkts.yfilter) || ydk::is_set(ipifstatsinforwdatagrams.yfilter) || ydk::is_set(ipifstatshcinforwdatagrams.yfilter) || ydk::is_set(ipifstatsreasmreqds.yfilter) || ydk::is_set(ipifstatsreasmoks.yfilter) || ydk::is_set(ipifstatsreasmfails.yfilter) || ydk::is_set(ipifstatsindiscards.yfilter) || ydk::is_set(ipifstatsindelivers.yfilter) || ydk::is_set(ipifstatshcindelivers.yfilter) || ydk::is_set(ipifstatsoutrequests.yfilter) || ydk::is_set(ipifstatshcoutrequests.yfilter) || ydk::is_set(ipifstatsoutforwdatagrams.yfilter) || ydk::is_set(ipifstatshcoutforwdatagrams.yfilter) || ydk::is_set(ipifstatsoutdiscards.yfilter) || ydk::is_set(ipifstatsoutfragreqds.yfilter) || ydk::is_set(ipifstatsoutfragoks.yfilter) || ydk::is_set(ipifstatsoutfragfails.yfilter) || ydk::is_set(ipifstatsoutfragcreates.yfilter) || ydk::is_set(ipifstatsouttransmits.yfilter) || ydk::is_set(ipifstatshcouttransmits.yfilter) || ydk::is_set(ipifstatsoutoctets.yfilter) || ydk::is_set(ipifstatshcoutoctets.yfilter) || ydk::is_set(ipifstatsinmcastpkts.yfilter) || ydk::is_set(ipifstatshcinmcastpkts.yfilter) || ydk::is_set(ipifstatsinmcastoctets.yfilter) || ydk::is_set(ipifstatshcinmcastoctets.yfilter) || ydk::is_set(ipifstatsoutmcastpkts.yfilter) || ydk::is_set(ipifstatshcoutmcastpkts.yfilter) || ydk::is_set(ipifstatsoutmcastoctets.yfilter) || ydk::is_set(ipifstatshcoutmcastoctets.yfilter) || ydk::is_set(ipifstatsinbcastpkts.yfilter) || ydk::is_set(ipifstatshcinbcastpkts.yfilter) || ydk::is_set(ipifstatsoutbcastpkts.yfilter) || ydk::is_set(ipifstatshcoutbcastpkts.yfilter) || ydk::is_set(ipifstatsdiscontinuitytime.yfilter) || ydk::is_set(ipifstatsrefreshrate.yfilter); } std::string IPMIB::IpIfStatsTable::IpIfStatsEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipIfStatsTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpIfStatsTable::IpIfStatsEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipIfStatsEntry"; ADD_KEY_TOKEN(ipifstatsipversion, "ipIfStatsIPVersion"); ADD_KEY_TOKEN(ipifstatsifindex, "ipIfStatsIfIndex"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpIfStatsTable::IpIfStatsEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipifstatsipversion.is_set || is_set(ipifstatsipversion.yfilter)) leaf_name_data.push_back(ipifstatsipversion.get_name_leafdata()); if (ipifstatsifindex.is_set || is_set(ipifstatsifindex.yfilter)) leaf_name_data.push_back(ipifstatsifindex.get_name_leafdata()); if (ipifstatsinreceives.is_set || is_set(ipifstatsinreceives.yfilter)) leaf_name_data.push_back(ipifstatsinreceives.get_name_leafdata()); if (ipifstatshcinreceives.is_set || is_set(ipifstatshcinreceives.yfilter)) leaf_name_data.push_back(ipifstatshcinreceives.get_name_leafdata()); if (ipifstatsinoctets.is_set || is_set(ipifstatsinoctets.yfilter)) leaf_name_data.push_back(ipifstatsinoctets.get_name_leafdata()); if (ipifstatshcinoctets.is_set || is_set(ipifstatshcinoctets.yfilter)) leaf_name_data.push_back(ipifstatshcinoctets.get_name_leafdata()); if (ipifstatsinhdrerrors.is_set || is_set(ipifstatsinhdrerrors.yfilter)) leaf_name_data.push_back(ipifstatsinhdrerrors.get_name_leafdata()); if (ipifstatsinnoroutes.is_set || is_set(ipifstatsinnoroutes.yfilter)) leaf_name_data.push_back(ipifstatsinnoroutes.get_name_leafdata()); if (ipifstatsinaddrerrors.is_set || is_set(ipifstatsinaddrerrors.yfilter)) leaf_name_data.push_back(ipifstatsinaddrerrors.get_name_leafdata()); if (ipifstatsinunknownprotos.is_set || is_set(ipifstatsinunknownprotos.yfilter)) leaf_name_data.push_back(ipifstatsinunknownprotos.get_name_leafdata()); if (ipifstatsintruncatedpkts.is_set || is_set(ipifstatsintruncatedpkts.yfilter)) leaf_name_data.push_back(ipifstatsintruncatedpkts.get_name_leafdata()); if (ipifstatsinforwdatagrams.is_set || is_set(ipifstatsinforwdatagrams.yfilter)) leaf_name_data.push_back(ipifstatsinforwdatagrams.get_name_leafdata()); if (ipifstatshcinforwdatagrams.is_set || is_set(ipifstatshcinforwdatagrams.yfilter)) leaf_name_data.push_back(ipifstatshcinforwdatagrams.get_name_leafdata()); if (ipifstatsreasmreqds.is_set || is_set(ipifstatsreasmreqds.yfilter)) leaf_name_data.push_back(ipifstatsreasmreqds.get_name_leafdata()); if (ipifstatsreasmoks.is_set || is_set(ipifstatsreasmoks.yfilter)) leaf_name_data.push_back(ipifstatsreasmoks.get_name_leafdata()); if (ipifstatsreasmfails.is_set || is_set(ipifstatsreasmfails.yfilter)) leaf_name_data.push_back(ipifstatsreasmfails.get_name_leafdata()); if (ipifstatsindiscards.is_set || is_set(ipifstatsindiscards.yfilter)) leaf_name_data.push_back(ipifstatsindiscards.get_name_leafdata()); if (ipifstatsindelivers.is_set || is_set(ipifstatsindelivers.yfilter)) leaf_name_data.push_back(ipifstatsindelivers.get_name_leafdata()); if (ipifstatshcindelivers.is_set || is_set(ipifstatshcindelivers.yfilter)) leaf_name_data.push_back(ipifstatshcindelivers.get_name_leafdata()); if (ipifstatsoutrequests.is_set || is_set(ipifstatsoutrequests.yfilter)) leaf_name_data.push_back(ipifstatsoutrequests.get_name_leafdata()); if (ipifstatshcoutrequests.is_set || is_set(ipifstatshcoutrequests.yfilter)) leaf_name_data.push_back(ipifstatshcoutrequests.get_name_leafdata()); if (ipifstatsoutforwdatagrams.is_set || is_set(ipifstatsoutforwdatagrams.yfilter)) leaf_name_data.push_back(ipifstatsoutforwdatagrams.get_name_leafdata()); if (ipifstatshcoutforwdatagrams.is_set || is_set(ipifstatshcoutforwdatagrams.yfilter)) leaf_name_data.push_back(ipifstatshcoutforwdatagrams.get_name_leafdata()); if (ipifstatsoutdiscards.is_set || is_set(ipifstatsoutdiscards.yfilter)) leaf_name_data.push_back(ipifstatsoutdiscards.get_name_leafdata()); if (ipifstatsoutfragreqds.is_set || is_set(ipifstatsoutfragreqds.yfilter)) leaf_name_data.push_back(ipifstatsoutfragreqds.get_name_leafdata()); if (ipifstatsoutfragoks.is_set || is_set(ipifstatsoutfragoks.yfilter)) leaf_name_data.push_back(ipifstatsoutfragoks.get_name_leafdata()); if (ipifstatsoutfragfails.is_set || is_set(ipifstatsoutfragfails.yfilter)) leaf_name_data.push_back(ipifstatsoutfragfails.get_name_leafdata()); if (ipifstatsoutfragcreates.is_set || is_set(ipifstatsoutfragcreates.yfilter)) leaf_name_data.push_back(ipifstatsoutfragcreates.get_name_leafdata()); if (ipifstatsouttransmits.is_set || is_set(ipifstatsouttransmits.yfilter)) leaf_name_data.push_back(ipifstatsouttransmits.get_name_leafdata()); if (ipifstatshcouttransmits.is_set || is_set(ipifstatshcouttransmits.yfilter)) leaf_name_data.push_back(ipifstatshcouttransmits.get_name_leafdata()); if (ipifstatsoutoctets.is_set || is_set(ipifstatsoutoctets.yfilter)) leaf_name_data.push_back(ipifstatsoutoctets.get_name_leafdata()); if (ipifstatshcoutoctets.is_set || is_set(ipifstatshcoutoctets.yfilter)) leaf_name_data.push_back(ipifstatshcoutoctets.get_name_leafdata()); if (ipifstatsinmcastpkts.is_set || is_set(ipifstatsinmcastpkts.yfilter)) leaf_name_data.push_back(ipifstatsinmcastpkts.get_name_leafdata()); if (ipifstatshcinmcastpkts.is_set || is_set(ipifstatshcinmcastpkts.yfilter)) leaf_name_data.push_back(ipifstatshcinmcastpkts.get_name_leafdata()); if (ipifstatsinmcastoctets.is_set || is_set(ipifstatsinmcastoctets.yfilter)) leaf_name_data.push_back(ipifstatsinmcastoctets.get_name_leafdata()); if (ipifstatshcinmcastoctets.is_set || is_set(ipifstatshcinmcastoctets.yfilter)) leaf_name_data.push_back(ipifstatshcinmcastoctets.get_name_leafdata()); if (ipifstatsoutmcastpkts.is_set || is_set(ipifstatsoutmcastpkts.yfilter)) leaf_name_data.push_back(ipifstatsoutmcastpkts.get_name_leafdata()); if (ipifstatshcoutmcastpkts.is_set || is_set(ipifstatshcoutmcastpkts.yfilter)) leaf_name_data.push_back(ipifstatshcoutmcastpkts.get_name_leafdata()); if (ipifstatsoutmcastoctets.is_set || is_set(ipifstatsoutmcastoctets.yfilter)) leaf_name_data.push_back(ipifstatsoutmcastoctets.get_name_leafdata()); if (ipifstatshcoutmcastoctets.is_set || is_set(ipifstatshcoutmcastoctets.yfilter)) leaf_name_data.push_back(ipifstatshcoutmcastoctets.get_name_leafdata()); if (ipifstatsinbcastpkts.is_set || is_set(ipifstatsinbcastpkts.yfilter)) leaf_name_data.push_back(ipifstatsinbcastpkts.get_name_leafdata()); if (ipifstatshcinbcastpkts.is_set || is_set(ipifstatshcinbcastpkts.yfilter)) leaf_name_data.push_back(ipifstatshcinbcastpkts.get_name_leafdata()); if (ipifstatsoutbcastpkts.is_set || is_set(ipifstatsoutbcastpkts.yfilter)) leaf_name_data.push_back(ipifstatsoutbcastpkts.get_name_leafdata()); if (ipifstatshcoutbcastpkts.is_set || is_set(ipifstatshcoutbcastpkts.yfilter)) leaf_name_data.push_back(ipifstatshcoutbcastpkts.get_name_leafdata()); if (ipifstatsdiscontinuitytime.is_set || is_set(ipifstatsdiscontinuitytime.yfilter)) leaf_name_data.push_back(ipifstatsdiscontinuitytime.get_name_leafdata()); if (ipifstatsrefreshrate.is_set || is_set(ipifstatsrefreshrate.yfilter)) leaf_name_data.push_back(ipifstatsrefreshrate.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpIfStatsTable::IpIfStatsEntry::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>> IPMIB::IpIfStatsTable::IpIfStatsEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IpIfStatsTable::IpIfStatsEntry::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 == "ipIfStatsIPVersion") { ipifstatsipversion = value; ipifstatsipversion.value_namespace = name_space; ipifstatsipversion.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsIfIndex") { ipifstatsifindex = value; ipifstatsifindex.value_namespace = name_space; ipifstatsifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInReceives") { ipifstatsinreceives = value; ipifstatsinreceives.value_namespace = name_space; ipifstatsinreceives.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCInReceives") { ipifstatshcinreceives = value; ipifstatshcinreceives.value_namespace = name_space; ipifstatshcinreceives.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInOctets") { ipifstatsinoctets = value; ipifstatsinoctets.value_namespace = name_space; ipifstatsinoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCInOctets") { ipifstatshcinoctets = value; ipifstatshcinoctets.value_namespace = name_space; ipifstatshcinoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInHdrErrors") { ipifstatsinhdrerrors = value; ipifstatsinhdrerrors.value_namespace = name_space; ipifstatsinhdrerrors.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInNoRoutes") { ipifstatsinnoroutes = value; ipifstatsinnoroutes.value_namespace = name_space; ipifstatsinnoroutes.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInAddrErrors") { ipifstatsinaddrerrors = value; ipifstatsinaddrerrors.value_namespace = name_space; ipifstatsinaddrerrors.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInUnknownProtos") { ipifstatsinunknownprotos = value; ipifstatsinunknownprotos.value_namespace = name_space; ipifstatsinunknownprotos.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInTruncatedPkts") { ipifstatsintruncatedpkts = value; ipifstatsintruncatedpkts.value_namespace = name_space; ipifstatsintruncatedpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInForwDatagrams") { ipifstatsinforwdatagrams = value; ipifstatsinforwdatagrams.value_namespace = name_space; ipifstatsinforwdatagrams.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCInForwDatagrams") { ipifstatshcinforwdatagrams = value; ipifstatshcinforwdatagrams.value_namespace = name_space; ipifstatshcinforwdatagrams.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsReasmReqds") { ipifstatsreasmreqds = value; ipifstatsreasmreqds.value_namespace = name_space; ipifstatsreasmreqds.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsReasmOKs") { ipifstatsreasmoks = value; ipifstatsreasmoks.value_namespace = name_space; ipifstatsreasmoks.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsReasmFails") { ipifstatsreasmfails = value; ipifstatsreasmfails.value_namespace = name_space; ipifstatsreasmfails.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInDiscards") { ipifstatsindiscards = value; ipifstatsindiscards.value_namespace = name_space; ipifstatsindiscards.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInDelivers") { ipifstatsindelivers = value; ipifstatsindelivers.value_namespace = name_space; ipifstatsindelivers.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCInDelivers") { ipifstatshcindelivers = value; ipifstatshcindelivers.value_namespace = name_space; ipifstatshcindelivers.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutRequests") { ipifstatsoutrequests = value; ipifstatsoutrequests.value_namespace = name_space; ipifstatsoutrequests.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCOutRequests") { ipifstatshcoutrequests = value; ipifstatshcoutrequests.value_namespace = name_space; ipifstatshcoutrequests.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutForwDatagrams") { ipifstatsoutforwdatagrams = value; ipifstatsoutforwdatagrams.value_namespace = name_space; ipifstatsoutforwdatagrams.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCOutForwDatagrams") { ipifstatshcoutforwdatagrams = value; ipifstatshcoutforwdatagrams.value_namespace = name_space; ipifstatshcoutforwdatagrams.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutDiscards") { ipifstatsoutdiscards = value; ipifstatsoutdiscards.value_namespace = name_space; ipifstatsoutdiscards.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutFragReqds") { ipifstatsoutfragreqds = value; ipifstatsoutfragreqds.value_namespace = name_space; ipifstatsoutfragreqds.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutFragOKs") { ipifstatsoutfragoks = value; ipifstatsoutfragoks.value_namespace = name_space; ipifstatsoutfragoks.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutFragFails") { ipifstatsoutfragfails = value; ipifstatsoutfragfails.value_namespace = name_space; ipifstatsoutfragfails.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutFragCreates") { ipifstatsoutfragcreates = value; ipifstatsoutfragcreates.value_namespace = name_space; ipifstatsoutfragcreates.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutTransmits") { ipifstatsouttransmits = value; ipifstatsouttransmits.value_namespace = name_space; ipifstatsouttransmits.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCOutTransmits") { ipifstatshcouttransmits = value; ipifstatshcouttransmits.value_namespace = name_space; ipifstatshcouttransmits.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutOctets") { ipifstatsoutoctets = value; ipifstatsoutoctets.value_namespace = name_space; ipifstatsoutoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCOutOctets") { ipifstatshcoutoctets = value; ipifstatshcoutoctets.value_namespace = name_space; ipifstatshcoutoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInMcastPkts") { ipifstatsinmcastpkts = value; ipifstatsinmcastpkts.value_namespace = name_space; ipifstatsinmcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCInMcastPkts") { ipifstatshcinmcastpkts = value; ipifstatshcinmcastpkts.value_namespace = name_space; ipifstatshcinmcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInMcastOctets") { ipifstatsinmcastoctets = value; ipifstatsinmcastoctets.value_namespace = name_space; ipifstatsinmcastoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCInMcastOctets") { ipifstatshcinmcastoctets = value; ipifstatshcinmcastoctets.value_namespace = name_space; ipifstatshcinmcastoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutMcastPkts") { ipifstatsoutmcastpkts = value; ipifstatsoutmcastpkts.value_namespace = name_space; ipifstatsoutmcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCOutMcastPkts") { ipifstatshcoutmcastpkts = value; ipifstatshcoutmcastpkts.value_namespace = name_space; ipifstatshcoutmcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutMcastOctets") { ipifstatsoutmcastoctets = value; ipifstatsoutmcastoctets.value_namespace = name_space; ipifstatsoutmcastoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCOutMcastOctets") { ipifstatshcoutmcastoctets = value; ipifstatshcoutmcastoctets.value_namespace = name_space; ipifstatshcoutmcastoctets.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsInBcastPkts") { ipifstatsinbcastpkts = value; ipifstatsinbcastpkts.value_namespace = name_space; ipifstatsinbcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCInBcastPkts") { ipifstatshcinbcastpkts = value; ipifstatshcinbcastpkts.value_namespace = name_space; ipifstatshcinbcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsOutBcastPkts") { ipifstatsoutbcastpkts = value; ipifstatsoutbcastpkts.value_namespace = name_space; ipifstatsoutbcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsHCOutBcastPkts") { ipifstatshcoutbcastpkts = value; ipifstatshcoutbcastpkts.value_namespace = name_space; ipifstatshcoutbcastpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsDiscontinuityTime") { ipifstatsdiscontinuitytime = value; ipifstatsdiscontinuitytime.value_namespace = name_space; ipifstatsdiscontinuitytime.value_namespace_prefix = name_space_prefix; } if(value_path == "ipIfStatsRefreshRate") { ipifstatsrefreshrate = value; ipifstatsrefreshrate.value_namespace = name_space; ipifstatsrefreshrate.value_namespace_prefix = name_space_prefix; } } void IPMIB::IpIfStatsTable::IpIfStatsEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipIfStatsIPVersion") { ipifstatsipversion.yfilter = yfilter; } if(value_path == "ipIfStatsIfIndex") { ipifstatsifindex.yfilter = yfilter; } if(value_path == "ipIfStatsInReceives") { ipifstatsinreceives.yfilter = yfilter; } if(value_path == "ipIfStatsHCInReceives") { ipifstatshcinreceives.yfilter = yfilter; } if(value_path == "ipIfStatsInOctets") { ipifstatsinoctets.yfilter = yfilter; } if(value_path == "ipIfStatsHCInOctets") { ipifstatshcinoctets.yfilter = yfilter; } if(value_path == "ipIfStatsInHdrErrors") { ipifstatsinhdrerrors.yfilter = yfilter; } if(value_path == "ipIfStatsInNoRoutes") { ipifstatsinnoroutes.yfilter = yfilter; } if(value_path == "ipIfStatsInAddrErrors") { ipifstatsinaddrerrors.yfilter = yfilter; } if(value_path == "ipIfStatsInUnknownProtos") { ipifstatsinunknownprotos.yfilter = yfilter; } if(value_path == "ipIfStatsInTruncatedPkts") { ipifstatsintruncatedpkts.yfilter = yfilter; } if(value_path == "ipIfStatsInForwDatagrams") { ipifstatsinforwdatagrams.yfilter = yfilter; } if(value_path == "ipIfStatsHCInForwDatagrams") { ipifstatshcinforwdatagrams.yfilter = yfilter; } if(value_path == "ipIfStatsReasmReqds") { ipifstatsreasmreqds.yfilter = yfilter; } if(value_path == "ipIfStatsReasmOKs") { ipifstatsreasmoks.yfilter = yfilter; } if(value_path == "ipIfStatsReasmFails") { ipifstatsreasmfails.yfilter = yfilter; } if(value_path == "ipIfStatsInDiscards") { ipifstatsindiscards.yfilter = yfilter; } if(value_path == "ipIfStatsInDelivers") { ipifstatsindelivers.yfilter = yfilter; } if(value_path == "ipIfStatsHCInDelivers") { ipifstatshcindelivers.yfilter = yfilter; } if(value_path == "ipIfStatsOutRequests") { ipifstatsoutrequests.yfilter = yfilter; } if(value_path == "ipIfStatsHCOutRequests") { ipifstatshcoutrequests.yfilter = yfilter; } if(value_path == "ipIfStatsOutForwDatagrams") { ipifstatsoutforwdatagrams.yfilter = yfilter; } if(value_path == "ipIfStatsHCOutForwDatagrams") { ipifstatshcoutforwdatagrams.yfilter = yfilter; } if(value_path == "ipIfStatsOutDiscards") { ipifstatsoutdiscards.yfilter = yfilter; } if(value_path == "ipIfStatsOutFragReqds") { ipifstatsoutfragreqds.yfilter = yfilter; } if(value_path == "ipIfStatsOutFragOKs") { ipifstatsoutfragoks.yfilter = yfilter; } if(value_path == "ipIfStatsOutFragFails") { ipifstatsoutfragfails.yfilter = yfilter; } if(value_path == "ipIfStatsOutFragCreates") { ipifstatsoutfragcreates.yfilter = yfilter; } if(value_path == "ipIfStatsOutTransmits") { ipifstatsouttransmits.yfilter = yfilter; } if(value_path == "ipIfStatsHCOutTransmits") { ipifstatshcouttransmits.yfilter = yfilter; } if(value_path == "ipIfStatsOutOctets") { ipifstatsoutoctets.yfilter = yfilter; } if(value_path == "ipIfStatsHCOutOctets") { ipifstatshcoutoctets.yfilter = yfilter; } if(value_path == "ipIfStatsInMcastPkts") { ipifstatsinmcastpkts.yfilter = yfilter; } if(value_path == "ipIfStatsHCInMcastPkts") { ipifstatshcinmcastpkts.yfilter = yfilter; } if(value_path == "ipIfStatsInMcastOctets") { ipifstatsinmcastoctets.yfilter = yfilter; } if(value_path == "ipIfStatsHCInMcastOctets") { ipifstatshcinmcastoctets.yfilter = yfilter; } if(value_path == "ipIfStatsOutMcastPkts") { ipifstatsoutmcastpkts.yfilter = yfilter; } if(value_path == "ipIfStatsHCOutMcastPkts") { ipifstatshcoutmcastpkts.yfilter = yfilter; } if(value_path == "ipIfStatsOutMcastOctets") { ipifstatsoutmcastoctets.yfilter = yfilter; } if(value_path == "ipIfStatsHCOutMcastOctets") { ipifstatshcoutmcastoctets.yfilter = yfilter; } if(value_path == "ipIfStatsInBcastPkts") { ipifstatsinbcastpkts.yfilter = yfilter; } if(value_path == "ipIfStatsHCInBcastPkts") { ipifstatshcinbcastpkts.yfilter = yfilter; } if(value_path == "ipIfStatsOutBcastPkts") { ipifstatsoutbcastpkts.yfilter = yfilter; } if(value_path == "ipIfStatsHCOutBcastPkts") { ipifstatshcoutbcastpkts.yfilter = yfilter; } if(value_path == "ipIfStatsDiscontinuityTime") { ipifstatsdiscontinuitytime.yfilter = yfilter; } if(value_path == "ipIfStatsRefreshRate") { ipifstatsrefreshrate.yfilter = yfilter; } } bool IPMIB::IpIfStatsTable::IpIfStatsEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipIfStatsIPVersion" || name == "ipIfStatsIfIndex" || name == "ipIfStatsInReceives" || name == "ipIfStatsHCInReceives" || name == "ipIfStatsInOctets" || name == "ipIfStatsHCInOctets" || name == "ipIfStatsInHdrErrors" || name == "ipIfStatsInNoRoutes" || name == "ipIfStatsInAddrErrors" || name == "ipIfStatsInUnknownProtos" || name == "ipIfStatsInTruncatedPkts" || name == "ipIfStatsInForwDatagrams" || name == "ipIfStatsHCInForwDatagrams" || name == "ipIfStatsReasmReqds" || name == "ipIfStatsReasmOKs" || name == "ipIfStatsReasmFails" || name == "ipIfStatsInDiscards" || name == "ipIfStatsInDelivers" || name == "ipIfStatsHCInDelivers" || name == "ipIfStatsOutRequests" || name == "ipIfStatsHCOutRequests" || name == "ipIfStatsOutForwDatagrams" || name == "ipIfStatsHCOutForwDatagrams" || name == "ipIfStatsOutDiscards" || name == "ipIfStatsOutFragReqds" || name == "ipIfStatsOutFragOKs" || name == "ipIfStatsOutFragFails" || name == "ipIfStatsOutFragCreates" || name == "ipIfStatsOutTransmits" || name == "ipIfStatsHCOutTransmits" || name == "ipIfStatsOutOctets" || name == "ipIfStatsHCOutOctets" || name == "ipIfStatsInMcastPkts" || name == "ipIfStatsHCInMcastPkts" || name == "ipIfStatsInMcastOctets" || name == "ipIfStatsHCInMcastOctets" || name == "ipIfStatsOutMcastPkts" || name == "ipIfStatsHCOutMcastPkts" || name == "ipIfStatsOutMcastOctets" || name == "ipIfStatsHCOutMcastOctets" || name == "ipIfStatsInBcastPkts" || name == "ipIfStatsHCInBcastPkts" || name == "ipIfStatsOutBcastPkts" || name == "ipIfStatsHCOutBcastPkts" || name == "ipIfStatsDiscontinuityTime" || name == "ipIfStatsRefreshRate") return true; return false; } IPMIB::IpAddressPrefixTable::IpAddressPrefixTable() : ipaddressprefixentry(this, {"ipaddressprefixifindex", "ipaddressprefixtype", "ipaddressprefixprefix", "ipaddressprefixlength"}) { yang_name = "ipAddressPrefixTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpAddressPrefixTable::~IpAddressPrefixTable() { } bool IPMIB::IpAddressPrefixTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipaddressprefixentry.len(); index++) { if(ipaddressprefixentry[index]->has_data()) return true; } return false; } bool IPMIB::IpAddressPrefixTable::has_operation() const { for (std::size_t index=0; index<ipaddressprefixentry.len(); index++) { if(ipaddressprefixentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IpAddressPrefixTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpAddressPrefixTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipAddressPrefixTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpAddressPrefixTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpAddressPrefixTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipAddressPrefixEntry") { auto ent_ = std::make_shared<IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry>(); ent_->parent = this; ipaddressprefixentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IpAddressPrefixTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipaddressprefixentry.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 IPMIB::IpAddressPrefixTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IpAddressPrefixTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IpAddressPrefixTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipAddressPrefixEntry") return true; return false; } IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::IpAddressPrefixEntry() : ipaddressprefixifindex{YType::int32, "ipAddressPrefixIfIndex"}, ipaddressprefixtype{YType::enumeration, "ipAddressPrefixType"}, ipaddressprefixprefix{YType::str, "ipAddressPrefixPrefix"}, ipaddressprefixlength{YType::uint32, "ipAddressPrefixLength"}, ipaddressprefixorigin{YType::enumeration, "ipAddressPrefixOrigin"}, ipaddressprefixonlinkflag{YType::boolean, "ipAddressPrefixOnLinkFlag"}, ipaddressprefixautonomousflag{YType::boolean, "ipAddressPrefixAutonomousFlag"}, ipaddressprefixadvpreferredlifetime{YType::uint32, "ipAddressPrefixAdvPreferredLifetime"}, ipaddressprefixadvvalidlifetime{YType::uint32, "ipAddressPrefixAdvValidLifetime"} { yang_name = "ipAddressPrefixEntry"; yang_parent_name = "ipAddressPrefixTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::~IpAddressPrefixEntry() { } bool IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::has_data() const { if (is_presence_container) return true; return ipaddressprefixifindex.is_set || ipaddressprefixtype.is_set || ipaddressprefixprefix.is_set || ipaddressprefixlength.is_set || ipaddressprefixorigin.is_set || ipaddressprefixonlinkflag.is_set || ipaddressprefixautonomousflag.is_set || ipaddressprefixadvpreferredlifetime.is_set || ipaddressprefixadvvalidlifetime.is_set; } bool IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipaddressprefixifindex.yfilter) || ydk::is_set(ipaddressprefixtype.yfilter) || ydk::is_set(ipaddressprefixprefix.yfilter) || ydk::is_set(ipaddressprefixlength.yfilter) || ydk::is_set(ipaddressprefixorigin.yfilter) || ydk::is_set(ipaddressprefixonlinkflag.yfilter) || ydk::is_set(ipaddressprefixautonomousflag.yfilter) || ydk::is_set(ipaddressprefixadvpreferredlifetime.yfilter) || ydk::is_set(ipaddressprefixadvvalidlifetime.yfilter); } std::string IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipAddressPrefixTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipAddressPrefixEntry"; ADD_KEY_TOKEN(ipaddressprefixifindex, "ipAddressPrefixIfIndex"); ADD_KEY_TOKEN(ipaddressprefixtype, "ipAddressPrefixType"); ADD_KEY_TOKEN(ipaddressprefixprefix, "ipAddressPrefixPrefix"); ADD_KEY_TOKEN(ipaddressprefixlength, "ipAddressPrefixLength"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipaddressprefixifindex.is_set || is_set(ipaddressprefixifindex.yfilter)) leaf_name_data.push_back(ipaddressprefixifindex.get_name_leafdata()); if (ipaddressprefixtype.is_set || is_set(ipaddressprefixtype.yfilter)) leaf_name_data.push_back(ipaddressprefixtype.get_name_leafdata()); if (ipaddressprefixprefix.is_set || is_set(ipaddressprefixprefix.yfilter)) leaf_name_data.push_back(ipaddressprefixprefix.get_name_leafdata()); if (ipaddressprefixlength.is_set || is_set(ipaddressprefixlength.yfilter)) leaf_name_data.push_back(ipaddressprefixlength.get_name_leafdata()); if (ipaddressprefixorigin.is_set || is_set(ipaddressprefixorigin.yfilter)) leaf_name_data.push_back(ipaddressprefixorigin.get_name_leafdata()); if (ipaddressprefixonlinkflag.is_set || is_set(ipaddressprefixonlinkflag.yfilter)) leaf_name_data.push_back(ipaddressprefixonlinkflag.get_name_leafdata()); if (ipaddressprefixautonomousflag.is_set || is_set(ipaddressprefixautonomousflag.yfilter)) leaf_name_data.push_back(ipaddressprefixautonomousflag.get_name_leafdata()); if (ipaddressprefixadvpreferredlifetime.is_set || is_set(ipaddressprefixadvpreferredlifetime.yfilter)) leaf_name_data.push_back(ipaddressprefixadvpreferredlifetime.get_name_leafdata()); if (ipaddressprefixadvvalidlifetime.is_set || is_set(ipaddressprefixadvvalidlifetime.yfilter)) leaf_name_data.push_back(ipaddressprefixadvvalidlifetime.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::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>> IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::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 == "ipAddressPrefixIfIndex") { ipaddressprefixifindex = value; ipaddressprefixifindex.value_namespace = name_space; ipaddressprefixifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressPrefixType") { ipaddressprefixtype = value; ipaddressprefixtype.value_namespace = name_space; ipaddressprefixtype.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressPrefixPrefix") { ipaddressprefixprefix = value; ipaddressprefixprefix.value_namespace = name_space; ipaddressprefixprefix.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressPrefixLength") { ipaddressprefixlength = value; ipaddressprefixlength.value_namespace = name_space; ipaddressprefixlength.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressPrefixOrigin") { ipaddressprefixorigin = value; ipaddressprefixorigin.value_namespace = name_space; ipaddressprefixorigin.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressPrefixOnLinkFlag") { ipaddressprefixonlinkflag = value; ipaddressprefixonlinkflag.value_namespace = name_space; ipaddressprefixonlinkflag.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressPrefixAutonomousFlag") { ipaddressprefixautonomousflag = value; ipaddressprefixautonomousflag.value_namespace = name_space; ipaddressprefixautonomousflag.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressPrefixAdvPreferredLifetime") { ipaddressprefixadvpreferredlifetime = value; ipaddressprefixadvpreferredlifetime.value_namespace = name_space; ipaddressprefixadvpreferredlifetime.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressPrefixAdvValidLifetime") { ipaddressprefixadvvalidlifetime = value; ipaddressprefixadvvalidlifetime.value_namespace = name_space; ipaddressprefixadvvalidlifetime.value_namespace_prefix = name_space_prefix; } } void IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipAddressPrefixIfIndex") { ipaddressprefixifindex.yfilter = yfilter; } if(value_path == "ipAddressPrefixType") { ipaddressprefixtype.yfilter = yfilter; } if(value_path == "ipAddressPrefixPrefix") { ipaddressprefixprefix.yfilter = yfilter; } if(value_path == "ipAddressPrefixLength") { ipaddressprefixlength.yfilter = yfilter; } if(value_path == "ipAddressPrefixOrigin") { ipaddressprefixorigin.yfilter = yfilter; } if(value_path == "ipAddressPrefixOnLinkFlag") { ipaddressprefixonlinkflag.yfilter = yfilter; } if(value_path == "ipAddressPrefixAutonomousFlag") { ipaddressprefixautonomousflag.yfilter = yfilter; } if(value_path == "ipAddressPrefixAdvPreferredLifetime") { ipaddressprefixadvpreferredlifetime.yfilter = yfilter; } if(value_path == "ipAddressPrefixAdvValidLifetime") { ipaddressprefixadvvalidlifetime.yfilter = yfilter; } } bool IPMIB::IpAddressPrefixTable::IpAddressPrefixEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipAddressPrefixIfIndex" || name == "ipAddressPrefixType" || name == "ipAddressPrefixPrefix" || name == "ipAddressPrefixLength" || name == "ipAddressPrefixOrigin" || name == "ipAddressPrefixOnLinkFlag" || name == "ipAddressPrefixAutonomousFlag" || name == "ipAddressPrefixAdvPreferredLifetime" || name == "ipAddressPrefixAdvValidLifetime") return true; return false; } IPMIB::IpAddressTable::IpAddressTable() : ipaddressentry(this, {"ipaddressaddrtype", "ipaddressaddr"}) { yang_name = "ipAddressTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpAddressTable::~IpAddressTable() { } bool IPMIB::IpAddressTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipaddressentry.len(); index++) { if(ipaddressentry[index]->has_data()) return true; } return false; } bool IPMIB::IpAddressTable::has_operation() const { for (std::size_t index=0; index<ipaddressentry.len(); index++) { if(ipaddressentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IpAddressTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpAddressTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipAddressTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpAddressTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpAddressTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipAddressEntry") { auto ent_ = std::make_shared<IPMIB::IpAddressTable::IpAddressEntry>(); ent_->parent = this; ipaddressentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IpAddressTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipaddressentry.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 IPMIB::IpAddressTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IpAddressTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IpAddressTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipAddressEntry") return true; return false; } IPMIB::IpAddressTable::IpAddressEntry::IpAddressEntry() : ipaddressaddrtype{YType::enumeration, "ipAddressAddrType"}, ipaddressaddr{YType::str, "ipAddressAddr"}, ipaddressifindex{YType::int32, "ipAddressIfIndex"}, ipaddresstype{YType::enumeration, "ipAddressType"}, ipaddressprefix{YType::str, "ipAddressPrefix"}, ipaddressorigin{YType::enumeration, "ipAddressOrigin"}, ipaddressstatus{YType::enumeration, "ipAddressStatus"}, ipaddresscreated{YType::uint32, "ipAddressCreated"}, ipaddresslastchanged{YType::uint32, "ipAddressLastChanged"}, ipaddressrowstatus{YType::enumeration, "ipAddressRowStatus"}, ipaddressstoragetype{YType::enumeration, "ipAddressStorageType"} { yang_name = "ipAddressEntry"; yang_parent_name = "ipAddressTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpAddressTable::IpAddressEntry::~IpAddressEntry() { } bool IPMIB::IpAddressTable::IpAddressEntry::has_data() const { if (is_presence_container) return true; return ipaddressaddrtype.is_set || ipaddressaddr.is_set || ipaddressifindex.is_set || ipaddresstype.is_set || ipaddressprefix.is_set || ipaddressorigin.is_set || ipaddressstatus.is_set || ipaddresscreated.is_set || ipaddresslastchanged.is_set || ipaddressrowstatus.is_set || ipaddressstoragetype.is_set; } bool IPMIB::IpAddressTable::IpAddressEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipaddressaddrtype.yfilter) || ydk::is_set(ipaddressaddr.yfilter) || ydk::is_set(ipaddressifindex.yfilter) || ydk::is_set(ipaddresstype.yfilter) || ydk::is_set(ipaddressprefix.yfilter) || ydk::is_set(ipaddressorigin.yfilter) || ydk::is_set(ipaddressstatus.yfilter) || ydk::is_set(ipaddresscreated.yfilter) || ydk::is_set(ipaddresslastchanged.yfilter) || ydk::is_set(ipaddressrowstatus.yfilter) || ydk::is_set(ipaddressstoragetype.yfilter); } std::string IPMIB::IpAddressTable::IpAddressEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipAddressTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpAddressTable::IpAddressEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipAddressEntry"; ADD_KEY_TOKEN(ipaddressaddrtype, "ipAddressAddrType"); ADD_KEY_TOKEN(ipaddressaddr, "ipAddressAddr"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpAddressTable::IpAddressEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipaddressaddrtype.is_set || is_set(ipaddressaddrtype.yfilter)) leaf_name_data.push_back(ipaddressaddrtype.get_name_leafdata()); if (ipaddressaddr.is_set || is_set(ipaddressaddr.yfilter)) leaf_name_data.push_back(ipaddressaddr.get_name_leafdata()); if (ipaddressifindex.is_set || is_set(ipaddressifindex.yfilter)) leaf_name_data.push_back(ipaddressifindex.get_name_leafdata()); if (ipaddresstype.is_set || is_set(ipaddresstype.yfilter)) leaf_name_data.push_back(ipaddresstype.get_name_leafdata()); if (ipaddressprefix.is_set || is_set(ipaddressprefix.yfilter)) leaf_name_data.push_back(ipaddressprefix.get_name_leafdata()); if (ipaddressorigin.is_set || is_set(ipaddressorigin.yfilter)) leaf_name_data.push_back(ipaddressorigin.get_name_leafdata()); if (ipaddressstatus.is_set || is_set(ipaddressstatus.yfilter)) leaf_name_data.push_back(ipaddressstatus.get_name_leafdata()); if (ipaddresscreated.is_set || is_set(ipaddresscreated.yfilter)) leaf_name_data.push_back(ipaddresscreated.get_name_leafdata()); if (ipaddresslastchanged.is_set || is_set(ipaddresslastchanged.yfilter)) leaf_name_data.push_back(ipaddresslastchanged.get_name_leafdata()); if (ipaddressrowstatus.is_set || is_set(ipaddressrowstatus.yfilter)) leaf_name_data.push_back(ipaddressrowstatus.get_name_leafdata()); if (ipaddressstoragetype.is_set || is_set(ipaddressstoragetype.yfilter)) leaf_name_data.push_back(ipaddressstoragetype.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpAddressTable::IpAddressEntry::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>> IPMIB::IpAddressTable::IpAddressEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IpAddressTable::IpAddressEntry::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 == "ipAddressAddrType") { ipaddressaddrtype = value; ipaddressaddrtype.value_namespace = name_space; ipaddressaddrtype.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressAddr") { ipaddressaddr = value; ipaddressaddr.value_namespace = name_space; ipaddressaddr.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressIfIndex") { ipaddressifindex = value; ipaddressifindex.value_namespace = name_space; ipaddressifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressType") { ipaddresstype = value; ipaddresstype.value_namespace = name_space; ipaddresstype.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressPrefix") { ipaddressprefix = value; ipaddressprefix.value_namespace = name_space; ipaddressprefix.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressOrigin") { ipaddressorigin = value; ipaddressorigin.value_namespace = name_space; ipaddressorigin.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressStatus") { ipaddressstatus = value; ipaddressstatus.value_namespace = name_space; ipaddressstatus.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressCreated") { ipaddresscreated = value; ipaddresscreated.value_namespace = name_space; ipaddresscreated.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressLastChanged") { ipaddresslastchanged = value; ipaddresslastchanged.value_namespace = name_space; ipaddresslastchanged.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressRowStatus") { ipaddressrowstatus = value; ipaddressrowstatus.value_namespace = name_space; ipaddressrowstatus.value_namespace_prefix = name_space_prefix; } if(value_path == "ipAddressStorageType") { ipaddressstoragetype = value; ipaddressstoragetype.value_namespace = name_space; ipaddressstoragetype.value_namespace_prefix = name_space_prefix; } } void IPMIB::IpAddressTable::IpAddressEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipAddressAddrType") { ipaddressaddrtype.yfilter = yfilter; } if(value_path == "ipAddressAddr") { ipaddressaddr.yfilter = yfilter; } if(value_path == "ipAddressIfIndex") { ipaddressifindex.yfilter = yfilter; } if(value_path == "ipAddressType") { ipaddresstype.yfilter = yfilter; } if(value_path == "ipAddressPrefix") { ipaddressprefix.yfilter = yfilter; } if(value_path == "ipAddressOrigin") { ipaddressorigin.yfilter = yfilter; } if(value_path == "ipAddressStatus") { ipaddressstatus.yfilter = yfilter; } if(value_path == "ipAddressCreated") { ipaddresscreated.yfilter = yfilter; } if(value_path == "ipAddressLastChanged") { ipaddresslastchanged.yfilter = yfilter; } if(value_path == "ipAddressRowStatus") { ipaddressrowstatus.yfilter = yfilter; } if(value_path == "ipAddressStorageType") { ipaddressstoragetype.yfilter = yfilter; } } bool IPMIB::IpAddressTable::IpAddressEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipAddressAddrType" || name == "ipAddressAddr" || name == "ipAddressIfIndex" || name == "ipAddressType" || name == "ipAddressPrefix" || name == "ipAddressOrigin" || name == "ipAddressStatus" || name == "ipAddressCreated" || name == "ipAddressLastChanged" || name == "ipAddressRowStatus" || name == "ipAddressStorageType") return true; return false; } IPMIB::IpNetToPhysicalTable::IpNetToPhysicalTable() : ipnettophysicalentry(this, {"ipnettophysicalifindex", "ipnettophysicalnetaddresstype", "ipnettophysicalnetaddress"}) { yang_name = "ipNetToPhysicalTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpNetToPhysicalTable::~IpNetToPhysicalTable() { } bool IPMIB::IpNetToPhysicalTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipnettophysicalentry.len(); index++) { if(ipnettophysicalentry[index]->has_data()) return true; } return false; } bool IPMIB::IpNetToPhysicalTable::has_operation() const { for (std::size_t index=0; index<ipnettophysicalentry.len(); index++) { if(ipnettophysicalentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IpNetToPhysicalTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpNetToPhysicalTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipNetToPhysicalTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpNetToPhysicalTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpNetToPhysicalTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipNetToPhysicalEntry") { auto ent_ = std::make_shared<IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry>(); ent_->parent = this; ipnettophysicalentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IpNetToPhysicalTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipnettophysicalentry.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 IPMIB::IpNetToPhysicalTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IpNetToPhysicalTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IpNetToPhysicalTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipNetToPhysicalEntry") return true; return false; } IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalEntry() : ipnettophysicalifindex{YType::int32, "ipNetToPhysicalIfIndex"}, ipnettophysicalnetaddresstype{YType::enumeration, "ipNetToPhysicalNetAddressType"}, ipnettophysicalnetaddress{YType::str, "ipNetToPhysicalNetAddress"}, ipnettophysicalphysaddress{YType::str, "ipNetToPhysicalPhysAddress"}, ipnettophysicallastupdated{YType::uint32, "ipNetToPhysicalLastUpdated"}, ipnettophysicaltype{YType::enumeration, "ipNetToPhysicalType"}, ipnettophysicalstate{YType::enumeration, "ipNetToPhysicalState"}, ipnettophysicalrowstatus{YType::enumeration, "ipNetToPhysicalRowStatus"} { yang_name = "ipNetToPhysicalEntry"; yang_parent_name = "ipNetToPhysicalTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::~IpNetToPhysicalEntry() { } bool IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::has_data() const { if (is_presence_container) return true; return ipnettophysicalifindex.is_set || ipnettophysicalnetaddresstype.is_set || ipnettophysicalnetaddress.is_set || ipnettophysicalphysaddress.is_set || ipnettophysicallastupdated.is_set || ipnettophysicaltype.is_set || ipnettophysicalstate.is_set || ipnettophysicalrowstatus.is_set; } bool IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipnettophysicalifindex.yfilter) || ydk::is_set(ipnettophysicalnetaddresstype.yfilter) || ydk::is_set(ipnettophysicalnetaddress.yfilter) || ydk::is_set(ipnettophysicalphysaddress.yfilter) || ydk::is_set(ipnettophysicallastupdated.yfilter) || ydk::is_set(ipnettophysicaltype.yfilter) || ydk::is_set(ipnettophysicalstate.yfilter) || ydk::is_set(ipnettophysicalrowstatus.yfilter); } std::string IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipNetToPhysicalTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipNetToPhysicalEntry"; ADD_KEY_TOKEN(ipnettophysicalifindex, "ipNetToPhysicalIfIndex"); ADD_KEY_TOKEN(ipnettophysicalnetaddresstype, "ipNetToPhysicalNetAddressType"); ADD_KEY_TOKEN(ipnettophysicalnetaddress, "ipNetToPhysicalNetAddress"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipnettophysicalifindex.is_set || is_set(ipnettophysicalifindex.yfilter)) leaf_name_data.push_back(ipnettophysicalifindex.get_name_leafdata()); if (ipnettophysicalnetaddresstype.is_set || is_set(ipnettophysicalnetaddresstype.yfilter)) leaf_name_data.push_back(ipnettophysicalnetaddresstype.get_name_leafdata()); if (ipnettophysicalnetaddress.is_set || is_set(ipnettophysicalnetaddress.yfilter)) leaf_name_data.push_back(ipnettophysicalnetaddress.get_name_leafdata()); if (ipnettophysicalphysaddress.is_set || is_set(ipnettophysicalphysaddress.yfilter)) leaf_name_data.push_back(ipnettophysicalphysaddress.get_name_leafdata()); if (ipnettophysicallastupdated.is_set || is_set(ipnettophysicallastupdated.yfilter)) leaf_name_data.push_back(ipnettophysicallastupdated.get_name_leafdata()); if (ipnettophysicaltype.is_set || is_set(ipnettophysicaltype.yfilter)) leaf_name_data.push_back(ipnettophysicaltype.get_name_leafdata()); if (ipnettophysicalstate.is_set || is_set(ipnettophysicalstate.yfilter)) leaf_name_data.push_back(ipnettophysicalstate.get_name_leafdata()); if (ipnettophysicalrowstatus.is_set || is_set(ipnettophysicalrowstatus.yfilter)) leaf_name_data.push_back(ipnettophysicalrowstatus.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::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>> IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::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 == "ipNetToPhysicalIfIndex") { ipnettophysicalifindex = value; ipnettophysicalifindex.value_namespace = name_space; ipnettophysicalifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToPhysicalNetAddressType") { ipnettophysicalnetaddresstype = value; ipnettophysicalnetaddresstype.value_namespace = name_space; ipnettophysicalnetaddresstype.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToPhysicalNetAddress") { ipnettophysicalnetaddress = value; ipnettophysicalnetaddress.value_namespace = name_space; ipnettophysicalnetaddress.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToPhysicalPhysAddress") { ipnettophysicalphysaddress = value; ipnettophysicalphysaddress.value_namespace = name_space; ipnettophysicalphysaddress.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToPhysicalLastUpdated") { ipnettophysicallastupdated = value; ipnettophysicallastupdated.value_namespace = name_space; ipnettophysicallastupdated.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToPhysicalType") { ipnettophysicaltype = value; ipnettophysicaltype.value_namespace = name_space; ipnettophysicaltype.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToPhysicalState") { ipnettophysicalstate = value; ipnettophysicalstate.value_namespace = name_space; ipnettophysicalstate.value_namespace_prefix = name_space_prefix; } if(value_path == "ipNetToPhysicalRowStatus") { ipnettophysicalrowstatus = value; ipnettophysicalrowstatus.value_namespace = name_space; ipnettophysicalrowstatus.value_namespace_prefix = name_space_prefix; } } void IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipNetToPhysicalIfIndex") { ipnettophysicalifindex.yfilter = yfilter; } if(value_path == "ipNetToPhysicalNetAddressType") { ipnettophysicalnetaddresstype.yfilter = yfilter; } if(value_path == "ipNetToPhysicalNetAddress") { ipnettophysicalnetaddress.yfilter = yfilter; } if(value_path == "ipNetToPhysicalPhysAddress") { ipnettophysicalphysaddress.yfilter = yfilter; } if(value_path == "ipNetToPhysicalLastUpdated") { ipnettophysicallastupdated.yfilter = yfilter; } if(value_path == "ipNetToPhysicalType") { ipnettophysicaltype.yfilter = yfilter; } if(value_path == "ipNetToPhysicalState") { ipnettophysicalstate.yfilter = yfilter; } if(value_path == "ipNetToPhysicalRowStatus") { ipnettophysicalrowstatus.yfilter = yfilter; } } bool IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipNetToPhysicalIfIndex" || name == "ipNetToPhysicalNetAddressType" || name == "ipNetToPhysicalNetAddress" || name == "ipNetToPhysicalPhysAddress" || name == "ipNetToPhysicalLastUpdated" || name == "ipNetToPhysicalType" || name == "ipNetToPhysicalState" || name == "ipNetToPhysicalRowStatus") return true; return false; } IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexTable() : ipv6scopezoneindexentry(this, {"ipv6scopezoneindexifindex"}) { yang_name = "ipv6ScopeZoneIndexTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Ipv6ScopeZoneIndexTable::~Ipv6ScopeZoneIndexTable() { } bool IPMIB::Ipv6ScopeZoneIndexTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipv6scopezoneindexentry.len(); index++) { if(ipv6scopezoneindexentry[index]->has_data()) return true; } return false; } bool IPMIB::Ipv6ScopeZoneIndexTable::has_operation() const { for (std::size_t index=0; index<ipv6scopezoneindexentry.len(); index++) { if(ipv6scopezoneindexentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::Ipv6ScopeZoneIndexTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Ipv6ScopeZoneIndexTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv6ScopeZoneIndexTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Ipv6ScopeZoneIndexTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Ipv6ScopeZoneIndexTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipv6ScopeZoneIndexEntry") { auto ent_ = std::make_shared<IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry>(); ent_->parent = this; ipv6scopezoneindexentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::Ipv6ScopeZoneIndexTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipv6scopezoneindexentry.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 IPMIB::Ipv6ScopeZoneIndexTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::Ipv6ScopeZoneIndexTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::Ipv6ScopeZoneIndexTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6ScopeZoneIndexEntry") return true; return false; } IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::Ipv6ScopeZoneIndexEntry() : ipv6scopezoneindexifindex{YType::int32, "ipv6ScopeZoneIndexIfIndex"}, ipv6scopezoneindexlinklocal{YType::uint32, "ipv6ScopeZoneIndexLinkLocal"}, ipv6scopezoneindex3{YType::uint32, "ipv6ScopeZoneIndex3"}, ipv6scopezoneindexadminlocal{YType::uint32, "ipv6ScopeZoneIndexAdminLocal"}, ipv6scopezoneindexsitelocal{YType::uint32, "ipv6ScopeZoneIndexSiteLocal"}, ipv6scopezoneindex6{YType::uint32, "ipv6ScopeZoneIndex6"}, ipv6scopezoneindex7{YType::uint32, "ipv6ScopeZoneIndex7"}, ipv6scopezoneindexorganizationlocal{YType::uint32, "ipv6ScopeZoneIndexOrganizationLocal"}, ipv6scopezoneindex9{YType::uint32, "ipv6ScopeZoneIndex9"}, ipv6scopezoneindexa{YType::uint32, "ipv6ScopeZoneIndexA"}, ipv6scopezoneindexb{YType::uint32, "ipv6ScopeZoneIndexB"}, ipv6scopezoneindexc{YType::uint32, "ipv6ScopeZoneIndexC"}, ipv6scopezoneindexd{YType::uint32, "ipv6ScopeZoneIndexD"} { yang_name = "ipv6ScopeZoneIndexEntry"; yang_parent_name = "ipv6ScopeZoneIndexTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::~Ipv6ScopeZoneIndexEntry() { } bool IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::has_data() const { if (is_presence_container) return true; return ipv6scopezoneindexifindex.is_set || ipv6scopezoneindexlinklocal.is_set || ipv6scopezoneindex3.is_set || ipv6scopezoneindexadminlocal.is_set || ipv6scopezoneindexsitelocal.is_set || ipv6scopezoneindex6.is_set || ipv6scopezoneindex7.is_set || ipv6scopezoneindexorganizationlocal.is_set || ipv6scopezoneindex9.is_set || ipv6scopezoneindexa.is_set || ipv6scopezoneindexb.is_set || ipv6scopezoneindexc.is_set || ipv6scopezoneindexd.is_set; } bool IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv6scopezoneindexifindex.yfilter) || ydk::is_set(ipv6scopezoneindexlinklocal.yfilter) || ydk::is_set(ipv6scopezoneindex3.yfilter) || ydk::is_set(ipv6scopezoneindexadminlocal.yfilter) || ydk::is_set(ipv6scopezoneindexsitelocal.yfilter) || ydk::is_set(ipv6scopezoneindex6.yfilter) || ydk::is_set(ipv6scopezoneindex7.yfilter) || ydk::is_set(ipv6scopezoneindexorganizationlocal.yfilter) || ydk::is_set(ipv6scopezoneindex9.yfilter) || ydk::is_set(ipv6scopezoneindexa.yfilter) || ydk::is_set(ipv6scopezoneindexb.yfilter) || ydk::is_set(ipv6scopezoneindexc.yfilter) || ydk::is_set(ipv6scopezoneindexd.yfilter); } std::string IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipv6ScopeZoneIndexTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv6ScopeZoneIndexEntry"; ADD_KEY_TOKEN(ipv6scopezoneindexifindex, "ipv6ScopeZoneIndexIfIndex"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv6scopezoneindexifindex.is_set || is_set(ipv6scopezoneindexifindex.yfilter)) leaf_name_data.push_back(ipv6scopezoneindexifindex.get_name_leafdata()); if (ipv6scopezoneindexlinklocal.is_set || is_set(ipv6scopezoneindexlinklocal.yfilter)) leaf_name_data.push_back(ipv6scopezoneindexlinklocal.get_name_leafdata()); if (ipv6scopezoneindex3.is_set || is_set(ipv6scopezoneindex3.yfilter)) leaf_name_data.push_back(ipv6scopezoneindex3.get_name_leafdata()); if (ipv6scopezoneindexadminlocal.is_set || is_set(ipv6scopezoneindexadminlocal.yfilter)) leaf_name_data.push_back(ipv6scopezoneindexadminlocal.get_name_leafdata()); if (ipv6scopezoneindexsitelocal.is_set || is_set(ipv6scopezoneindexsitelocal.yfilter)) leaf_name_data.push_back(ipv6scopezoneindexsitelocal.get_name_leafdata()); if (ipv6scopezoneindex6.is_set || is_set(ipv6scopezoneindex6.yfilter)) leaf_name_data.push_back(ipv6scopezoneindex6.get_name_leafdata()); if (ipv6scopezoneindex7.is_set || is_set(ipv6scopezoneindex7.yfilter)) leaf_name_data.push_back(ipv6scopezoneindex7.get_name_leafdata()); if (ipv6scopezoneindexorganizationlocal.is_set || is_set(ipv6scopezoneindexorganizationlocal.yfilter)) leaf_name_data.push_back(ipv6scopezoneindexorganizationlocal.get_name_leafdata()); if (ipv6scopezoneindex9.is_set || is_set(ipv6scopezoneindex9.yfilter)) leaf_name_data.push_back(ipv6scopezoneindex9.get_name_leafdata()); if (ipv6scopezoneindexa.is_set || is_set(ipv6scopezoneindexa.yfilter)) leaf_name_data.push_back(ipv6scopezoneindexa.get_name_leafdata()); if (ipv6scopezoneindexb.is_set || is_set(ipv6scopezoneindexb.yfilter)) leaf_name_data.push_back(ipv6scopezoneindexb.get_name_leafdata()); if (ipv6scopezoneindexc.is_set || is_set(ipv6scopezoneindexc.yfilter)) leaf_name_data.push_back(ipv6scopezoneindexc.get_name_leafdata()); if (ipv6scopezoneindexd.is_set || is_set(ipv6scopezoneindexd.yfilter)) leaf_name_data.push_back(ipv6scopezoneindexd.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::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>> IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::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 == "ipv6ScopeZoneIndexIfIndex") { ipv6scopezoneindexifindex = value; ipv6scopezoneindexifindex.value_namespace = name_space; ipv6scopezoneindexifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndexLinkLocal") { ipv6scopezoneindexlinklocal = value; ipv6scopezoneindexlinklocal.value_namespace = name_space; ipv6scopezoneindexlinklocal.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndex3") { ipv6scopezoneindex3 = value; ipv6scopezoneindex3.value_namespace = name_space; ipv6scopezoneindex3.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndexAdminLocal") { ipv6scopezoneindexadminlocal = value; ipv6scopezoneindexadminlocal.value_namespace = name_space; ipv6scopezoneindexadminlocal.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndexSiteLocal") { ipv6scopezoneindexsitelocal = value; ipv6scopezoneindexsitelocal.value_namespace = name_space; ipv6scopezoneindexsitelocal.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndex6") { ipv6scopezoneindex6 = value; ipv6scopezoneindex6.value_namespace = name_space; ipv6scopezoneindex6.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndex7") { ipv6scopezoneindex7 = value; ipv6scopezoneindex7.value_namespace = name_space; ipv6scopezoneindex7.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndexOrganizationLocal") { ipv6scopezoneindexorganizationlocal = value; ipv6scopezoneindexorganizationlocal.value_namespace = name_space; ipv6scopezoneindexorganizationlocal.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndex9") { ipv6scopezoneindex9 = value; ipv6scopezoneindex9.value_namespace = name_space; ipv6scopezoneindex9.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndexA") { ipv6scopezoneindexa = value; ipv6scopezoneindexa.value_namespace = name_space; ipv6scopezoneindexa.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndexB") { ipv6scopezoneindexb = value; ipv6scopezoneindexb.value_namespace = name_space; ipv6scopezoneindexb.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndexC") { ipv6scopezoneindexc = value; ipv6scopezoneindexc.value_namespace = name_space; ipv6scopezoneindexc.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6ScopeZoneIndexD") { ipv6scopezoneindexd = value; ipv6scopezoneindexd.value_namespace = name_space; ipv6scopezoneindexd.value_namespace_prefix = name_space_prefix; } } void IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv6ScopeZoneIndexIfIndex") { ipv6scopezoneindexifindex.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndexLinkLocal") { ipv6scopezoneindexlinklocal.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndex3") { ipv6scopezoneindex3.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndexAdminLocal") { ipv6scopezoneindexadminlocal.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndexSiteLocal") { ipv6scopezoneindexsitelocal.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndex6") { ipv6scopezoneindex6.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndex7") { ipv6scopezoneindex7.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndexOrganizationLocal") { ipv6scopezoneindexorganizationlocal.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndex9") { ipv6scopezoneindex9.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndexA") { ipv6scopezoneindexa.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndexB") { ipv6scopezoneindexb.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndexC") { ipv6scopezoneindexc.yfilter = yfilter; } if(value_path == "ipv6ScopeZoneIndexD") { ipv6scopezoneindexd.yfilter = yfilter; } } bool IPMIB::Ipv6ScopeZoneIndexTable::Ipv6ScopeZoneIndexEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6ScopeZoneIndexIfIndex" || name == "ipv6ScopeZoneIndexLinkLocal" || name == "ipv6ScopeZoneIndex3" || name == "ipv6ScopeZoneIndexAdminLocal" || name == "ipv6ScopeZoneIndexSiteLocal" || name == "ipv6ScopeZoneIndex6" || name == "ipv6ScopeZoneIndex7" || name == "ipv6ScopeZoneIndexOrganizationLocal" || name == "ipv6ScopeZoneIndex9" || name == "ipv6ScopeZoneIndexA" || name == "ipv6ScopeZoneIndexB" || name == "ipv6ScopeZoneIndexC" || name == "ipv6ScopeZoneIndexD") return true; return false; } IPMIB::IpDefaultRouterTable::IpDefaultRouterTable() : ipdefaultrouterentry(this, {"ipdefaultrouteraddresstype", "ipdefaultrouteraddress", "ipdefaultrouterifindex"}) { yang_name = "ipDefaultRouterTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpDefaultRouterTable::~IpDefaultRouterTable() { } bool IPMIB::IpDefaultRouterTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipdefaultrouterentry.len(); index++) { if(ipdefaultrouterentry[index]->has_data()) return true; } return false; } bool IPMIB::IpDefaultRouterTable::has_operation() const { for (std::size_t index=0; index<ipdefaultrouterentry.len(); index++) { if(ipdefaultrouterentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IpDefaultRouterTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpDefaultRouterTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipDefaultRouterTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpDefaultRouterTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpDefaultRouterTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipDefaultRouterEntry") { auto ent_ = std::make_shared<IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry>(); ent_->parent = this; ipdefaultrouterentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IpDefaultRouterTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipdefaultrouterentry.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 IPMIB::IpDefaultRouterTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IpDefaultRouterTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IpDefaultRouterTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipDefaultRouterEntry") return true; return false; } IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::IpDefaultRouterEntry() : ipdefaultrouteraddresstype{YType::enumeration, "ipDefaultRouterAddressType"}, ipdefaultrouteraddress{YType::str, "ipDefaultRouterAddress"}, ipdefaultrouterifindex{YType::int32, "ipDefaultRouterIfIndex"}, ipdefaultrouterlifetime{YType::uint32, "ipDefaultRouterLifetime"}, ipdefaultrouterpreference{YType::enumeration, "ipDefaultRouterPreference"} { yang_name = "ipDefaultRouterEntry"; yang_parent_name = "ipDefaultRouterTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::~IpDefaultRouterEntry() { } bool IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::has_data() const { if (is_presence_container) return true; return ipdefaultrouteraddresstype.is_set || ipdefaultrouteraddress.is_set || ipdefaultrouterifindex.is_set || ipdefaultrouterlifetime.is_set || ipdefaultrouterpreference.is_set; } bool IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipdefaultrouteraddresstype.yfilter) || ydk::is_set(ipdefaultrouteraddress.yfilter) || ydk::is_set(ipdefaultrouterifindex.yfilter) || ydk::is_set(ipdefaultrouterlifetime.yfilter) || ydk::is_set(ipdefaultrouterpreference.yfilter); } std::string IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipDefaultRouterTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipDefaultRouterEntry"; ADD_KEY_TOKEN(ipdefaultrouteraddresstype, "ipDefaultRouterAddressType"); ADD_KEY_TOKEN(ipdefaultrouteraddress, "ipDefaultRouterAddress"); ADD_KEY_TOKEN(ipdefaultrouterifindex, "ipDefaultRouterIfIndex"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipdefaultrouteraddresstype.is_set || is_set(ipdefaultrouteraddresstype.yfilter)) leaf_name_data.push_back(ipdefaultrouteraddresstype.get_name_leafdata()); if (ipdefaultrouteraddress.is_set || is_set(ipdefaultrouteraddress.yfilter)) leaf_name_data.push_back(ipdefaultrouteraddress.get_name_leafdata()); if (ipdefaultrouterifindex.is_set || is_set(ipdefaultrouterifindex.yfilter)) leaf_name_data.push_back(ipdefaultrouterifindex.get_name_leafdata()); if (ipdefaultrouterlifetime.is_set || is_set(ipdefaultrouterlifetime.yfilter)) leaf_name_data.push_back(ipdefaultrouterlifetime.get_name_leafdata()); if (ipdefaultrouterpreference.is_set || is_set(ipdefaultrouterpreference.yfilter)) leaf_name_data.push_back(ipdefaultrouterpreference.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::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>> IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::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 == "ipDefaultRouterAddressType") { ipdefaultrouteraddresstype = value; ipdefaultrouteraddresstype.value_namespace = name_space; ipdefaultrouteraddresstype.value_namespace_prefix = name_space_prefix; } if(value_path == "ipDefaultRouterAddress") { ipdefaultrouteraddress = value; ipdefaultrouteraddress.value_namespace = name_space; ipdefaultrouteraddress.value_namespace_prefix = name_space_prefix; } if(value_path == "ipDefaultRouterIfIndex") { ipdefaultrouterifindex = value; ipdefaultrouterifindex.value_namespace = name_space; ipdefaultrouterifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipDefaultRouterLifetime") { ipdefaultrouterlifetime = value; ipdefaultrouterlifetime.value_namespace = name_space; ipdefaultrouterlifetime.value_namespace_prefix = name_space_prefix; } if(value_path == "ipDefaultRouterPreference") { ipdefaultrouterpreference = value; ipdefaultrouterpreference.value_namespace = name_space; ipdefaultrouterpreference.value_namespace_prefix = name_space_prefix; } } void IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipDefaultRouterAddressType") { ipdefaultrouteraddresstype.yfilter = yfilter; } if(value_path == "ipDefaultRouterAddress") { ipdefaultrouteraddress.yfilter = yfilter; } if(value_path == "ipDefaultRouterIfIndex") { ipdefaultrouterifindex.yfilter = yfilter; } if(value_path == "ipDefaultRouterLifetime") { ipdefaultrouterlifetime.yfilter = yfilter; } if(value_path == "ipDefaultRouterPreference") { ipdefaultrouterpreference.yfilter = yfilter; } } bool IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipDefaultRouterAddressType" || name == "ipDefaultRouterAddress" || name == "ipDefaultRouterIfIndex" || name == "ipDefaultRouterLifetime" || name == "ipDefaultRouterPreference") return true; return false; } IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertTable() : ipv6routeradvertentry(this, {"ipv6routeradvertifindex"}) { yang_name = "ipv6RouterAdvertTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Ipv6RouterAdvertTable::~Ipv6RouterAdvertTable() { } bool IPMIB::Ipv6RouterAdvertTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<ipv6routeradvertentry.len(); index++) { if(ipv6routeradvertentry[index]->has_data()) return true; } return false; } bool IPMIB::Ipv6RouterAdvertTable::has_operation() const { for (std::size_t index=0; index<ipv6routeradvertentry.len(); index++) { if(ipv6routeradvertentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::Ipv6RouterAdvertTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Ipv6RouterAdvertTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv6RouterAdvertTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Ipv6RouterAdvertTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Ipv6RouterAdvertTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "ipv6RouterAdvertEntry") { auto ent_ = std::make_shared<IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry>(); ent_->parent = this; ipv6routeradvertentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::Ipv6RouterAdvertTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : ipv6routeradvertentry.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 IPMIB::Ipv6RouterAdvertTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::Ipv6RouterAdvertTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::Ipv6RouterAdvertTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6RouterAdvertEntry") return true; return false; } IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::Ipv6RouterAdvertEntry() : ipv6routeradvertifindex{YType::int32, "ipv6RouterAdvertIfIndex"}, ipv6routeradvertsendadverts{YType::boolean, "ipv6RouterAdvertSendAdverts"}, ipv6routeradvertmaxinterval{YType::uint32, "ipv6RouterAdvertMaxInterval"}, ipv6routeradvertmininterval{YType::uint32, "ipv6RouterAdvertMinInterval"}, ipv6routeradvertmanagedflag{YType::boolean, "ipv6RouterAdvertManagedFlag"}, ipv6routeradvertotherconfigflag{YType::boolean, "ipv6RouterAdvertOtherConfigFlag"}, ipv6routeradvertlinkmtu{YType::uint32, "ipv6RouterAdvertLinkMTU"}, ipv6routeradvertreachabletime{YType::uint32, "ipv6RouterAdvertReachableTime"}, ipv6routeradvertretransmittime{YType::uint32, "ipv6RouterAdvertRetransmitTime"}, ipv6routeradvertcurhoplimit{YType::uint32, "ipv6RouterAdvertCurHopLimit"}, ipv6routeradvertdefaultlifetime{YType::uint32, "ipv6RouterAdvertDefaultLifetime"}, ipv6routeradvertrowstatus{YType::enumeration, "ipv6RouterAdvertRowStatus"} { yang_name = "ipv6RouterAdvertEntry"; yang_parent_name = "ipv6RouterAdvertTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::~Ipv6RouterAdvertEntry() { } bool IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::has_data() const { if (is_presence_container) return true; return ipv6routeradvertifindex.is_set || ipv6routeradvertsendadverts.is_set || ipv6routeradvertmaxinterval.is_set || ipv6routeradvertmininterval.is_set || ipv6routeradvertmanagedflag.is_set || ipv6routeradvertotherconfigflag.is_set || ipv6routeradvertlinkmtu.is_set || ipv6routeradvertreachabletime.is_set || ipv6routeradvertretransmittime.is_set || ipv6routeradvertcurhoplimit.is_set || ipv6routeradvertdefaultlifetime.is_set || ipv6routeradvertrowstatus.is_set; } bool IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(ipv6routeradvertifindex.yfilter) || ydk::is_set(ipv6routeradvertsendadverts.yfilter) || ydk::is_set(ipv6routeradvertmaxinterval.yfilter) || ydk::is_set(ipv6routeradvertmininterval.yfilter) || ydk::is_set(ipv6routeradvertmanagedflag.yfilter) || ydk::is_set(ipv6routeradvertotherconfigflag.yfilter) || ydk::is_set(ipv6routeradvertlinkmtu.yfilter) || ydk::is_set(ipv6routeradvertreachabletime.yfilter) || ydk::is_set(ipv6routeradvertretransmittime.yfilter) || ydk::is_set(ipv6routeradvertcurhoplimit.yfilter) || ydk::is_set(ipv6routeradvertdefaultlifetime.yfilter) || ydk::is_set(ipv6routeradvertrowstatus.yfilter); } std::string IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/ipv6RouterAdvertTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ipv6RouterAdvertEntry"; ADD_KEY_TOKEN(ipv6routeradvertifindex, "ipv6RouterAdvertIfIndex"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (ipv6routeradvertifindex.is_set || is_set(ipv6routeradvertifindex.yfilter)) leaf_name_data.push_back(ipv6routeradvertifindex.get_name_leafdata()); if (ipv6routeradvertsendadverts.is_set || is_set(ipv6routeradvertsendadverts.yfilter)) leaf_name_data.push_back(ipv6routeradvertsendadverts.get_name_leafdata()); if (ipv6routeradvertmaxinterval.is_set || is_set(ipv6routeradvertmaxinterval.yfilter)) leaf_name_data.push_back(ipv6routeradvertmaxinterval.get_name_leafdata()); if (ipv6routeradvertmininterval.is_set || is_set(ipv6routeradvertmininterval.yfilter)) leaf_name_data.push_back(ipv6routeradvertmininterval.get_name_leafdata()); if (ipv6routeradvertmanagedflag.is_set || is_set(ipv6routeradvertmanagedflag.yfilter)) leaf_name_data.push_back(ipv6routeradvertmanagedflag.get_name_leafdata()); if (ipv6routeradvertotherconfigflag.is_set || is_set(ipv6routeradvertotherconfigflag.yfilter)) leaf_name_data.push_back(ipv6routeradvertotherconfigflag.get_name_leafdata()); if (ipv6routeradvertlinkmtu.is_set || is_set(ipv6routeradvertlinkmtu.yfilter)) leaf_name_data.push_back(ipv6routeradvertlinkmtu.get_name_leafdata()); if (ipv6routeradvertreachabletime.is_set || is_set(ipv6routeradvertreachabletime.yfilter)) leaf_name_data.push_back(ipv6routeradvertreachabletime.get_name_leafdata()); if (ipv6routeradvertretransmittime.is_set || is_set(ipv6routeradvertretransmittime.yfilter)) leaf_name_data.push_back(ipv6routeradvertretransmittime.get_name_leafdata()); if (ipv6routeradvertcurhoplimit.is_set || is_set(ipv6routeradvertcurhoplimit.yfilter)) leaf_name_data.push_back(ipv6routeradvertcurhoplimit.get_name_leafdata()); if (ipv6routeradvertdefaultlifetime.is_set || is_set(ipv6routeradvertdefaultlifetime.yfilter)) leaf_name_data.push_back(ipv6routeradvertdefaultlifetime.get_name_leafdata()); if (ipv6routeradvertrowstatus.is_set || is_set(ipv6routeradvertrowstatus.yfilter)) leaf_name_data.push_back(ipv6routeradvertrowstatus.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::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>> IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::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 == "ipv6RouterAdvertIfIndex") { ipv6routeradvertifindex = value; ipv6routeradvertifindex.value_namespace = name_space; ipv6routeradvertifindex.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertSendAdverts") { ipv6routeradvertsendadverts = value; ipv6routeradvertsendadverts.value_namespace = name_space; ipv6routeradvertsendadverts.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertMaxInterval") { ipv6routeradvertmaxinterval = value; ipv6routeradvertmaxinterval.value_namespace = name_space; ipv6routeradvertmaxinterval.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertMinInterval") { ipv6routeradvertmininterval = value; ipv6routeradvertmininterval.value_namespace = name_space; ipv6routeradvertmininterval.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertManagedFlag") { ipv6routeradvertmanagedflag = value; ipv6routeradvertmanagedflag.value_namespace = name_space; ipv6routeradvertmanagedflag.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertOtherConfigFlag") { ipv6routeradvertotherconfigflag = value; ipv6routeradvertotherconfigflag.value_namespace = name_space; ipv6routeradvertotherconfigflag.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertLinkMTU") { ipv6routeradvertlinkmtu = value; ipv6routeradvertlinkmtu.value_namespace = name_space; ipv6routeradvertlinkmtu.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertReachableTime") { ipv6routeradvertreachabletime = value; ipv6routeradvertreachabletime.value_namespace = name_space; ipv6routeradvertreachabletime.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertRetransmitTime") { ipv6routeradvertretransmittime = value; ipv6routeradvertretransmittime.value_namespace = name_space; ipv6routeradvertretransmittime.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertCurHopLimit") { ipv6routeradvertcurhoplimit = value; ipv6routeradvertcurhoplimit.value_namespace = name_space; ipv6routeradvertcurhoplimit.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertDefaultLifetime") { ipv6routeradvertdefaultlifetime = value; ipv6routeradvertdefaultlifetime.value_namespace = name_space; ipv6routeradvertdefaultlifetime.value_namespace_prefix = name_space_prefix; } if(value_path == "ipv6RouterAdvertRowStatus") { ipv6routeradvertrowstatus = value; ipv6routeradvertrowstatus.value_namespace = name_space; ipv6routeradvertrowstatus.value_namespace_prefix = name_space_prefix; } } void IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "ipv6RouterAdvertIfIndex") { ipv6routeradvertifindex.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertSendAdverts") { ipv6routeradvertsendadverts.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertMaxInterval") { ipv6routeradvertmaxinterval.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertMinInterval") { ipv6routeradvertmininterval.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertManagedFlag") { ipv6routeradvertmanagedflag.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertOtherConfigFlag") { ipv6routeradvertotherconfigflag.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertLinkMTU") { ipv6routeradvertlinkmtu.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertReachableTime") { ipv6routeradvertreachabletime.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertRetransmitTime") { ipv6routeradvertretransmittime.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertCurHopLimit") { ipv6routeradvertcurhoplimit.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertDefaultLifetime") { ipv6routeradvertdefaultlifetime.yfilter = yfilter; } if(value_path == "ipv6RouterAdvertRowStatus") { ipv6routeradvertrowstatus.yfilter = yfilter; } } bool IPMIB::Ipv6RouterAdvertTable::Ipv6RouterAdvertEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "ipv6RouterAdvertIfIndex" || name == "ipv6RouterAdvertSendAdverts" || name == "ipv6RouterAdvertMaxInterval" || name == "ipv6RouterAdvertMinInterval" || name == "ipv6RouterAdvertManagedFlag" || name == "ipv6RouterAdvertOtherConfigFlag" || name == "ipv6RouterAdvertLinkMTU" || name == "ipv6RouterAdvertReachableTime" || name == "ipv6RouterAdvertRetransmitTime" || name == "ipv6RouterAdvertCurHopLimit" || name == "ipv6RouterAdvertDefaultLifetime" || name == "ipv6RouterAdvertRowStatus") return true; return false; } IPMIB::IcmpStatsTable::IcmpStatsTable() : icmpstatsentry(this, {"icmpstatsipversion"}) { yang_name = "icmpStatsTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IcmpStatsTable::~IcmpStatsTable() { } bool IPMIB::IcmpStatsTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<icmpstatsentry.len(); index++) { if(icmpstatsentry[index]->has_data()) return true; } return false; } bool IPMIB::IcmpStatsTable::has_operation() const { for (std::size_t index=0; index<icmpstatsentry.len(); index++) { if(icmpstatsentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IcmpStatsTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IcmpStatsTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "icmpStatsTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IcmpStatsTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IcmpStatsTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "icmpStatsEntry") { auto ent_ = std::make_shared<IPMIB::IcmpStatsTable::IcmpStatsEntry>(); ent_->parent = this; icmpstatsentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IcmpStatsTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : icmpstatsentry.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 IPMIB::IcmpStatsTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IcmpStatsTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IcmpStatsTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "icmpStatsEntry") return true; return false; } IPMIB::IcmpStatsTable::IcmpStatsEntry::IcmpStatsEntry() : icmpstatsipversion{YType::enumeration, "icmpStatsIPVersion"}, icmpstatsinmsgs{YType::uint32, "icmpStatsInMsgs"}, icmpstatsinerrors{YType::uint32, "icmpStatsInErrors"}, icmpstatsoutmsgs{YType::uint32, "icmpStatsOutMsgs"}, icmpstatsouterrors{YType::uint32, "icmpStatsOutErrors"} { yang_name = "icmpStatsEntry"; yang_parent_name = "icmpStatsTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IcmpStatsTable::IcmpStatsEntry::~IcmpStatsEntry() { } bool IPMIB::IcmpStatsTable::IcmpStatsEntry::has_data() const { if (is_presence_container) return true; return icmpstatsipversion.is_set || icmpstatsinmsgs.is_set || icmpstatsinerrors.is_set || icmpstatsoutmsgs.is_set || icmpstatsouterrors.is_set; } bool IPMIB::IcmpStatsTable::IcmpStatsEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(icmpstatsipversion.yfilter) || ydk::is_set(icmpstatsinmsgs.yfilter) || ydk::is_set(icmpstatsinerrors.yfilter) || ydk::is_set(icmpstatsoutmsgs.yfilter) || ydk::is_set(icmpstatsouterrors.yfilter); } std::string IPMIB::IcmpStatsTable::IcmpStatsEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/icmpStatsTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IcmpStatsTable::IcmpStatsEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "icmpStatsEntry"; ADD_KEY_TOKEN(icmpstatsipversion, "icmpStatsIPVersion"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IcmpStatsTable::IcmpStatsEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (icmpstatsipversion.is_set || is_set(icmpstatsipversion.yfilter)) leaf_name_data.push_back(icmpstatsipversion.get_name_leafdata()); if (icmpstatsinmsgs.is_set || is_set(icmpstatsinmsgs.yfilter)) leaf_name_data.push_back(icmpstatsinmsgs.get_name_leafdata()); if (icmpstatsinerrors.is_set || is_set(icmpstatsinerrors.yfilter)) leaf_name_data.push_back(icmpstatsinerrors.get_name_leafdata()); if (icmpstatsoutmsgs.is_set || is_set(icmpstatsoutmsgs.yfilter)) leaf_name_data.push_back(icmpstatsoutmsgs.get_name_leafdata()); if (icmpstatsouterrors.is_set || is_set(icmpstatsouterrors.yfilter)) leaf_name_data.push_back(icmpstatsouterrors.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IcmpStatsTable::IcmpStatsEntry::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>> IPMIB::IcmpStatsTable::IcmpStatsEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IcmpStatsTable::IcmpStatsEntry::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 == "icmpStatsIPVersion") { icmpstatsipversion = value; icmpstatsipversion.value_namespace = name_space; icmpstatsipversion.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpStatsInMsgs") { icmpstatsinmsgs = value; icmpstatsinmsgs.value_namespace = name_space; icmpstatsinmsgs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpStatsInErrors") { icmpstatsinerrors = value; icmpstatsinerrors.value_namespace = name_space; icmpstatsinerrors.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpStatsOutMsgs") { icmpstatsoutmsgs = value; icmpstatsoutmsgs.value_namespace = name_space; icmpstatsoutmsgs.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpStatsOutErrors") { icmpstatsouterrors = value; icmpstatsouterrors.value_namespace = name_space; icmpstatsouterrors.value_namespace_prefix = name_space_prefix; } } void IPMIB::IcmpStatsTable::IcmpStatsEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "icmpStatsIPVersion") { icmpstatsipversion.yfilter = yfilter; } if(value_path == "icmpStatsInMsgs") { icmpstatsinmsgs.yfilter = yfilter; } if(value_path == "icmpStatsInErrors") { icmpstatsinerrors.yfilter = yfilter; } if(value_path == "icmpStatsOutMsgs") { icmpstatsoutmsgs.yfilter = yfilter; } if(value_path == "icmpStatsOutErrors") { icmpstatsouterrors.yfilter = yfilter; } } bool IPMIB::IcmpStatsTable::IcmpStatsEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "icmpStatsIPVersion" || name == "icmpStatsInMsgs" || name == "icmpStatsInErrors" || name == "icmpStatsOutMsgs" || name == "icmpStatsOutErrors") return true; return false; } IPMIB::IcmpMsgStatsTable::IcmpMsgStatsTable() : icmpmsgstatsentry(this, {"icmpmsgstatsipversion", "icmpmsgstatstype"}) { yang_name = "icmpMsgStatsTable"; yang_parent_name = "IP-MIB"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IcmpMsgStatsTable::~IcmpMsgStatsTable() { } bool IPMIB::IcmpMsgStatsTable::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<icmpmsgstatsentry.len(); index++) { if(icmpmsgstatsentry[index]->has_data()) return true; } return false; } bool IPMIB::IcmpMsgStatsTable::has_operation() const { for (std::size_t index=0; index<icmpmsgstatsentry.len(); index++) { if(icmpmsgstatsentry[index]->has_operation()) return true; } return is_set(yfilter); } std::string IPMIB::IcmpMsgStatsTable::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IcmpMsgStatsTable::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "icmpMsgStatsTable"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IcmpMsgStatsTable::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IcmpMsgStatsTable::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "icmpMsgStatsEntry") { auto ent_ = std::make_shared<IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry>(); ent_->parent = this; icmpmsgstatsentry.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> IPMIB::IcmpMsgStatsTable::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : icmpmsgstatsentry.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 IPMIB::IcmpMsgStatsTable::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void IPMIB::IcmpMsgStatsTable::set_filter(const std::string & value_path, YFilter yfilter) { } bool IPMIB::IcmpMsgStatsTable::has_leaf_or_child_of_name(const std::string & name) const { if(name == "icmpMsgStatsEntry") return true; return false; } IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::IcmpMsgStatsEntry() : icmpmsgstatsipversion{YType::enumeration, "icmpMsgStatsIPVersion"}, icmpmsgstatstype{YType::int32, "icmpMsgStatsType"}, icmpmsgstatsinpkts{YType::uint32, "icmpMsgStatsInPkts"}, icmpmsgstatsoutpkts{YType::uint32, "icmpMsgStatsOutPkts"} { yang_name = "icmpMsgStatsEntry"; yang_parent_name = "icmpMsgStatsTable"; is_top_level_class = false; has_list_ancestor = false; } IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::~IcmpMsgStatsEntry() { } bool IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::has_data() const { if (is_presence_container) return true; return icmpmsgstatsipversion.is_set || icmpmsgstatstype.is_set || icmpmsgstatsinpkts.is_set || icmpmsgstatsoutpkts.is_set; } bool IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::has_operation() const { return is_set(yfilter) || ydk::is_set(icmpmsgstatsipversion.yfilter) || ydk::is_set(icmpmsgstatstype.yfilter) || ydk::is_set(icmpmsgstatsinpkts.yfilter) || ydk::is_set(icmpmsgstatsoutpkts.yfilter); } std::string IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::get_absolute_path() const { std::ostringstream path_buffer; path_buffer << "IP-MIB:IP-MIB/icmpMsgStatsTable/" << get_segment_path(); return path_buffer.str(); } std::string IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "icmpMsgStatsEntry"; ADD_KEY_TOKEN(icmpmsgstatsipversion, "icmpMsgStatsIPVersion"); ADD_KEY_TOKEN(icmpmsgstatstype, "icmpMsgStatsType"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (icmpmsgstatsipversion.is_set || is_set(icmpmsgstatsipversion.yfilter)) leaf_name_data.push_back(icmpmsgstatsipversion.get_name_leafdata()); if (icmpmsgstatstype.is_set || is_set(icmpmsgstatstype.yfilter)) leaf_name_data.push_back(icmpmsgstatstype.get_name_leafdata()); if (icmpmsgstatsinpkts.is_set || is_set(icmpmsgstatsinpkts.yfilter)) leaf_name_data.push_back(icmpmsgstatsinpkts.get_name_leafdata()); if (icmpmsgstatsoutpkts.is_set || is_set(icmpmsgstatsoutpkts.yfilter)) leaf_name_data.push_back(icmpmsgstatsoutpkts.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::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>> IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::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 == "icmpMsgStatsIPVersion") { icmpmsgstatsipversion = value; icmpmsgstatsipversion.value_namespace = name_space; icmpmsgstatsipversion.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpMsgStatsType") { icmpmsgstatstype = value; icmpmsgstatstype.value_namespace = name_space; icmpmsgstatstype.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpMsgStatsInPkts") { icmpmsgstatsinpkts = value; icmpmsgstatsinpkts.value_namespace = name_space; icmpmsgstatsinpkts.value_namespace_prefix = name_space_prefix; } if(value_path == "icmpMsgStatsOutPkts") { icmpmsgstatsoutpkts = value; icmpmsgstatsoutpkts.value_namespace = name_space; icmpmsgstatsoutpkts.value_namespace_prefix = name_space_prefix; } } void IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "icmpMsgStatsIPVersion") { icmpmsgstatsipversion.yfilter = yfilter; } if(value_path == "icmpMsgStatsType") { icmpmsgstatstype.yfilter = yfilter; } if(value_path == "icmpMsgStatsInPkts") { icmpmsgstatsinpkts.yfilter = yfilter; } if(value_path == "icmpMsgStatsOutPkts") { icmpmsgstatsoutpkts.yfilter = yfilter; } } bool IPMIB::IcmpMsgStatsTable::IcmpMsgStatsEntry::has_leaf_or_child_of_name(const std::string & name) const { if(name == "icmpMsgStatsIPVersion" || name == "icmpMsgStatsType" || name == "icmpMsgStatsInPkts" || name == "icmpMsgStatsOutPkts") return true; return false; } const Enum::YLeaf IpAddressPrefixOriginTC::other {1, "other"}; const Enum::YLeaf IpAddressPrefixOriginTC::manual {2, "manual"}; const Enum::YLeaf IpAddressPrefixOriginTC::wellknown {3, "wellknown"}; const Enum::YLeaf IpAddressPrefixOriginTC::dhcp {4, "dhcp"}; const Enum::YLeaf IpAddressPrefixOriginTC::routeradv {5, "routeradv"}; const Enum::YLeaf IpAddressOriginTC::other {1, "other"}; const Enum::YLeaf IpAddressOriginTC::manual {2, "manual"}; const Enum::YLeaf IpAddressOriginTC::dhcp {4, "dhcp"}; const Enum::YLeaf IpAddressOriginTC::linklayer {5, "linklayer"}; const Enum::YLeaf IpAddressOriginTC::random {6, "random"}; const Enum::YLeaf IpAddressStatusTC::preferred {1, "preferred"}; const Enum::YLeaf IpAddressStatusTC::deprecated {2, "deprecated"}; const Enum::YLeaf IpAddressStatusTC::invalid {3, "invalid"}; const Enum::YLeaf IpAddressStatusTC::inaccessible {4, "inaccessible"}; const Enum::YLeaf IpAddressStatusTC::unknown {5, "unknown"}; const Enum::YLeaf IpAddressStatusTC::tentative {6, "tentative"}; const Enum::YLeaf IpAddressStatusTC::duplicate {7, "duplicate"}; const Enum::YLeaf IpAddressStatusTC::optimistic {8, "optimistic"}; const Enum::YLeaf IPMIB::Ip::IpForwarding::forwarding {1, "forwarding"}; const Enum::YLeaf IPMIB::Ip::IpForwarding::notForwarding {2, "notForwarding"}; const Enum::YLeaf IPMIB::Ip::Ipv6IpForwarding::forwarding {1, "forwarding"}; const Enum::YLeaf IPMIB::Ip::Ipv6IpForwarding::notForwarding {2, "notForwarding"}; const Enum::YLeaf IPMIB::IpNetToMediaTable::IpNetToMediaEntry::IpNetToMediaType::other {1, "other"}; const Enum::YLeaf IPMIB::IpNetToMediaTable::IpNetToMediaEntry::IpNetToMediaType::invalid {2, "invalid"}; const Enum::YLeaf IPMIB::IpNetToMediaTable::IpNetToMediaEntry::IpNetToMediaType::dynamic {3, "dynamic"}; const Enum::YLeaf IPMIB::IpNetToMediaTable::IpNetToMediaEntry::IpNetToMediaType::static_ {4, "static"}; const Enum::YLeaf IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::Ipv4InterfaceEnableStatus::up {1, "up"}; const Enum::YLeaf IPMIB::Ipv4InterfaceTable::Ipv4InterfaceEntry::Ipv4InterfaceEnableStatus::down {2, "down"}; const Enum::YLeaf IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::Ipv6InterfaceEnableStatus::up {1, "up"}; const Enum::YLeaf IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::Ipv6InterfaceEnableStatus::down {2, "down"}; const Enum::YLeaf IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::Ipv6InterfaceForwarding::forwarding {1, "forwarding"}; const Enum::YLeaf IPMIB::Ipv6InterfaceTable::Ipv6InterfaceEntry::Ipv6InterfaceForwarding::notForwarding {2, "notForwarding"}; const Enum::YLeaf IPMIB::IpAddressTable::IpAddressEntry::IpAddressType::unicast {1, "unicast"}; const Enum::YLeaf IPMIB::IpAddressTable::IpAddressEntry::IpAddressType::anycast {2, "anycast"}; const Enum::YLeaf IPMIB::IpAddressTable::IpAddressEntry::IpAddressType::broadcast {3, "broadcast"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalType::other {1, "other"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalType::invalid {2, "invalid"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalType::dynamic {3, "dynamic"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalType::static_ {4, "static"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalType::local {5, "local"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalState::reachable {1, "reachable"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalState::stale {2, "stale"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalState::delay {3, "delay"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalState::probe {4, "probe"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalState::invalid {5, "invalid"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalState::unknown {6, "unknown"}; const Enum::YLeaf IPMIB::IpNetToPhysicalTable::IpNetToPhysicalEntry::IpNetToPhysicalState::incomplete {7, "incomplete"}; const Enum::YLeaf IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::IpDefaultRouterPreference::reserved {-2, "reserved"}; const Enum::YLeaf IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::IpDefaultRouterPreference::low {-1, "low"}; const Enum::YLeaf IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::IpDefaultRouterPreference::medium {0, "medium"}; const Enum::YLeaf IPMIB::IpDefaultRouterTable::IpDefaultRouterEntry::IpDefaultRouterPreference::high {1, "high"}; } }
38.681611
1,810
0.734013
CiscoDevNet
cad2c3baaa4ab70e2f9e6384e047468d2bf3a435
1,794
cpp
C++
CXXPRIMER/test.cpp
Clelo4/OS_study
cf12a4721c3c9c338f91c2cdf069ac3b49b60522
[ "MIT" ]
null
null
null
CXXPRIMER/test.cpp
Clelo4/OS_study
cf12a4721c3c9c338f91c2cdf069ac3b49b60522
[ "MIT" ]
null
null
null
CXXPRIMER/test.cpp
Clelo4/OS_study
cf12a4721c3c9c338f91c2cdf069ac3b49b60522
[ "MIT" ]
null
null
null
/** * @file 1.cpp * @author Jack * @mail chengjunjie.jack@gmail.com * @date 2021-12-28 * @version 0.1 * * @copyright Copyright (c) 2021 */ #include <algorithm> #include <cstdio> #include <iostream> #include <string> #include <type_traits> #include <vector> class B; class A { public: A(int a, int b = 1, int c = 1) { printf("a: %d, b: %d\n", a, b); } friend class B; protected: int prot_mem = 1; private: int private_mem = 2; }; class B : private A { public: B(int a) : A(a) {} using A::private_mem; using A::prot_mem; }; void fn(const A &arg){}; void fn() { static int count = -1; ++count; std::cout << "fn count: " << count << std::endl; }; // 64位系统 #include <stdio.h> struct { int x; char y; } s; int main() { int a = 1; int *b = &a; if (std::is_same<decltype(*b), int &>::value) { std::printf("decltype(*b) is same as int&\n"); } if (std::is_same<decltype((a)), int &>::value) { std::printf("decltype((a)) is same as int&\n"); } std::string s = "A"; for (auto &c : s) { if (std::is_same<decltype(c), char &>::value) { std::printf("decltype(c) is same as char&\n"); } } std::vector<int> is; if (std::is_same<decltype(is.begin() - is.end()), std::vector<int>::difference_type>::value) { std::printf( "decltype(is.begin() - is.end()) is same as " "std::vector<int>::difference_type\n"); } int arr1[] = {1, 2, 3, 4}; decltype(std::begin(arr1)) b_ptr; std::vector<int> vi(std::begin(arr1), std::end(arr1)); fn(1); A a1 = {1, 2}; B b1{1}; std::cout << "b1.prot_mem: " << b1.prot_mem << std::endl; std::cout << "b1.private_mem: " << b1.private_mem << std::endl; for (int i = 0; i < 10; ++i) fn(); printf("%d\n", sizeof(s)); // 输出24 return 0; }
20.62069
68
0.554069
Clelo4
cad2cf6ce997ee6f1ed98c20b9f1d3d20c6e4471
11,262
hpp
C++
lib/gfx/include/gfx_draw_helpers.hpp
codewitch-honey-crisis/gfx_demo
90545974ff95d5b0e4f5f5320ac6b05b8172a0ec
[ "MIT" ]
58
2021-05-10T23:25:06.000Z
2022-03-22T00:59:04.000Z
lib/gfx/include/gfx_draw_helpers.hpp
codewitch-honey-crisis/gfx_demo
90545974ff95d5b0e4f5f5320ac6b05b8172a0ec
[ "MIT" ]
3
2021-07-28T16:26:35.000Z
2022-02-18T21:45:09.000Z
lib/gfx/include/gfx_draw_helpers.hpp
codewitch-honey-crisis/gfx_demo
90545974ff95d5b0e4f5f5320ac6b05b8172a0ec
[ "MIT" ]
5
2021-07-16T12:00:48.000Z
2022-02-14T02:04:06.000Z
#ifndef HTCW_GFX_DRAW_HELPERS_HPP #define HTCW_GFX_DRAW_HELPERS_HPP #include "gfx_positioning.hpp" namespace gfx { namespace helpers { template<typename Destination,typename Source,bool HasAlpha> struct blender { static gfx_result point(Destination& destination,point16 pt,Source& source,point16 spt, typename Source::pixel_type pixel) { typename Destination::pixel_type px; // printf("pixel.native_value = %d\r\n",(int)pixel.native_value); gfx_result r=convert_palette(destination,source,pixel,&px); //printf("px.native_value = %d\r\n",(int)px.native_value); if(gfx_result::success!=r) { return r; } return destination.point(pt,px); } }; template<typename Destination,typename Source> struct blender<Destination,Source,true> { static gfx_result point(Destination& destination,point16 pt,Source& source,point16 spt, typename Source::pixel_type pixel) { double alpha = pixel.template channelr<channel_name::A>(); if(0.0==alpha) return gfx_result::success; if(1.0==alpha) return blender<Destination,Source,false>::point(destination,pt,source,spt,pixel); typename Source::pixel_type spx; gfx_result r=source.point(spt,&spx); if(gfx_result::success!=r) { return r; } rgb_pixel<HTCW_MAX_WORD> bg; r=convert_palette_to(source,spx,&bg); if(gfx_result::success!=r) { return r; } rgb_pixel<HTCW_MAX_WORD> fg; r=convert_palette_to(source,pixel,&fg); if(gfx_result::success!=r) { return r; } r=fg.blend(bg,alpha,&fg); if(gfx_result::success!=r) { return r; } typename Destination::pixel_type px; r=convert_palette_from(destination,fg,&px); if(gfx_result::success!=r) { return r; } return destination.point(pt,px); } }; template<typename Destination,bool Batch,bool Async> struct batcher { inline static gfx_result begin_batch(Destination& destination,const rect16& bounds,bool async) { return gfx_result::success; } inline static gfx_result write_batch(Destination& destination,point16 location,typename Destination::pixel_type pixel,bool async) { return destination.point(location,pixel); } inline static gfx_result commit_batch(Destination& destination,bool async) { return gfx_result::success; } }; template<typename Destination> struct batcher<Destination,false,true> { inline static gfx_result begin_batch(Destination& destination,const rect16& bounds,bool async) { return gfx_result::success; } inline static gfx_result write_batch(Destination& destination,point16 location,typename Destination::pixel_type pixel,bool async) { if(async) { return destination.point_async(location,pixel); } else { return destination.point(location,pixel); } } inline static gfx_result commit_batch(Destination& destination,bool async) { return gfx_result::success; } }; template<typename Destination,bool Batch,bool Async, bool Read> struct alpha_batcher { inline static gfx_result begin_batch(Destination& destination,const rect16& bounds,bool async) { return batcher<Destination,Batch,Async>::begin_batch(destination,bounds,async); } inline static gfx_result write_batch(Destination& destination,point16 location,typename Destination::pixel_type pixel,bool async) { return batcher<Destination,Batch,Async>::write_batch(destination,location,pixel,async); } inline static gfx_result commit_batch(Destination& destination,bool async) { return batcher<Destination,Batch,Async>::commit_batch(destination,async); } }; template<typename Destination,bool Batch,bool Async> struct alpha_batcher<Destination,Batch,Async,true> { inline static gfx_result begin_batch(Destination& destination,const rect16& bounds,bool async) { return batcher<Destination,false,Async>::begin_batch(destination,bounds,async); } inline static gfx_result write_batch(Destination& destination,point16 location,typename Destination::pixel_type pixel,bool async) { return batcher<Destination,false,Async>::write_batch(destination,location,pixel,async); } inline static gfx_result commit_batch(Destination& destination,bool async) { return batcher<Destination,false,Async>::commit_batch(destination,async); } }; template<typename Destination> struct batcher<Destination,true,false> { inline static gfx_result begin_batch(Destination& destination,const rect16& bounds,bool async) { return destination.begin_batch(bounds); } inline static gfx_result write_batch(Destination& destination,point16 location,typename Destination::pixel_type pixel,bool async) { return destination.write_batch(pixel); } inline static gfx_result commit_batch(Destination& destination,bool async) { return destination.commit_batch(); } }; template<typename Destination> struct batcher<Destination,true,true> { inline static gfx_result begin_batch(Destination& destination,const rect16& bounds,bool async) { if(async) { return destination.begin_batch_async(bounds); } else { return destination.begin_batch(bounds); } } inline static gfx_result write_batch(Destination& destination,point16 location,typename Destination::pixel_type pixel,bool async) { if(async) { return destination.write_batch_async(pixel); } else { return destination.write_batch(pixel); } } inline static gfx_result commit_batch(Destination& destination,bool async) { if(async) { return destination.commit_batch_async(); } else { return destination.commit_batch(); } } }; template<typename Destination,bool Suspend,bool Async> struct suspender { inline suspender(Destination& dest,bool async=false) { } inline suspender(const suspender& rhs) = default; inline suspender& operator=(const suspender& rhs)=default; inline ~suspender() =default; inline static gfx_result suspend(Destination& dst) { return gfx_result::success; } inline static gfx_result resume(Destination& dst,bool force=false) { return gfx_result::success; } inline static gfx_result suspend_async(Destination& dst) { return gfx_result::success; } inline static gfx_result resume_async(Destination& dst,bool force=false) { return gfx_result::success; } }; template<typename Destination> struct suspender<Destination,true,false> { Destination& destination; inline suspender(Destination& dest,bool async=false) : destination(dest) { suspend(destination); } inline suspender(const suspender& rhs) { suspend(destination); } inline suspender& operator=(const suspender& rhs) { destination = rhs.destination; suspend(destination); return *this; } inline ~suspender() { resume(destination); } inline static gfx_result suspend(Destination& dst) { return dst.suspend(); } inline static gfx_result resume(Destination& dst,bool force=false) { if(force) { return resume(dst,true); } return dst.resume(); } inline static gfx_result suspend_async(Destination& dst) { return suspend(dst); } inline static gfx_result resume_async(Destination& dst,bool force=false) { if(force) { return resume(dst,true); } return resume(dst); } }; template<typename Destination> struct suspender<Destination,true,true> { Destination& destination; const bool async; inline suspender(Destination& dest,bool async=false) : destination(dest),async(async) { if(async) { suspend_async(destination); return; } suspend(destination); } inline suspender(const suspender& rhs) { destination = rhs.destination; if(async) { suspend_async(destination); return; } suspend(destination); } inline suspender& operator=(const suspender& rhs) { destination = rhs.destination; if(async) { suspend_async(destination); return *this; } suspend(destination); return *this; } inline ~suspender() { if(async) { resume_async(destination); return; } resume(destination); } inline static gfx_result suspend(Destination& dst) { return dst.suspend(); } inline static gfx_result resume(Destination& dst,bool force=false) { if(force) { return dst.resume(true); } return dst.resume(); } inline static gfx_result suspend_async(Destination& dst) { return dst.suspend_async(); } inline static gfx_result resume_async(Destination& dst,bool force=false) { if(force) { dst.resume_async(true); } return dst.resume_async(); } }; } } #endif
43.992188
143
0.551234
codewitch-honey-crisis
cad317aafe7c0078ca77280af0b65a64d4ac8d9a
21,455
cpp
C++
src/lib/objects/aobject.cpp
leaderit/ananas-qt4
6830bf5074b316582a38f6bed147a1186dd7cc95
[ "MIT" ]
1
2021-03-16T21:47:41.000Z
2021-03-16T21:47:41.000Z
src/lib/objects/aobject.cpp
leaderit/ananas-qt4
6830bf5074b316582a38f6bed147a1186dd7cc95
[ "MIT" ]
null
null
null
src/lib/objects/aobject.cpp
leaderit/ananas-qt4
6830bf5074b316582a38f6bed147a1186dd7cc95
[ "MIT" ]
null
null
null
/**************************************************************************** ** $Id: aobject.cpp,v 1.3 2008/11/09 21:09:11 leader Exp $ ** ** Code file of the Ananas Object of Ananas ** Designer and Engine applications ** ** Created : 20031201 ** ** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved. ** Copyright (C) 2005-2006 Grigory Panov <gr1313 at mail.ru>, Yoshkar-Ola. ** ** This file is part of the Library of the Ananas ** automation accounting system. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru ** See http://www.leaderit.ru/gpl/ for GPL licensing information. ** ** Contact org@leaderit.ru if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include <qobject.h> #include <q3sqlcursor.h> #include <q3sqlpropertymap.h> #include <qdialog.h> #include "adatabase.h" #include "aobject.h" #include "aform.h" #include "alog.h" /*! * \en * Craeate abstract aObject. * \param parent - parent object * \param name - name of object * \_en * \ru * Создает абстрактный не связанный с базой данных объект управления данными. * Созданный таким образом объект не использует информацию из метаданных о составе и * типах полей. То есть он не является какой-либо моделью данных. И на самом деле малопригоден * для использования. В дазе данных ни как не отражается создание этого объекта. Для того, * что бы зарегистрировать вновь созданный абстрактный объект в базе данных, необходимо * сначала проинициализировать его с использованием метаданных, а затем вызвать метод New(). * \_ru */ aObject::aObject( QObject *parent, const char *name ) :QObject( parent, name ) { db = 0; vInited = false; filtred = false; selectFlag = false; } /*! * \en * Create aObject, inited by md object. * md object finding by name * \param oname - md name of object, name contens prefix * Document. for documents, * InfoRegister. for information registers, * Catalogue. for catalogues, * AccumulationRegister. for Accumulation registers, * DocJournal. for journals * \param adb - link on object aDataBase used for work * \param parent - parent object * \param name - name of object * \_en * \ru * Создает объект как модель данных, описанную в метаданных. На описание в метаданных * указывает один из передаваемых при вызове параметров - имя элемента метаданных. * После успешного создания объекта с ним можно работать как с объектом данных со структурой, * описанной в метаданных, и индентифицируемой именем, переданным в параметрах вызова. * * \_ru */ aObject::aObject( const QString &oname, aDatabase *adb, QObject *parent, const char *name ) :QObject( parent, name ) { vInited = false; filtred = false; selectFlag = false; db = adb; if ( adb ) { obj = adb->cfg.find( oname ); setObject( obj ); } } /*! * Create aObject, inited by md object. * \param context - hi leve md object * \param adb - link on object aDataBase used for work * \param parent - parent object * \param name - name of object */ aObject::aObject( aCfgItem context, aDatabase *adb, QObject *parent, const char *name ) :QObject( parent, name ) { filtred = false; vInited = false; db = adb; if ( adb ) { setObject( context ); } } /*! * virtual destructor. */ aObject::~aObject() { } /*! * Tune on metadata object and it's database tables. * \param adb - link on database object * \return error code */ ERR_Code aObject::init() { if ( isInited() ) return err_noerror; return initObject(); } /*! * Set new object type after create * /param newobject - new md object * \return error code */ ERR_Code aObject::setObject( aCfgItem newobject ) { setInited( false ); obj = newobject; return init(); } /*! * Init object after create. * Need setObject( id ), where id - if of the metadata object of the adb->cfg loaded Configuration. * \return error code */ ERR_Code aObject::initObject() { aCfgItem fg, f; QString tname; setInited( true ); // db = adb; md = 0; if ( db ) md = &db->cfg; else { aLog::print(aLog::Error, tr("aObject have no database!")); return err_nodatabase; } if ( obj.isNull() ) { aLog::print(aLog::Error, tr("aObject md object not found")); return err_objnotfound; } return err_noerror; } /*! * */ bool aObject::checkStructure() { return false; } /*! * Return the table of object by it's name. * /param name - name of table for main table use name="" or empty parametr * /return link on aDataTable or 0 if table not found */ aDataTable * aObject::table( const QString &name ) { if ( !dbtables[ name ] ) { if (name!="" && !name.isEmpty()) { aLog::print(aLog::Error, tr("aObject table with name %1 not found").arg(name)); cfg_message(1, tr("Table `%s' not found.\n").utf8(),(const char*) name); } // else // { // cfg_message(1, tr("Table name is empty.\n").utf8()); // } return 0; } return dbtables[ name ]; } /*! * Insert table name and it link into internal buffer. * used for finding table by it's md name or some default name * /param dbname - database name of table * /param obj - md object, used for aDataTable initing * /param name - name of table, used for finding table in buffer * /return error code */ ERR_Code aObject::tableInsert( const QString &dbname, aCfgItem obj, const QString &name ) { if ( db ) { aDataTable *t = db->table( dbname ); if ( !t ) return err_notable; t->setObject( obj ); dbtables.insert( name, t ); return err_noerror; } aLog::print(aLog::Error, tr("aObject have no database!")); return err_nodatabase; } /*! * Insert table name and it link into internal buffer. * used for finding table by it's md name or some default name * table not inited by md object * /param dbname - database name of table * /param name - name of table, used for finding table in buffer * /return error code */ ERR_Code aObject::tableInsert( const QString &dbname, const QString &name ) { if ( db ) { aDataTable *t = db->table( dbname ); if ( !t ) return err_notable; dbtables.insert( name, t ); return err_noerror; } aLog::print(aLog::Error, tr("aObject have no database!")); return err_nodatabase; } /*! * Remove table from buffer. * /param name - table name * /return err_notable if table not found */ ERR_Code aObject::tableRemove( const QString &name ) { if ( !dbtables[name] ) { aLog::print(aLog::Error, tr("aObject table with name %1 not found").arg(name)); return err_notable; } dbtables.remove( name ); return err_noerror; } /*! * */ QString aObject::trSysName( const QString & ) { return ""; } /*! * Gets system field value. * \param name (in) - field name. * \return field value or QVariant::Invalid if field no exist. */ QVariant aObject::sysValue( const QString & name, const QString &tableName ) { aDataTable *t = table( tableName ); if ( t && t->sysFieldExists( name ) ) { return t->sysValue(name); } else return QVariant::Invalid; } /*! * Sets system field value. * \param name (in) - field name. * \param value (in) - sets value. */ int aObject::setSysValue( const QString & name, QVariant value, const QString &tableName ) { aDataTable *t = table( tableName ); if ( t ) { t->setSysValue( name, value ); return err_noerror; } return err_notable; } /*! * Return field value of the primary object database table. */ QVariant aObject::Value( const QString & name, const QString &tableName ) { aDataTable *t = table( tableName ); QString trName = trSysName(name); if ( trName != "" ) return sysValue( trName ); else { if ( t ) return t->value( name ); } return QVariant(""); } /*! * Set field value of the primary object database table. */ int aObject::SetValue( const QString & name, const QVariant &value, const QString &tableName ) { aDataTable *t = table( tableName ); QString trName = trSysName(name); if ( trName != "" ) return setSysValue( trName, value ); else { if ( t ) { t->setValue( name, value ); return err_noerror; } } return err_notable; // return setTValue( "", name, value ); } /*! * Check object selecting. * \return true if object record selected in database. */ bool aObject::IsSelected() { return selected(); } /*! * */ bool aObject::IsMarkDeleted(const QString & tname) { aDataTable *t = table( tname ); if ( t && t->sysFieldExists( "df" ) ) return t->sysValue( "df" ).toInt() == 1; return false; } /*! * */ bool aObject::IsMarked() { aDataTable *t = table(); if ( t && t->sysFieldExists( "mf" ) ) return t->sysValue( "mf" ).toInt() == 1; return false; } /*! * */ /* int aObject::TableSetMarkDeleted( bool Deleted, const QString & tname ) { aDataTable *t = table( tname ); if ( t && t->sysFieldExists( "df" ) ) { QString v = "0"; if ( Deleted ) v = "1"; t->setSysValue( "df", QVariant( v ) ); return err_noerror; } return err_incorrecttype; // Object can not be mark deleted } */ /*! * */ int aObject::SetMarkDeleted( bool Deleted, const QString & tname ) { aDataTable *t = table( tname ); if ( t && t->sysFieldExists( "df" ) ) { QString v = "0"; if ( Deleted ) v = "1"; t->setSysValue( "df", QVariant( v ) ); return err_noerror; } else { aLog::print(aLog::Error, tr("aObject have no system field %1").arg("df")); return err_incorrecttype; // Object can not be mark deleted } } /*! * */ int aObject::SetMarked( bool Marked ) { aDataTable *t = table(); if ( t && t->sysFieldExists( "mf" ) ) { QString v = ""; if ( Marked ) v = "1"; t->setSysValue( "mf", QVariant( v ) ); // t->printRecord(); return err_noerror; } aLog::print(aLog::Error, tr("aObject have no system field %1").arg("mf")); return err_incorrecttype; // Object can not be marked } /*! * Add new object record in database. */ int aObject::New() { aDataTable *t = table(); if ( !t ) return err_notable; setSelected ( t->New() ); /* Q_ULLONG Uid = t->primeInsert()->value("id").toULongLong(); if ( t->insert() ) { if ( t->select(QString("id=%1").arg(Uid), false) ) if ( t->first() ) { setSelected(true); return err_noerror; } return err_selecterror; } */ if ( selected() ) return err_noerror; return err_inserterror; } /*! * Copy current selected object data in database. */ /*Q_ULLONG aObject::copy( const QString & tablename ) { aDataTable * t = table( tablename ); if ( !t ) return 0; if ( !selected(tablename) ) return 0; QSqlRecord * r = t->primeUpdate(); Q_ULLONG Uid = db->uid( t->id ); r->setValue("id",Uid); if ( t->insert() ) return Uid; else return 0; } */ /*! * */ int aObject::Copy() { // QSqlRecord r; // Q_ULLONG Uid = copy(); // if ( !Uid ) return err_copyerror; aDataTable *t = table(); if ( t->Copy() ) return err_noerror; // if ( t->select(QString("id=%1").arg(Uid)) ) // if ( t->first() ) // return err_noerror; return err_copyerror; } /*! * Delete curent selected object record from database. */ int aObject::Delete() { aDataTable * t = table(); if ( !t ) return err_notable; db->markDeleted(getUid()); t->Delete(); // if ( !selected() ) return err_notselected; // t->primeDelete(); // t->del(); setSelected (false); return err_noerror; } /*! *\~english * Update curent selected object record to database. *\~russian *\~ */ int aObject::Update() { aDataTable *t = table(); QSqlRecord *r; int i; if ( !t ) return err_notable; t->Update(); /* r = t->primeUpdate(); t->printRecord(); for ( i=0;i<r->count();i++ ) r->setValue( i, t->value( i ) ); t->update(); */ if ( t->lastError().type() ) { //debug_message("update error %i %s\n",t->lastError().type(), ( const char *)t->lastError().text()); aLog::print(aLog::Error, tr("aObject update error. Driver message: %1").arg(t->lastError().text())); return err_updateerror; } else { return err_noerror; } } /*! *\~english * Update object attributes from curent selected object database record. *\~russian *\~ *//* void aObject::updateAttributes( const QString & tname ) { aDataTable *t = table(); } */ /*! *\~english * Conduct document. * Do nothing. Added for wDocument compatibility. *\~russian * Проводит документ. * Ничего не делает. Предназначена для совместимости и работы в wDocument. *\~ *\return \~english error code - abstract object.\~russian код ошибки - абстрактный обект.\~ */ int aObject::Conduct() { return err_abstractobj; } /*! *\~english * UnConduct document. * Do nothing. Added for wDocument compatibility. *\~russian * Распроводит документ. * Ничего не делает. Предназначена для совместимости и работы в wDocument. *\~ *\return \~english error code - abstract object.\~russian код ошибки - абстрактный обект.\~ */ int aObject::UnConduct() { return err_abstractobj; } bool aObject::IsConducted() { return 0; } /*! *\~english * Return document database id. * always return 0. Added for wJournal compatibility. *\~russian * Возвращает id документа в базе данных. * Всегда возвращает 0. Предназначена для совместимости и работы в wJournal. *\~ *\return \~english 0.\~russian 0.\~ */ qulonglong aObject::docId() { return 0; } /*! * \ru * Позиционирует указатель в БД на запись, соотвествующую объекту * с указанным идентификатором. * \param id - Идентификатор объекта. * \return возвращает код ошибки или 0 в случае успеха. * \_ru */ ERR_Code aObject::select( qulonglong id ) { aDataTable * t = table(); if ( !t ) return err_notable; setSelected (false); long otype = db->uidType( id ); // debug_message("otype=%li\n",otype); if ( !otype ) return err_objnotfound; if ( concrete && ( otype != t->getMdObjId() ) ) return err_incorrecttype; if ( !concrete ) { aCfgItem tmpObj = md->find( otype ); if ( tmpObj.isNull() ) return err_objnotfound; setObject ( tmpObj ); } if ( t->select( QString("id=%1").arg(id), false ) ) if ( t->first() ) { // t->primeUpdate(); setSelected (true); // t->printRecord(); return err_noerror; } else return err_notselected; return err_selecterror; } /*! * */ ERR_Code aObject::select(const QString & query, const QString &tableName) { aDataTable * t = table(tableName); if ( !t ) return err_notable; if (t->select(query)) if( t->first() ) { setSelected (true); return err_noerror; } else return err_notselected; return err_selecterror; } /*! * Return field value of the secondary object database table. */ QVariant aObject::tValue( const QString & tablename, const QString & name ) { aDataTable *t = table( tablename ); //CHECK_POINT if ( t ) return t->value( name ); return QVariant(""); } /*! * Set field value of the secondary object database table. */ ERR_Code aObject::setTValue( const QString & tablename, const QString & name, const QVariant &value ) { aDataTable *t = table( tablename ); if ( t ) { t->setValue( name, value ); return err_noerror; } return err_notable; } /*! * */ ERR_Code aObject::decodeDocNum( QString nm, QString & pref, int & num) { aLog::print(aLog::Debug, tr("aObject decode doc number %1").arg(nm)); int pos = -1; for ( uint i = nm.length(); i > 0; i-- ) { if ( ( nm.at(i-1) >='0' ) && ( nm.at(i-1) <= '9' ) ) continue; else { pos = i; break; } } if ( pos == -1 ) { //CHECK_POINT pref = ""; num = nm.toInt(); return err_incorrectname; } if ( pos == ( int ) nm.length() ) { //CHECK_POINT pref = nm; num = -1; return err_incorrectname; } //CHECK_POINT pref = nm.left( pos ); num = nm.mid(pos).toInt(); aLog::print(aLog::Debug, tr("aObject decode doc number ok, pref=%1 num=%2").arg(pref).arg(num)); return err_noerror; } /*! * */ /* bool aObject::Next() { return table()->next(); // return dbtables[""]->next(); } */ /*! * */ /* bool aObject::Prev() { // return dbtables[""]->prev(); return table()->prev(); } */ /*! * */ /* bool aObject::First() { // return dbtables[""]->first(); return table()->first(); } */ /*! * */ /* bool aObject::Last() { // return dbtables[""]->last(); return table()->last(); } */ /*! * */ bool aObject::Next( const QString& tableName ) { return table(tableName)->next(); } /*! * */ bool aObject::Prev( const QString& tableName ) { return table(tableName)->prev(); } /*! * */ bool aObject::First( const QString& tableName ) { return table(tableName)->first(); } /*! * */ bool aObject::Last( const QString& tableName ) { return table(tableName)->last(); } /*! * \ru * Возвращает уникальный идентификатор объекта из базы данных. * В качестве объекта например может выступать "Приходная накладная" от такого-то числа за таким то номером. * Каждый вновь созданный в системе документ или элемент справочника, включая группы справочника имеет свой уникальный * неповторяющийся идентификатор. Если какое-либо поле, какого-либо объекта имеет тип Объект (например Document.Накладная), * то в качестве значения ему нужно задавать уникальный идентификатор объекта, возвращаемый функцией Uid(). * Не существует возможности изменить существующий идентификатор какого-либо объекта. Созданием и управлением * идентификаторами объектов занимается система. * \return строка со значением уникального идентификатора. * \_ru */ QString aObject::Uid() { return QString::number(getUid()); } /*! * */ qulonglong aObject::getUid() { qulonglong Uid = 0; if ( selected() ) Uid = table()->sysValue("id").toULongLong(); return Uid; } /*! * */ void aObject::setSelected( bool sel, const QString & tablename ) { if ( tablename == "" ) selectFlag = sel; else table(tablename)->selected = sel; } /*! * */ bool aObject::selected( const QString & tablename ) { if ( tablename == "" ) return selectFlag; else return table(tablename)->selected; } /*! * */ ERR_Code aObject::setTFilter( const QString & tname, const QString & valname, const QVariant & value ) { aDataTable * t = dbtables[tname]; if ( !t ) return err_notable; if ( t->setFilter( valname, value ) ) return err_noerror; else return err_fieldnotfound; } /*! * */ ERR_Code aObject::clearTFilter( const QString & tname ) { aDataTable * t = dbtables[tname]; if ( !t ) return err_notable; t->clearFilter(); return err_noerror; } /*! * */ int aObject::SetFilter( const QString & valname, const QVariant & value ) { int err = setTFilter( "", valname, value ); filtred = !err; return err; } /*! * */ int aObject::ClearFilter() { filtred = false; return clearTFilter(""); } /*! * */ int aObject::TableSetFilter( const QString & tname, const QString & valname, const QVariant & value ) { return setTFilter( tname, valname, value ); } /*! * */ int aObject::TableClearFilter( const QString & tname ) { return clearTFilter(tname); } /*! * \ru * Обновляет базу данных данными табличной части объекта. Обычно вызывается * после метода TableSetValue. * \param tablename - имя таблицы. Необходим для указания имени, так как * в объекте возможно наличие нескольких табличных частей. * \return возвращает код ошибки или 0 в случае успеха. * \_ru */ int aObject::TableUpdate( const QString & tablename ) { aDataTable *t = table( tablename ); if ( !t ) { aLog::print(aLog::Error, tr("aObject table update: no table found with name %1").arg(tablename)); return err_notable; } // t->primeUpdate(); t->Update(); if (t->lastError().type()) { aLog::print(aLog::Error, tr("aObject update error. Driver message: %1").arg(t->lastError().text())); return err_updateerror; } return err_noerror; } /*! * */ QString aObject::displayString() { QString res="***"; int stdfc = 0, fid; aCfgItem sw, f; sw = displayStringContext(); // if ( md->objClass( obj ) == md_catalogue ) { // sw = md->find( md->find( obj, md_element ), md_string_view ); // } else { // sw = md->find( obj, md_string_view ); // } if ( !sw.isNull() ) { stdfc = md->attr( sw, mda_stdf ).toInt(); switch ( stdfc ) { case 0: fid = md->sText( sw, md_fieldid ).toInt(); res = table()->sysValue( QString( "uf%1" ).arg( fid ) ).toString(); //printf("fid=%i res=%s\n",fid, ( const char *) res ); break; case 1: break; case 2: break; } } else { aLog::print(aLog::Debug, tr("aObject display string context is null")); } // res = return res; } aCfgItem aObject::displayStringContext() { return md->find( obj, md_string_view ); } /** * \ru * Вид объекта, так как он описан в метаданных. * \_ru */ QString aObject::Kind( const QString & name ) { QString wasKind = md->objClass( obj ); if ( !name.isEmpty() ) { // Set new kind. } return wasKind; }
18.869833
123
0.633605
leaderit
cad3e94e1b59a1fdce02299341fce844a0656a78
1,993
cpp
C++
Problems/CtCi6thEd/Chapter-3/stackMin.cpp
pedrotorreao/DSA
31f9dffbed5275590d5c7b7f6a73fd6dea411564
[ "MIT" ]
1
2021-07-08T01:02:06.000Z
2021-07-08T01:02:06.000Z
Problems/CtCi6thEd/Chapter-3/stackMin.cpp
pedrotorreao/DSA
31f9dffbed5275590d5c7b7f6a73fd6dea411564
[ "MIT" ]
null
null
null
Problems/CtCi6thEd/Chapter-3/stackMin.cpp
pedrotorreao/DSA
31f9dffbed5275590d5c7b7f6a73fd6dea411564
[ "MIT" ]
null
null
null
/*********************************************************************************************/ /* Problem: Stack Min (CtCi 3.2) ********/ /*********************************************************************************************/ /* --Problem statement: How would you design a stack which, in addition to push and pop, has a function min which returns the minimum elements? Push, pop and min should all operate in O(1) time. --Reasoning: Use two stacks, one to store all the elements and one to keep track of the min values. --Time complexity: O(1), operations do not depend on the size of the stack. --Space complexity: O(n), in the worst case scenario where the input is made of elements sorted in descending order, we'd have to store all elements in the second stack. */ #include <iostream> #include <vector> #include <climits> #include "stack/stack.h" class StackMin { private: Stack<int> st_values, st_min; public: void push(int value) { st_values.push(value); if (min() >= value) { st_min.push(value); } } void pop(void) { if (min() == st_values.peek()) { st_min.pop(); } st_values.pop(); } int peek(void) { return st_values.peek(); } int min(void) { if (st_min.isEmpty()) { return INT_MAX; } return st_min.peek(); } StackMin() {} ~StackMin() = default; }; // driver code: int main() { StackMin st; std::vector<int> values{11, 5, 3, 9, 23, -2, 47, 1}; for (auto v : values) { st.push(v); } std::cout << "Min element in the stack: " << st.min() << "\n"; std::cout << "Top element in the stack: " << st.peek() << "\n"; st.pop(); std::cout << "Min element in the stack: " << st.min() << "\n"; std::cout << "Top element in the stack: " << st.peek() << "\n"; st.pop(); st.pop(); std::cout << "Min element in the stack: " << st.min() << "\n"; std::cout << "Top element in the stack: " << st.peek() << "\n"; return 0; }
20.760417
98
0.530858
pedrotorreao
cad64800a8364134b661a3cdcf4d3ccc8041f3f3
1,080
cpp
C++
2021/04. Conditions/20311006/7. CircleIntercept 2.0/7. CircleIntercept 2.0.cpp
GeorgiIT/CS104
7efcc069256dfdb5bc18bd76fbb683edf2cde230
[ "MIT" ]
7
2021-03-24T16:30:45.000Z
2022-03-27T09:02:15.000Z
2021/04. Conditions/20311006/7. CircleIntercept 2.0/7. CircleIntercept 2.0.cpp
GeorgiIT/CS104
7efcc069256dfdb5bc18bd76fbb683edf2cde230
[ "MIT" ]
null
null
null
2021/04. Conditions/20311006/7. CircleIntercept 2.0/7. CircleIntercept 2.0.cpp
GeorgiIT/CS104
7efcc069256dfdb5bc18bd76fbb683edf2cde230
[ "MIT" ]
17
2021-03-22T09:42:22.000Z
2022-03-28T03:24:07.000Z
#include <iostream> #include <cmath> using namespace std; int main() { float Ax, Ay, Ar, Bx, By, Br; cout << "Enter first circle [x y r]:" << endl; cin >> Ax >> Ay >> Ar; cout << "Enter second circle [x y r]:" << endl; cin >> Bx >> By >> Br; float d = sqrt(pow((Ax - Bx), 2) + pow((Ay - By), 2)); float a = (pow(Ar, 2) - pow(Br, 2) + pow(d, 2)) / (2 * d); float h= sqrt(pow(Ar, 2) - pow(a, 2)); float x = Ax + a * (Bx - Ax) / d; float y = Ay + a * (By - Ay) / d; float Cx = x + (By - Ay) * h / d; float Cy = y - (Bx - Ax) * h / d; float Dx = x - (By - Ay) * h / d; float Dy = y + (Bx - Ax) * h / d; if (Ar + Br < d) cout << "No interception points."; else if (Ar + Br == d) { cout << "One interception point." << endl; cout << "x = " << x << ", y = " << y << endl; } else if (Ar + Br > d) { cout << "Two interception points." << endl; cout << "Cx = " << Cx << ", Cy = " << Cy << endl; cout << "Dx = " << Dx << ", Dy = " << Dy << endl; } return 0; }
31.764706
62
0.424074
GeorgiIT
cad698cf8e4dc0ef03757f0b4cd624f36c2283d1
1,067
cpp
C++
Scripts/out/v8pp-module/bakkesmod/wrappers/GameObject/CarComponent/DoubleJumpComponentWrapper.cpp
Stanbroek/BakkesModSDK-JavaScript
356c466766a24016edf6a6a6a9b43b0d30407b76
[ "MIT" ]
1
2022-01-27T17:35:02.000Z
2022-01-27T17:35:02.000Z
Scripts/out/v8pp-module/bakkesmod/wrappers/GameObject/CarComponent/DoubleJumpComponentWrapper.cpp
Stanbroek/BakkesModSDK-JavaScript
356c466766a24016edf6a6a6a9b43b0d30407b76
[ "MIT" ]
null
null
null
Scripts/out/v8pp-module/bakkesmod/wrappers/GameObject/CarComponent/DoubleJumpComponentWrapper.cpp
Stanbroek/BakkesModSDK-JavaScript
356c466766a24016edf6a6a6a9b43b0d30407b76
[ "MIT" ]
null
null
null
void bind_DoubleJumpComponentWrapper([[maybe_unused]] v8::Isolate* isolate, v8pp::module& module) { v8pp::class_<DoubleJumpComponentWrapper> cl_DoubleJumpComponentWrapper(isolate); cl_DoubleJumpComponentWrapper.inherit<CarComponentWrapper>(); cl_DoubleJumpComponentWrapper.ctor<uintptr_t>(); cl_DoubleJumpComponentWrapper.set<void(DoubleJumpComponentWrapper::*)(float)>("SetJumpImpulse", &DoubleJumpComponentWrapper::SetJumpImpulse); cl_DoubleJumpComponentWrapper.set<float(DoubleJumpComponentWrapper::*)()>("GetImpulseScale", &DoubleJumpComponentWrapper::GetImpulseScale); cl_DoubleJumpComponentWrapper.set<void(DoubleJumpComponentWrapper::*)(float)>("SetImpulseScale", &DoubleJumpComponentWrapper::SetImpulseScale); cl_DoubleJumpComponentWrapper.set<void(DoubleJumpComponentWrapper::*)(float)>("ApplyForces", &DoubleJumpComponentWrapper::ApplyForces); cl_DoubleJumpComponentWrapper.set<void(DoubleJumpComponentWrapper::*)()>("OnCreated", &DoubleJumpComponentWrapper::OnCreated); module.set("DoubleJumpComponentWrapper", cl_DoubleJumpComponentWrapper); }
71.133333
144
0.839738
Stanbroek
cad88d7a70ebfce8c460486420008734b51228f4
7,388
cpp
C++
src/src/state_expresslrs.cpp
cruwaller/FENIX-rx5808-pro-diversity
6d1c07bde3c0782a599c3a0a40db8dacc522ef6e
[ "MIT" ]
1
2020-08-20T19:58:13.000Z
2020-08-20T19:58:13.000Z
src/src/state_expresslrs.cpp
cruwaller/FENIX-rx5808-pro-diversity
6d1c07bde3c0782a599c3a0a40db8dacc522ef6e
[ "MIT" ]
null
null
null
src/src/state_expresslrs.cpp
cruwaller/FENIX-rx5808-pro-diversity
6d1c07bde3c0782a599c3a0a40db8dacc522ef6e
[ "MIT" ]
null
null
null
#include <stdint.h> #include "settings_eeprom.h" #include "state_expresslrs.h" #include "ui.h" #include "temperature.h" #include "touchpad.h" #include "comm_espnow.h" #include "protocol_ExpressLRS.h" void StateMachine::ExLRSStateHandler::onEnter() { //onUpdateDraw(false); } void StateMachine::ExLRSStateHandler::onUpdate() { onUpdateDraw(TouchPad::touchData.buttonPrimary); } void StateMachine::ExLRSStateHandler::onUpdateDraw(uint8_t tapAction) { uint32_t off_x = 20, off_x2 = off_x + 17 * Ui::CHAR_W, off_y = 20; int16_t cursor_x = TouchPad::touchData.cursorX, cursor_y = TouchPad::touchData.cursorY; uint8_t region = expresslrs_params_get_region(); if (drawHeader()) return; // Mode Ui::display.setCursor(off_x, off_y); Ui::display.print("Mode (Hz):"); Ui::display.setCursor(off_x2, off_y); if (region == 3) Ui::display.print("50 125 250"); else Ui::display.print("50 100 200"); off_y += 20; // RF Power Ui::display.setCursor(off_x, off_y); Ui::display.print("Power (mW):"); Ui::display.setCursor(off_x2, off_y); Ui::display.print("25 50 100"); off_y += 20; // TLM Rate Ui::display.setCursor(off_x, off_y); Ui::display.print("Telemetry:"); Ui::display.setCursor(off_x2, off_y); Ui::display.print("On Off"); off_y += 20; // Set VTX channel Ui::display.setCursor(off_x, off_y); Ui::display.print("VTX channel:"); Ui::display.setCursor(off_x2, off_y); Ui::display.print("SEND"); off_y += 20; /*************************************/ // Print current settings off_y += 20; Ui::display.setCursor(off_x, off_y); Ui::display.print("== Current settings =="); off_y += 12; off_x = 40; off_x2 = off_x + 100; Ui::display.setCursor(off_x, off_y); Ui::display.print("Frequency:"); Ui::display.setCursor(off_x2, off_y); switch (expresslrs_params_get_region()) { case 0: Ui::display.print("915MHz"); break; case 1: Ui::display.print("868MHz"); break; case 2: Ui::display.print("433MHz"); break; case 3: Ui::display.print("2.4GHz"); break; default: Ui::display.print("---"); break; }; off_y += 10; Ui::display.setCursor(off_x, off_y); Ui::display.print("Rate:"); Ui::display.setCursor(off_x2, off_y); switch (expresslrs_params_get_rate()) { case 0: Ui::display.print((region == 3) ? "250Hz" : "200Hz"); break; case 1: Ui::display.print((region == 3) ? "125Hz" : "100Hz"); break; case 2: Ui::display.print("50Hz"); break; default: Ui::display.print("---"); break; }; off_y += 10; Ui::display.setCursor(off_x, off_y); Ui::display.print("Power:"); Ui::display.setCursor(off_x2, off_y); switch (expresslrs_params_get_power()) { case 0: Ui::display.print("dynamic"); break; case 1: Ui::display.print("10mW"); break; case 2: Ui::display.print("25mW"); break; case 3: Ui::display.print("50mW"); break; case 4: Ui::display.print("100mW"); break; case 5: Ui::display.print("250mW"); break; case 6: Ui::display.print("500mW"); break; case 7: Ui::display.print("1000mW"); break; case 8: Ui::display.print("2000mW"); break; default: Ui::display.print("---"); break; }; off_y += 10; Ui::display.setCursor(off_x, off_y); Ui::display.print("Telemetry:"); Ui::display.setCursor(off_x2, off_y); switch (expresslrs_params_get_tlm()) { case 0: Ui::display.print("OFF"); break; case 1: Ui::display.print("1/128"); break; case 2: Ui::display.print("1/64"); break; case 3: Ui::display.print("1/32"); break; case 4: Ui::display.print("1/16"); break; case 5: Ui::display.print("1/8"); break; case 6: Ui::display.print("1/4"); break; case 7: Ui::display.print("1/2"); break; default: Ui::display.print("---"); break; }; // Draw Mode box if (cursor_y > 16 && cursor_y < 31) { if ( // 50 cursor_x > (20 + 17 * 8 - 4) && cursor_x < (20 + 19 * 8 + 3)) { Ui::display.rect(20 + 17 * 8 - 4, 16, 23, 15, 100); if (tapAction) expresslrs_rate_send(ExLRS_50Hz); } else if ( // 100 cursor_x > (20 + 23 * 8 - 4) && cursor_x < (20 + 26 * 8 + 3)) { Ui::display.rect(20 + 23 * 8 - 4, 16, 31, 15, 100); if (tapAction) expresslrs_rate_send(ExLRS_100Hz); } else if ( // 200 cursor_x > (20 + 30 * 8 - 4) && cursor_x < (20 + 33 * 8 + 3)) { Ui::display.rect(20 + 30 * 8 - 4, 16, 31, 15, 100); if (tapAction) expresslrs_rate_send(ExLRS_200Hz); } } // Draw RF Power box else if (cursor_y > 36 && cursor_y < 51) { if ( // 25mW cursor_x > (20 + 17 * 8 - 4) && cursor_x < (20 + 19 * 8 + 3)) { Ui::display.rect(20 + 17 * 8 - 4, 36, 23, 15, 100); if (tapAction) expresslrs_power_send(ExLRS_PWR_25mW); } else if ( // 50mW cursor_x > (20 + 23 * 8 - 4) && cursor_x < (20 + 25 * 8 + 3)) { Ui::display.rect(20 + 23 * 8 - 4, 36, 23, 15, 100); if (tapAction) expresslrs_power_send(ExLRS_PWR_50mW); } else if ( // 100mW cursor_x > (20 + 30 * 8 - 4) && cursor_x < (20 + 33 * 8 + 3)) { Ui::display.rect(20 + 30 * 8 - 4, 36, 31, 15, 100); if (tapAction) expresslrs_power_send(ExLRS_PWR_100mW); } } // Draw TLM box else if (cursor_y > 56 && cursor_y < 71) { if ( // On cursor_x > (20 + 17 * 8 - 4) && cursor_x < (20 + 19 * 8 + 3)) { Ui::display.rect(20 + 17 * 8 - 4, 56, 23, 15, 100); if (tapAction) expresslrs_tlm_send(ExLRS_TLM_ON); } else if ( // Off cursor_x > (20 + 23 * 8 - 4) && cursor_x < (20 + 26 * 8 + 3)) { Ui::display.rect(20 + 23 * 8 - 4, 56, 31, 15, 100); if (tapAction) expresslrs_tlm_send(ExLRS_TLM_OFF); } } // Draw VTX SEND box else if (cursor_y > 76 && cursor_y < 91) { if (cursor_x > (20 + 17 * 8 - 4) && cursor_x < (20 + 21 * 8 + 3)) { Ui::display.rect((20 + 17 * 8 - 4), 76, (4 + 4 * 8 + 3), 15, 100); if (tapAction) expresslrs_vtx_freq_send(Channels::getFrequency(Receiver::activeChannel)); } } }
27.774436
91
0.479561
cruwaller
cadcc2b6714e6671e442e9b1df1a7bf4145cbce1
215
cpp
C++
apps/main.cpp
zhearing/basic_Structure_from_Motion
110f4bca4a78c7a9357b6c2a6475ba922431677f
[ "MIT" ]
null
null
null
apps/main.cpp
zhearing/basic_Structure_from_Motion
110f4bca4a78c7a9357b6c2a6475ba922431677f
[ "MIT" ]
null
null
null
apps/main.cpp
zhearing/basic_Structure_from_Motion
110f4bca4a78c7a9357b6c2a6475ba922431677f
[ "MIT" ]
null
null
null
// Copyright 2018 Zeyu Zhong // Lincese(MIT) // Author: Zeyu Zhong // Date: 2018.5.7 #include "../src/basicSfM.h" int main(int argc, char *argv[]) { basicSfM sfm; sfm.algorithm_sparse3d(); return 0; }
16.538462
34
0.637209
zhearing
cadd46c3909b89e1617961c273435bb98b73f88f
5,703
cpp
C++
src/Webinaria/Grabber.cpp
mkmpvtltd1/Webinaria
41d86467800adb48e77ab49b92891fae2a99bb77
[ "MIT" ]
5
2015-03-31T15:51:22.000Z
2022-03-10T07:01:56.000Z
src/Webinaria/Grabber.cpp
mkmpvtltd1/Webinaria
41d86467800adb48e77ab49b92891fae2a99bb77
[ "MIT" ]
null
null
null
src/Webinaria/Grabber.cpp
mkmpvtltd1/Webinaria
41d86467800adb48e77ab49b92891fae2a99bb77
[ "MIT" ]
null
null
null
#include "StdAfx.h" #include "Grabber.h" using namespace WebinariaApplication::WebinariaLogical; ////////////////////////////////////////////////////////////////////////// // Public methods // ////////////////////////////////////////////////////////////////////////// // Default constructor CGrabber::CGrabber(HWND hWnd): AllocateBytes(0), IsCapturing(false), File(NULL), hMainWnd(hWnd), pME(NULL), pDF(NULL), pVW(NULL), pRender(NULL), pSink(NULL), ////////////////////// ghDevNotify(0), gpUnregisterDeviceNotification(0), gpRegisterDeviceNotification(0), g_dwGraphRegister(0) ////////////////////// { /*File = new wchar_t[10]; WIN32_FIND_DATA fd; HANDLE hr = FindFirstFile("tmp",&fd); FindClose(hr); if (hr == INVALID_HANDLE_VALUE) CreateDirectory("tmp",NULL); else { hr = FindFirstFile("tmp\\~.avi",&fd); if ( hr != INVALID_HANDLE_VALUE) DeleteFile("tmp\\~.avi"); FindClose(hr); } wcscpy(File, L"tmp\\~.avi");*/ //\\tmp // Register for device add/remove notifications DEV_BROADCAST_DEVICEINTERFACE filterData; ZeroMemory(&filterData, sizeof(DEV_BROADCAST_DEVICEINTERFACE)); filterData.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE); filterData.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; filterData.dbcc_classguid = AM_KSCATEGORY_CAPTURE; gpUnregisterDeviceNotification = NULL; gpRegisterDeviceNotification = NULL; // dynload device removal APIs { HMODULE hmodUser = GetModuleHandle(TEXT("user32.dll")); //ASSERT(hmodUser); // we link to user32 gpUnregisterDeviceNotification = (PUnregisterDeviceNotification) GetProcAddress(hmodUser, "UnregisterDeviceNotification"); // m_pRegisterDeviceNotification is prototyped differently in unicode gpRegisterDeviceNotification = (PRegisterDeviceNotification) GetProcAddress(hmodUser, #ifdef UNICODE "RegisterDeviceNotificationW" #else "RegisterDeviceNotificationA" #endif ); // failures expected on older platforms. /*ASSERT(gpRegisterDeviceNotification && gpUnregisterDeviceNotification || !gpRegisterDeviceNotification && !gpUnregisterDeviceNotification);*/ } ghDevNotify = NULL; if(gpRegisterDeviceNotification) { ghDevNotify = gpRegisterDeviceNotification(hMainWnd, &filterData, DEVICE_NOTIFY_WINDOW_HANDLE); //ASSERT(ghDevNotify != NULL); } } // Virtual destructor CGrabber::~CGrabber(void) { if (File != NULL) delete[] File; IsCapturing = false; AllocateBytes = 0; SAFE_RELEASE(pSink); SAFE_RELEASE(pME); SAFE_RELEASE(pDF); SAFE_RELEASE(pVW); SAFE_RELEASE(pRender); } // Get interface for provide media events IMediaEventEx * CGrabber::GetMediaEventInterface() { return pME; } // Return full path to current file for captured data wchar_t * CGrabber::GetSelectFile() const { wchar_t * tmp = new wchar_t[wcslen(File)+1]; wcscpy(tmp,File); return tmp; } // Update and retrive current capturing file size unsigned long long CGrabber::GetCapFileSize() { HANDLE hFile = CreateFileW( File, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 ); if(hFile == INVALID_HANDLE_VALUE) { return 0; } unsigned long SizeHigh; unsigned long SizeLow = GetFileSize(hFile, &SizeHigh); CapFileSize = SizeLow + ((unsigned long long)SizeHigh << 32); if(!CloseHandle(hFile)) { CapFileSize = 0; } return CapFileSize; } // Function to Measure Available Disk Space unsigned long long CGrabber::GetFreeDiskSpaceInBytes() { DWORD dwFreeClusters, dwBytesPerSector, dwSectorsPerCluster, dwClusters; wchar_t RootName[MAX_PATH]; LPWSTR ptmp=0; // Required argument ULARGE_INTEGER ulA, ulB, ulFreeBytes; // Need to find path for root directory on drive containing this file. GetFullPathNameW( File, NUMELMS(RootName), RootName, &ptmp); // Truncate this to the name of the root directory if(RootName[0] == '\\' && RootName[1] == '\\') { // Path begins with \\server\share\path so skip the first three backslashes ptmp = &RootName[2]; while(*ptmp && (*ptmp != '\\')) { ptmp++; } if(*ptmp) { // Advance past the third backslash ptmp++; } } else { // Path must be drv:\path ptmp = RootName; } // Find next backslash and put a null after it while(*ptmp && (*ptmp != '\\')) { ptmp++; } // Found a backslash ? if(*ptmp) { // Skip it and insert null ptmp++; *ptmp = '\0'; } // The only real way of finding out free disk space is calling // GetDiskFreeSpaceExA, but it doesn't exist on Win95 HINSTANCE h = LoadLibrary(TEXT("kernel32.dll\0")); if(h) { typedef BOOL(WINAPI *ExtFunc)(LPCWSTR RootName, PULARGE_INTEGER pulA, PULARGE_INTEGER pulB, PULARGE_INTEGER pulFreeBytes); ExtFunc pfnGetDiskFreeSpaceExW = (ExtFunc)GetProcAddress(h, "GetDiskFreeSpaceExW"); FreeLibrary(h); if(pfnGetDiskFreeSpaceExW) { if(!pfnGetDiskFreeSpaceExW(RootName, &ulA, &ulB, &ulFreeBytes)) return -1; else return (ulFreeBytes.QuadPart); } } if(!GetDiskFreeSpaceW(RootName, &dwSectorsPerCluster, &dwBytesPerSector, &dwFreeClusters, &dwClusters)) return (-1); else return(dwSectorsPerCluster * dwBytesPerSector * dwFreeClusters); } // Function for select file for saving captured information bool CGrabber::SelectFile() { USES_CONVERSION; if(OpenFileDialog()) { OFSTRUCT os; // We have a capture file name // If this is a new file, then invite the user to allocate some space if(OpenFile(W2A(File), &os, OF_EXIST) == HFILE_ERROR) { //nothing } } else return false; if(pSink) { HRESULT hr = pSink->SetFileName(File, NULL); } return true; }
23.861925
124
0.676311
mkmpvtltd1
cadd8abc4d2c83c0b3b3aefd622051866e31a55b
3,236
cpp
C++
src/proofnetwork/user.cpp
DmitryNesterenok/proofbase
acd8e9420ddbd33d0ed933060e6082477cce1f0a
[ "BSD-3-Clause" ]
null
null
null
src/proofnetwork/user.cpp
DmitryNesterenok/proofbase
acd8e9420ddbd33d0ed933060e6082477cce1f0a
[ "BSD-3-Clause" ]
null
null
null
src/proofnetwork/user.cpp
DmitryNesterenok/proofbase
acd8e9420ddbd33d0ed933060e6082477cce1f0a
[ "BSD-3-Clause" ]
null
null
null
/* Copyright 2018, OpenSoft 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 OpenSoft Inc. nor the names of its contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include "proofnetwork/user.h" #include "proofnetwork/user_p.h" using namespace Proof; User::User(const QString &userName) : User(*new UserPrivate(userName)) {} User::User(Proof::UserPrivate &dd) : NetworkDataEntity(dd) {} QString User::userName() const { Q_D_CONST(User); return d->userName; } QString User::fullName() const { Q_D_CONST(User); return d->fullName; } QString User::email() const { Q_D_CONST(User); return d->email; } UserQmlWrapper *User::toQmlWrapper(QObject *parent) const { UserSP castedSelf = castedSelfPtr<User>(); Q_ASSERT(castedSelf); return new UserQmlWrapper(castedSelf, parent); } UserSP User::create(const QString &userName) { UserSP result(new User(userName)); initSelfWeakPtr(result); return result; } UserPrivate::UserPrivate(const QString &userName) : userName(userName) { setDirty(!userName.isEmpty()); } void User::updateSelf(const NetworkDataEntitySP &other) { Q_D(User); UserSP castedOther = qSharedPointerCast<User>(other); d->setUserName(castedOther->userName()); d->setFullName(castedOther->fullName()); d->setEmail(castedOther->email()); NetworkDataEntity::updateSelf(other); } void UserPrivate::setUserName(const QString &arg) { Q_Q(User); if (userName != arg) { userName = arg; emit q->userNameChanged(arg); } } void UserPrivate::setFullName(const QString &arg) { Q_Q(User); if (fullName != arg) { fullName = arg; emit q->fullNameChanged(arg); } } void UserPrivate::setEmail(const QString &arg) { Q_Q(User); if (email != arg) { email = arg; emit q->emailChanged(arg); } }
29.153153
101
0.717862
DmitryNesterenok
cadedb4dec156252ce1748b4dac7cd5f88a358c1
416
hpp
C++
lib/kernel/src/kernel/stacksize.hpp
daantimmer/dtos
20b1e8463983394296690131ad0fb77a32e05574
[ "MIT" ]
1
2020-05-31T22:49:39.000Z
2020-05-31T22:49:39.000Z
lib/kernel/src/kernel/stacksize.hpp
daantimmer/dtos
20b1e8463983394296690131ad0fb77a32e05574
[ "MIT" ]
1
2022-01-03T23:55:34.000Z
2022-01-03T23:55:34.000Z
lib/kernel/src/kernel/stacksize.hpp
daantimmer/dtos
20b1e8463983394296690131ad0fb77a32e05574
[ "MIT" ]
null
null
null
#pragma once #include "type_safe/strong_typedef.hpp" #include <cstddef> namespace kernel { struct StackSize_t : type_safe::strong_typedef<StackSize_t, std::size_t> , type_safe::strong_typedef_op::addition<StackSize_t> , type_safe::strong_typedef_op::subtraction<StackSize_t> { using type_safe::strong_typedef<StackSize_t, std::size_t>::strong_typedef; }; }
27.733333
83
0.689904
daantimmer
cadf4fd3b8d50e506571832aae0832c4a8c3391b
7,228
cpp
C++
Src/OpenGL/Shapes/GLOpenAssetImportMesh.cpp
StavrosBizelis/NetworkDistributedDeferredShading
07c03ce9b13bb5adb164cd4321b2bba284e49b4d
[ "MIT" ]
null
null
null
Src/OpenGL/Shapes/GLOpenAssetImportMesh.cpp
StavrosBizelis/NetworkDistributedDeferredShading
07c03ce9b13bb5adb164cd4321b2bba284e49b4d
[ "MIT" ]
null
null
null
Src/OpenGL/Shapes/GLOpenAssetImportMesh.cpp
StavrosBizelis/NetworkDistributedDeferredShading
07c03ce9b13bb5adb164cd4321b2bba284e49b4d
[ "MIT" ]
null
null
null
/*********************************************************************** * AUTHOR: <Doublecross> * FILE: GLOpenAssetImportMesh.cpp * DATE: Mon Jun 11 16:21:07 2018 * DESCR: ***********************************************************************/ #include "OpenGL/Shapes/GLOpenAssetImportMesh.h" #include <assert.h> #include "gl/include/glew.h" #include "gl/gl.h" #include <windows.h> GLOpenAssetImportMesh::MeshEntry::MeshEntry() { vbo = INVALID_OGL_VALUE; ibo = INVALID_OGL_VALUE; NumIndices = 0; MaterialIndex = INVALID_MATERIAL; }; GLOpenAssetImportMesh::MeshEntry::~MeshEntry() { if (vbo != INVALID_OGL_VALUE) glDeleteBuffers(1, &vbo); if (ibo != INVALID_OGL_VALUE) glDeleteBuffers(1, &ibo); } void GLOpenAssetImportMesh::MeshEntry::Init(const std::vector<Vertex>& Vertices, const std::vector<unsigned int>& Indices) { NumIndices = Indices.size(); glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, sizeof(Vertex) * Vertices.size(), &Vertices[0], GL_STATIC_DRAW); glGenBuffers(1, &ibo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned int) * NumIndices, &Indices[0], GL_STATIC_DRAW); } /* * Method: GLOpenAssetImportMesh::Load * Params: const std::string &Filename * Returns: bool * Effects: */ bool GLOpenAssetImportMesh::Load(const std::string &Filename) { // Release the previously loaded mesh (if it exists) Release(); bool Ret = false; Assimp::Importer Importer; const aiScene* pScene = Importer.ReadFile(Filename.c_str(), aiProcess_Triangulate | aiProcess_GenSmoothNormals | aiProcess_FlipUVs | aiProcess_CalcTangentSpace); if (pScene) { Ret = InitFromScene(pScene, Filename); } else { MessageBox(NULL, Importer.GetErrorString(), "Error loading mesh model", MB_ICONHAND); } return Ret; } std::shared_ptr<ITexture> GLOpenAssetImportMesh::GetTexture() { if (1 < m_Textures.size() && m_Textures[1]) return m_Textures[1]; return nullptr; } void GLOpenAssetImportMesh::Clear() { //for (unsigned int i = 0 ; i < m_Textures.size() ; i++) { // SAFE_DELETE(m_Textures[i]); //} glDeleteVertexArrays(1, &m_vao); m_Entries.clear(); m_Textures.clear(); } /* * Method: GLOpenAssetImportMesh::Create * Params: * Returns: void * Effects: */ void GLOpenAssetImportMesh::Create() { } /* * Method: GLOpenAssetImportMesh::Render * Params: * Returns: void * Effects: */ void GLOpenAssetImportMesh::Render() { glBindVertexArray(m_vao); for (unsigned int i = 0 ; i < m_Entries.size() ; i++) { glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glEnableVertexAttribArray(2); glEnableVertexAttribArray(3); glBindBuffer(GL_ARRAY_BUFFER, m_Entries[i].vbo); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)12); glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)20); glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*)32); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_Entries[i].ibo); glDrawElements(GL_TRIANGLES, m_Entries[i].NumIndices, GL_UNSIGNED_INT, 0); glDisableVertexAttribArray(0); glDisableVertexAttribArray(1); glDisableVertexAttribArray(2); glDisableVertexAttribArray(3); } } /* * Method: GLOpenAssetImportMesh::Release * Params: * Returns: void * Effects: */ void GLOpenAssetImportMesh::Release() { if( m_vao != 0) { glDeleteVertexArrays(1, &m_vao); m_vao = 0; } } bool GLOpenAssetImportMesh::InitFromScene(const aiScene* pScene, const std::string& Filename) { m_Entries.resize(pScene->mNumMeshes); m_Textures.resize(pScene->mNumMaterials); glGenVertexArrays(1, &m_vao); glBindVertexArray(m_vao); // Initialize the meshes in the scene one by one for (unsigned int i = 0 ; i < m_Entries.size() ; i++) { const aiMesh* paiMesh = pScene->mMeshes[i]; InitMesh(i, paiMesh); } return InitMaterials(pScene, Filename); } void GLOpenAssetImportMesh::InitMesh(unsigned int Index, const aiMesh* paiMesh) { m_Entries[Index].MaterialIndex = paiMesh->mMaterialIndex; std::vector<Vertex> Vertices; std::vector<unsigned int> Indices; const aiVector3D Zero3D(0.0f, 0.0f, 0.0f); for (unsigned int i = 0 ; i < paiMesh->mNumVertices ; i++) { const aiVector3D* pPos = &(paiMesh->mVertices[i]); const aiVector3D* pNormal = &(paiMesh->mNormals[i]); const aiVector3D* pTexCoord = paiMesh->HasTextureCoords(0) ? &(paiMesh->mTextureCoords[0][i]) : &Zero3D; const aiVector3D* pTangent = paiMesh->HasTangentsAndBitangents() ? &(paiMesh->mTangents[i]) : &Zero3D; Vertex v(glm::vec3(pPos->x, pPos->y, pPos->z), glm::vec2(pTexCoord->x, 1.0f-pTexCoord->y), glm::vec3(pNormal->x, pNormal->y, pNormal->z), glm::vec3(pTangent->x, pTangent->y, pTangent->z) ); Vertices.push_back(v); } for (unsigned int i = 0 ; i < paiMesh->mNumFaces ; i++) { const aiFace& Face = paiMesh->mFaces[i]; assert(Face.mNumIndices == 3); Indices.push_back(Face.mIndices[0]); Indices.push_back(Face.mIndices[1]); Indices.push_back(Face.mIndices[2]); } m_Entries[Index].Init(Vertices, Indices); } bool GLOpenAssetImportMesh::InitMaterials(const aiScene* pScene, const std::string& Filename) { // Extract the directory part from the file name std::string::size_type SlashIndex = Filename.find_last_of("\\"); std::string Dir; if (SlashIndex == std::string::npos) { Dir = "."; } else if (SlashIndex == 0) { Dir = "\\"; } else { Dir = Filename.substr(0, SlashIndex); } bool Ret = true; // Initialize the materials for (unsigned int i = 0 ; i < pScene->mNumMaterials ; i++) { const aiMaterial* pMaterial = pScene->mMaterials[i]; m_Textures[i] = NULL; if (pMaterial->GetTextureCount(aiTextureType_DIFFUSE) > 0) { aiString Path; if (pMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &Path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS) { std::string FullPath = Dir + "\\" + Path.data; m_Textures[i] = std::make_shared<GLTexture>(); if (!m_Textures[i]->Load(FullPath, true)) { MessageBox(NULL, FullPath.c_str(), "Error loading mesh texture", MB_ICONHAND); // delete m_Textures[i]; m_Textures[i] = NULL; Ret = false; } else { printf("Loaded texture '%s'\n", FullPath.c_str()); } } } // Load a single colour texture matching the diffuse colour if no texture added if (!m_Textures[i]) { aiColor3D color (0.f,0.f,0.f); pMaterial->Get(AI_MATKEY_COLOR_DIFFUSE,color); m_Textures[i] = std::make_shared<GLTexture>(); char data[3]; data[0] = (char) (color[2]*255); data[1] = (char) (color[1]*255); data[2] = (char) (color[0]*255); m_Textures[i]->CreateFromData(data, 1, 1, 24, false); } } return Ret; }
26.671587
163
0.642778
StavrosBizelis
cadf83d04a50f806791698ba7f714e12ae0b80dd
1,229
hxx
C++
Legolas/Matrix/tst/PoissonEquation2DTT/LaplacianMatrixDefinition.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Matrix/tst/PoissonEquation2DTT/LaplacianMatrixDefinition.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Matrix/tst/PoissonEquation2DTT/LaplacianMatrixDefinition.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
1
2021-02-11T14:43:25.000Z
2021-02-11T14:43:25.000Z
/** * project DESCARTES * * @file LaplacianMatrixDefinition.hxx * * @author Laurent PLAGNE * @date june 2004 - january 2005 * * @par Modifications * - author date object * * (c) Copyright EDF R&D - CEA 2001-2005 */ #ifndef __LEGOLAS_LAPLACIANMATRIXDEFINITION_HXX__ #define __LEGOLAS_LAPLACIANMATRIXDEFINITION_HXX__ #include "Legolas/Matrix/MatrixStructures/MatrixStructureTags.hxx" #include "Legolas/Matrix/Helper/DefaultMatrixDefinition.hxx" class LaplacianMatrixDefinition : public Legolas::DefaultMatrixDefinition<double> { public: // Types that must be defined to model the MATRIX_DEFINITION concept typedef Legolas::TriDiagonal MatrixStructure; typedef double RealType; typedef double GetElement; typedef Legolas::MatrixShape<1> Data; // 3 static functions to be defined to model the TRIDIAGONAL_MATRIX_DEFINITION concept static inline GetElement diagonalGetElement( int i , const Data & data) { return -2.0;} static inline GetElement upperDiagonalGetElement( int i , const Data & data) { return 1.0;} static inline GetElement lowerDiagonalGetElement( int i , const Data & data) { return 1.0;} }; #endif
27.931818
93
0.71847
LaurentPlagne
cae654e9332356a12d0a2c043548f0c35e29f5cc
2,446
cpp
C++
templates/bcc_node.cpp
ssstare/icpc
4f0ed7b045297459a6abfd880e0b995124af4bd0
[ "MIT" ]
7
2021-03-30T06:19:09.000Z
2022-03-27T12:50:36.000Z
templates/bcc_node.cpp
ssstare/icpc
4f0ed7b045297459a6abfd880e0b995124af4bd0
[ "MIT" ]
null
null
null
templates/bcc_node.cpp
ssstare/icpc
4f0ed7b045297459a6abfd880e0b995124af4bd0
[ "MIT" ]
null
null
null
const int kN = 10000 + 5; const int kM = 100000 + 5; int dfn[kN],low[kN],head[kN],etot,btot,n,m,nq,belong[kN]; bool is_cut[kN],visited[kN]; std::stack<int> stack; struct Edge { int v,next,belong; bool visited,is_cut; }g[kM<<1]; std::vector<int> graph[kN+kM]; void add_edge(int u,int v) { g[etot].belong = -1; g[etot].visited = g[etot].is_cut = false; g[etot].v = v; g[etot].next = head[u]; head[u] = etot ++; } void tarjan(int u,int root,int tim) { dfn[u] = low[u] = tim; visited[u] = true; int child_count = 0; for (int i = head[u]; i != -1; i = g[i].next) { Edge &e = g[i]; if (e.visited) continue; stack.push(i); g[i].visited = g[i^1].visited = true; if (visited[e.v]) { low[u] = std::min(low[u],dfn[e.v]); continue; } tarjan(e.v,root,tim+1); g[i].is_cut = g[i^1].is_cut = (low[e.v]>dfn[u] || g[i].is_cut); if (u!=root) is_cut[u] |= (low[e.v]>=dfn[u]); if (low[e.v]>=dfn[u] || u==root) { while (true) { int id = stack.top(); stack.pop(); g[id].belong = g[id^1].belong = btot; if (id==i) break; } btot ++; } low[u] = std::min(low[e.v],low[u]); child_count ++; } if (u==root && child_count>1) is_cut[u] = true; } void bcc() { for (int i = 0; i < n; ++ i) { dfn[i] = 0; is_cut[i] = false; visited[i] = false; } btot = 0; for (int i = 0; i < n; ++ i) { if (!visited[i]) { tarjan(i,i,1); } } } void build() { std::fill(graph,graph+n+m,std::vector<int>()); for (int u = 0; u < n; ++ u) { if (is_cut[u] || head[u]==-1) { int id = btot ++; belong[u] = id; for (int i = head[u]; i != -1; i = g[i].next) { Edge &e = g[i]; int v = e.belong; graph[id].push_back(v); graph[v].push_back(id); } } } for (int u = 0; u < btot; ++ u) { std::sort(graph[u].begin(),graph[u].end()); graph[u].erase(std::unique(graph[u].begin(),graph[u].end()),graph[u].end()); } for (int i = 0; i < m; ++ i) { int u = g[i<<1].v; int v = g[i<<1|1].v; if (!is_cut[u]) belong[u] = g[i<<1].belong; if (!is_cut[v]) belong[v] = g[i<<1].belong; } } int main() { while (scanf("%d%d",&n,&m)==2) { std::fill(head,head+n,-1); etot = 0; for (int i = 0; i < m; ++ i) { int a,b; scanf("%d%d",&a,&b); a --; b --; add_edge(a,b); add_edge(b,a); } bcc(); build(); } return 0; }
23.747573
80
0.481194
ssstare
cae7fe89a55f01c35e3ae9e30685681cfaedd0dd
523
cc
C++
chromeos/dbus/cryptohome/account_identifier_operators.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
14,668
2015-01-01T01:57:10.000Z
2022-03-31T23:33:32.000Z
chromeos/dbus/cryptohome/account_identifier_operators.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
113
2015-05-04T09:58:14.000Z
2022-01-31T19:35:03.000Z
chromeos/dbus/cryptohome/account_identifier_operators.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
5,941
2015-01-02T11:32:21.000Z
2022-03-31T16:35:46.000Z
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chromeos/dbus/cryptohome/account_identifier_operators.h" namespace cryptohome { bool operator<(const AccountIdentifier& l, const AccountIdentifier& r) { return l.account_id() < r.account_id(); } bool operator==(const AccountIdentifier& l, const AccountIdentifier& r) { return l.account_id() == r.account_id(); } } // namespace cryptohome
29.055556
73
0.751434
zealoussnow